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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?
  2. $GroupID = $_GET['groupid'];
  3. $TorrentID = $_GET['torrentid'];
  4. if (!is_number($GroupID) || !is_number($TorrentID)) {
  5. error(0);
  6. }
  7. $DB->query("
  8. SELECT last_action, LastReseedRequest, UserID, Time
  9. FROM torrents
  10. WHERE ID = '$TorrentID'");
  11. list($LastActive, $LastReseedRequest, $UploaderID, $UploadedTime) = $DB->next_record();
  12. if (!check_perms('users_mod')) {
  13. if (time() - strtotime($LastReseedRequest) < 864000) {
  14. error('There was already a re-seed request for this torrent within the past 10 days.');
  15. }
  16. if ($LastActive || time() - strtotime($LastActive) < 345678) {
  17. error(403);
  18. }
  19. }
  20. $DB->query("
  21. UPDATE torrents
  22. SET LastReseedRequest = NOW()
  23. WHERE ID = '$TorrentID'");
  24. $Group = Torrents::get_groups(array($GroupID));
  25. extract(Torrents::array_group($Group[$GroupID]));
  26. $Name = '';
  27. $Name .= Artists::display_artists(array('1' => $Artists), false, true);
  28. $Name .= $GroupName;
  29. $DB->query("
  30. SELECT uid, MAX(tstamp) AS tstamp
  31. FROM xbt_snatched
  32. WHERE fid = '$TorrentID'
  33. GROUP BY uid
  34. ORDER BY tstamp DESC
  35. LIMIT 10");
  36. if ($DB->has_results()) {
  37. $Users = $DB->to_array();
  38. foreach ($Users as $User) {
  39. $UserID = $User['uid'];
  40. $DB->query("
  41. SELECT UserID
  42. FROM top_snatchers
  43. WHERE UserID = '$UserID'");
  44. if ($DB->has_results()) {
  45. continue;
  46. }
  47. $UserInfo = Users::user_info($UserID);
  48. $Username = $UserInfo['Username'];
  49. $TimeStamp = $User['tstamp'];
  50. $Request = "Hi $Username,
  51. The user [url=".site_url()."user.php?id=$LoggedUser[ID]]$LoggedUser[Username][/url] has requested a re-seed for the torrent [url=".site_url()."torrents.php?id=$GroupID&torrentid=$TorrentID]{$Name}[/url], which you snatched on ".date('M d Y', $TimeStamp).". The torrent is now un-seeded, and we need your help to resurrect it!
  52. The exact process for re-seeding a torrent is slightly different for each client, but the concept is the same. 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.
  53. Thanks!";
  54. Misc::send_pm($UserID, 0, "Re-seed request for torrent $Name", $Request);
  55. }
  56. $NumUsers = count($Users);
  57. } else {
  58. $UserInfo = Users::user_info($UploaderID);
  59. $Username = $UserInfo['Username'];
  60. $Request = "Hi $Username,
  61. The user [url=".site_url()."user.php?id=$LoggedUser[ID]]$LoggedUser[Username][/url] has requested a re-seed for the torrent [url=".site_url()."torrents.php?id=$GroupID&torrentid=$TorrentID]{$Name}[/url], which you uploaded on ".date('M d Y', strtotime($UploadedTime)).". The torrent is now un-seeded, and we need your help to resurrect it!
  62. The exact process for re-seeding a torrent is slightly different for each client, but the concept is the same. 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.
  63. Thanks!";
  64. Misc::send_pm($UploaderID, 0, "Re-seed request for torrent $Name", $Request);
  65. $NumUsers = 1;
  66. }
  67. View::show_header();
  68. ?>
  69. <div class="thin">
  70. <div class="header">
  71. <h2>Successfully sent re-seed request</h2>
  72. </div>
  73. <div class="box pad thin">
  74. <p>Successfully sent re-seed request for torrent <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=display_str($Name)?></a> to <?=$NumUsers?> user<?=$NumUsers === 1 ? '' : 's';?>.</p>
  75. </div>
  76. </div>
  77. <?
  78. View::show_footer();
  79. ?>