login: userless handler call to obtain metadata
[minimedit.git] / foto / index.php
index 0acd44e7ab701aa6bfb091ed5c4a96ac08221521..c2cc95c730a37361bc82143085340dc8593df233 100644 (file)
@@ -1,6 +1,20 @@
 <?php
 $rootdir = $Page->link;
 
+$nav = explode('/', $rootdir);
+$nav[0] = "Foto's"; # override of root 'foto'
+$title = array_pop($nav);
+$Page->title = ($nav ? implode(' ', $nav) . ': ' : '') . $title;
+
+if (!$User) {
+       $img = "$rootdir/index.jpg";
+       if (file_exists($img)) {
+               # cover image of current album
+               $Page->image = "/$img";
+       }
+       return;
+}
+
 if ($User->admin('foto')) {
        if ($Page->restricted) {
                $access = '<span class="icon icon-locked">&#x1F512;</span> Bewoners';
@@ -16,11 +30,6 @@ if ($User->admin('foto')) {
        print "<aside>$access</aside>\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 "<h2>";
 foreach ($nav as $i => $linktitle) {
@@ -34,6 +43,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,6 +61,7 @@ function showthumb($path)
 
        return sprintf('<a href="/%s"><%s /></a>'."\n", $target, $imgtag);
 }
+}
 
 if ($imgs = glob("$rootdir/*", GLOB_ONLYDIR)) {
        natsort($imgs);