diff --git a/conf/config.php b/conf/config.php index 2d56c2d..bdf514c 100644 --- a/conf/config.php +++ b/conf/config.php @@ -22,6 +22,6 @@ $conf['defpage'] = 1; // Images per Page if not specified $conf['defslice'] = 34; // Default Subdirectory if none given -$conf['defdir'] = ''; +$conf['defdir'] = '/'; ?> \ No newline at end of file diff --git a/index.php b/index.php index 155e92b..c0443ed 100644 --- a/index.php +++ b/index.php @@ -32,21 +32,14 @@ session_start(); $t = new Thumb(Helpers::end_dir($imagedir.$dir), $thumbdir, 200, 200); // Filelist Cache Handling -if (isset($_SESSION['files']) - && $_SESSION['dir'] == $dir - && (time() - $_SESSION['cachetime']) < $conf['flcache'] +if (isset($_SESSION[$dir]) + && (time() - $_SESSION[$dir]['t']) < $conf['flcache'] && !isset($_GET['refcache'])) { - $files = $_SESSION['files']; + $files = $_SESSION[$dir]['f']; } else { $r_imagedir = realpath($imagedir.$dir); - - - if ($r_imagedir === false || strpos(Helpers::end_dir($r_imagedir), $r_basedir.DIRECTORY_SEPARATOR) !== 0) { - print_r($r_basedir); - - print_r($r_imagedir); print "Path Traversal Detected!"; exit(); } @@ -59,9 +52,8 @@ if (isset($_SESSION['files']) $rmdirs[] = '.'; $rmdirs[] = '..'; $files = array_diff(scandir($imagedir.$dir, SCANDIR_SORT_DESCENDING), $rmdirs); - $_SESSION['files'] = $files; - $_SESSION['dir'] = $dir; - $_SESSION['cachetime'] = time(); + $_SESSION[$dir]['f'] = $files; + $_SESSION[$dir]['t'] = time(); } // Apply Filters to Filelist