get ( "usergroup" );
if (! $user_group) {
$user_group = array ();
$db->query ( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row () ) {
$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) {
$user_group[$row['id']][$key] = $value;
}}
$cache->set ( "usergroup", $user_group );
$db->free ();
}
if (! $is_logged) {$member_id['user_group'] = 5;}
if (! $user_group[$member_id['user_group']]['allow_files']) die ( "Access denied" );
$_SERVER['HTTP_REFERER'] = clean_url ( $_SERVER['HTTP_REFERER'] );
$_SERVER['HTTP_HOST'] = clean_url ( $_SERVER['HTTP_HOST'] );
if ($_SERVER['HTTP_HOST'] != $_SERVER['HTTP_REFERER']) {
@header ( 'Location: ' . $config['http_home_url'] );
die ( "Access denied!!!
Please visit {$config['http_home_url']}" );
}
$id = intval ( $_REQUEST['id'] );
$d_time = time() + ($config['date_adjust'] * 60);
$row = $db->super_query ( "SELECT name, onserver, info_hash FROM " . PREFIX . "_torrents WHERE id ='$id'" );
if (! $row) die ( "Access denied" );
if(substr($row['name'], -8) == ".torrent") {
require_once( SYSTEM_DIR."/classes/torrent.class.php" );
$tr_file = TORRENT_DIR.$row['onserver'];
$torrent = new Torrent($tr_file);
if($error = $torrent->errors()){
}
else
{
$torrent->comment("http://".$_SERVER['HTTP_HOST']."/");
if (! $is_logged) {
$torrent->announce("http://".$_SERVER['HTTP_HOST'].":2710/announce"); //Добавляем дополнительные анонсеры, оставляя уже добавленные
} else {
$tpv = $member_id['torrent_pass_version'];
$tppk = $db->super_query("SELECT value FROM xbt_config WHERE name='torrent_pass_private_key'" );
$site_key = $tppk['value'];
$passkey = sprintf('%08x%s', $member_id['user_id'], substr(sha1(sprintf('%s %d %d %s', $site_key, $tpv, $member_id['user_id'], $row['info_hash'])), 0, 24));
$torrent->announce("http://".$_SERVER['HTTP_HOST'].":2710/{$passkey}/announce"); //Добавляем дополнительные анонсеры, оставляя уже добавленные
}
}} else die ( "Access denied" );
if ($config['files_count'] == "yes" and ! $file->range) $db->query ( "UPDATE " . PREFIX . "_torrents SET dcount=dcount+1 WHERE id ='$id'" );
$db->close ();
$torrent->send($row['name']);
?>