page: api attribute indicate index requests
[minimedit.git] / foto / index.php
index 1e973c786c14855a2c56b998de5db72f4b9359b0..a6378ef8f393487113b64b430a121adb4d33d511 100644 (file)
@@ -6,14 +6,16 @@ $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 glob("$rootdir/*", GLOB_ONLYDIR); #TODO: recurse
+               return array_map(function ($dir) {
+                       return new ArchiveArticle($dir . '/index.html');
+               }, glob("$rootdir/*", GLOB_ONLYDIR)); #TODO: recurse
        }
        return;
 }