From c6fe4241e3103ae4b8b3117d51bb8c94cd3ed78b Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Mon, 2 Oct 2023 20:32:56 +0700 Subject: [PATCH] Use \Arokettu\Bencode\ instead \SandFox\Bencode\ (#932) --- bt/announce.php | 2 +- bt/includes/init_tr.php | 8 ++++---- bt/scrape.php | 4 ++-- library/ajax/view_torrent.php | 2 +- src/Legacy/Torrent.php | 12 ++++++------ 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/bt/announce.php b/bt/announce.php index bd60278f8..b872ff2dd 100644 --- a/bt/announce.php +++ b/bt/announce.php @@ -412,6 +412,6 @@ if (!$output) { } // Return data to client -echo \SandFox\Bencode\Bencode::encode($output); +echo \Arokettu\Bencode\Bencode::encode($output); exit; diff --git a/bt/includes/init_tr.php b/bt/includes/init_tr.php index fbf7a1d24..9d0c06966 100644 --- a/bt/includes/init_tr.php +++ b/bt/includes/init_tr.php @@ -23,14 +23,14 @@ if ($bb_cfg['tracker']['bt_off']) { // function silent_exit($msg = '') { - echo \SandFox\Bencode\Bencode::encode(['warning message' => str_compact($msg)]); + echo \Arokettu\Bencode\Bencode::encode(['warning message' => str_compact($msg)]); exit; } function error_exit($msg = '') { - echo \SandFox\Bencode\Bencode::encode(['failure reason' => str_compact($msg)]); + echo \Arokettu\Bencode\Bencode::encode(['failure reason' => str_compact($msg)]); exit; } @@ -50,7 +50,7 @@ function drop_fast_announce($lp_info, $lp_cached_peers = []) function msg_die($msg) { - $output = \SandFox\Bencode\Bencode::encode([ + $output = \Arokettu\Bencode\Bencode::encode([ 'min interval' => (int)1800, 'failure reason' => (string)$msg, ]); @@ -74,7 +74,7 @@ function dummy_exit($interval = 1800, $cache_dict = []) $output['peers'] = $cache_dict['peers']; } - $output = \SandFox\Bencode\Bencode::encode($output); + $output = \Arokettu\Bencode\Bencode::encode($output); die($output); } diff --git a/bt/scrape.php b/bt/scrape.php index 73d15c4a3..ee817da3c 100644 --- a/bt/scrape.php +++ b/bt/scrape.php @@ -43,7 +43,7 @@ if (strlen($info_hash) == 32) { } if ($lp_scrape_info = CACHE('tr_cache')->get(SCRAPE_LIST_PREFIX . $info_hash_hex)) { - die(\SandFox\Bencode\Bencode::encode($lp_scrape_info)); + die(\Arokettu\Bencode\Bencode::encode($lp_scrape_info)); } $info_hash_sql = rtrim(DB()->escape($info_hash), ' '); @@ -73,6 +73,6 @@ $output['files'][$info_hash] = [ $peers_list_cached = CACHE('tr_cache')->set(SCRAPE_LIST_PREFIX . $info_hash_hex, $output, SCRAPE_LIST_EXPIRE); -echo \SandFox\Bencode\Bencode::encode($output); +echo \Arokettu\Bencode\Bencode::encode($output); exit; diff --git a/library/ajax/view_torrent.php b/library/ajax/view_torrent.php index 36b48d96a..0a0dbf7f1 100644 --- a/library/ajax/view_torrent.php +++ b/library/ajax/view_torrent.php @@ -32,7 +32,7 @@ if (!file_exists($filename) || !$file_contents = file_get_contents($filename)) { } } -if (!$tor = \SandFox\Bencode\Bencode::decode($file_contents)) { +if (!$tor = \Arokettu\Bencode\Bencode::decode($file_contents)) { return $lang['TORFILE_INVALID']; } diff --git a/src/Legacy/Torrent.php b/src/Legacy/Torrent.php index 5a90f6f63..e3341d958 100644 --- a/src/Legacy/Torrent.php +++ b/src/Legacy/Torrent.php @@ -319,14 +319,14 @@ class Torrent if (!file_exists($filename)) { return self::torrent_error_exit('File not exists'); } - if (!$tor = \SandFox\Bencode\Bencode::decode($file_contents)) { + if (!$tor = \Arokettu\Bencode\Bencode::decode($file_contents)) { return self::torrent_error_exit('This is not a bencoded file'); } if ($bb_cfg['bt_disable_dht']) { $tor['info']['private'] = (int)1; $fp = fopen($filename, 'wb+'); - fwrite($fp, \SandFox\Bencode\Bencode::encode($tor)); + fwrite($fp, \Arokettu\Bencode\Bencode::encode($tor)); fclose($fp); } @@ -362,14 +362,14 @@ class Torrent // Getting info_hash v1 if ($bt_v1) { - $info_hash = pack('H*', hash('sha1', \SandFox\Bencode\Bencode::encode($info))); + $info_hash = pack('H*', hash('sha1', \Arokettu\Bencode\Bencode::encode($info))); $info_hash_sql = rtrim(DB()->escape($info_hash), ' '); $info_hash_where = "WHERE info_hash = '$info_hash_sql'"; } // Getting info_hash v2 if ($bt_v2) { - $v2_hash = hash('sha256', \SandFox\Bencode\Bencode::encode($info)); + $v2_hash = hash('sha256', \Arokettu\Bencode\Bencode::encode($info)); $info_hash_v2 = pack('H*', $v2_hash); $info_hash_v2_sql = rtrim(DB()->escape($info_hash_v2), ' '); $info_hash_where = "WHERE info_hash_v2 = '$info_hash_v2_sql'"; @@ -541,7 +541,7 @@ class Torrent $ann_url = $bb_cfg['bt_announce_url']; $file_contents = file_get_contents($filename); - if (!$tor = \SandFox\Bencode\Bencode::decode($file_contents)) { + if (!$tor = \Arokettu\Bencode\Bencode::decode($file_contents)) { bb_die('This is not a bencoded file'); } @@ -584,7 +584,7 @@ class Torrent unset($tor['comment.utf-8']); // Send torrent - $output = \SandFox\Bencode\Bencode::encode($tor); + $output = \Arokettu\Bencode\Bencode::encode($tor); $dl_fname = '[' . $bb_cfg['server_name'] . '].t' . $topic_id . '.torrent'; if (!empty($_COOKIE['explain'])) {