%title item", array("title" => html::purify($item->title))); $this->_check_star_permissions($item); star::star($item); message::success($msg); json::reply(array("result" => "success", "reload" => 1)); } /** * Allows the given item to be displayed again. * * @param int $id the item id */ public function unstar($id) { $item = model_cache::get("item", $id); $msg = t("Un-starred %title item", array("title" => html::purify($item->title))); $this->_check_star_permissions($item); star::unstar($item); message::success($msg); json::reply(array("result" => "success", "reload" => 1)); } public function star_only_on() { //$item = model_cache::get("item", $id); access::verify_csrf(); $msg = t("Showing starred items."); //$this->_check_star_permissions($item); star::star_only_on(); message::success($msg); json::reply(array("result" => "success", "reload" => 1)); } public function star_only_off() { //$item = model_cache::get("item", $id); access::verify_csrf(); $msg = t("Showing all items."); //$this->_check_star_permissions($item); star::star_only_off(); message::success($msg); json::reply(array("result" => "success", "reload" => 1)); } /** * Checks whether the given object can be starred by the active user. * * @param Item_Model $item the item */ private function _check_star_permissions(Item_Model $item) { access::verify_csrf(); access::required("view", $item); access::required("edit", $item); if (!star::can_star()) { access::forbidden(); } } }