From 237e7ec6ef3dcfd632026469a189eb3f05ec7937 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Wed, 5 Jun 2024 12:51:23 +0700 Subject: [PATCH] =?UTF-8?q?Some=20cleanup...=F0=9F=98=A3=20(#1488)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Some cleanup...😣 * Update main.php * Update CHANGELOG.md * Update main.php * Update main.php * Update main.php * Update main.php * Update main.php * Update main.php * Update main.php * Update main.php * Update main.php * Update main.php * Update main.php * Update main.php * Update main.php * Update config.php * Update Common.php * Updated * Update filelist.php * Update filelist.php * Update viewtopic_attach.tpl * Updated --- CHANGELOG.md | 3 +- admin/admin_log.php | 4 +- filelist.php | 6 ++- index.php | 8 +++- library/ajax/mod_action.php | 8 +++- library/language/source/main.php | 43 +------------------ modcp.php | 16 +++++-- src/Legacy/Datastore/Common.php | 20 +++++---- src/Legacy/Post.php | 8 +++- src/Legacy/SqlDb.php | 4 +- styles/templates/default/css/misc.css | 4 ++ styles/templates/default/viewtopic_attach.tpl | 4 +- viewtopic.php | 8 +++- 13 files changed, 65 insertions(+), 71 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e275af76..9d2810fe1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Added support for APCu caching method [\#1442](https://github.com/torrentpier/torrentpier/pull/1442) ([belomaxorka](https://github.com/belomaxorka)) - Added support for attribute to ignoring auto spoilers opening [\#1466](https://github.com/torrentpier/torrentpier/pull/1466) ([belomaxorka](https://github.com/belomaxorka)) - Some enhancements [\#1445](https://github.com/torrentpier/torrentpier/pull/1445) ([belomaxorka](https://github.com/belomaxorka)) +- Some cleanup...😣 [\#1488](https://github.com/torrentpier/torrentpier/pull/1488) ([belomaxorka](https://github.com/belomaxorka)) - Guests can view polls [\#1464](https://github.com/torrentpier/torrentpier/pull/1464) ([belomaxorka](https://github.com/belomaxorka)) - Improved app debug [\#1438](https://github.com/torrentpier/torrentpier/pull/1438) ([belomaxorka](https://github.com/belomaxorka)) - Show client country in seeders / leechers list 🌍 [\#1478](https://github.com/torrentpier/torrentpier/pull/1478) ([belomaxorka](https://github.com/belomaxorka)) @@ -21,7 +22,7 @@ - Code refactoring [\#1441](https://github.com/torrentpier/torrentpier/pull/1441) ([belomaxorka](https://github.com/belomaxorka)) - Minor improvements [\#1435](https://github.com/torrentpier/torrentpier/pull/1435), [\#1443](https://github.com/torrentpier/torrentpier/pull/1443), [\#1446](https://github.com/torrentpier/torrentpier/pull/1446), [\#1450](https://github.com/torrentpier/torrentpier/pull/1450), [\#1452](https://github.com/torrentpier/torrentpier/pull/1452), [\#1458](https://github.com/torrentpier/torrentpier/pull/1458), [\#1461](https://github.com/torrentpier/torrentpier/pull/1461), [\#1462](https://github.com/torrentpier/torrentpier/pull/1462), [\#1467](https://github.com/torrentpier/torrentpier/pull/1467), [\#1469](https://github.com/torrentpier/torrentpier/pull/1469), [\#1472](https://github.com/torrentpier/torrentpier/pull/1472), [\#1477](https://github.com/torrentpier/torrentpier/pull/1477), [\#1480](https://github.com/torrentpier/torrentpier/pull/1480), [\#1481](https://github.com/torrentpier/torrentpier/pull/1481), [\#1482](https://github.com/torrentpier/torrentpier/pull/1482), [\#1484](https://github.com/torrentpier/torrentpier/pull/1484) ([belomaxorka](https://github.com/belomaxorka)) - Updated deps [\#1454](https://github.com/torrentpier/torrentpier/pull/1454), [\#1455](https://github.com/torrentpier/torrentpier/pull/1455), [\#1459](https://github.com/torrentpier/torrentpier/pull/1459), [\#1460](https://github.com/torrentpier/torrentpier/pull/1460), [\#1485](https://github.com/torrentpier/torrentpier/pull/1485), [\#1486](https://github.com/torrentpier/torrentpier/pull/1486) ([belomaxorka](https://github.com/belomaxorka)) -- New Crowdin updates [\#1444](https://github.com/torrentpier/torrentpier/pull/1444), [\#1447](https://github.com/torrentpier/torrentpier/pull/1447), [\#1453](https://github.com/torrentpier/torrentpier/pull/1453), [\#1468](https://github.com/torrentpier/torrentpier/pull/1468), [\#1473](https://github.com/torrentpier/torrentpier/pull/1473), [\#1476](https://github.com/torrentpier/torrentpier/pull/1476), [\#1479](https://github.com/torrentpier/torrentpier/pull/1479) ([Exileum](https://github.com/Exileum)) +- New Crowdin updates [\#1444](https://github.com/torrentpier/torrentpier/pull/1444), [\#1447](https://github.com/torrentpier/torrentpier/pull/1447), [\#1453](https://github.com/torrentpier/torrentpier/pull/1453), [\#1468](https://github.com/torrentpier/torrentpier/pull/1468), [\#1473](https://github.com/torrentpier/torrentpier/pull/1473), [\#1476](https://github.com/torrentpier/torrentpier/pull/1476), [\#1479](https://github.com/torrentpier/torrentpier/pull/1479), [\#1487](https://github.com/torrentpier/torrentpier/pull/1487) ([Exileum](https://github.com/Exileum)) ## [v2.4.2](https://github.com/torrentpier/torrentpier/tree/v2.4.2) (2024-03-30) [Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.1...v2.4.2) diff --git a/admin/admin_log.php b/admin/admin_log.php index ded30c84d..4fa8f7d2a 100644 --- a/admin/admin_log.php +++ b/admin/admin_log.php @@ -14,10 +14,10 @@ if (!empty($setmodules)) { require __DIR__ . '/pagestart.php'; -$datastore->enqueue(array( +$datastore->enqueue([ 'moderators', 'cat_forums', -)); +]); $log_action->init(); diff --git a/filelist.php b/filelist.php index b9aa39426..cdf8a1fc7 100644 --- a/filelist.php +++ b/filelist.php @@ -163,6 +163,10 @@ a { color: #1d9100; } +a:hover { + text-decoration: underline; +} + sup { color: #aa8000; } @@ -178,7 +182,7 @@ sup { top: 0; opacity: 0; transition: opacity 0.7s; - width: 400px; + width: 200px; background-color: #111; color: #acacac; text-align: left; diff --git a/index.php b/index.php index d5f6468b8..19a5c3a2f 100644 --- a/index.php +++ b/index.php @@ -32,10 +32,14 @@ $datastore->enqueue([ ]); if ($bb_cfg['show_latest_news']) { - $datastore->enqueue('latest_news'); + $datastore->enqueue([ + 'latest_news' + ]); } if ($bb_cfg['show_network_news']) { - $datastore->enqueue('network_news'); + $datastore->enqueue([ + 'network_news' + ]); } // Init userdata diff --git a/library/ajax/mod_action.php b/library/ajax/mod_action.php index 7b66e9369..3b2b4fff6 100644 --- a/library/ajax/mod_action.php +++ b/library/ajax/mod_action.php @@ -60,13 +60,17 @@ switch ($mode) { // Обновление кеша новостей на главной $news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id'])); if (isset($news_forums[$t_data['forum_id']]) && $bb_cfg['show_latest_news']) { - $datastore->enqueue('latest_news'); + $datastore->enqueue([ + 'latest_news' + ]); $datastore->update('latest_news'); } $net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id'])); if (isset($net_forums[$t_data['forum_id']]) && $bb_cfg['show_network_news']) { - $datastore->enqueue('network_news'); + $datastore->enqueue([ + 'network_news' + ]); $datastore->update('network_news'); } diff --git a/library/language/source/main.php b/library/language/source/main.php index 45067e770..70f749fe9 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -544,6 +544,7 @@ $lang['NO_SEND_ACCOUNT'] = 'Sorry, but your password cannot be retrieved. Please $lang['ALWAYS_ADD_SIG'] = 'Always attach my signature'; $lang['HIDE_PORN_FORUMS'] = 'Hide content 18+'; +$lang['ADD_RETRACKER'] = 'Add retracker in torrent files'; $lang['ALWAYS_NOTIFY'] = 'Always notify me of replies'; $lang['ALWAYS_NOTIFY_EXPLAIN'] = 'Sends an e-mail when someone replies to a topic you have posted in. This can be changed whenever you post.'; @@ -2524,48 +2525,6 @@ $lang['RETURN_CONFIG'] = '%sReturn to Configuration%s'; $lang['CONFIG_UPD'] = 'Configuration Updated Successfully'; $lang['SET_DEFAULTS'] = 'Restore defaults'; -$lang['OFF_TRACKER'] = 'Disable tracker'; -$lang['OFF_REASON'] = 'Disable reason'; -$lang['OFF_REASON_EXPL'] = 'this message will be sent to client when the tracker is disabled'; -$lang['AUTOCLEAN_EXPL'] = 'autoclean peers table - do not disable without reason'; -$lang['COMPACT_MODE'] = 'Compact mode'; -$lang['COMPACT_MODE_EXPL'] = '"Yes" - tracker will only accept clients working in compact mode
"No" - compatible mode (chosen by client)'; -$lang['BROWSER_REDIRECT_URL'] = 'Browser redirect URL'; -$lang['BROWSER_REDIRECT_URL_EXPL'] = 'if user tries to open tracker URL in Web browser
leave blank to disable'; - -$lang['ANNOUNCE_INTERVAL_HEAD'] = 'Misc'; -$lang['ANNOUNCE_INTERVAL'] = 'Announce interval'; -$lang['ANNOUNCE_INTERVAL_EXPL'] = 'peers should wait at least this many seconds between announcements'; -$lang['NUMWANT'] = 'Numwant value'; -$lang['NUMWANT_EXPL'] = 'number of peers being sent to client'; -$lang['EXPIRE_FACTOR'] = 'Peer expire factor'; -$lang['EXPIRE_FACTOR_EXPL'] = 'Consider a peer dead if it has not announced in a number of seconds equal to this many times the calculated announce interval at the time of its last announcement (must be greater than 1)'; -$lang['IGNORE_GIVEN_IP'] = 'Ignore IP reported by client'; -$lang['UPDATE_DLSTAT'] = 'Store users up/down statistics'; - -$lang['LIMIT_ACTIVE_TOR_HEAD'] = 'Limits'; -$lang['LIMIT_ACTIVE_TOR'] = 'Limit active torrents'; -$lang['LIMIT_SEED_COUNT'] = 'Seeding limit'; -$lang['LIMIT_SEED_COUNT_EXPL'] = '(0 - no limit)'; -$lang['LIMIT_LEECH_COUNT'] = 'Leeching limit'; -$lang['LIMIT_LEECH_COUNT_EXPL'] = '(0 - no limit)'; -$lang['LEECH_EXPIRE_FACTOR'] = 'Leech expire factor'; -$lang['LEECH_EXPIRE_FACTOR_EXPL'] = 'Treat a peer as active for this number of minutes even if it sent "stopped" event after starting dl
0 - take into account "stopped" event'; -$lang['LIMIT_CONCURRENT_IPS'] = "Limit concurrent IP's"; -$lang['LIMIT_CONCURRENT_IPS_EXPL'] = 'per torrent limit'; -$lang['LIMIT_SEED_IPS'] = 'Seeding IP limit'; -$lang['LIMIT_SEED_IPS_EXPL'] = "allow seeding from no more than xx IP's
0 - no limit"; -$lang['LIMIT_LEECH_IPS'] = 'Leeching IP limit'; -$lang['LIMIT_LEECH_IPS_EXPL'] = "allow leeching from no more than xx IP's
0 - no limit"; - -$lang['USE_AUTH_KEY_HEAD'] = 'Authorization'; -$lang['USE_AUTH_KEY'] = 'Passkey'; -$lang['USE_AUTH_KEY_EXPL'] = 'enable check for passkey'; -$lang['AUTH_KEY_NAME'] = 'Passkey name'; -$lang['AUTH_KEY_NAME_EXPL'] = 'passkey key name in GET request'; -$lang['ALLOW_GUEST_DL'] = 'Allow guest access to tracker'; -$lang['ADD_RETRACKER'] = 'Add retracker in torrent files'; - // Forum config $lang['FORUM_CFG_EXPL'] = 'Forum config'; diff --git a/modcp.php b/modcp.php index a8ec6a0db..cea7e9f73 100644 --- a/modcp.php +++ b/modcp.php @@ -225,13 +225,17 @@ switch ($mode) { //Обновление кеша новостей на главной $news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id'])); if (isset($news_forums[$forum_id]) && $bb_cfg['show_latest_news'] && $result) { - $datastore->enqueue('latest_news'); + $datastore->enqueue([ + 'latest_news' + ]); $datastore->update('latest_news'); } $net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id'])); if (isset($net_forums[$forum_id]) && $bb_cfg['show_network_news'] && $result) { - $datastore->enqueue('network_news'); + $datastore->enqueue([ + 'network_news' + ]); $datastore->update('network_news'); } @@ -256,13 +260,17 @@ switch ($mode) { //Обновление кеша новостей на главной $news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id'])); if ((isset($news_forums[$forum_id]) || isset($news_forums[$new_forum_id])) && $bb_cfg['show_latest_news'] && $result) { - $datastore->enqueue('latest_news'); + $datastore->enqueue([ + 'latest_news' + ]); $datastore->update('latest_news'); } $net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id'])); if ((isset($net_forums[$forum_id]) || isset($net_forums[$new_forum_id])) && $bb_cfg['show_network_news'] && $result) { - $datastore->enqueue('network_news'); + $datastore->enqueue([ + 'network_news' + ]); $datastore->update('network_news'); } diff --git a/src/Legacy/Datastore/Common.php b/src/Legacy/Datastore/Common.php index 5e2435b11..9450ec01c 100644 --- a/src/Legacy/Datastore/Common.php +++ b/src/Legacy/Datastore/Common.php @@ -21,23 +21,25 @@ class Common * Директория с builder-скриптами (внутри INC_DIR) */ public $ds_dir = 'datastore'; + /** * Готовая к употреблению data * array('title' => data) */ - public $data = []; + public array $data = []; + /** * Список элементов, которые будут извлечены из хранилища при первом же запросе get() * до этого момента они ставятся в очередь $queued_items для дальнейшего извлечения _fetch()'ем * всех элементов одним запросом * array('title1', 'title2'...) */ - public $queued_items = []; + public array $queued_items = []; /** * 'title' => 'builder script name' inside "includes/datastore" dir */ - public $known_items = [ + public array $known_items = [ 'cat_forums' => 'build_cat_forums.php', 'check_updates' => 'build_check_updates.php', 'jumpbox' => 'build_cat_forums.php', @@ -54,13 +56,13 @@ class Common ]; /** - * @param array (item1_title, item2_title...) or single item's title + * @param array $items + * @return void */ - public function enqueue($items) + public function enqueue(array $items): void { - foreach ((array)$items as $item) { - // игнор уже поставленного в очередь либо уже извлеченного - if (!\in_array($item, $this->queued_items) && !isset($this->data[$item])) { + foreach ($items as $item) { + if (!in_array($item, $this->queued_items) && !isset($this->data[$item])) { $this->queued_items[] = $item; } } @@ -69,7 +71,7 @@ class Common public function &get($title) { if (!isset($this->data[$title])) { - $this->enqueue($title); + $this->enqueue([$title]); $this->_fetch(); } return $this->data[$title]; diff --git a/src/Legacy/Post.php b/src/Legacy/Post.php index 92593c92c..8910738d5 100644 --- a/src/Legacy/Post.php +++ b/src/Legacy/Post.php @@ -201,7 +201,9 @@ class Post if ($bb_cfg['show_latest_news']) { $news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id'])); if (isset($news_forums[$forum_id]) && $bb_cfg['show_latest_news'] && $mode == 'newtopic') { - $datastore->enqueue('latest_news'); + $datastore->enqueue([ + 'latest_news' + ]); $datastore->update('latest_news'); } } @@ -209,7 +211,9 @@ class Post if ($bb_cfg['show_network_news']) { $net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id'])); if (isset($net_forums[$forum_id]) && $bb_cfg['show_network_news'] && $mode == 'newtopic') { - $datastore->enqueue('network_news'); + $datastore->enqueue([ + 'network_news' + ]); $datastore->update('network_news'); } } diff --git a/src/Legacy/SqlDb.php b/src/Legacy/SqlDb.php index a65b5fd7b..8c1835438 100644 --- a/src/Legacy/SqlDb.php +++ b/src/Legacy/SqlDb.php @@ -997,8 +997,8 @@ class SqlDb $this->explain_out .= ' - - + +
 ' . $dbg['src'] . '  [' . sprintf('%.4f', $dbg['time']) . ' s]  ' . $dbg['info'] . '' . "[$this->engine] $this->db_server.$this->selected_db" . ' :: Query #' . ($this->num_queries + 1) . '  ' . $dbg['src'] . '  [' . sprintf('%.4f', $dbg['time']) . ' s]  ' . $dbg['info'] . '' . "[$this->engine] $this->db_server.$this->selected_db" . ' :: Query #' . ($this->num_queries + 1) . ' 
' . $this->explain_hold . '
diff --git a/styles/templates/default/css/misc.css b/styles/templates/default/css/misc.css index e0f0f4529..4fdf78f03 100644 --- a/styles/templates/default/css/misc.css +++ b/styles/templates/default/css/misc.css @@ -104,3 +104,7 @@ pre, .pre { border: 2px solid #CC6600; padding: 8px; } + +.copyElement { + cursor: pointer !important; +} diff --git a/styles/templates/default/viewtopic_attach.tpl b/styles/templates/default/viewtopic_attach.tpl index 8f8c4ae0b..9abc82e9d 100644 --- a/styles/templates/default/viewtopic_attach.tpl +++ b/styles/templates/default/viewtopic_attach.tpl @@ -160,8 +160,8 @@ {postrow.attach.tor_reged.TRACKER_LINK} [ {postrow.attach.tor_reged.REGED_TIME} ] -

info_hash: {postrow.attach.tor_reged.HASH} -
info_hash v2: {postrow.attach.tor_reged.HASH_V2} +

info_hash: {postrow.attach.tor_reged.HASH} +
info_hash v2: {postrow.attach.tor_reged.HASH_V2} diff --git a/viewtopic.php b/viewtopic.php index d88b4f387..ca571ecd6 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -119,11 +119,15 @@ if ($t_data['allow_porno_topic'] && bf($userdata['user_opt'], 'user_opt', 'user_ if ($userdata['session_admin'] && !empty($_REQUEST['mod'])) { if (IS_ADMIN) { - $datastore->enqueue(['viewtopic_forum_select']); + $datastore->enqueue([ + 'viewtopic_forum_select' + ]); } } if ($topic_attachment) { - $datastore->enqueue(['attach_extensions']); + $datastore->enqueue([ + 'attach_extensions' + ]); } set_die_append_msg($forum_id);