From 0fa08eb2e6da16d917df8de36f6e2392ea8d46d8 Mon Sep 17 00:00:00 2001 From: glix08 Date: Thu, 8 Aug 2013 21:19:05 +0000 Subject: [PATCH] r543 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Фикс неработоспособности magnet-ссылок при выбранном типе анонсера xbt. Спасибо Matt Brown. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@543 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/config.php | 2 +- upload/includes/functions.php | 56 +++++++++++++++++++++-------------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/upload/config.php b/upload/config.php index 3e8062c5c..0166e4a64 100644 --- a/upload/config.php +++ b/upload/config.php @@ -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'; diff --git a/upload/includes/functions.php b/upload/includes/functions.php index 6bb2a8203..eb16769dd 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -2670,36 +2670,46 @@ function pad_with_space ($str) function create_magnet($infohash, $auth_key, $logged_in) { - global $bb_cfg, $_GET, $images; - $passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && $bb_cfg['bt_tor_browse_only_reg']) ? '' : "?{$bb_cfg['passkey_key']}=$auth_key"; - return ''; + 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 ''; + } + else + { + $passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && $bb_cfg['bt_tor_browse_only_reg']) ? '' : "?{$bb_cfg['passkey_key']}=$auth_key"; + return ''; + } } function get_avatar ($avatar, $type, $allow_avatar = true, $height = '', $width = '') { - global $bb_cfg; + global $bb_cfg; - $height = ($height != '') ? 'height="'. $height .'"' : ''; - $width = ($width != '') ? 'width="'. $width .'"' : ''; + $height = ($height != '') ? 'height="'. $height .'"' : ''; + $width = ($width != '') ? 'width="'. $width .'"' : ''; - $user_avatar = ''; + $user_avatar = ''; - if ($allow_avatar) - { - switch($type) - { - case USER_AVATAR_UPLOAD: - $user_avatar = ( $bb_cfg['allow_avatar_upload'] ) ? '' : ''; - break; - case USER_AVATAR_REMOTE: - $user_avatar = ( $bb_cfg['allow_avatar_remote'] ) ? '' : ''; - break; - case USER_AVATAR_GALLERY: - $user_avatar = ( $bb_cfg['allow_avatar_local'] ) ? '' : ''; - break; - } - } - return $user_avatar; + if ($allow_avatar) + { + switch($type) + { + case USER_AVATAR_UPLOAD: + $user_avatar = ( $bb_cfg['allow_avatar_upload'] ) ? '' : ''; + break; + case USER_AVATAR_REMOTE: + $user_avatar = ( $bb_cfg['allow_avatar_remote'] ) ? '' : ''; + break; + case USER_AVATAR_GALLERY: + $user_avatar = ( $bb_cfg['allow_avatar_local'] ) ? '' : ''; + break; + } + } + return $user_avatar; } function set_die_append_msg ($forum_id = null, $topic_id = null)