Also Cache Dir List

This commit is contained in:
seiichiro 2022-01-11 17:15:40 +01:00
parent 823b330b99
commit 84ed2579b3

View file

@ -37,6 +37,7 @@ if (isset($_SESSION[$dir])
&& !isset($_GET['refcache'])) && !isset($_GET['refcache']))
{ {
$files = $_SESSION[$dir]['f']; $files = $_SESSION[$dir]['f'];
$dirs = $_SESSION[$dir]['d'];
} else { } else {
$r_imagedir = realpath($imagedir.$dir); $r_imagedir = realpath($imagedir.$dir);
if ($r_imagedir === false || strpos(Helpers::end_dir($r_imagedir), $r_basedir.DIRECTORY_SEPARATOR) !== 0) { if ($r_imagedir === false || strpos(Helpers::end_dir($r_imagedir), $r_basedir.DIRECTORY_SEPARATOR) !== 0) {
@ -53,6 +54,7 @@ if (isset($_SESSION[$dir])
$rmdirs[] = '..'; $rmdirs[] = '..';
$files = array_diff(scandir($imagedir.$dir, SCANDIR_SORT_DESCENDING), $rmdirs); $files = array_diff(scandir($imagedir.$dir, SCANDIR_SORT_DESCENDING), $rmdirs);
$_SESSION[$dir]['f'] = $files; $_SESSION[$dir]['f'] = $files;
$_SESSION[$dir]['d'] = $dirs;
$_SESSION[$dir]['t'] = time(); $_SESSION[$dir]['t'] = time();
} }