From 4e6f2f1b4c489c21546c2ae685b814c42e689d71 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 18 Sep 2009 23:53:48 -0700 Subject: Don't display the add menu if the underlying operating system directory is not writable. THis should fix ticket #775 --- modules/gallery/helpers/gallery.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'modules/gallery/helpers') 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") -- cgit v1.2.3