From: Matteo Nastasi (mop) Date: Thu, 2 Oct 2014 15:53:25 +0000 (+0200) Subject: tos can be download as pdf or txt now X-Git-Tag: v4.15.0~7 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=7e4dfd67f0e1a1293c6cbbedd88c9100b0204c92;p=brisk.git tos can be download as pdf or txt now --- diff --git a/web/doc_download.php b/web/doc_download.php index d447c19..9e86ef1 100644 --- a/web/doc_download.php +++ b/web/doc_download.php @@ -9,16 +9,23 @@ function main() return(FALSE); } - $fname = sprintf("%s%s.pdf", $G_doc_path, basename($_GET['doc'])); + $ext = "pdf"; + $cont_type = "application/octet-stream"; + if (isset($_GET['ext']) && ($_GET['ext'] == "txt")) { + $cont_type = "plain/text"; + $ext = $_GET['ext']; + } + + $fname = sprintf("%s%s.%s", $G_doc_path, basename($_GET['doc']), $ext); if (! file_exists($fname)) { return(FALSE); } - header("Content-Type: application/octet-stream"); + header(sprintf("Content-Type: %s", $cont_type)); header(sprintf("Content-Disposition: attachment; filename=brisk_%s", basename($fname))); readfile($fname); return(TRUE); } main(); -?> \ No newline at end of file +?>