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

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