/** * deleteBookmark * Delete an existing bookmark. * Takes the file id in parameter. * Not supported. */ public static function deletebookmark($input) { self::check_version($input, "1.9.0"); $id = self::check_parameter($input, 'id'); $type = Subsonic_XML_Data::getAmpacheType($id); $bookmark = new Bookmark(Subsonic_XML_Data::getAmpacheId($id), $type); if ($bookmark->id) { $bookmark->remove(); $r = Subsonic_XML_Data::createSuccessResponse(); } else { $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND); } self::apiOutput($input, $r); }
$offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (!$sortorder) { $sortorder = "ASC"; } if (!$sortfield) { $sortfield = "position"; } $limit = $conf->liste_limit; /* * Actions */ if ($_GET["action"] == 'delete') { $bookmark = new Bookmark($db); $res = $bookmark->remove($_GET["bid"]); if ($res > 0) { header("Location: " . $_SERVER["PHP_SELF"]); exit; } else { $mesg = '<div class="error">' . $bookmark->error . '</div>'; } } /* * View */ $userstatic = new User($db); llxHeader(); print_fiche_titre($langs->trans("Bookmarks")); if ($mesg) { print $mesg;
<?php namespace cd; $session->requireLoggedIn(); switch ($this->owner) { case 'adduser': // child = user id Bookmark::create(BOOKMARK_FAVORITEUSER, $this->child); js_redirect('u/bookmark/listusers'); break; case 'removeuser': // child = user id Bookmark::remove(BOOKMARK_FAVORITEUSER, $this->child); js_redirect('u/bookmark/listusers'); break; case 'listusers': echo '<h1>Favorite users</h1>'; $bookmarks = Bookmark::getList(BOOKMARK_FAVORITEUSER, $session->id); foreach ($bookmarks as $bm) { $u = User::get($bm->value); echo ahref('u/profile/' . $u->id, $u->name); echo ' '; echo ahref('u/bookmark/removeuser/' . $u->id, 'Remove'); echo '<br/>'; } break; default: echo 'No handler for view ' . $this->owner; }
else { $mesg='<div class="error">'.$bookmark->error.'</div>'; } } if ($_GET["action"] == 'delete') { $bookmark=new Bookmark($db); $bookmark->id=$_GET["bid"]; $bookmark->url=$user->id; $bookmark->target=$user->id; $bookmark->title='xxx'; $bookmark->favicon='xxx'; $res=$bookmark->remove(); if ($res > 0) { header("Location: ".$_SERVER["PHP_SELF"]); } else { $mesg='<div class="error">'.$bookmark->error.'</div>'; } } print_fiche_titre($langs->trans("Bookmarks")); $sql = "SELECT s.rowid, s.nom, b.dateb as dateb, b.rowid as bid, b.fk_user, b.url, b.target, u.name, u.firstname";
namespace cd; $session->requireLoggedIn(); switch ($this->owner) { case 'user': // child = user id if (!$this->child || $this->child == $session->id) { die('meh'); } if (confirmed('You sure you want to block this user from contacting you?')) { Bookmark::create(BOOKMARK_USERBLOCK, $this->child); js_redirect('u/profile/' . $this->child); } break; case 'remove': // child = user id Bookmark::remove(BOOKMARK_USERBLOCK, $this->child); js_redirect('u/block/manage'); break; case 'manage': echo '<h1>Manage your blocked users</h1>'; $list = Bookmark::getList(BOOKMARK_USERBLOCK, $session->id); foreach ($list as $o) { echo ahref('u/profile/' . $o->value, User::get($o->value)->name) . ' '; echo ahref('u/block/remove/' . $o->value, 'Remove block') . '<br/>'; } break; default: echo 'no such view: ' . $this->owner; }