diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-18 23:53:48 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-18 23:53:48 -0700 |
commit | 4e6f2f1b4c489c21546c2ae685b814c42e689d71 (patch) | |
tree | 4b422b72da6fed1dba1a781b707d54abfda00f4d /modules/gallery/helpers/gallery.php | |
parent | be84c7be2557dae92426e64ab44170e8999cfc44 (diff) |
Don't display the add menu if the underlying operating system directory is not writable. THis should fix ticket #775
Diffstat (limited to 'modules/gallery/helpers/gallery.php')
-rw-r--r-- | modules/gallery/helpers/gallery.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 40e188e2..d5b2fed9 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -89,9 +89,11 @@ class gallery_Core { $item = $theme->item(); $can_edit = $item && access::can("edit", $item); + $is_album_writable = + is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path()); $can_add = $item && access::can("add", $item); - if ($can_add) { + if ($can_add && $is_album_writable) { $menu->append($add_menu = Menu::factory("submenu") ->id("add_menu") ->label(t("Add"))); @@ -105,6 +107,9 @@ class gallery_Core { ->label(t("Add an album")) ->url(url::site("form/add/albums/$item->id?type=album"))); } + } else if (!$is_album_writable) { + message::warning(t("The album '%album_name' is not writable.", + array("album_name" => $item->title))); } $menu->append($options_menu = Menu::factory("submenu") |