page: api attribute indicate index requests
[minimedit.git] / foto / index.php
index c2cc95c730a37361bc82143085340dc8593df233..a6378ef8f393487113b64b430a121adb4d33d511 100644 (file)
@@ -6,12 +6,17 @@ $nav[0] = "Foto's"; # override of root 'foto'
 $title = array_pop($nav);
 $Page->title = ($nav ? implode(' ', $nav) . ': ' : '') . $title;
 
-if (!$User) {
+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;
 }