public function validate_link() { $c_id = Request::get_c_id(); $id = Request::get_id(); $repo = LinkRepository::instance(); $link = $repo->find_one_by_id($c_id, $id); $success = $link ? $link->validate() : false; $this->response($success); }
public function go() { $id = Request::get_id(); $c_id = Request::get_c_id(); $repo = LinkRepository::instance(); $link = $repo->find_one_by_id($c_id, $id); $url = $link->url; event_link($id); Header::cache_control('no-store, no-cache, must-revalidate'); Header::pragma('no-cache'); Redirect::go($url); }
function remove($category) { $table = Database::get_course_table(TABLE_LINK_CATEGORY); $c_id = (int) $category->c_id; $id = (int) $category->id; $sql = "DELETE FROM {$table} WHERE c_id={$c_id} AND id={$id}"; $success = (bool) Database::query($sql); if ($success) { LinkRepository::instance()->remove_by_category($category); } return $success; }