diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7103bdf0..f0a61de7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,7 @@
**Merged pull requests:**
- Release v2.1.5-2023.09 🎉
-- Minor improvements [\#235](https://github.com/torrentpier/torrentpier-lts/pull/235), [\#236](https://github.com/torrentpier/torrentpier-lts/pull/236), [\#237](https://github.com/torrentpier/torrentpier-lts/pull/237) ([belomaxorka](https://github.com/belomaxorka))
+- Minor improvements [\#235](https://github.com/torrentpier/torrentpier-lts/pull/235), [\#236](https://github.com/torrentpier/torrentpier-lts/pull/236), [\#237](https://github.com/torrentpier/torrentpier-lts/pull/237), [\#238](https://github.com/torrentpier/torrentpier-lts/pull/238) ([belomaxorka](https://github.com/belomaxorka))
## [v2.1.5-2023.08](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.08) (2023-09-04)
[Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.07...v2.1.5-2023.08)
diff --git a/bt/announce.php b/bt/announce.php
index 9f327810..96e9665b 100644
--- a/bt/announce.php
+++ b/bt/announce.php
@@ -19,10 +19,6 @@ if (isset($_GET['event']) && $_GET['event'] === 'completed')
$announce_interval = $bb_cfg['announce_interval'];
$passkey_key = $bb_cfg['passkey_key'];
-$max_left_val = 536870912000; // 500 GB
-$max_up_down_val = 5497558138880; // 5 TB
-$max_up_add_val = 85899345920; // 80 GB
-$max_down_add_val = 85899345920; // 80 GB
// Recover info_hash
if (isset($_GET['?info_hash']) && !isset($_GET['info_hash']))
@@ -37,7 +33,7 @@ if (strpos($_SERVER['REQUEST_URI'], 'scrape') !== false)
}
if (!isset($_GET[$passkey_key]) || !is_string($_GET[$passkey_key]) || strlen($_GET[$passkey_key]) != BT_AUTH_KEY_LENGTH)
{
- msg_die('Please LOG IN and REDOWNLOAD this torrent (passkey not found)');
+ msg_die('Please LOG IN and RE-DOWNLOAD this torrent (passkey not found)');
}
// Input var names
@@ -74,33 +70,37 @@ $passkey = isset($$passkey_key) ? $$passkey_key : null;
// Verify request
// Required params (info_hash, peer_id, port, uploaded, downloaded, left, passkey)
-if (!isset($info_hash) || strlen($info_hash) != 20)
+if (!isset($info_hash))
{
- msg_die('Invalid info_hash');
+ msg_die('info_hash was not provided');
+}
+if (strlen($info_hash) != 20)
+{
+ msg_die('Invalid info_hash: ' . bin2hex($info_hash));
}
if (!isset($peer_id) || strlen($peer_id) != 20)
{
- msg_die('Invalid peer_id');
+ msg_die('Invalid peer_id: ' . bin2hex($peer_id));
}
if (!isset($port) || $port < 0 || $port > 0xFFFF)
{
- msg_die('Invalid port');
+ msg_die('Invalid port: ' . $port);
}
-if (!isset($uploaded) || $uploaded < 0 || $uploaded > $max_up_down_val || $uploaded == 1844674407370)
+if (!isset($uploaded) || $uploaded < 0)
{
- msg_die('Invalid uploaded value');
+ msg_die('Invalid uploaded value: ' . $uploaded);
}
-if (!isset($downloaded) || $downloaded < 0 || $downloaded > $max_up_down_val || $downloaded == 1844674407370)
+if (!isset($downloaded) || $downloaded < 0)
{
- msg_die('Invalid downloaded value');
+ msg_die('Invalid downloaded value: ' . $downloaded);
}
-if (!isset($left) || $left < 0 || $left > $max_left_val)
+if (!isset($left) || $left < 0)
{
- msg_die('Invalid left value');
+ msg_die('Invalid left value: ' . $left);
}
if (!verify_id($passkey, BT_AUTH_KEY_LENGTH))
{
- msg_die('Invalid passkey');
+ msg_die('Invalid passkey: ' . $passkey);
}
// IP
@@ -243,7 +243,7 @@ else
}
if (empty($row['user_id']))
{
- msg_die('Please LOG IN and REDOWNLOAD this torrent (user not found)');
+ msg_die('Please LOG IN and RE-DOWNLOAD this torrent (user not found)');
}
$user_id = $row['user_id'];
diff --git a/bt/scrape.php b/bt/scrape.php
index e09ebbb9..800ba482 100644
--- a/bt/scrape.php
+++ b/bt/scrape.php
@@ -12,9 +12,13 @@ if (isset($_GET['?info_hash']) && !isset($_GET['info_hash']))
$_GET['info_hash'] = $_GET['?info_hash'];
}
-if (!isset($_GET['info_hash']) || strlen($_GET['info_hash']) != 20)
+if (!isset($_GET['info_hash']))
{
- msg_die('Invalid info_hash');
+ msg_die('info_hash was not provided');
+}
+if (strlen($_GET['info_hash']) != 20)
+{
+ msg_die('Invalid info_hash: ' . bin2hex($_GET['info_hash']));
}
$info_hash = $_GET['info_hash'];
@@ -54,4 +58,4 @@ $output['files'][$info_hash] = array(
echo bencode($output);
tracker_exit();
-exit;
\ No newline at end of file
+exit;
diff --git a/library/attach_mod/displaying_torrent.php b/library/attach_mod/displaying_torrent.php
index f12b5e44..556c7df5 100644
--- a/library/attach_mod/displaying_torrent.php
+++ b/library/attach_mod/displaying_torrent.php
@@ -154,7 +154,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']);
+ $tor_magnet = create_magnet($tor_info['info_hash'], $passkey['auth_key'], wbr($t_data['topic_title']));
// ratio limits
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];
diff --git a/library/config.php b/library/config.php
index 75616f0c..cb98b9d9 100644
--- a/library/config.php
+++ b/library/config.php
@@ -61,7 +61,7 @@ $bb_cfg['cache']['memcache'] = array(
$bb_cfg['cache']['redis'] = array(
'host' => '127.0.0.1',
'port' => 6379,
- 'pconnect' => true,
+ 'pconnect' => PHP_ZTS ? false : true,
'con_required' => true,
);
diff --git a/library/includes/functions.php b/library/includes/functions.php
index 70626d3a..61472156 100644
--- a/library/includes/functions.php
+++ b/library/includes/functions.php
@@ -2574,7 +2574,7 @@ function pad_with_space ($str)
return ($str) ? " $str " : $str;
}
-function create_magnet ($infohash, $auth_key)
+function create_magnet ($infohash, $auth_key, $name)
{
global $bb_cfg, $images, $lang, $userdata;
@@ -2597,7 +2597,7 @@ function create_magnet ($infohash, $auth_key)
}
$passkey_url = $passkey ? "?{$bb_cfg['passkey_key']}=$auth_key" : '';
- return '
';
+ return '
';
}
function set_die_append_msg ($forum_id = null, $topic_id = null, $group_id = null)
diff --git a/tracker.php b/tracker.php
index 7195bab3..141c71a8 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']);
+ $tor_magnet = create_magnet($tor['info_hash'], $passkey['auth_key'], wbr($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';
@@ -993,4 +993,4 @@ $template->assign_vars(array(
'TR_POSTER_URL' => "$tracker_url?$poster_id_key=",
));
-print_page('tracker.tpl');
\ No newline at end of file
+print_page('tracker.tpl');
diff --git a/viewforum.php b/viewforum.php
index 98a3978b..ee08b7e2 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']);
+ $tor_magnet = create_magnet($topic['info_hash'], $topic['auth_key'], wbr($topic['topic_title']));
$template->assign_block_vars('t.tor', array(
'SEEDERS' => (int) $topic['seeders'],