diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-12-30 16:12:32 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-12-30 16:12:32 -0800 |
commit | d6ddbd1a31600543c4d8dec406ef73b0e8b84dde (patch) | |
tree | 684f5a3d9c9011bac9fa7d8ebebef7b8c2d015e4 /modules/gallery/helpers/item.php | |
parent | d50b7531993fcf7dee2542255f11b20257db737d (diff) |
Rollback the refactoring of the update into a helper method. Also remove the refactoring for check for commits
Diffstat (limited to 'modules/gallery/helpers/item.php')
-rw-r--r-- | modules/gallery/helpers/item.php | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index fc390e70..f6181f8a 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -96,51 +96,6 @@ class item_Core { } } - - static function update($item, $fields) { - $dirty = false; - if ($item->id != 1 && !empty($fields["name"]) && $fields["name"] != $item->name) { - $item->rename($fields["name"]); - unset($fields["name"]); - $dirty = true; - } - foreach ($fields as $field => $value) { - if ($value !== $item->$field) { - $item->$field = $value; - $dirty = true; - } - } - - if ($dirty) { - $item->save(); - } - } - - static function check_for_conflicts($item, $new_name, $new_slug) { - $errors = array(); - - if ($row = db::build() - ->select(array("name", "slug")) - ->from("items") - ->where("parent_id", "=", $item->parent_id) - ->where("id", "<>", $item->id) - ->and_open() - ->where("name", "=", $new_name) - ->or_where("slug", "=", $new_slug) - ->close() - ->execute() - ->current()) { - if ($row->name == $new_name) { - $errors["name_conflict"] = 1; - } - if ($row->slug == $new_slug) { - $errors["slug_conflict"] = 1; - } - } - - return $errors; - } - /** * Sanitize a filename into something presentable as an item title * @param string $filename |