aboutsummaryrefslogtreecommitdiffstats
path: root/config/filemgr/rbfminc/download.php
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-08-12 00:14:51 +0200
committerdoktornotor <notordoktor@gmail.com>2015-08-12 00:14:51 +0200
commitaf566daf06605f67b6cc9e60906ff7690134526f (patch)
tree4c5a17bb44b2e524bdbaf820b55fe1a7bc9ee017 /config/filemgr/rbfminc/download.php
parent17caa109011938ca533d5c7bb7cfa38606c0645e (diff)
downloadpfsense-packages-af566daf06605f67b6cc9e60906ff7690134526f.tar.gz
pfsense-packages-af566daf06605f67b6cc9e60906ff7690134526f.tar.bz2
pfsense-packages-af566daf06605f67b6cc9e60906ff7690134526f.zip
Rename download.tmp to download.php
Diffstat (limited to 'config/filemgr/rbfminc/download.php')
-rw-r--r--config/filemgr/rbfminc/download.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/config/filemgr/rbfminc/download.php b/config/filemgr/rbfminc/download.php
new file mode 100644
index 00000000..172ec896
--- /dev/null
+++ b/config/filemgr/rbfminc/download.php
@@ -0,0 +1,49 @@
+<?php
+include_once("auth.inc");
+include "functions.php";
+//Set the cache policy
+ob_end_clean();
+header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Pragma: no-cache");
+//Gets the parameters
+$_GET['file_name'] = urldecode($_GET['file_name']);
+$_GET['p'] = urldecode($_GET['p']);
+//Check Authentication
+$candownload = false;
+if (function_exists("session_auth"))
+ {//pfSense 2.X
+ $candownload = session_auth();}
+else
+ {//pfSense 1.2.3
+ $candownload = htpasswd_backed_basic_auth();}
+if ($candownload)
+{
+ if($_GET['file_name'] and $_GET['p']){
+ $filepath = $_GET['p'].$_GET['file_name'];
+ if(file_exists($filepath)){
+ $type = wp_check_filetype($_GET['file_name']);
+ header('Content-type: ' . $type[$_GET['file_name']]);
+ header('Content-Disposition: attachment; filename="'.$_GET['file_name'].'"');
+ header('Content-Length: ' . filesize($filepath));
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($filepath)).' GMT', true, 200);
+ flush();
+ readfile($filepath);
+ exit;
+ }
+ else
+ {
+ echo("File not found");
+ }
+ }
+ else
+ {
+ echo("File Unknown");
+ }
+}
+else
+{
+ echo("Session Expired");
+}
+?>