From 1412407f0c1e8f123ff01d25b4aebf7c30093f81 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 24 Jun 2023 10:34:10 +0700 Subject: [PATCH] Minor improvements (#192) * Minor improvements * fix --- CHANGELOG.md | 2 +- common.php | 2 +- library/config.php | 4 ++-- library/includes/core/mysql.php | 18 ++++++++++++++---- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0ad71cd..71fadad1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ - Corrected translations [\#183](https://github.com/torrentpier/torrentpier-lts/pull/183) ([belomaxorka](https://github.com/belomaxorka)) - Fixed $bb_cfg['pm_days_keep'] [\#180](https://github.com/torrentpier/torrentpier-lts/pull/180) ([belomaxorka](https://github.com/belomaxorka)) - IP storage bugfix [\#177](https://github.com/torrentpier/torrentpier-lts/pull/177) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#172](https://github.com/torrentpier/torrentpier-lts/pull/172), [\#175](https://github.com/torrentpier/torrentpier-lts/pull/175), [\#176](https://github.com/torrentpier/torrentpier-lts/pull/176), [\#178](https://github.com/torrentpier/torrentpier-lts/pull/178), [\#179](https://github.com/torrentpier/torrentpier-lts/pull/179), [\#181](https://github.com/torrentpier/torrentpier-lts/pull/181), [\#187](https://github.com/torrentpier/torrentpier-lts/pull/187), [\#186](https://github.com/torrentpier/torrentpier-lts/pull/186), [\#191](https://github.com/torrentpier/torrentpier-lts/pull/191) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#172](https://github.com/torrentpier/torrentpier-lts/pull/172), [\#175](https://github.com/torrentpier/torrentpier-lts/pull/175), [\#176](https://github.com/torrentpier/torrentpier-lts/pull/176), [\#178](https://github.com/torrentpier/torrentpier-lts/pull/178), [\#179](https://github.com/torrentpier/torrentpier-lts/pull/179), [\#181](https://github.com/torrentpier/torrentpier-lts/pull/181), [\#187](https://github.com/torrentpier/torrentpier-lts/pull/187), [\#186](https://github.com/torrentpier/torrentpier-lts/pull/186), [\#191](https://github.com/torrentpier/torrentpier-lts/pull/191), [\#192](https://github.com/torrentpier/torrentpier-lts/pull/192) ([belomaxorka](https://github.com/belomaxorka)) - Fixed empty user search box [\#171](https://github.com/torrentpier/torrentpier-lts/pull/171) ([belomaxorka](https://github.com/belomaxorka)) - Added some placeholders for input fields [\#173](https://github.com/torrentpier/torrentpier-lts/pull/173) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/common.php b/common.php index 0931e9dc..fe1b44c3 100644 --- a/common.php +++ b/common.php @@ -13,7 +13,7 @@ if (empty($_SERVER['SERVER_NAME'])) $_SERVER['SERVER_NAME'] = ''; if (empty($_SERVER['SERVER_ADDR'])) $_SERVER['SERVER_ADDR'] = getenv('SERVER_ADDR'); if (!defined('BB_ROOT')) define('BB_ROOT', './'); -if (!defined('BB_SCRIPT')) define('BB_SCRIPT', 'undefined'); +if (!defined('BB_SCRIPT')) define('BB_SCRIPT', null); if (!defined('IN_FORUM') && !defined('IN_TRACKER')) define('IN_FORUM', true); header('X-Frame-Options: SAMEORIGIN'); diff --git a/library/config.php b/library/config.php index 0396bd6f..29dcb13a 100644 --- a/library/config.php +++ b/library/config.php @@ -380,8 +380,8 @@ $bb_cfg['adv_email'] = "adv@$domain_name"; define('SPHINX_LOG_ERRORS', true); // log sphinx errors define('SPHINX_LOG_NAME', 'sphinx_errors'); // sphinx log filename -define('DBG_LOG', true); // enable forum debug (off on production) -define('DBG_TRACKER', true); // enable tracker debug (off on production) +define('DBG_LOG', false); // enable forum debug (off on production) +define('DBG_TRACKER', false); // enable tracker debug (off on production) define('COOKIE_DBG', 'bb_dbg'); // debug cookie name define('SQL_DEBUG', true); // enable forum sql & cache debug define('SQL_LOG_NAME', 'sql_error_bb'); // mysql log filename diff --git a/library/includes/core/mysql.php b/library/includes/core/mysql.php index 220253ae..d4b103e4 100644 --- a/library/includes/core/mysql.php +++ b/library/includes/core/mysql.php @@ -73,7 +73,12 @@ class sql_db { if (!$this->sql_query("SET NAMES {$this->cfg['charset']}")) { - die("Could not set charset {$this->cfg['charset']}"); + $charset_error = "Could not set charset {$this->cfg['charset']}"; + if (DBG_USER) + { + dbg_log($charset_error, "{$this->cfg['charset']}-DB-charset-FAIL_" . time()); + } + die($charset_error); } } @@ -123,8 +128,13 @@ class sql_db if (!@mysql_select_db($this->cfg['dbname'], $this->link)) { - $database = (DBG_USER) ? $this->cfg['dbhost'] : ''; - die("Could not select database $database"); + $db_name = (DBG_USER) ? $this->cfg['dbname'] : ''; + $select_error = "Could not select database $db_name"; + if (DBG_USER) + { + dbg_log($select_error, "{$db_name}-DB-select-FAIL_" . time()); + } + die($select_error); } $this->debug('stop'); @@ -994,4 +1004,4 @@ class sql_db break; } } -} \ No newline at end of file +}