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'); require_once('../inc/lib_base.php');
$file=$_GET['file']; if(isset($_GET['path'])){
$dir=(isset($_GET['dir']))?$_GET['dir']:''; $filename=$_GET['path'];
if(strstr($file,'..') or strstr($dir,'..')){ }else{
die(); $file=$_GET['file'];
$dir=(isset($_GET['dir']))?$_GET['dir']:'';
$filename=$dir.'/'.$file;
}
if(strstr($filename,'..')){
die();
} }
$filename=$dir.'/'.$file;
$filename=stripslashes($filename); $filename=stripslashes($filename);
$ftype=OC_FILESYSTEM::getMimeType($filename); $ftype=OC_FILESYSTEM::getMimeType($filename);
ob_end_clean(); ob_end_clean();