Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

notify.php 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?
  2. authorize();
  3. if (!check_perms('site_torrents_notify')) {
  4. error(403);
  5. }
  6. $ArtistID = $_GET['artistid'];
  7. if (!is_number($ArtistID)) {
  8. error(0);
  9. }
  10. /*
  11. $DB->query("
  12. SELECT GROUP_CONCAT(Name SEPARATOR '|')
  13. FROM artists_alias
  14. WHERE ArtistID = '$ArtistID'
  15. AND Redirect = 0
  16. GROUP BY ArtistID");
  17. list($ArtistAliases) = $DB->next_record(MYSQLI_NUM, FALSE);
  18. */
  19. $DB->query("
  20. SELECT Name
  21. FROM artists_group
  22. WHERE ArtistID = '$ArtistID'");
  23. list($ArtistAliases) = $DB->next_record(MYSQLI_NUM, FALSE);
  24. $Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID']);
  25. if (empty($Notify)) {
  26. $DB->query("
  27. SELECT ID, Artists
  28. FROM users_notify_filters
  29. WHERE Label = 'Artist notifications'
  30. AND UserID = '$LoggedUser[ID]'
  31. ORDER BY ID
  32. LIMIT 1");
  33. } else {
  34. $DB->query("
  35. SELECT ID, Artists
  36. FROM users_notify_filters
  37. WHERE ID = '$Notify[ID]'");
  38. }
  39. if (empty($Notify) && !$DB->has_results()) {
  40. $DB->query("
  41. INSERT INTO users_notify_filters
  42. (UserID, Label, Artists)
  43. VALUES
  44. ('$LoggedUser[ID]', 'Artist notifications', '|".db_string($ArtistAliases)."|')");
  45. $FilterID = $DB->inserted_id();
  46. $Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
  47. $Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
  48. } else {
  49. list($ID, $ArtistNames) = $DB->next_record(MYSQLI_NUM, FALSE);
  50. if (stripos($ArtistNames, "|$ArtistAliases|") === false) {
  51. $ArtistNames .= "$ArtistAliases|";
  52. $DB->query("
  53. UPDATE users_notify_filters
  54. SET Artists = '".db_string($ArtistNames)."'
  55. WHERE ID = '$ID'");
  56. $Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
  57. $Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
  58. }
  59. }
  60. header('Location: '.$_SERVER['HTTP_REFERER']);
  61. ?>