Фикс неработоспособности 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 // Increase number of revision after update
$bb_cfg['tp_version'] = '2.5 (unstable)'; $bb_cfg['tp_version'] = '2.5 (unstable)';
$bb_cfg['tp_release_date'] = '09-08-2013'; $bb_cfg['tp_release_date'] = '09-08-2013';
$bb_cfg['tp_release_state'] = 'R542'; $bb_cfg['tp_release_state'] = 'R543';
// Database // Database
$charset = 'utf8'; $charset = 'utf8';

View file

@ -2670,36 +2670,46 @@ function pad_with_space ($str)
function create_magnet($infohash, $auth_key, $logged_in) function create_magnet($infohash, $auth_key, $logged_in)
{ {
global $bb_cfg, $_GET, $images; global $bb_cfg, $_GET, $userdata, $images;
$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>'; 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 = '') function get_avatar ($avatar, $type, $allow_avatar = true, $height = '', $width = '')
{ {
global $bb_cfg; global $bb_cfg;
$height = ($height != '') ? 'height="'. $height .'"' : ''; $height = ($height != '') ? 'height="'. $height .'"' : '';
$width = ($width != '') ? 'width="'. $width .'"' : ''; $width = ($width != '') ? 'width="'. $width .'"' : '';
$user_avatar = '<img src="'. $bb_cfg['no_avatar'] .'" alt="" border="0" '. $height .' '. $width .'/>'; $user_avatar = '<img src="'. $bb_cfg['no_avatar'] .'" alt="" border="0" '. $height .' '. $width .'/>';
if ($allow_avatar) if ($allow_avatar)
{ {
switch($type) switch($type)
{ {
case USER_AVATAR_UPLOAD: case USER_AVATAR_UPLOAD:
$user_avatar = ( $bb_cfg['allow_avatar_upload'] ) ? '<img src="'. $bb_cfg['avatar_path'] .'/'. $avatar .'" alt="" border="0" '. $height .' '. $width .'/>' : ''; $user_avatar = ( $bb_cfg['allow_avatar_upload'] ) ? '<img src="'. $bb_cfg['avatar_path'] .'/'. $avatar .'" alt="" border="0" '. $height .' '. $width .'/>' : '';
break; break;
case USER_AVATAR_REMOTE: case USER_AVATAR_REMOTE:
$user_avatar = ( $bb_cfg['allow_avatar_remote'] ) ? '<img src="'. $avatar .'" alt="" border="0" onload="imgFit(this, 100);" onClick="return imgFit(this, 100);" '. $height .' '. $width .'/>' : ''; $user_avatar = ( $bb_cfg['allow_avatar_remote'] ) ? '<img src="'. $avatar .'" alt="" border="0" onload="imgFit(this, 100);" onClick="return imgFit(this, 100);" '. $height .' '. $width .'/>' : '';
break; break;
case USER_AVATAR_GALLERY: case USER_AVATAR_GALLERY:
$user_avatar = ( $bb_cfg['allow_avatar_local'] ) ? '<img src="'. $bb_cfg['avatar_gallery_path'] .'/'. $avatar .'" alt="" border="0" '. $height .' '. $width .'/>' : ''; $user_avatar = ( $bb_cfg['allow_avatar_local'] ) ? '<img src="'. $bb_cfg['avatar_gallery_path'] .'/'. $avatar .'" alt="" border="0" '. $height .' '. $width .'/>' : '';
break; break;
} }
} }
return $user_avatar; return $user_avatar;
} }
function set_die_append_msg ($forum_id = null, $topic_id = null) function set_die_append_msg ($forum_id = null, $topic_id = null)