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";
18 if ($User->admin('foto')) {
19 if ($Page->restricted) {
20 $access = '<span class="icon icon-locked">🔒</span> Bewoners';
21 if ($Page->restricted != $rootdir) {
22 $access .= sprintf(' vanaf <a href="%s">%s</a>',
23 "/{$Page->restricted}", pathinfo($Page->restricted, PATHINFO_FILENAME)
28 $access = '<span class="icon icon-locked">🔓</span> Openbaar';
30 print "<aside>$access</aside>\n\n";
35 foreach ($nav as $i => $linktitle) {
36 $link .= '/' . ($i ? $linktitle : $Page->handler);
37 printf('<a href="%s">%s</a> →'."\n", $link, $linktitle);
42 if (isset($Page->raw)) {
43 print $Page->raw; # page intro
46 if (!function_exists('showthumb')) {
47 function showthumb($path)
49 // assume all album entries are symlinks to archive originals
50 $target = preg_replace('{^(\.\./)*}', '', readlink($path));
51 $thumb = 'thumb/262/' . $target;
53 @list ($order, $size, $title) = explode(':', pathinfo($path, PATHINFO_FILENAME), 3);
54 $imgtag = 'img src="/'.$thumb.'"';
56 $imgtag .= ' title="'.htmlspecialchars(urldecode($title)).'"';
59 $imgtag .= ' data-size="'.$size.'"';
62 return sprintf('<a href="/%s"><%s /></a>'."\n", $target, $imgtag);
66 if ($imgs = glob("$rootdir/*", GLOB_ONLYDIR)) {
68 print '<ul class="gallery cat">'."\n";
69 foreach ($imgs as $path) {
70 $parts = pathinfo($path);
71 $album = $parts['filename'];
72 $cover = "$path/index.jpg";
73 if (!file_exists($cover)) $cover = 'foto/index.jpg';
74 if (is_link($cover)) {
75 $cover = preg_replace('{^(?:\.\./)*(?=data/)}', 'thumb/100/', readlink($cover));
78 $html = '<img src="/'.$cover.'" />';
79 $html .= "<figcaption>$album</figcaption>";
80 if (!$User->login and file_exists("$path/.private")) {
81 $html = '<s title="bewoners">'.$html.'</s>';
83 $html = "<figure>$html</figure>";
85 printf('<li id="%s"><a href="%s">%s</a>'."\n", $album, "/$path", $html);
90 if ($imgs = glob("$rootdir/*.jpg")) {
91 print '<ul class="gallery album">'."\n";
92 foreach ($imgs as $img) {
93 if ($img == "$rootdir/index.jpg") {
94 # cover image of current album
95 $Page->image = "/$img";
98 if (!is_link($img)) continue;
99 print '<li>'.showthumb($img);
101 print '</ul>'."\n\n";
103 include 'foto/album.inc.php';