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.

reseed.php 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. #declare(strict_types = 1);
  3. $GroupID = $_GET['groupid'];
  4. $TorrentID = $_GET['torrentid'];
  5. if (!is_number($GroupID) || !is_number($TorrentID)) {
  6. error(0);
  7. }
  8. $DB->query("
  9. SELECT
  10. `last_action`,
  11. `LastReseedRequest`,
  12. `UserID`,
  13. `Time`
  14. FROM
  15. `torrents`
  16. WHERE
  17. `ID` = '$TorrentID'
  18. ");
  19. list($LastActive, $LastReseedRequest, $UploaderID, $UploadedTime) = $DB->next_record();
  20. if (!check_perms('users_mod')) {
  21. if (time() - strtotime($LastReseedRequest) < 864000) {
  22. error('There was already a re-seed request for this torrent within the past 10 days');
  23. }
  24. if (!$LastActive || time() - strtotime($LastActive) < 345678) {
  25. error(403);
  26. }
  27. }
  28. $DB->query("
  29. UPDATE
  30. `torrents`
  31. SET
  32. `LastReseedRequest` = NOW()
  33. WHERE
  34. `ID` = '$TorrentID'
  35. ");
  36. $Group = Torrents::get_groups(array($GroupID));
  37. extract(Torrents::array_group($Group[$GroupID]));
  38. $Name = '';
  39. #$Name .= Artists::display_artists(array('1' => $Artists), false, true);
  40. $Name .= $GroupName;
  41. $DB->query("
  42. SELECT
  43. `uid`,
  44. MAX(`tstamp`) AS tstamp
  45. FROM
  46. `xbt_snatched`
  47. WHERE
  48. `fid` = '$TorrentID'
  49. GROUP BY
  50. `uid`
  51. ORDER BY
  52. `tstamp`
  53. DESC
  54. LIMIT 10
  55. ");
  56. if ($DB->has_results()) {
  57. $Users = $DB->to_array();
  58. foreach ($Users as $User) {
  59. $UserID = $User['uid'];
  60. $DB->query("
  61. SELECT
  62. `UserID`
  63. FROM
  64. `top_snatchers`
  65. WHERE
  66. `UserID` = '$UserID'
  67. ");
  68. if ($DB->has_results()) {
  69. continue;
  70. }
  71. $UserInfo = Users::user_info($UserID);
  72. $Username = $UserInfo['Username'];
  73. $TimeStamp = $User['tstamp'];
  74. $Request = "
  75. Hi $Username,
  76. The user
  77. [url=".site_url()."user.php?id=$LoggedUser[ID]]$LoggedUser[Username][/url]
  78. has requested a re-seed for the torrent
  79. [url=".site_url()."torrents.php?id=$GroupID&torrentid=$TorrentID]{$Name}[/url],
  80. which you snatched on ".date('M d Y', $TimeStamp).".
  81. The torrent is now un-seeded, and we need your help to resurrect it!
  82. The exact process for re-seeding a torrent is slightly different for each client, but the concept is the same.
  83. The idea is to download the torrent file and open it in your client, and point your client to the location where the data files are, then initiate a hash check.
  84. Thanks!";
  85. Misc::send_pm($UserID, 0, "Re-seed request for torrent $Name", $Request);
  86. }
  87. $NumUsers = count($Users);
  88. } else {
  89. $UserInfo = Users::user_info($UploaderID);
  90. $Username = $UserInfo['Username'];
  91. $Request = "
  92. Hi $Username,
  93. The user
  94. [url=".site_url()."user.php?id=$LoggedUser[ID]]$LoggedUser[Username][/url]
  95. has requested a re-seed for the torrent
  96. [url=".site_url()."torrents.php?id=$GroupID&torrentid=$TorrentID]{$Name}[/url],
  97. which you uploaded on ".date('M d Y', strtotime($UploadedTime)).".
  98. The torrent is now un-seeded, and we need your help to resurrect it!
  99. The exact process for re-seeding a torrent is slightly different for each client, but the concept is the same.
  100. The idea is to download the torrent file and open it in your client, and point your client to the location where the data files are, then initiate a hash check.
  101. Thanks!";
  102. Misc::send_pm($UploaderID, 0, "Re-seed request for torrent $Name", $Request);
  103. $NumUsers = 1;
  104. }
  105. View::show_header();
  106. ?>
  107. <div>
  108. <div class="header">
  109. <h2>
  110. Successfully sent re-seed request
  111. </h2>
  112. </div>
  113. <div class="box pad">
  114. <p>
  115. Successfully sent re-seed request for torrent
  116. <a
  117. href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=display_str($Name)?></a>
  118. to <?=$NumUsers?> user<?=$NumUsers === 1 ? '' : 's';?>.
  119. </p>
  120. </div>
  121. </div>
  122. <?php View::show_footer();