mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 05:43:55 -07:00
Generate .torrent file names based on topic titles (#958)
This commit is contained in:
parent
8e218f5d69
commit
e2bf40bd64
3 changed files with 10 additions and 4 deletions
|
@ -88,7 +88,7 @@ if ($tor_auth_reg || $tor_auth_del) {
|
||||||
$tracker_link = ($tor_reged) ? $unreg_tor_url : $reg_tor_url;
|
$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) {
|
if (!$tor_reged) {
|
||||||
$template->assign_block_vars('postrow.attach.tor_not_reged', [
|
$template->assign_block_vars('postrow.attach.tor_not_reged', [
|
||||||
|
|
|
@ -55,7 +55,7 @@ class IPHelper extends Ip
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Long to IP
|
* Long to IP
|
||||||
* Decodes long form from both IPv4 & IPv6.
|
* Decodes long format from both IPv4 & IPv6.
|
||||||
*
|
*
|
||||||
* @param string $ip
|
* @param string $ip
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
@ -495,12 +495,17 @@ class Torrent
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get $topic_id
|
// 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))) {
|
if (!($topic_id_result = DB()->sql_query($topic_id_sql))) {
|
||||||
bb_die('Could not query post information');
|
bb_die('Could not query post information');
|
||||||
}
|
}
|
||||||
$topic_id_row = DB()->sql_fetchrow($topic_id_result);
|
$topic_id_row = DB()->sql_fetchrow($topic_id_result);
|
||||||
$topic_id = $topic_id_row['topic_id'];
|
$topic_id = $topic_id_row['topic_id'];
|
||||||
|
$topic_title = $topic_id_row['topic_title'];
|
||||||
|
|
||||||
if (!$attachment['tracker_status']) {
|
if (!$attachment['tracker_status']) {
|
||||||
bb_die($lang['PASSKEY_ERR_TOR_NOT_REG']);
|
bb_die($lang['PASSKEY_ERR_TOR_NOT_REG']);
|
||||||
|
@ -585,7 +590,8 @@ class Torrent
|
||||||
|
|
||||||
// Send torrent
|
// Send torrent
|
||||||
$output = \Arokettu\Bencode\Bencode::encode($tor);
|
$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'])) {
|
if (!empty($_COOKIE['explain'])) {
|
||||||
$out = "attach path: $filename<br /><br />";
|
$out = "attach path: $filename<br /><br />";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue