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.

torrents.php 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. ini_set('memory_limit', -1);
  3. function compare($X, $Y)
  4. {
  5. return($Y['count'] - $X['count']);
  6. }
  7. if (!empty($_GET['userid'])) {
  8. if (!check_perms('users_override_paranoia')) {
  9. error(403);
  10. }
  11. $UserID = $_GET['userid'];
  12. if (!is_number($UserID)) {
  13. error(404);
  14. }
  15. $DB->query("
  16. SELECT
  17. `Username`
  18. FROM
  19. `users_main`
  20. WHERE
  21. `ID` = '$UserID'
  22. ");
  23. list($Username) = $DB->next_record();
  24. } else {
  25. $UserID = $LoggedUser['ID'];
  26. }
  27. $Sneaky = ($UserID !== $LoggedUser['ID']);
  28. $JsonBookmarks = [];
  29. list($GroupIDs, $CollageDataList, $GroupList) = Users::get_bookmarks($UserID);
  30. foreach ($GroupIDs as $GroupID) {
  31. if (!isset($GroupList[$GroupID])) {
  32. continue;
  33. }
  34. $Group = $GroupList[$GroupID];
  35. $JsonTorrents = [];
  36. foreach ($Group['Torrents'] as $Torrent) {
  37. $JsonTorrents[] = array(
  38. 'id' => (int) $Torrent['ID'],
  39. 'groupId' => (int) $Torrent['GroupID'],
  40. 'platform' => $Torrent['Media'],
  41. 'fileCount' => (int) $Torrent['FileCount'],
  42. 'freeTorrent' => $Torrent['FreeTorrent'] === 1,
  43. 'size' => (float) $Torrent['Size'],
  44. 'leechers' => (int) $Torrent['Leechers'],
  45. 'seeders' => (int) $Torrent['Seeders'],
  46. 'snatched' => (int) $Torrent['Snatched'],
  47. 'time' => $Torrent['Time'],
  48. 'hasFile' => (int) $Torrent['HasFile']
  49. );
  50. /*
  51. $JsonTorrents[] = array(
  52. 'id' => (int) $Torrent['ID'],
  53. 'groupId' => (int) $Torrent['GroupID'],
  54. 'media' => $Torrent['Media'],
  55. 'format' => $Torrent['Format'],
  56. 'encoding' => $Torrent['Encoding'],
  57. 'remasterYear' => (int) $Torrent['RemasterYear'],
  58. 'remastered' => $Torrent['Remastered'] == 1,
  59. 'remasterTitle' => $Torrent['RemasterTitle'],
  60. 'remasterRecordLabel' => $Torrent['RemasterRecordLabel'],
  61. 'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'],
  62. 'scene' => $Torrent['Scene'] === 1,
  63. 'hasLog' => $Torrent['HasLog'] === 1,
  64. 'hasCue' => $Torrent['HasCue'] === 1,
  65. 'logScore' => (float) $Torrent['LogScore'],
  66. 'fileCount' => (int) $Torrent['FileCount'],
  67. 'freeTorrent' => $Torrent['FreeTorrent'] === 1,
  68. 'size' => (float) $Torrent['Size'],
  69. 'leechers' => (int) $Torrent['Leechers'],
  70. 'seeders' => (int) $Torrent['Seeders'],
  71. 'snatched' => (int) $Torrent['Snatched'],
  72. 'time' => $Torrent['Time'],
  73. 'hasFile' => (int) $Torrent['HasFile']
  74. );
  75. */
  76. }
  77. $JsonBookmarks[] = array(
  78. 'id' => (int) $Group['ID'],
  79. 'name' => $Group['Name'],
  80. 'year' => (int) $Group['Year'],
  81. 'accession' => $Group['CatalogueNumber'],
  82. 'tagList' => $Group['TagList'],
  83. 'vanityHouse' => $Group['VanityHouse'] === 1,
  84. 'picture' => $Group['WikiImage'],
  85. 'torrents' => $JsonTorrents
  86. );
  87. /*
  88. $JsonBookmarks[] = array(
  89. 'id' => (int) $Group['ID'],
  90. 'name' => $Group['Name'],
  91. 'year' => (int) $Group['Year'],
  92. 'recordLabel' => $Group['RecordLabel'],
  93. 'catalogueNumber' => $Group['CatalogueNumber'],
  94. 'tagList' => $Group['TagList'],
  95. 'releaseType' => $Group['ReleaseType'],
  96. 'vanityHouse' => $Group['VanityHouse'] === 1,
  97. 'image' => $Group['WikiImage'],
  98. 'torrents' => $JsonTorrents
  99. );
  100. */
  101. }
  102. print
  103. json_encode(
  104. array(
  105. 'status' => 'success',
  106. 'response' => array(
  107. 'bookmarks' => $JsonBookmarks
  108. )
  109. )
  110. );