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.4KB

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