mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 13:24:01 -07:00
Fixed empty $auth_key after gen passkey (#670)
This commit is contained in:
parent
0fd4b733fc
commit
d6b94ac91f
4 changed files with 6 additions and 5 deletions
|
@ -143,7 +143,7 @@ if ($tor_reged && $tor_info) {
|
|||
|
||||
// Magnet link
|
||||
$passkey = DB()->fetch_row("SELECT auth_key FROM " . BB_BT_USERS . " WHERE user_id = " . (int)$bt_user_id . " LIMIT 1");
|
||||
$tor_magnet = create_magnet($tor_info['info_hash'], $passkey['auth_key']);
|
||||
$tor_magnet = create_magnet($tor_info['info_hash'], ($passkey['auth_key'] ?? ''));
|
||||
|
||||
// ratio limits
|
||||
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];
|
||||
|
|
|
@ -1861,16 +1861,17 @@ function pad_with_space($str)
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
function create_magnet($infohash, $auth_key)
|
||||
function create_magnet($infohash, $auth_key): string
|
||||
{
|
||||
global $bb_cfg, $images, $lang, $userdata;
|
||||
|
||||
if (IS_GUEST && $bb_cfg['bt_tor_browse_only_reg']) {
|
||||
$passkey = '';
|
||||
$passkey = false;
|
||||
} elseif (empty($auth_key)) {
|
||||
if (!$passkey = \TorrentPier\Legacy\Torrent::generate_passkey($userdata['user_id'], true)) {
|
||||
bb_die($lang['PASSKEY_ERR_EMPTY']);
|
||||
}
|
||||
$auth_key = $passkey;
|
||||
} else {
|
||||
$passkey = $auth_key;
|
||||
}
|
||||
|
|
|
@ -698,7 +698,7 @@ if ($allowed_forums) {
|
|||
$s_last = $tor['seeder_last_seen'];
|
||||
$att_id = $tor['attach_id'];
|
||||
$size = $tor['size'];
|
||||
$tor_magnet = create_magnet($tor['info_hash'], $passkey['auth_key']);
|
||||
$tor_magnet = create_magnet($tor['info_hash'], ($passkey['auth_key'] ?? ''));
|
||||
$compl = $tor['complete_count'];
|
||||
$dl_sp = ($dl) ? humn_size($dl, 0, 'KB') . '/s' : '0 KB/s';
|
||||
$ul_sp = ($ul) ? humn_size($ul, 0, 'KB') . '/s' : '0 KB/s';
|
||||
|
|
|
@ -471,7 +471,7 @@ foreach ($topic_rowset as $topic) {
|
|||
));
|
||||
|
||||
if (isset($topic['tor_size'])) {
|
||||
$tor_magnet = create_magnet($topic['info_hash'], $topic['auth_key']);
|
||||
$tor_magnet = create_magnet($topic['info_hash'], ($topic['auth_key'] ?? ''));
|
||||
|
||||
$template->assign_block_vars('t.tor', array(
|
||||
'SEEDERS' => (int)$topic['seeders'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue