Gazelle/sections/bookmarks/remove.php

32 lines
748 B
PHP
Raw Normal View History

2013-07-13 08:00:46 +00:00
<?php
authorize();
2013-05-05 08:00:31 +00:00
if (!Bookmarks::can_bookmark($_GET['type'])) {
error(404);
}
$Type = $_GET['type'];
2013-03-29 08:00:08 +00:00
list($Table, $Col) = Bookmarks::bookmark_schema($Type);
2013-05-05 08:00:31 +00:00
if (!is_number($_GET['id'])) {
error(0);
}
2013-05-05 08:00:31 +00:00
$DB->query("
DELETE FROM $Table
2013-07-13 08:00:46 +00:00
WHERE UserID = '".$LoggedUser['ID']."'
AND $Col = '".db_string($_GET['id'])."'");
$Cache->delete_value("bookmarks_$Type"."_$UserID");
2013-02-25 21:16:55 +00:00
if ($Type === 'torrent') {
2013-07-13 08:00:46 +00:00
$Cache->delete_value("bookmarks_group_ids_$UserID");
2013-02-25 21:16:55 +00:00
} elseif ($Type === 'request') {
2013-07-13 08:00:46 +00:00
$DB->query("
SELECT UserID
FROM $Table
WHERE $Col = '".db_string($_GET['id'])."'");
$Bookmarkers = $DB->collect('UserID');
2011-08-24 08:00:06 +00:00
$SS->UpdateAttributes('requests requests_delta', array('bookmarker'), array($_GET['id'] => array($Bookmarkers)), true);
}