Gazelle/sections/artist/notifyremove.php

32 lines
1.1 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
authorize();
2013-04-13 08:00:19 +00:00
if (!check_perms('site_torrents_notify')) {
error(403);
}
2011-03-28 14:21:28 +00:00
$ArtistID = $_GET['artistid'];
2013-04-13 08:00:19 +00:00
if (!is_number($ArtistID)) {
error(0);
}
2011-03-28 14:21:28 +00:00
2013-04-13 08:00:19 +00:00
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
2011-03-28 14:21:28 +00:00
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE Label='Artist notifications' AND UserID='$LoggedUser[ID]' ORDER BY ID LIMIT 1");
} else {
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE ID='$Notify[ID]'");
}
list($ID,$Artists) = $DB->next_record(MYSQLI_NUM, FALSE);
$DB->query("SELECT Name FROM artists_alias WHERE ArtistID = '$ArtistID' AND Redirect=0");
2013-04-13 08:00:19 +00:00
while (list($Alias) = $DB->next_record(MYSQLI_NUM, FALSE)) {
while (stripos($Artists, '|'.$Alias.'|') !== false) {
2011-03-28 14:21:28 +00:00
$Artists = str_ireplace('|'.$Alias.'|', '|', $Artists);
}
}
2013-04-13 08:00:19 +00:00
if ($Artists == '|') {
2011-03-28 14:21:28 +00:00
$DB->query("DELETE FROM users_notify_filters WHERE ID=$ID");
} else {
$DB->query("UPDATE users_notify_filters SET Artists='".db_string($Artists)."' WHERE ID='$ID'");
}
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
$Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
header('Location: '.$_SERVER['HTTP_REFERER']);
?>