Gazelle/sections/bookmarks/add.php

30 lines
920 B
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
authorize();
if (!can_bookmark($_GET['type'])) { error(404); }
$Type = $_GET['type'];
list($Table, $Col) = bookmark_schema($Type);
if(!is_number($_GET['id'])) {
2011-03-28 14:21:28 +00:00
error(0);
}
$DB->query("SELECT UserID FROM $Table WHERE UserID='$LoggedUser[ID]' AND $Col='".db_string($_GET['id'])."'");
2011-03-28 14:21:28 +00:00
if($DB->record_count() == 0) {
$DB->query("INSERT IGNORE INTO $Table
(UserID, $Col, Time)
2011-03-28 14:21:28 +00:00
VALUES
('$LoggedUser[ID]', '".db_string($_GET['id'])."', '".sqltime()."')");
$Cache->delete_value('bookmarks_'.$Type.'_'.$LoggedUser['ID']);
if ($Type == 'torrent') {
$Cache->delete_value('bookmarks_torrent_'.$LoggedUser['ID'].'_full');
} elseif ($Type == 'request') {
$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);
}
2011-03-28 14:21:28 +00:00
}
?>