From faede91a1490971a4e15bec9ae0b40dc0adcec54 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 13 Jul 2024 18:25:21 +0700 Subject: [PATCH] Minor improvements (#1539) * Minor improvements * Update CHANGELOG.md * Update thanks.php * Updated --- CHANGELOG.md | 2 +- library/ajax/thanks.php | 12 ++++++++++++ library/config.php | 9 +++++++++ library/language/source/main.php | 1 + src/Dev.php | 15 ++++++++++++--- styles/templates/default/viewtopic_attach.tpl | 6 +++++- 6 files changed, 40 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21291ffb8..ba2f02a3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ - Hide in topic: Added country hiding [\#1535](https://github.com/torrentpier/torrentpier/pull/1535) ([belomaxorka](https://github.com/belomaxorka)) - Hide vote button in topic for guests [\#1507](https://github.com/torrentpier/torrentpier/pull/1507) ([belomaxorka](https://github.com/belomaxorka)) - Word censor code optimization [\#1537](https://github.com/torrentpier/torrentpier/pull/1537) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#1502](https://github.com/torrentpier/torrentpier/pull/1502), [\#1506](https://github.com/torrentpier/torrentpier/pull/1506), [\#1509](https://github.com/torrentpier/torrentpier/pull/1509), [\#1511](https://github.com/torrentpier/torrentpier/pull/1511), [\#1515](https://github.com/torrentpier/torrentpier/pull/1515), [\#1516](https://github.com/torrentpier/torrentpier/pull/1516), [\#1517](https://github.com/torrentpier/torrentpier/pull/1517), [\#1519](https://github.com/torrentpier/torrentpier/pull/1519), [\#1523](https://github.com/torrentpier/torrentpier/pull/1523), [\#1525](https://github.com/torrentpier/torrentpier/pull/1525), [\#1530](https://github.com/torrentpier/torrentpier/pull/1530), [\#1532](https://github.com/torrentpier/torrentpier/pull/1532), [\#1536](https://github.com/torrentpier/torrentpier/pull/1536) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#1502](https://github.com/torrentpier/torrentpier/pull/1502), [\#1506](https://github.com/torrentpier/torrentpier/pull/1506), [\#1509](https://github.com/torrentpier/torrentpier/pull/1509), [\#1511](https://github.com/torrentpier/torrentpier/pull/1511), [\#1515](https://github.com/torrentpier/torrentpier/pull/1515), [\#1516](https://github.com/torrentpier/torrentpier/pull/1516), [\#1517](https://github.com/torrentpier/torrentpier/pull/1517), [\#1519](https://github.com/torrentpier/torrentpier/pull/1519), [\#1523](https://github.com/torrentpier/torrentpier/pull/1523), [\#1525](https://github.com/torrentpier/torrentpier/pull/1525), [\#1530](https://github.com/torrentpier/torrentpier/pull/1530), [\#1532](https://github.com/torrentpier/torrentpier/pull/1532), [\#1536](https://github.com/torrentpier/torrentpier/pull/1536), [\#1539](https://github.com/torrentpier/torrentpier/pull/1539) ([belomaxorka](https://github.com/belomaxorka)) - New Crowdin updates [\#1504](https://github.com/torrentpier/torrentpier/pull/1504), [\#1513](https://github.com/torrentpier/torrentpier/pull/1513) ([Exileum](https://github.com/Exileum)) ## [v2.4.3](https://github.com/torrentpier/torrentpier/tree/v2.4.3) (2024-06-09) diff --git a/library/ajax/thanks.php b/library/ajax/thanks.php index 3ce74cb6b..a93ae953d 100644 --- a/library/ajax/thanks.php +++ b/library/ajax/thanks.php @@ -46,6 +46,18 @@ switch ($mode) { $columns = 'topic_id, user_id, time'; $values = "$topic_id, {$userdata['user_id']}, " . TIMENOW; DB()->query('INSERT IGNORE INTO ' . BB_THX . " ($columns) VALUES ($values)"); + DB()->query(" + DELETE FROM " . BB_THX . " + WHERE user_id IN ( + SELECT user_id FROM ( + SELECT user_id + FROM " . BB_THX . " + WHERE topic_id = $topic_id + ORDER BY time ASC + LIMIT 1 + ) AS subquery + ) AND (SELECT COUNT(*) FROM " . BB_THX . " WHERE topic_id = $topic_id) > 50; + "); break; case 'get': if (IS_GUEST && !$bb_cfg['tor_thanks_list_guests']) { diff --git a/library/config.php b/library/config.php index 98476cecf..a9aff668a 100644 --- a/library/config.php +++ b/library/config.php @@ -446,6 +446,15 @@ $bb_cfg['abuse_email'] = "abuse@$domain_name"; // abuse email (e.g. DMCA) $bb_cfg['adv_email'] = "adv@$domain_name"; // advertisement email // Error reporting +$bb_cfg['whoops'] = [ + 'error_message' => 'Sorry, something went wrong. Drink coffee and come back after some time... ☕️', + 'blacklist' => [ + '_COOKIE' => array_keys($_COOKIE), + '_SERVER' => array_keys($_SERVER), + '_ENV' => array_keys($_ENV), + ] +]; + $bb_cfg['bugsnag'] = [ 'enabled' => true, 'api_key' => '33b3ed0102946bab71341f9edc125e21', // Don't change this if you want to help us find bugs diff --git a/library/language/source/main.php b/library/language/source/main.php index 3b99e25ec..624940880 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -1693,6 +1693,7 @@ $lang['FILELIST'] = 'Filelist'; $lang['COLLAPSE'] = 'Collapse directory'; $lang['EXPAND'] = 'Expand'; $lang['SWITCH'] = 'Switch'; +$lang['TOGGLE_WINDOW_FULL_SIZE'] = 'Increase/smart window'; $lang['EMPTY_ATTACH_ID'] = 'Missing file identifier!'; $lang['TOR_NOT_FOUND'] = 'File is missing on the server!'; $lang['ERROR_BUILD'] = 'The content of this torrent file can not be viewed on the site (it was not possible to build a list of files)'; diff --git a/src/Dev.php b/src/Dev.php index cf946c6cf..9186ad51c 100644 --- a/src/Dev.php +++ b/src/Dev.php @@ -58,7 +58,7 @@ class Dev */ public function __construct() { - $this->envType = env('APP_ENV', 'production'); + $this->envType = strtolower(env('APP_ENV', 'production')); $this->whoops = new Run; switch ($this->envType) { @@ -128,7 +128,8 @@ class Dev private function getWhoopsProduction(): void { $this->whoops->pushHandler(function () { - echo 'Sorry, something went wrong. Drink coffee and come back after some time... ☕️'; + global $bb_cfg; + echo $bb_cfg['whoops']['error_message']; }); } @@ -139,10 +140,18 @@ class Dev */ private function getWhoops(): void { + global $bb_cfg; + /** * Show errors on page */ - $this->whoops->pushHandler(new PrettyPageHandler); + $prettyPageHandler = new PrettyPageHandler(); + foreach ($bb_cfg['whoops']['blacklist'] as $key => $secrets) { + foreach ($secrets as $secret) { + $prettyPageHandler->blacklist($key, $secret); + } + } + $this->whoops->pushHandler($prettyPageHandler); /** * Show log in browser console diff --git a/styles/templates/default/viewtopic_attach.tpl b/styles/templates/default/viewtopic_attach.tpl index e262073d5..ef6781bc3 100644 --- a/styles/templates/default/viewtopic_attach.tpl +++ b/styles/templates/default/viewtopic_attach.tpl @@ -347,6 +347,7 @@ $('#tor-filelist-btn').click(function () { margin: 0 2px; padding: 8px 6px; max-height: 284px; overflow: auto; } +.tor-filelist-fullsize { max-height: unset !important; } #tor-filelist i { color: #7A7A7A; padding-left: 4px; } #tor-filelist s { color: #0000FF; text-decoration: none; } #tor-filelist .b > s { color: #800000; } @@ -363,9 +364,12 @@ $('#tor-filelist-btn').click(function () {
-