BioTorrents.de’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.8KB

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