summaryrefslogtreecommitdiff
path: root/modules/gallery/models
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-27 21:52:18 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-27 21:52:18 -0800
commit212633d05a5a8abb77a744a69c61d6e3051b73c5 (patch)
treef434444e950bc2bed16b6e15b4bb0c373aa6dfd1 /modules/gallery/models
parentec0f89f10a58c3c3751387d5c1d1efcbf940bc9a (diff)
Prevent accidentally deleting the root album.
Diffstat (limited to 'modules/gallery/models')
-rw-r--r--modules/gallery/models/item.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index e4ff0bfb..9706d61f 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -71,6 +71,12 @@ class Item_Model extends ORM_MPTT {
}
public function delete() {
+ if ($this->id == 1) {
+ $v = new Validation(array("id"));
+ $v->add_error("id", "cant_delete_root_album");
+ ORM_Validation_Exception::handle_validation($this->table_name, $v);
+ }
+
$old = clone $this;
module::event("item_before_delete", $this);