/** * @NoAdminRequired * @NoCSRFRequired */ public function bookmarklet($url = "", $title = "") { $bookmarkExists = Bookmarks::bookmarkExists($url, $this->userId, $this->db); $description = ""; if ($bookmarkExists != false) { $bookmark = Bookmarks::findUniqueBookmark($bookmarkExists, $this->userId, $this->db); $description = $bookmark['description']; } $params = array('url' => $url, 'title' => $title, 'description' => $description, 'bookmarkExists' => $bookmarkExists); return new TemplateResponse('bookmarks', 'addBookmarklet', $params); // templates/main.php }
function testDeleteBookmark() { $this->cleanDB(); Bookmarks::addBookmark($this->userid, $this->db, "http://www.google.de", "Google", array("one"), "PrivateNoTag", false); $id = Bookmarks::addBookmark($this->userid, $this->db, "http://www.heise.de", "Heise", array("one", "two"), "PrivatTag", false); $this->assertNotEquals(false, Bookmarks::bookmarkExists("http://www.google.de", $this->userid, $this->db)); $this->assertNotEquals(false, Bookmarks::bookmarkExists("http://www.heise.de", $this->userid, $this->db)); Bookmarks::deleteUrl($this->userid, $this->db, $id); $this->assertFalse(Bookmarks::bookmarkExists("http://www.heise.de", $this->userid, $this->db)); }