From 57cd76df63a53f86003b7ae2bce7983fe4925044 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Thu, 16 Nov 2023 00:41:21 +0700 Subject: [PATCH] Updated --- ajax.php | 4 ++-- library/attach_mod/displaying_torrent.php | 2 +- library/includes/init_bb.php | 5 +++++ tracker.php | 2 +- viewforum.php | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ajax.php b/ajax.php index 1846f7c3..64e20b3b 100644 --- a/ajax.php +++ b/ajax.php @@ -214,7 +214,7 @@ class ajax_common function ajax_die($error_msg, $error_code = E_AJAX_GENERAL_ERROR) { $this->response['error_code'] = $error_code; - $this->response['error_msg'] = strip_tags(preg_replace('##i', "\n", $error_msg)); + $this->response['error_msg'] = strip_tags(br2nl($error_msg)); // Get caller info if (!empty($_COOKIE['explain'])) @@ -323,7 +323,7 @@ class ajax_common if (empty($confirm_msg)) $this->ajax_die('false'); $this->response['prompt_confirm'] = 1; - $this->response['confirm_msg'] = strip_tags(preg_replace('##i', "\n", $confirm_msg)); + $this->response['confirm_msg'] = strip_tags(br2nl($confirm_msg)); $this->send(); } diff --git a/library/attach_mod/displaying_torrent.php b/library/attach_mod/displaying_torrent.php index 3af079f7..ecb9cfd6 100644 --- a/library/attach_mod/displaying_torrent.php +++ b/library/attach_mod/displaying_torrent.php @@ -155,7 +155,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'], html_entity_decode($t_data['topic_title'], ENT_QUOTES, 'UTF-8')); + $tor_magnet = create_magnet($tor_info['info_hash'], $passkey['auth_key'], html_ent_decode($t_data['topic_title'])); // ratio limits $min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor']; diff --git a/library/includes/init_bb.php b/library/includes/init_bb.php index 66938f62..af078336 100644 --- a/library/includes/init_bb.php +++ b/library/includes/init_bb.php @@ -421,6 +421,11 @@ function htmlCHR ($txt, $double_encode = false, $quote_style = ENT_QUOTES, $char return (string) htmlspecialchars($txt, $quote_style, $charset, $double_encode); } +function br2nl ($txt) +{ + return preg_replace('##i', "\n", $txt); +} + function html_ent_decode ($txt, $quote_style = ENT_QUOTES, $charset = 'UTF-8') { return (string) html_entity_decode($txt, $quote_style, $charset); diff --git a/tracker.php b/tracker.php index 03b63649..9d26b34d 100644 --- a/tracker.php +++ b/tracker.php @@ -787,7 +787,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'], html_entity_decode($tor['topic_title'], ENT_QUOTES, 'UTF-8')); + $tor_magnet = create_magnet($tor['info_hash'], $passkey['auth_key'], html_ent_decode($tor['topic_title'])); $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'; diff --git a/viewforum.php b/viewforum.php index f5360178..9b8f6c29 100644 --- a/viewforum.php +++ b/viewforum.php @@ -512,7 +512,7 @@ foreach ($topic_rowset as $topic) if (isset($topic['tor_size'])) { - $tor_magnet = create_magnet($topic['info_hash'], $topic['auth_key'], html_entity_decode($topic['topic_title'], ENT_QUOTES, 'UTF-8')); + $tor_magnet = create_magnet($topic['info_hash'], $topic['auth_key'], html_ent_decode($topic['topic_title'])); $template->assign_block_vars('t.tor', array( 'SEEDERS' => (int) $topic['seeders'],