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 (!function_exists('showthumb')) {
52 function showthumb($path)
54 // assume all album entries are symlinks to archive originals
55 $target = preg_replace('{^(\.\./)*}', '', readlink($path));
56 $thumb = 'thumb/262/' . $target;
58 @list ($order, $size, $title) = explode(':', pathinfo($path, PATHINFO_FILENAME), 3);
59 $imgtag = 'img src="/'.$thumb.'"';
61 $imgtag .= ' title="'.htmlspecialchars(urldecode($title)).'"';
64 $imgtag .= ' data-size="'.$size.'"';
67 return sprintf('<a href="/%s"><%s /></a>'."\n", $target, $imgtag);
71 if ($imgs = glob("$rootdir/*", GLOB_ONLYDIR)) {
73 print '<ul class="gallery cat">'."\n";
74 foreach ($imgs as $path) {
75 $parts = pathinfo($path);
76 $album = $parts['filename'];
77 $cover = "$path/index.jpg";
78 if (!file_exists($cover)) $cover = 'foto/index.jpg';
79 if (is_link($cover)) {
80 $cover = preg_replace('{^(?:\.\./)*(?=data/)}', 'thumb/100/', readlink($cover));
83 $html = '<img src="/'.$cover.'" />';
84 $html .= "<figcaption>$album</figcaption>";
85 if (!$User->login and file_exists("$path/.private")) {
86 $html = '<s title="bewoners">'.$html.'</s>';
88 $html = "<figure>$html</figure>";
90 printf('<li id="%s"><a href="%s">%s</a>'."\n", $album, "/$path", $html);
95 if ($imgs = glob("$rootdir/*.jpg")) {
96 print '<ul class="gallery album">'."\n";
97 foreach ($imgs as $img) {
98 if ($img == "$rootdir/index.jpg") {
99 # cover image of current album
100 $Page->image = "/$img";
103 if (!is_link($img)) continue;
104 print '<li>'.showthumb($img);
106 print '</ul>'."\n\n";
108 include 'foto/album.inc.php';