2011-03-28 14:21:28 +00:00
< ?
2016-01-08 08:00:30 +00:00
$TorrentID = ( int ) $_GET [ 'torrentid' ];
2011-03-28 14:21:28 +00:00
2013-06-04 08:00:34 +00:00
$DB -> query ( "
2016-01-08 08:00:30 +00:00
SELECT last_action , LastReseedRequest , UserID , Time , GroupID
2013-06-04 08:00:34 +00:00
FROM torrents
2013-11-12 08:00:58 +00:00
WHERE ID = '$TorrentID' " );
2016-01-08 08:00:30 +00:00
list ( $LastActive , $LastReseedRequest , $UploaderID , $UploadedTime , $GroupID ) = $DB -> next_record ();
2011-03-28 14:21:28 +00:00
2013-06-04 08:00:34 +00:00
if ( ! check_perms ( 'users_mod' )) {
2013-06-03 08:00:52 +00:00
if ( time () - strtotime ( $LastReseedRequest ) < 864000 ) {
error ( 'There was already a re-seed request for this torrent within the past 10 days.' );
}
if ( $LastActive == '0000-00-00 00:00:00' || time () - strtotime ( $LastActive ) < 345678 ) {
error ( 403 );
}
2013-04-19 08:00:55 +00:00
}
2011-03-28 14:21:28 +00:00
2013-06-04 08:00:34 +00:00
$DB -> query ( "
UPDATE torrents
2013-11-12 08:00:58 +00:00
SET LastReseedRequest = NOW ()
WHERE ID = '$TorrentID' " );
2011-03-28 14:21:28 +00:00
2012-10-11 08:00:15 +00:00
$Group = Torrents :: get_groups ( array ( $GroupID ));
2013-09-13 08:00:53 +00:00
extract ( Torrents :: array_group ( $Group [ $GroupID ]));
2011-03-28 14:21:28 +00:00
2016-01-08 08:00:30 +00:00
$Name = Artists :: display_artists ( array ( '1' => $Artists ), false , true );
2011-03-28 14:21:28 +00:00
$Name .= $GroupName ;
2016-01-08 08:00:30 +00:00
$usersToNotify = array ();
2013-06-04 08:00:34 +00:00
$DB -> query ( "
2016-01-08 08:00:30 +00:00
SELECT s . uid AS id , MAX ( s . tstamp ) AS tstamp
FROM xbt_snatched as s
INNER JOIN users_main as u
ON s . uid = u . ID
WHERE s . fid = '$TorrentID'
AND u . Enabled = '1'
GROUP BY s . uid
ORDER BY tstamp DESC
LIMIT 100 " );
2013-07-10 00:08:53 +00:00
if ( $DB -> has_results ()) {
2011-03-28 14:21:28 +00:00
$Users = $DB -> to_array ();
2013-05-01 08:00:16 +00:00
foreach ( $Users as $User ) {
2016-01-08 08:00:30 +00:00
$UserID = $User [ 'id' ];
2011-03-28 14:21:28 +00:00
$TimeStamp = $User [ 'tstamp' ];
2016-01-08 08:00:30 +00:00
$usersToNotify [ $UserID ] = array ( " snatched " , $TimeStamp );
}
}
2011-03-28 14:21:28 +00:00
2016-01-08 08:00:30 +00:00
$usersToNotify [ $UploaderID ] = array ( " uploaded " , strtotime ( $UploadedTime ));
2013-02-22 08:00:24 +00:00
2016-01-08 08:00:30 +00:00
foreach ( $usersToNotify as $UserID => $info ) {
$Username = Users :: user_info ( $UserID )[ 'Username' ];
list ( $action , $TimeStamp ) = $info ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
$Request = " Hi $Username ,
2016-01-08 08:00:30 +00:00
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 " . $action . " on " .date('M d Y', $TimeStamp ). " . The torrent is now un - seeded , and we need your help to resurrect it !
2011-03-28 14:21:28 +00:00
2013-11-12 08:00:58 +00:00
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 .
2011-03-28 14:21:28 +00:00
Thanks ! " ;
2013-02-22 08:00:24 +00:00
2016-01-08 08:00:30 +00:00
Misc :: send_pm ( $UserID , 0 , " Re-seed request for torrent $Name " , $Request );
2011-03-28 14:21:28 +00:00
}
2016-01-08 08:00:30 +00:00
$NumUsers = count ( $usersToNotify );
2012-10-11 08:00:15 +00:00
View :: show_header ();
2011-03-28 14:21:28 +00:00
?>
< div class = " thin " >
2012-08-19 08:00:19 +00:00
< div class = " header " >
< h2 > Successfully sent re - seed request </ h2 >
</ div >
2013-11-12 08:00:58 +00:00
< div class = " box pad thin " >
2016-01-08 08:00:30 +00:00
< p style = " color: black; " > Successfully sent re - seed request for torrent < a href = " torrents.php?id=<?= $GroupID ?>&torrentid=<?= $TorrentID ?> " >< ? = display_str ( $Name ) ?> </a> to <?=$NumUsers?> user<?=$NumUsers === 1 ? '' : 's';?>.</p>
2013-11-12 08:00:58 +00:00
</ div >
2011-03-28 14:21:28 +00:00
</ div >
2013-11-12 08:00:58 +00:00
< ?
View :: show_footer ();
?>