From 5316a9a61ef693f93ffbe5789496669c83fa7751 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Fri, 27 Oct 2023 14:27:28 +0700 Subject: [PATCH] Added check $bb_cfg['magnet_links_enabled'] in create_magnet() (#996) --- library/includes/functions.php | 8 ++++++-- library/language/source/main.php | 2 +- styles/templates/default/tracker.tpl | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/library/includes/functions.php b/library/includes/functions.php index 4cf2f51d5..f73462a53 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -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 ''; + return ''; } function set_die_append_msg($forum_id = null, $topic_id = null, $group_id = null) diff --git a/library/language/source/main.php b/library/language/source/main.php index 3a9e6e4fa..263e13c54 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -1083,7 +1083,7 @@ $lang['RELEASING'] = 'Self'; $lang['SEEDING'] = 'Seed'; $lang['LEECHING'] = 'Leech'; $lang['IS_REGISTERED'] = 'Registered'; -$lang['MAGNET'] = 'Magnet'; +$lang['MAGNET'] = 'Magnet-link'; //torrent status mod $lang['TOR_STATUS'] = 'Status'; diff --git a/styles/templates/default/tracker.tpl b/styles/templates/default/tracker.tpl index 1bd3b1e24..a6f3eb336 100644 --- a/styles/templates/default/tracker.tpl +++ b/styles/templates/default/tracker.tpl @@ -417,7 +417,7 @@ $(function(){ {tor.TOR_SIZE_RAW} - {tor.TOR_SIZE} {tor.MAGNET} + {tor.TOR_SIZE} {tor.MAGNET} {tor.TOR_SIZE} {tor.SEEDS}