diff --git a/library/attach_mod/displaying_torrent.php b/library/attach_mod/displaying_torrent.php index 908e0951f..b037baa23 100644 --- a/library/attach_mod/displaying_torrent.php +++ b/library/attach_mod/displaying_torrent.php @@ -88,7 +88,7 @@ if ($tor_auth_reg || $tor_auth_del) { $tracker_link = ($tor_reged) ? $unreg_tor_url : $reg_tor_url; } -$display_name = '[' . $bb_cfg['server_name'] . '].t' . $bt_topic_id . '.torrent'; +$display_name = wbr($t_data['topic_title']) . ' [' . $bb_cfg['server_name'] . '-' . $bt_topic_id . ']' . '.torrent'; if (!$tor_reged) { $template->assign_block_vars('postrow.attach.tor_not_reged', [ diff --git a/src/Helpers/IPHelper.php b/src/Helpers/IPHelper.php index bee37174b..3f50af546 100644 --- a/src/Helpers/IPHelper.php +++ b/src/Helpers/IPHelper.php @@ -55,7 +55,7 @@ class IPHelper extends Ip /** * Long to IP - * Decodes long form from both IPv4 & IPv6. + * Decodes long format from both IPv4 & IPv6. * * @param string $ip * @return string diff --git a/src/Legacy/Torrent.php b/src/Legacy/Torrent.php index e3341d958..fbd990939 100644 --- a/src/Legacy/Torrent.php +++ b/src/Legacy/Torrent.php @@ -495,12 +495,17 @@ class Torrent } // Get $topic_id - $topic_id_sql = 'SELECT topic_id FROM ' . BB_POSTS . ' WHERE post_id = ' . (int)$post_id; + $topic_id_sql = 'SELECT p.topic_id, t.topic_title + FROM ' . BB_POSTS . ' p + JOIN ' . BB_TOPICS . ' t ON p.topic_id = t.topic_id + WHERE p.post_id = ' . (int)$post_id; + if (!($topic_id_result = DB()->sql_query($topic_id_sql))) { bb_die('Could not query post information'); } $topic_id_row = DB()->sql_fetchrow($topic_id_result); $topic_id = $topic_id_row['topic_id']; + $topic_title = $topic_id_row['topic_title']; if (!$attachment['tracker_status']) { bb_die($lang['PASSKEY_ERR_TOR_NOT_REG']); @@ -585,7 +590,8 @@ class Torrent // Send torrent $output = \Arokettu\Bencode\Bencode::encode($tor); - $dl_fname = '[' . $bb_cfg['server_name'] . '].t' . $topic_id . '.torrent'; + + $dl_fname = wbr($topic_title) . ' [' . $bb_cfg['server_name'] . '-' . $topic_id . ']' . '.torrent'; if (!empty($_COOKIE['explain'])) { $out = "attach path: $filename

";