fix(ACP): A non-numeric value encountered for stats

This commit is contained in:
Roman Kelesidis 2025-08-03 20:00:13 +03:00
commit f2873b9854
No known key found for this signature in database
GPG key ID: D8157C4D4C4C6DB4
3 changed files with 10 additions and 10 deletions

View file

@ -128,14 +128,14 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$topics_per_day = $total_topics;
}
if ($users_per_day > $total_users) {
if ((int)$users_per_day > $total_users) {
$users_per_day = $total_users;
}
$template->assign_vars([
'NUMBER_OF_POSTS' => $total_posts,
'NUMBER_OF_TOPICS' => $total_topics,
'NUMBER_OF_USERS' => $total_users,
'NUMBER_OF_POSTS' => commify($total_posts),
'NUMBER_OF_TOPICS' => commify($total_topics),
'NUMBER_OF_USERS' => commify($total_users),
'START_DATE' => $start_date,
'POSTS_PER_DAY' => $posts_per_day,
'TOPICS_PER_DAY' => $topics_per_day,

View file

@ -272,9 +272,9 @@ $template->assign_vars([
'PAGE_TITLE' => $viewcat ? $cat_title_html[$viewcat] : $lang['HOME'],
'NO_FORUMS_MSG' => $only_new ? $lang['NO_NEW_POSTS'] : $lang['NO_FORUMS'],
'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']),
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']),
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']),
'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], commify($stats['topiccount'])),
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], commify($stats['postcount'])),
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], commify($stats['usercount'])),
'TOTAL_GENDER' => $bb_cfg['gender'] ? sprintf(
$lang['USERS_TOTAL_GENDER'],
$stats['male'],

View file

@ -17,7 +17,7 @@ $data = [];
// usercount
$row = DB()->fetch_row("SELECT COUNT(*) AS usercount FROM " . BB_USERS . " WHERE user_id NOT IN(" . EXCLUDED_USERS . ")");
$data['usercount'] = commify($row['usercount']);
$data['usercount'] = (int)$row['usercount'];
// newestuser
$row = DB()->fetch_row("SELECT user_id, username, user_rank FROM " . BB_USERS . " WHERE user_active = 1 AND user_id NOT IN(" . EXCLUDED_USERS . ") ORDER BY user_id DESC LIMIT 1");
@ -25,8 +25,8 @@ $data['newestuser'] = $row;
// post/topic count
$row = DB()->fetch_row("SELECT SUM(forum_topics) AS topiccount, SUM(forum_posts) AS postcount FROM " . BB_FORUMS);
$data['postcount'] = commify($row['postcount']);
$data['topiccount'] = commify($row['topiccount']);
$data['postcount'] = (int)$row['postcount'];
$data['topiccount'] = (int)$row['topiccount'];
// Tracker stats
if ($bb_cfg['tor_stats']) {