2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
//******************************************************************************//
|
|
|
|
//--------------- Delete a recommendation --------------------------------------//
|
|
|
|
|
2013-04-24 08:00:23 +00:00
|
|
|
if (!check_perms('site_recommend_own') && !check_perms('site_manage_recommendations')) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
|
2016-01-20 08:00:29 +00:00
|
|
|
$GroupID = $_GET['groupid'];
|
2013-04-24 08:00:23 +00:00
|
|
|
if (!$GroupID || !is_number($GroupID)) {
|
|
|
|
error(404);
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
|
2013-04-24 08:00:23 +00:00
|
|
|
if (!check_perms('site_manage_recommendations')) {
|
2013-07-04 08:00:56 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT UserID
|
|
|
|
FROM torrents_recommended
|
|
|
|
WHERE GroupID = '$GroupID'");
|
2011-03-28 14:21:28 +00:00
|
|
|
list($UserID) = $DB->next_record();
|
2013-04-24 08:00:23 +00:00
|
|
|
if ($UserID != $LoggedUser['ID']) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-04 08:00:56 +00:00
|
|
|
$DB->query("
|
|
|
|
DELETE FROM torrents_recommended
|
|
|
|
WHERE GroupID = '$GroupID'");
|
2011-03-28 14:21:28 +00:00
|
|
|
|
|
|
|
$Cache->delete_value('recommend');
|
|
|
|
header('Location: '.$_SERVER['HTTP_REFERER']);
|
|
|
|
?>
|