diff --git a/etc/settings.php b/etc/settings.php index 1a22c72..c33e4d9 100644 --- a/etc/settings.php +++ b/etc/settings.php @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/html/index.php b/html/index.php index 4ccf5f4..353701e 100644 --- a/html/index.php +++ b/html/index.php @@ -58,33 +58,33 @@ return $header; } function checkPath($pathToCheck) { - global $path, $subpath; - $fullpath = $path.'/'.$pathToCheck + global $imagepath, $subpath; + $fullpath = $imagepath.'/'.$pathToCheck if ($fullpath==realpath($fullpath) && is_dir($fullpath)) { $subpath=$pathToCheck; - $path = $fullpath; + $imagepath = $fullpath; } else { error_die('path not allowed: '.htmlentities($pathToCheck)); } } function checkFile($fileToCheck, $thumb = false) { - global $path, $file, $subpath, $thumbs, $imgfile; - if (!ereg('/', $fileToCheck) && is_file($path.'/'.$fileToCheck)) { + global $imagepath, $file, $subpath, $thumbpath, $imgfile; + if (!ereg('/', $fileToCheck) && is_file($imagepath.'/'.$fileToCheck)) { $imgfile = $fileToCheck; } else { error_die('file not found', '404 Not Found'); } if ($thumb) { // image from thumbnail path - $file = $thumbs.'/'.$subpath.'/'.$fileToCheck; - if (!is_dir($thumbs.'/'.$subpath)) mkdir($thumbs.'/'.$subpath, 0777, true); + $file = $thumbpath.'/'.$subpath.'/'.$fileToCheck; + if (!is_dir($thumbpath.'/'.$subpath)) mkdir($thumbpath.'/'.$subpath, 0777, true); if (!is_file($file)) { // create thumbnail $image = new Imagick(); - $image->readImage($path.'/'.$fileToCheck); + $image->readImage($imagepath.'/'.$fileToCheck); $image->thumbnailImage(200, 200, true); $image->writeImage($file); } } else { - $file = $path.'/'.$fileToCheck; + $file = $imagepath.'/'.$fileToCheck; } } function returnFile($file) { @@ -160,9 +160,9 @@ if ($username=="") error_die('not authorized', '403 Forbidden'); if (isset($_REQUEST['path'])) checkPath($_REQUEST['path']); if (isset($_REQUEST['folder']) && !ereg('/', $_REQUEST['folder'])) { - $file = $thumbs.'/folders/'.$subpath.'/'.$_REQUEST['folder'].'.png'; + $file = $thumbpath.'/folders/'.$subpath.'/'.$_REQUEST['folder'].'.png'; $type="image/png"; - if (!is_dir($thumbs.'/folders/'.$subpath)) mkdir($thumbs.'/folders/'.$subpath, 0777, true); + if (!is_dir($thumbpath.'/folders/'.$subpath)) mkdir($thumbpath.'/folders/'.$subpath, 0777, true); if (!is_file($file)) { // create folder image $txt = wordwrap(preg_replace('/ +/', ' ', preg_replace('/-/', ' - ', preg_replace('/_/', " ", $_REQUEST['folder']))), 16, "\n", true); $image = new Imagick(); @@ -315,7 +315,7 @@ makelink('?path='.urlencode($subpath).'&file='.urlencode($f).'&view', '?path='.urlencode($subpath).'&file='.urlencode($f).'&thumb', $f); } else { if (isset($_REQUEST['view'])) { // view single image - $objects = extractDir($path); + $objects = extractDir($imagepath); $pos = array_search($imgfile, $objects['files']); if ($pos>0) echo 'previous'; @@ -348,7 +348,7 @@ } elseif ($subpath!="") { echo '↑'; } - $objects = extractDir($path); + $objects = extractDir($imagepath); foreach ($objects['dirs'] as $f) makelink('?path='.urlencode($subpath.($subpath!=""?'/':'').$f), '?path='.urlencode($subpath).'&folder='.urlencode($f), $f); echo '
';