2 $rootdir = $Page . $Args;
4 if ($User and $User->admin('foto')) {
5 $access = '🔓 Openbaar';
6 if (isset($PageAccess)) {
7 $access = "🔒 Bewoners";
8 if ($PageAccess != $rootdir) {
9 $access .= sprintf(' vanaf <a href="%s">%s</a>',
10 "/$PageAccess", pathinfo($PageAccess, PATHINFO_FILENAME)
14 print "<aside>$access</aside>\n\n";
17 $nav = explode('/', $rootdir);
18 $nav[0] = "Foto's"; # override of root 'foto'
19 $title = array_pop($nav);
20 $Article->title = implode(' ', $nav) . ': ' . $title;
24 foreach ($nav as $i => $linktitle) {
25 $link .= '/' . ($i ? $linktitle : $Page);
26 printf('<a href="%s">%s</a> →'."\n", $link, $linktitle);
31 if (isset($Article->raw)) {
32 print $Article->raw; # page intro
35 function showthumb($path)
37 // assume all album entries are symlinks to archive originals
38 $target = preg_replace('{^(\.\./)*}', '', readlink($path));
39 $thumb = 'thumb/200/' . $target;
41 @list ($order, $size, $title) = explode(':', pathinfo($path, PATHINFO_FILENAME), 3);
42 $imgtag = 'img src="/'.$thumb.'"';
44 $imgtag .= ' title="'.htmlspecialchars(urldecode($title)).'"';
47 $imgtag .= ' data-size="'.$size.'"';
50 return sprintf('<a href="/%s"><%s /></a>'."\n", $target, $imgtag);
53 if ($imgs = glob("$rootdir/*", GLOB_ONLYDIR)) {
55 print '<ul class="gallery cat">'."\n";
56 foreach ($imgs as $path) {
57 $parts = pathinfo($path);
58 $album = $parts['filename'];
59 $cover = "$path/index.jpg";
60 if (!file_exists($cover)) $cover = 'foto/index.jpg';
61 if (is_link($cover)) {
62 $cover = preg_replace('{^(?:\.\./)*(?=data/)}', 'thumb/100/', readlink($cover));
65 $html = '<img src="/'.$cover.'" />';
66 $html .= "<figcaption>$album</figcaption>";
67 if (empty($User) and file_exists("$path/.private")) {
68 $html = '<strike title="bewoners">'.$html.'</strike>';
70 $html = "<figure>$html</figure>";
72 printf('<li id="%s"><a href="%s">%s</a>'."\n", $album, "/$path", $html);
77 if ($imgs = glob("$rootdir/*.jpg")) {
78 print '<ul class="gallery album">'."\n";
79 foreach ($imgs as $img) {
80 if ($img == "$rootdir/index.jpg") {
81 # cover image of current album
82 $Article->image = "/$img";
85 if (!is_link($img)) continue;
86 print '<li>'.showthumb($img);
90 include 'foto/album.inc.php';