Add Dirs in Pagination

This commit is contained in:
seiichiro 2022-01-11 17:26:51 +01:00
parent 9947f2b706
commit 9b10de412e

View file

@ -76,6 +76,7 @@ if (isset($_GET['f'])) {
// Sort and Reverse Filelist // Sort and Reverse Filelist
natcasesort($files); natcasesort($files);
$files = array_reverse($files); $files = array_reverse($files);
$files = array_merge($dirs, $files);
// Get Files for current Page // Get Files for current Page
$curfiles = array_slice($files, ($page-1)*$slice ,$slice, true); $curfiles = array_slice($files, ($page-1)*$slice ,$slice, true);
@ -100,13 +101,17 @@ if (!empty($curfiles)| !empty($dirs)) {
if ($slice > 1) { if ($slice > 1) {
if (!empty($curfiles)) { if (!empty($curfiles)) {
foreach ($curfiles as $index => $image) { foreach ($curfiles as $index => $image) {
if (in_array($image, $dirs)) {
$data['dirs'][] = $image;
} else {
$tmp['n'] = $image; $tmp['n'] = $image;
$tmp['i'] = $index+1; $tmp['i'] = $index+1;
$tmp['t'] = $thumburl.$t->get_thumb($image); $tmp['t'] = $thumburl.$t->get_thumb($image);
$data['images'][] = $tmp; $data['images'][] = $tmp;
} }
} }
$data['dirs'] = $dirs; }
Template::view('tpl/gallery.html', $data); Template::view('tpl/gallery.html', $data);
} else { } else {
$data['gallery_page'] = ceil($page/$gslice); $data['gallery_page'] = ceil($page/$gslice);