improve previous / next function in photo gallery

pull/12614/head
Hannes Heute 2023-01-04 14:25:33 +01:00
rodzic a12172cf69
commit 46461be818
1 zmienionych plików z 8 dodań i 2 usunięć

Wyświetl plik

@ -937,11 +937,17 @@ function photos_content(App $a)
$nxt = null;
foreach ($prvnxt as $z => $entry) {
if ($entry['resource-id'] == $ph[0]['resource-id']) {
$prv = $z - 1;
$nxt = $z + 1;
$prv = ($order_field === 'created') ? ($z - 1) : ($z + 1);
$nxt = ($order_field === 'created') ? ($z + 1) : ($z - 1);
if ($prv < 0) {
$prv = count($prvnxt) - 1;
}
if ($nxt < 0) {
$nxt = count($prvnxt) - 1;
}
if ($prv >= count($prvnxt)) {
$prv = 0;
}
if ($nxt >= count($prvnxt)) {
$nxt = 0;
}