Фикс неработоспособности magnet-ссылок при выбранном типе анонсера xbt. Спасибо Matt Brown. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@543 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
glix08 2013-08-08 21:19:05 +00:00
commit 0fa08eb2e6
2 changed files with 34 additions and 24 deletions

View file

@ -56,7 +56,7 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
// Increase number of revision after update
$bb_cfg['tp_version'] = '2.5 (unstable)';
$bb_cfg['tp_release_date'] = '09-08-2013';
$bb_cfg['tp_release_state'] = 'R542';
$bb_cfg['tp_release_state'] = 'R543';
// Database
$charset = 'utf8';

View file

@ -2670,9 +2670,19 @@ function pad_with_space ($str)
function create_magnet($infohash, $auth_key, $logged_in)
{
global $bb_cfg, $_GET, $images;
global $bb_cfg, $_GET, $userdata, $images;
if ($bb_cfg['announce_type'] == 'xbt')
{
$passkey = substr('00000000'. dechex($userdata['user_id']), -8) . substr(sha1($bb_cfg['torrent_pass_private_key'] .' '. $auth_key .' '. $userdata['user_id'] .' '. $infohash), 0, 24);
$announce = $bb_cfg['announce_xbt'] .'/'. $passkey .'/announce';
return '<a href="magnet:?xt=urn:btih:'. bin2hex($infohash) .'&tr='. urlencode($announce) .'"><img src="'. $images['icon_magnet'] .'" width="12" height="12" border="0" /></a>';
}
else
{
$passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && $bb_cfg['bt_tor_browse_only_reg']) ? '' : "?{$bb_cfg['passkey_key']}=$auth_key";
return '<a href="magnet:?xt=urn:btih:'. bin2hex($infohash) .'&tr='. urlencode($bb_cfg['bt_announce_url'] . $passkey_url) .'"><img src="'. $images['icon_magnet'] .'" width="12" height="12" border="0" /></a>';
}
}
function get_avatar ($avatar, $type, $allow_avatar = true, $height = '', $width = '')