2 $rootdir = $Page->link;
4 $nav = explode('/', $rootdir);
5 $nav[0] = "Foto's"; # override of root 'foto'
6 $title = array_pop($nav);
7 $Page->title = ($nav ? implode(' ', $nav) . ': ' : '') . $title;
10 $img = "$rootdir/index.jpg";
11 if (file_exists($img)) {
12 # cover image of current album
13 $Page->image = "/$img";
16 return array_map(function ($dir) {
17 return new ArchiveArticle($dir . '/index.html');
18 }, glob("$rootdir/*", GLOB_ONLYDIR)); #TODO: recurse
23 if ($User->admin('foto')) {
24 if ($Page->restricted) {
25 $access = '<span class="icon icon-locked">🔒</span> Bewoners';
26 if ($Page->restricted != $rootdir) {
27 $access .= sprintf(' vanaf <a href="%s">%s</a>',
28 "/{$Page->restricted}", pathinfo($Page->restricted, PATHINFO_FILENAME)
33 $access = '<span class="icon icon-locked">🔓</span> Openbaar';
35 print "<aside>$access</aside>\n\n";
40 foreach ($nav as $i => $linktitle) {
41 $link .= '/' . ($i ? $linktitle : $Page->handler);
42 printf('<a href="%s">%s</a> →'."\n", $link, $linktitle);
47 if (isset($Page->raw)) {
48 print $Page->raw; # page intro
51 if ($imgs = glob("$rootdir/*", GLOB_ONLYDIR)) {
53 print '<ul class="gallery cat">'."\n";
54 foreach ($imgs as $path) {
55 $album = htmlspecialchars(pathinfo($path, PATHINFO_FILENAME));
56 $cover = "$path/index.jpg";
57 if (!file_exists($cover)) $cover = 'foto/index.jpg';
58 if (is_link($cover)) {
59 $cover = preg_replace('{^(?:\.\./)*(?=data/)}', 'thumb/100/', readlink($cover));
62 $html = sprintf('<img src="/%s" />', htmlspecialchars($cover));
63 $html .= "<figcaption>$album</figcaption>";
64 if (!$User->login and file_exists("$path/.private")) {
65 $html = '<s title="bewoners">'.$html.'</s>';
67 $html = "<figure>$html</figure>";
69 printf('<li id="%s">', $album);
70 printf('<a href="/%s">%s</a>'."\n", htmlspecialchars($path), $html);
75 if ($imgs = glob("$rootdir/*.jpg")) {
76 print '<ul class="gallery album">'."\n";
77 foreach ($imgs as $path) {
78 if ($path == "$rootdir/index.jpg") {
79 # cover image of current album
80 $Page->image = "/$path";
83 if (!is_link($path)) continue;
85 // assume all album entries are symlinks to archive originals
86 $target = preg_replace('{^(\.\./)*}', '', readlink($path));
87 $thumb = 'thumb/262/' . $target;
89 @list ($order, $size, $title) = explode(':', pathinfo($path, PATHINFO_FILENAME), 3);
90 $imgtag = 'img src="/'.$thumb.'"';
92 $imgtag .= ' title="'.htmlspecialchars(urldecode($title)).'"';
95 $imgtag .= ' data-size="'.$size.'"';
99 printf('<a href="/%s"><%s /></a>'."\n", $target, $imgtag);
101 print '</ul>'."\n\n";
103 include 'foto/album.inc.php';