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.

collage.php 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. #declare(strict_types=1);
  3. $CollageID = (int) $_GET['id'];
  4. Security::checkInt($CollageID);
  5. $CollageData = $Cache->get_value("collage_$CollageID");
  6. if ($CollageData) {
  7. list($Name, $Description, $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers) = $CollageData;
  8. } else {
  9. $DB->query("
  10. SELECT
  11. `Name`,
  12. `Description`,
  13. `UserID`,
  14. `Deleted`,
  15. `CategoryID`,
  16. `Locked`,
  17. `MaxGroups`,
  18. `MaxGroupsPerUser`,
  19. `Updated`,
  20. `Subscribers`
  21. FROM
  22. `collages`
  23. WHERE
  24. `ID` = '$CollageID'
  25. ");
  26. if ($DB->has_results()) {
  27. list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers) = $DB->next_record(MYSQLI_NUM);
  28. $CommentList = null;
  29. } else {
  30. $Deleted = '1';
  31. }
  32. $SetCache = true;
  33. }
  34. if ($Deleted === '1') {
  35. header("Location: log.php?search=Collage+$CollageID");
  36. error(404);
  37. }
  38. // Handle subscriptions
  39. if (($CollageSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) === false) {
  40. $DB->query("
  41. SELECT
  42. `CollageID`
  43. FROM
  44. `users_collage_subs`
  45. WHERE
  46. `UserID` = '$LoggedUser[ID]'
  47. ");
  48. $CollageSubscriptions = $DB->collect(0);
  49. $Cache->cache_value('collage_subs_user_'.$LoggedUser['ID'], $CollageSubscriptions, 0);
  50. }
  51. if (!empty($CollageSubscriptions) && in_array($CollageID, $CollageSubscriptions)) {
  52. $DB->query("
  53. UPDATE
  54. `users_collage_subs`
  55. SET
  56. `LastVisit` = NOW()
  57. WHERE
  58. `UserID` = ".$LoggedUser['ID']."
  59. AND `CollageID` = $CollageID
  60. ");
  61. $Cache->delete_value('collage_subs_user_new_'.$LoggedUser['ID']);
  62. }
  63. if ($CollageCategoryID === array_search(ARTIST_COLLAGE, $CollageCats)) {
  64. include SERVER_ROOT.'/sections/collages/artist_collage.php';
  65. } else {
  66. include SERVER_ROOT.'/sections/collages/torrent_collage.php';
  67. }
  68. if (isset($SetCache)) {
  69. $CollageData = array(
  70. $Name,
  71. $Description,
  72. $CommentList,
  73. (bool) $Deleted,
  74. (int) $CollageCategoryID,
  75. (int) $CreatorID,
  76. (bool) $Locked,
  77. (int) $MaxGroups,
  78. (int) $MaxGroupsPerUser,
  79. $Updated,
  80. (int) $Subscribers);
  81. $Cache->cache_value("collage_$CollageID", $CollageData, 3600);
  82. }