2 if (!$User->admin('foto')) {
3 abort("Beheerrechten verplicht voor instellen van covers", '403 unauthorised');
6 $rootdir = 'foto' . $Page->path;
7 $target = "$rootdir/index.jpg";
9 if (is_link($target) or file_exists($target)) {
10 if (!unlink($target)) {
11 abort("Kon bestaande cover niet weghalen voor {$Page->path}", '500 delete error');
15 if (isset($_GET['img'])) {
16 $img = str_repeat('../', substr_count($target, '/')); # up to docroot
17 $img .= ltrim($_GET['img'], '/');
18 if (!symlink($img, $target)) {
19 abort("Fout bij instellen van cover voor {$Page->path}", '500 link error');
23 $album = pathinfo($rootdir);
24 abort("/{$album['dirname']}#{$album['basename']}", '302 linked');