X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/772961fd4e9be46ad340cad1e55ee5f28cc5b968..b28c58864e20c556b65ec60f02c0df6401f73351:/foto/index.php diff --git a/foto/index.php b/foto/index.php index 0acd44e..49e5483 100644 --- a/foto/index.php +++ b/foto/index.php @@ -1,6 +1,25 @@ link; +$nav = explode('/', $rootdir); +$nav[0] = "Foto's"; # override of root 'foto' +$title = array_pop($nav); +$Page->title = ($nav ? implode(' ', $nav) . ': ' : '') . $title; + +if ($Page->api) { + $img = "$rootdir/index.jpg"; + if (file_exists($img)) { + # cover image of current album + $Page->image = "/$img"; + } + if (!$Page->path) { + return array_map(function ($dir) { + return new ArchiveArticle($dir . '/index.html'); + }, glob("$rootdir/*", GLOB_ONLYDIR)); #TODO: recurse + } + return; +} + if ($User->admin('foto')) { if ($Page->restricted) { $access = '🔒 Bewoners'; @@ -16,11 +35,6 @@ if ($User->admin('foto')) { print "\n\n"; } -$nav = explode('/', $rootdir); -$nav[0] = "Foto's"; # override of root 'foto' -$title = array_pop($nav); -$Page->title = ($nav ? implode(' ', $nav) . ': ' : '') . $title; - $link = ''; print "

"; foreach ($nav as $i => $linktitle) { @@ -34,6 +48,7 @@ if (isset($Page->raw)) { print $Page->raw; # page intro } +if (!function_exists('showthumb')) { function showthumb($path) { // assume all album entries are symlinks to archive originals @@ -51,27 +66,28 @@ function showthumb($path) return sprintf('<%s />'."\n", $target, $imgtag); } +} if ($imgs = glob("$rootdir/*", GLOB_ONLYDIR)) { natsort($imgs); print '\n\n"; }