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 glob("$rootdir/*", GLOB_ONLYDIR); #TODO: recurse
21 if ($User->admin('foto')) {
22 if ($Page->restricted) {
23 $access = '<span class="icon icon-locked">🔒</span> Bewoners';
24 if ($Page->restricted != $rootdir) {
25 $access .= sprintf(' vanaf <a href="%s">%s</a>',
26 "/{$Page->restricted}", pathinfo($Page->restricted, PATHINFO_FILENAME)
31 $access = '<span class="icon icon-locked">🔓</span> Openbaar';
33 print "<aside>$access</aside>\n\n";
38 foreach ($nav as $i => $linktitle) {
39 $link .= '/' . ($i ? $linktitle : $Page->handler);
40 printf('<a href="%s">%s</a> →'."\n", $link, $linktitle);
45 if (isset($Page->raw)) {
46 print $Page->raw; # page intro
49 if (!function_exists('showthumb')) {
50 function showthumb($path)
52 // assume all album entries are symlinks to archive originals
53 $target = preg_replace('{^(\.\./)*}', '', readlink($path));
54 $thumb = 'thumb/262/' . $target;
56 @list ($order, $size, $title) = explode(':', pathinfo($path, PATHINFO_FILENAME), 3);
57 $imgtag = 'img src="/'.$thumb.'"';
59 $imgtag .= ' title="'.htmlspecialchars(urldecode($title)).'"';
62 $imgtag .= ' data-size="'.$size.'"';
65 return sprintf('<a href="/%s"><%s /></a>'."\n", $target, $imgtag);
69 if ($imgs = glob("$rootdir/*", GLOB_ONLYDIR)) {
71 print '<ul class="gallery cat">'."\n";
72 foreach ($imgs as $path) {
73 $parts = pathinfo($path);
74 $album = $parts['filename'];
75 $cover = "$path/index.jpg";
76 if (!file_exists($cover)) $cover = 'foto/index.jpg';
77 if (is_link($cover)) {
78 $cover = preg_replace('{^(?:\.\./)*(?=data/)}', 'thumb/100/', readlink($cover));
81 $html = '<img src="/'.$cover.'" />';
82 $html .= "<figcaption>$album</figcaption>";
83 if (!$User->login and file_exists("$path/.private")) {
84 $html = '<s title="bewoners">'.$html.'</s>';
86 $html = "<figure>$html</figure>";
88 printf('<li id="%s"><a href="%s">%s</a>'."\n", $album, "/$path", $html);
93 if ($imgs = glob("$rootdir/*.jpg")) {
94 print '<ul class="gallery album">'."\n";
95 foreach ($imgs as $img) {
96 if ($img == "$rootdir/index.jpg") {
97 # cover image of current album
98 $Page->image = "/$img";
101 if (!is_link($img)) continue;
102 print '<li>'.showthumb($img);
104 print '</ul>'."\n\n";
106 include 'foto/album.inc.php';