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