diff --git a/controllers/ViewPhotoAlbum.php b/controllers/ViewPhotoAlbum.php index 4f26d074..9dae53cf 100644 --- a/controllers/ViewPhotoAlbum.php +++ b/controllers/ViewPhotoAlbum.php @@ -57,16 +57,23 @@ class ViewPhotoAlbum extends HTMLController if (isset($header_box)) $this->page->adopt($header_box); - $this->page->adopt(new AlbumButtonBox([ - [ + // Can we do fancy things here? + // !!! TODO: permission system? + $buttons = []; + if (Registry::get('user')->isLoggedIn()) + $buttons[] = [ 'url' => BASEURL . '/uploadmedia/?tag=' . $id_tag, 'caption' => 'Upload new photos here', - ], - [ + ]; + if (Registry::get('user')->isAdmin()) + $buttons[] = [ 'url' => BASEURL . '/addalbum/?tag=' . $id_tag, 'caption' => 'Create new subalbum here', - ] - ])); + ]; + + // Enough actions for a button box? + if (!empty($buttons)) + $this->page->adopt(new AlbumButtonBox($buttons)); // Fetch subalbums, but only if we're on the first page. if ($page === 1)