Added check $bb_cfg['magnet_links_enabled'] in create_magnet() (#996)

This commit is contained in:
Roman Kelesidis 2023-10-27 14:27:28 +07:00 committed by GitHub
commit 5316a9a61e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -1849,7 +1849,11 @@ function decode_text_match($txt)
*/
function create_magnet(string $infohash, string $infohash_v2, string $auth_key, string $name): string
{
global $bb_cfg, $images;
global $bb_cfg, $images, $lang;
if (!$bb_cfg['magnet_links_enabled']) {
return false;
}
// Only for registered users
if (IS_GUEST && $bb_cfg['bt_tor_browse_only_reg']) {
@ -1869,7 +1873,7 @@ function create_magnet(string $infohash, string $infohash_v2, string $auth_key,
$magnet .= 'xt=urn:btmh:1220' . bin2hex($infohash_v2);
}
return '<a href="' . $magnet . '&tr=' . urlencode($bb_cfg['bt_announce_url'] . "?{$bb_cfg['passkey_key']}=$auth_key") . '&dn=' . urlencode($name) . '"><img src="' . $images['icon_magnet'] . '" width="12" height="12" border="0" /></a>';
return '<a title="' . $lang['MAGNET'] . '" href="' . $magnet . '&tr=' . urlencode($bb_cfg['bt_announce_url'] . "?{$bb_cfg['passkey_key']}=$auth_key") . '&dn=' . urlencode($name) . '"><img src="' . $images['icon_magnet'] . '" width="12" height="12" border="0" /></a>';
}
function set_die_append_msg($forum_id = null, $topic_id = null, $group_id = null)