diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-06-23 14:08:07 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-06-23 14:08:07 -0700 |
commit | d5ee5741f2afa0e4a2d6406828cdad01bc8c3f2e (patch) | |
tree | 63546a55ab2043636d557751a2aa4065620ebe9f | |
parent | 107431f2465e2ce0ddea14af70d1ee329d1d1990 (diff) |
Don't allow renaming of the root album.
-rw-r--r-- | modules/gallery/controllers/albums.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 17fdec6b..22f50fb8 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -167,7 +167,8 @@ class Albums_Controller extends Items_Controller { $form = album::get_edit_form($album); if ($valid = $form->validate()) { // Make sure that there's not a conflict - if (Database::instance() + if ($album->id != 1 && + Database::instance() ->from("items") ->where("parent_id", $album->parent_id) ->where("id <>", $album->id) @@ -188,7 +189,9 @@ class Albums_Controller extends Items_Controller { $album->description = $form->edit_album->description->value; $album->sort_column = $form->edit_album->sort_order->column->value; $album->sort_order = $form->edit_album->sort_order->direction->value; - $album->rename($form->edit_album->dirname->value); + if ($album->id != 1) { + $album->rename($form->edit_album->dirname->value); + } $album->save(); module::event("item_updated", $orig, $album); |