Also allow open_file.php to be called with a path paramater instead of only with seperate dir/file

This commit is contained in:
Robin Appelman 2011-01-04 23:02:38 +01:00
parent 56ec730337
commit e0f6ad1c9c
1 changed files with 9 additions and 5 deletions

View File

@ -24,12 +24,16 @@
require_once('../inc/lib_base.php');
$file=$_GET['file'];
$dir=(isset($_GET['dir']))?$_GET['dir']:'';
if(strstr($file,'..') or strstr($dir,'..')){
die();
if(isset($_GET['path'])){
$filename=$_GET['path'];
}else{
$file=$_GET['file'];
$dir=(isset($_GET['dir']))?$_GET['dir']:'';
$filename=$dir.'/'.$file;
}
if(strstr($filename,'..')){
die();
}
$filename=$dir.'/'.$file;
$filename=stripslashes($filename);
$ftype=OC_FILESYSTEM::getMimeType($filename);
ob_end_clean();