diff --git a/admin/stats/tracker.php b/admin/stats/tracker.php
index 66f8a8a0d..0d25fd227 100644
--- a/admin/stats/tracker.php
+++ b/admin/stats/tracker.php
@@ -74,7 +74,7 @@ foreach ($rowset as $cnt => $row) {
function commify_callback($matches)
{
- return commify($matches[0]);
+ return number_format($matches[0]);
}
function commify_ob($contents)
diff --git a/common.php b/common.php
index 0cd90035a..9222e1518 100644
--- a/common.php
+++ b/common.php
@@ -343,54 +343,6 @@ function sys($param)
}
}
-function dbg_log($str, $file)
-{
- $dir = LOG_DIR . (defined('IN_TRACKER') ? '/dbg_tr/' : '/dbg_bb/') . date('m-d_H') . '/';
- return file_write($str, $dir . $file, false, false);
-}
-
-function log_get($file = '', $prepend_str = false)
-{
- log_request($file, $prepend_str, false);
-}
-
-function log_post($file = '', $prepend_str = false)
-{
- log_request($file, $prepend_str, true);
-}
-
-function log_request($file = '', $prepend_str = false, $add_post = true)
-{
- global $user;
-
- $file = $file ?: 'req/' . date('m-d');
- $str = array();
- $str[] = date('m-d H:i:s');
- if ($prepend_str !== false) {
- $str[] = $prepend_str;
- }
- if (!empty($user->data)) {
- $str[] = $user->id . "\t" . html_entity_decode($user->name);
- }
- $str[] = sprintf('%-15s', $_SERVER['REMOTE_ADDR']);
-
- if (isset($_SERVER['REQUEST_URI'])) {
- $str[] = $_SERVER['REQUEST_URI'];
- }
- if (isset($_SERVER['HTTP_USER_AGENT'])) {
- $str[] = $_SERVER['HTTP_USER_AGENT'];
- }
- if (isset($_SERVER['HTTP_REFERER'])) {
- $str[] = $_SERVER['HTTP_REFERER'];
- }
-
- if (!empty($_POST) && $add_post) {
- $str[] = "post: " . str_compact(urldecode(http_build_query($_POST)));
- }
- $str = implode("\t", $str) . "\n";
- bb_log($str, $file);
-}
-
// Board or tracker init
if (!defined('IN_TRACKER')) {
require_once INC_DIR . '/init_bb.php';
diff --git a/index.php b/index.php
index 0dc0d1632..63a342a91 100644
--- a/index.php
+++ b/index.php
@@ -235,8 +235,8 @@ foreach ($cat_forums as $cid => $c) {
'FORUM_ID' => $fid,
'FORUM_NAME' => $fname_html,
'FORUM_DESC' => $f['forum_desc'],
- 'POSTS' => commify($f['forum_posts']),
- 'TOPICS' => commify($f['forum_topics']),
+ 'POSTS' => number_format($f['forum_posts']),
+ 'TOPICS' => number_format($f['forum_topics']),
'LAST_SF_ID' => $f['last_sf_id'] ?? null,
'MODERATORS' => isset($moderators[$fid]) ? implode(', ', $moderators[$fid]) : '',
'FORUM_FOLDER_ALT' => $new ? $lang['NEW'] : $lang['OLD'],
diff --git a/library/config.php b/library/config.php
index 407a88a8e..d072563c0 100644
--- a/library/config.php
+++ b/library/config.php
@@ -21,9 +21,9 @@ $bb_cfg = [];
$bb_cfg['js_ver'] = $bb_cfg['css_ver'] = 1;
// Version info
-$bb_cfg['tp_version'] = '2.3.1';
-$bb_cfg['tp_release_date'] = '18-03-2023';
-$bb_cfg['tp_release_codename'] = 'Bison';
+$bb_cfg['tp_version'] = '2.4.0-dev';
+$bb_cfg['tp_release_date'] = '18-04-2023';
+$bb_cfg['tp_release_codename'] = 'Cattle';
// Database
// Настройка баз данных ['db']['srv_name'] => (array) srv_cfg;
diff --git a/library/includes/datastore/build_stats.php b/library/includes/datastore/build_stats.php
index 13c221575..d25a9109f 100644
--- a/library/includes/datastore/build_stats.php
+++ b/library/includes/datastore/build_stats.php
@@ -71,7 +71,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
$birthday_today_list = $birthday_week_list = array();
foreach ($sql as $row) {
- $user_birthday = date('md', strtotime($row['user_birthday']));
+ $user_birthday = bb_date(strtotime($row['user_birthday']), 'md', false);
if ($user_birthday > $date_today && $user_birthday <= $date_forward) {
// user are having birthday within the next days
diff --git a/library/includes/functions.php b/library/includes/functions.php
index 444dcd66e..eb7fc7807 100644
--- a/library/includes/functions.php
+++ b/library/includes/functions.php
@@ -542,14 +542,6 @@ function url_arg($url, $arg, $value, $amp = '&')
return $url . $anchor;
}
-/**
- * Adds commas between every group of thousands
- */
-function commify($number)
-{
- return number_format($number);
-}
-
/**
* Returns a size formatted in a more human-friendly format, rounded to the nearest GB, MB, KB..
*/
@@ -2140,7 +2132,7 @@ function user_birthday_icon($user_birthday, $user_id): string
$current_date = bb_date(TIMENOW, 'md', false);
$user_birthday = ($user_id != GUEST_UID && !empty($user_birthday) && $user_birthday != '1900-01-01')
- ? date('md', strtotime($user_birthday)) : false;
+ ? bb_date(strtotime($user_birthday), 'md', false) : false;
return ($bb_cfg['birthday_enabled'] && $current_date == $user_birthday) ? '' : '';
}
diff --git a/src/Legacy/Cache/Common.php b/src/Legacy/Cache/Common.php
index 3465c4e71..088ce6d76 100644
--- a/src/Legacy/Cache/Common.php
+++ b/src/Legacy/Cache/Common.php
@@ -66,19 +66,24 @@ class Common
$id =& $this->dbg_id;
$dbg =& $this->dbg[$id];
- if ($mode == 'start') {
- $this->sql_starttime = utime();
-
- $dbg['sql'] = Dev::short_query($cur_query ?? $this->cur_query);
- $dbg['src'] = $this->debug_find_source();
- $dbg['file'] = $this->debug_find_source('file');
- $dbg['line'] = $this->debug_find_source('line');
- $dbg['time'] = '';
- } elseif ($mode == 'stop') {
- $this->cur_query_time = utime() - $this->sql_starttime;
- $this->sql_timetotal += $this->cur_query_time;
- $dbg['time'] = $this->cur_query_time;
- $id++;
+ switch ($mode) {
+ case 'start':
+ $this->sql_starttime = utime();
+ $dbg['sql'] = Dev::short_query($cur_query ?? $this->cur_query);
+ $dbg['src'] = $this->debug_find_source();
+ $dbg['file'] = $this->debug_find_source('file');
+ $dbg['line'] = $this->debug_find_source('line');
+ $dbg['time'] = '';
+ break;
+ case 'stop':
+ $this->cur_query_time = utime() - $this->sql_starttime;
+ $this->sql_timetotal += $this->cur_query_time;
+ $dbg['time'] = $this->cur_query_time;
+ $id++;
+ break;
+ default:
+ bb_simple_die('[Cache] Incorrect debug mode');
+ break;
}
}
diff --git a/src/Legacy/Datastore/Common.php b/src/Legacy/Datastore/Common.php
index 91b2738f7..b759c1a55 100644
--- a/src/Legacy/Datastore/Common.php
+++ b/src/Legacy/Datastore/Common.php
@@ -141,19 +141,23 @@ class Common
$id =& $this->dbg_id;
$dbg =& $this->dbg[$id];
- if ($mode == 'start') {
- $this->sql_starttime = utime();
-
- $dbg['sql'] = Dev::short_query($cur_query ?? $this->cur_query);
- $dbg['src'] = $this->debug_find_source();
- $dbg['file'] = $this->debug_find_source('file');
- $dbg['line'] = $this->debug_find_source('line');
- $dbg['time'] = '';
- } elseif ($mode == 'stop') {
- $this->cur_query_time = utime() - $this->sql_starttime;
- $this->sql_timetotal += $this->cur_query_time;
- $dbg['time'] = $this->cur_query_time;
- $id++;
+ switch ($mode) {
+ case 'start':
+ $this->sql_starttime = utime();
+ $dbg['sql'] = Dev::short_query($cur_query ?? $this->cur_query);
+ $dbg['src'] = $this->debug_find_source();
+ $dbg['file'] = $this->debug_find_source('file');
+ $dbg['line'] = $this->debug_find_source('line');
+ $dbg['time'] = '';
+ break;
+ case 'stop':
+ $this->cur_query_time = utime() - $this->sql_starttime;
+ $this->sql_timetotal += $this->cur_query_time;
+ $dbg['time'] = $this->cur_query_time;
+ $id++;
+ break;
+ default:
+ bb_simple_die('[Datastore] Incorrect debug mode');
}
}
diff --git a/src/Legacy/SqlDb.php b/src/Legacy/SqlDb.php
index 0a983a922..a43978204 100644
--- a/src/Legacy/SqlDb.php
+++ b/src/Legacy/SqlDb.php
@@ -104,13 +104,6 @@ class SqlDb
$this->link = mysqli_connect($p . $this->cfg['dbhost'], $this->cfg['dbuser'], $this->cfg['dbpasswd'], $this->cfg['dbname']);
$this->selected_db = $this->cfg['dbname'];
- if (mysqli_connect_error()) {
- $server = DBG_USER ? $this->cfg['dbhost'] : '';
- Http::statusCode(503);
- bb_log(' ', "db_err/connect_failed_{$this->cfg['dbhost']}");
- die("Could not connect to mysql server $server");
- }
-
register_shutdown_function([&$this, 'close']);
$this->debug('stop');
diff --git a/styles/templates/admin/admin_forums.tpl b/styles/templates/admin/admin_forums.tpl
index 04019db60..84154a03a 100644
--- a/styles/templates/admin/admin_forums.tpl
+++ b/styles/templates/admin/admin_forums.tpl
@@ -210,13 +210,13 @@ function hl (id, on)