diff options
Diffstat (limited to 'modules/tag/controllers')
| -rw-r--r-- | modules/tag/controllers/admin_tags.php | 20 | ||||
| -rw-r--r-- | modules/tag/controllers/tags.php | 10 |
2 files changed, 15 insertions, 15 deletions
diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index 67587c2e..e20b8ac8 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -19,7 +19,7 @@ */ class Admin_Tags_Controller extends Admin_Controller { public function index() { - $filter = $this->input->get("filter"); + $filter = Input::instance()->get("filter"); $view = new Admin_View("admin.html"); $view->content = new View("admin_tags.html"); @@ -29,13 +29,13 @@ class Admin_Tags_Controller extends Admin_Controller { if ($filter) { $query->like("name", $filter); } - $view->content->tags = $query->orderby("name", "ASC")->find_all(); + $view->content->tags = $query->order_by("name", "ASC")->find_all(); print $view; } public function form_delete($id) { $tag = ORM::factory("tag", $id); - if ($tag->loaded) { + if ($tag->loaded()) { print tag::get_delete_form($tag); } } @@ -44,14 +44,14 @@ class Admin_Tags_Controller extends Admin_Controller { access::verify_csrf(); $tag = ORM::factory("tag", $id); - if (!$tag->loaded) { - kohana::show_404(); + if (!$tag->loaded()) { + throw new Kohana_404_Exception(); } $form = tag::get_delete_form($tag); if ($form->validate()) { $name = $tag->name; - Database::instance()->delete("items_tags", array("tag_id" => "$tag->id")); + db::build()->delete("items_tags")->where("tag_id", "=", $tag->id)->execute(); $tag->delete(); message::success(t("Deleted tag %tag_name", array("tag_name" => $name))); log::success("tags", t("Deleted tag %tag_name", array("tag_name" => $name))); @@ -68,7 +68,7 @@ class Admin_Tags_Controller extends Admin_Controller { public function form_rename($id) { $tag = ORM::factory("tag", $id); - if ($tag->loaded) { + if ($tag->loaded()) { print InPlaceEdit::factory($tag->name) ->action("admin/tags/rename/$id") ->render(); @@ -79,8 +79,8 @@ class Admin_Tags_Controller extends Admin_Controller { access::verify_csrf(); $tag = ORM::factory("tag", $id); - if (!$tag->loaded) { - kohana::show_404(); + if (!$tag->loaded()) { + throw new Kohana_404_Exception(); } $in_place_edit = InPlaceEdit::factory($tag->name) @@ -106,7 +106,7 @@ class Admin_Tags_Controller extends Admin_Controller { } public function check_for_duplicate(Validation $post_data, $field) { - $tag_exists = ORM::factory("tag")->where("name", $post_data[$field])->count_all(); + $tag_exists = ORM::factory("tag")->where("name", "=", $post_data[$field])->count_all(); if ($tag_exists) { $post_data->add_error($field, "in_use"); } diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index 9f9e45d9..992c7411 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -21,7 +21,7 @@ class Tags_Controller extends Controller { public function show($tag_id) { $tag = ORM::factory("tag", $tag_id); $page_size = module::get_var("gallery", "page_size", 9); - $page = (int) $this->input->get("page", "1"); + $page = (int) Input::instance()->get("page", "1"); $children_count = $tag->items_count(); $offset = ($page-1) * $page_size; $max_pages = max(ceil($children_count / $page_size), 1); @@ -79,12 +79,12 @@ class Tags_Controller extends Controller { public function autocomplete() { $tags = array(); - $tag_parts = preg_split("#,#", $this->input->get("q")); - $limit = $this->input->get("limit"); + $tag_parts = preg_split("#,#", Input::instance()->get("q")); + $limit = Input::instance()->get("limit"); $tag_part = end($tag_parts); $tag_list = ORM::factory("tag") - ->like("name", "{$tag_part}%", false) - ->orderby("name", "ASC") + ->where("name", "LIKE", "{$tag_part}%") + ->order_by("name", "ASC") ->limit($limit) ->find_all(); foreach ($tag_list as $tag) { |
