Gazelle/sections/torrents/notify_actions.php

63 lines
2.1 KiB
PHP
Raw Normal View History

2012-10-27 08:00:09 +00:00
<?
2013-05-01 08:00:16 +00:00
switch ($_GET['action']) {
2012-10-27 08:00:09 +00:00
case 'notify_clear':
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND UnRead = '0'");
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
header('Location: torrents.php?action=notify');
break;
case 'notify_clear_item':
case 'notify_clearitem':
2013-05-01 08:00:16 +00:00
if (!isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) {
2012-10-27 08:00:09 +00:00
error(0);
}
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND TorrentID = '$_GET[torrentid]'");
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
break;
2013-02-15 08:00:35 +00:00
case 'notify_clear_items':
2013-05-01 08:00:16 +00:00
if (!isset($_GET['torrentids'])) {
2013-02-15 08:00:35 +00:00
error(0);
}
$TorrentIDs = explode(',', $_GET['torrentids']);
foreach ($TorrentIDs as $TorrentID) {
if (!is_number($TorrentID)) {
error(0);
}
}
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = $LoggedUser[ID] AND TorrentID IN ($_GET[torrentids])");
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
break;
2012-10-27 08:00:09 +00:00
case 'notify_clear_filter':
case 'notify_cleargroup':
2013-05-01 08:00:16 +00:00
if (!isset($_GET['filterid']) || !is_number($_GET['filterid'])) {
2012-10-27 08:00:09 +00:00
error(0);
}
$DB->query("DELETE FROM users_notify_torrents WHERE UserID = '$LoggedUser[ID]' AND FilterID = '$_GET[filterid]' AND UnRead = '0'");
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
header('Location: torrents.php?action=notify');
break;
case 'notify_catchup':
$DB->query("UPDATE users_notify_torrents SET UnRead = '0' WHERE UserID=$LoggedUser[ID]");
2013-05-01 08:00:16 +00:00
if ($DB->affected_rows()) {
2012-10-27 08:00:09 +00:00
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
}
header('Location: torrents.php?action=notify');
break;
case 'notify_catchup_filter':
2013-05-01 08:00:16 +00:00
if (!isset($_GET['filterid']) || !is_number($_GET['filterid'])) {
2012-10-27 08:00:09 +00:00
error(0);
}
$DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID = $LoggedUser[ID] AND FilterID = $_GET[filterid]");
2013-05-01 08:00:16 +00:00
if ($DB->affected_rows()) {
2012-10-27 08:00:09 +00:00
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
}
header('Location: torrents.php?action=notify');
break;
default:
error(0);
2013-05-01 08:00:16 +00:00
}