fix(ACP): A non-numeric value encountered for stats (#2073)
Some checks failed
Continuous Integration / Nightly builds 📦 (push) Has been cancelled
Continuous Integration / 🎉 Deploy (push) Has been cancelled
PHPMD / Run PHPMD scanning (push) Has been cancelled

This commit is contained in:
Roman Kelesidis 2025-08-03 20:01:55 +03:00 committed by GitHub
commit d690447cdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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; $topics_per_day = $total_topics;
} }
if ($users_per_day > $total_users) { if ((int)$users_per_day > $total_users) {
$users_per_day = $total_users; $users_per_day = $total_users;
} }
$template->assign_vars([ $template->assign_vars([
'NUMBER_OF_POSTS' => $total_posts, 'NUMBER_OF_POSTS' => commify($total_posts),
'NUMBER_OF_TOPICS' => $total_topics, 'NUMBER_OF_TOPICS' => commify($total_topics),
'NUMBER_OF_USERS' => $total_users, 'NUMBER_OF_USERS' => commify($total_users),
'START_DATE' => $start_date, 'START_DATE' => $start_date,
'POSTS_PER_DAY' => $posts_per_day, 'POSTS_PER_DAY' => $posts_per_day,
'TOPICS_PER_DAY' => $topics_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'], 'PAGE_TITLE' => $viewcat ? $cat_title_html[$viewcat] : $lang['HOME'],
'NO_FORUMS_MSG' => $only_new ? $lang['NO_NEW_POSTS'] : $lang['NO_FORUMS'], 'NO_FORUMS_MSG' => $only_new ? $lang['NO_NEW_POSTS'] : $lang['NO_FORUMS'],
'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']), 'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], commify($stats['topiccount'])),
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']), 'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], commify($stats['postcount'])),
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']), 'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], commify($stats['usercount'])),
'TOTAL_GENDER' => $bb_cfg['gender'] ? sprintf( 'TOTAL_GENDER' => $bb_cfg['gender'] ? sprintf(
$lang['USERS_TOTAL_GENDER'], $lang['USERS_TOTAL_GENDER'],
$stats['male'], $stats['male'],

View file

@ -17,7 +17,7 @@ $data = [];
// usercount // usercount
$row = DB()->fetch_row("SELECT COUNT(*) AS usercount FROM " . BB_USERS . " WHERE user_id NOT IN(" . EXCLUDED_USERS . ")"); $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 // 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"); $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 // post/topic count
$row = DB()->fetch_row("SELECT SUM(forum_topics) AS topiccount, SUM(forum_posts) AS postcount FROM " . BB_FORUMS); $row = DB()->fetch_row("SELECT SUM(forum_topics) AS topiccount, SUM(forum_posts) AS postcount FROM " . BB_FORUMS);
$data['postcount'] = commify($row['postcount']); $data['postcount'] = (int)$row['postcount'];
$data['topiccount'] = commify($row['topiccount']); $data['topiccount'] = (int)$row['topiccount'];
// Tracker stats // Tracker stats
if ($bb_cfg['tor_stats']) { if ($bb_cfg['tor_stats']) {