From f7ee6d8a57113316ea6fcce72309543e7a482a3f Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Tue, 20 Feb 2024 00:04:47 +0700 Subject: [PATCH] Minor improvements (#1408) * Minor improvements * Update Dev.php * Update IsHelper.php * Update CHANGELOG.md --- CHANGELOG.md | 2 +- README.md | 2 +- library/includes/page_footer.php | 2 +- src/Dev.php | 2 +- src/Helpers/IsHelper.php | 17 ++++++++---- styles/templates/default/viewtopic.tpl | 38 ++++++++++++-------------- 6 files changed, 33 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abf5c40b6..0111223df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ - Fixed Undefined variable $wordCensor [\#1400](https://github.com/torrentpier/torrentpier/pull/1400) ([belomaxorka](https://github.com/belomaxorka)) - Improved word censor 🤐 [\#1393](https://github.com/torrentpier/torrentpier/pull/1393) ([belomaxorka](https://github.com/belomaxorka)) - Used hashing for filenames generation [\#1385](https://github.com/torrentpier/torrentpier/pull/1385) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#1382](https://github.com/torrentpier/torrentpier/pull/1382), [\#1383](https://github.com/torrentpier/torrentpier/pull/1383), [\#1391](https://github.com/torrentpier/torrentpier/pull/1391), [\#1398](https://github.com/torrentpier/torrentpier/pull/1398), [\#1405](https://github.com/torrentpier/torrentpier/pull/1405), [\#1406](https://github.com/torrentpier/torrentpier/pull/1406) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#1382](https://github.com/torrentpier/torrentpier/pull/1382), [\#1383](https://github.com/torrentpier/torrentpier/pull/1383), [\#1391](https://github.com/torrentpier/torrentpier/pull/1391), [\#1398](https://github.com/torrentpier/torrentpier/pull/1398), [\#1405](https://github.com/torrentpier/torrentpier/pull/1405), [\#1406](https://github.com/torrentpier/torrentpier/pull/1406), [\#1408](https://github.com/torrentpier/torrentpier/pull/1408) ([belomaxorka](https://github.com/belomaxorka)) - Some bugfixes [\#1380](https://github.com/torrentpier/torrentpier/pull/1380) ([belomaxorka](https://github.com/belomaxorka)) - New Crowdin updates [\#1384](https://github.com/torrentpier/torrentpier/pull/1384), [\#1389](https://github.com/torrentpier/torrentpier/pull/1389), [\#1392](https://github.com/torrentpier/torrentpier/pull/1392), [\#1402](https://github.com/torrentpier/torrentpier/pull/1402), [\#1403](https://github.com/torrentpier/torrentpier/pull/1403) ([Exileum](https://github.com/Exileum)) diff --git a/README.md b/README.md index fceca46ef..1204ecc4d 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ For installation, you need to follow a few simple steps: 6. Edit domain name and domain port in the configuration file or a local copy (`$reserved_name` and `$reserved_port`) 7. Edit this files: 1. **favicon.png** (change on your own) - 2. **robots.txt** (change the addresses in lines **Host** and **Sitemap** on your own) + 2. **robots.txt** (change the addresses in lines `Host` and `Sitemap` on your own) 3. **opensearch_desc.xml** (change the description and address on your own) 4. **opensearch_desc_bt.xml** (change the description and address on your own) 8. Log in to the forum with **admin/admin** login/password and finish setting up via admin panel diff --git a/library/includes/page_footer.php b/library/includes/page_footer.php index da3dd1469..bdabc2539 100644 --- a/library/includes/page_footer.php +++ b/library/includes/page_footer.php @@ -25,7 +25,7 @@ if (!empty($template)) { $template->pparse('page_footer'); } -$show_dbg_info = (!IS_GUEST && APP_DEBUG && !(isset($_GET['pane']) && $_GET['pane'] == 'left')); +$show_dbg_info = (APP_DEBUG && !(isset($_GET['pane']) && $_GET['pane'] == 'left')); if (!$bb_cfg['gzip_compress']) { flush(); diff --git a/src/Dev.php b/src/Dev.php index c39fce40b..bd357cab0 100644 --- a/src/Dev.php +++ b/src/Dev.php @@ -216,7 +216,7 @@ class Dev $id = "sql_{$i}_" . random_int(0, mt_getrandmax()); $sql = self::short_query($dbg['sql'], true); $time = sprintf('%.4f', $dbg['time']); - $perc = @sprintf('[%d%%]', round($dbg['time'] * 100 / $db_obj->sql_timetotal)); + $perc = '[' . round($dbg['time'] * 100 / $db_obj->sql_timetotal) . '%]'; $info = !empty($dbg['info']) ? $dbg['info'] . ' [' . $dbg['src'] . ']' : $dbg['src']; $log .= '' diff --git a/src/Helpers/IsHelper.php b/src/Helpers/IsHelper.php index 8368f13d4..87cd3ecb8 100644 --- a/src/Helpers/IsHelper.php +++ b/src/Helpers/IsHelper.php @@ -22,12 +22,17 @@ class IsHelper */ public static function isHTTPS(): bool { - $is_secure = false; - if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { - $is_secure = true; - } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { - $is_secure = true; + if ( + (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') + || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') + || (!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') + || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) + || (isset($_SERVER['HTTP_X_FORWARDED_PORT']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == 443) + || (isset($_SERVER['REQUEST_SCHEME']) && $_SERVER['REQUEST_SCHEME'] == 'https') + ) { + return true; } - return $is_secure; + + return false; } } diff --git a/styles/templates/default/viewtopic.tpl b/styles/templates/default/viewtopic.tpl index 6d69996f9..045acf3f8 100644 --- a/styles/templates/default/viewtopic.tpl +++ b/styles/templates/default/viewtopic.tpl @@ -15,27 +15,25 @@