From 28b41056e3ea962dce1ad017a3c0a60252195e7a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 27 May 2009 15:07:27 -0700 Subject: Restructure things so that the application is now just another module. Kohana makes this type of transition fairly straightforward in that all controllers/helpers/etc are still located in the cascading filesystem without any extra effort, except that I've temporarily added a hack to force modules/gallery into the module path. Rename what's left of "core" to be "application" so that it conforms more closely to the Kohana standard (basically, just application/config/config.php which is the minimal thing that you need in the application directory) There's still considerable work left to be done here. --- core/helpers/item.php | 105 -------------------------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 core/helpers/item.php (limited to 'core/helpers/item.php') diff --git a/core/helpers/item.php b/core/helpers/item.php deleted file mode 100644 index 7daaf1e1..00000000 --- a/core/helpers/item.php +++ /dev/null @@ -1,105 +0,0 @@ -parent(); - if ($parent->album_cover_item_id == $source->id) { - if ($parent->children_count() > 1) { - foreach ($parent->children(2) as $child) { - if ($child->id != $source->id) { - $new_cover_item = $child; - break; - } - } - item::make_album_cover($new_cover_item); - } else { - item::remove_album_cover($parent); - } - } - - $source->move_to($target); - - // If the target has no cover item, make this it. - if ($target->album_cover_item_id == null) { - item::make_album_cover($source); - } - } - - static function make_album_cover($item) { - $parent = $item->parent(); - access::required("edit", $parent); - - model_cache::clear("item", $parent->album_cover_item_id); - $parent->album_cover_item_id = $item->is_album() ? $item->album_cover_item_id : $item->id; - $parent->thumb_dirty = 1; - $parent->save(); - graphics::generate($parent); - $grand_parent = $parent->parent(); - if ($grand_parent && $grand_parent->album_cover_item_id == null) { - item::make_album_cover($parent); - } - } - - static function remove_album_cover($album) { - access::required("edit", $album); - @unlink($album->thumb_path()); - - model_cache::clear("item", $album->album_cover_item_id) ; - $album->album_cover_item_id = null; - $album->thumb_width = 0; - $album->thumb_height = 0; - $album->thumb_dirty = 1; - $album->save(); - graphics::generate($album); - } - - static function validate_no_slashes($input) { - if (strpos($input->value, "/") !== false) { - $input->add_error("no_slashes", 1); - } - } - - static function validate_no_trailing_period($input) { - if (rtrim($input->value, ".") !== $input->value) { - $input->add_error("no_trailing_period", 1); - } - } - - static function validate_no_name_conflict($input) { - $itemid = Input::instance()->post("item"); - if (is_array($itemid)) { - $itemid = $itemid[0]; - } - $item = ORM::factory("item") - ->in("id", $itemid) - ->find(); - if (Database::instance() - ->from("items") - ->where("parent_id", $item->parent_id) - ->where("id <>", $item->id) - ->where("name", $input->value) - ->count_records()) { - $input->add_error("conflict", 1); - } - } -} \ No newline at end of file -- cgit v1.2.3