diff --git a/public-legacy/manage/general/index.php b/public-legacy/manage/general/index.php index fddfdd7..05e3a10 100644 --- a/public-legacy/manage/general/index.php +++ b/public-legacy/manage/general/index.php @@ -4,16 +4,16 @@ namespace Misuzu; $statistics = DB::query(' SELECT ( - SELECT COUNT(`user_id`) + SELECT COUNT(*) FROM `msz_users` ) AS `stat_users_total`, ( - SELECT COUNT(`user_id`) + SELECT COUNT(*) FROM `msz_users` WHERE `user_deleted` IS NOT NULL ) AS `stat_users_deleted`, ( - SELECT COUNT(`user_id`) + SELECT COUNT(*) FROM `msz_users` WHERE `user_active` IS NOT NULL AND `user_deleted` IS NULL @@ -23,117 +23,117 @@ $statistics = DB::query(' FROM `msz_audit_log` ) AS `stat_audit_logs`, ( - SELECT COUNT(`change_id`) + SELECT COUNT(*) FROM `msz_changelog_changes` ) AS `stat_changelog_entries`, ( - SELECT COUNT(`category_id`) + SELECT COUNT(*) FROM `msz_comments_categories` ) AS `stat_comment_categories_total`, ( - SELECT COUNT(`category_id`) + SELECT COUNT(*) FROM `msz_comments_categories` WHERE `category_locked` IS NOT NULL ) AS `stat_comment_categories_locked`, ( - SELECT COUNT(`comment_id`) + SELECT COUNT(*) FROM `msz_comments_posts` ) AS `stat_comment_posts_total`, ( - SELECT COUNT(`comment_id`) + SELECT COUNT(*) FROM `msz_comments_posts` WHERE `comment_deleted` IS NOT NULL ) AS `stat_comment_posts_deleted`, ( - SELECT COUNT(`comment_id`) + SELECT COUNT(*) FROM `msz_comments_posts` WHERE `comment_reply_to` IS NOT NULL ) AS `stat_comment_posts_replies`, ( - SELECT COUNT(`comment_id`) + SELECT COUNT(*) FROM `msz_comments_posts` WHERE `comment_pinned` IS NOT NULL ) AS `stat_comment_posts_pinned`, ( - SELECT COUNT(`comment_id`) + SELECT COUNT(*) FROM `msz_comments_posts` WHERE `comment_edited` IS NOT NULL ) AS `stat_comment_posts_edited`, ( - SELECT COUNT(`user_id`) + SELECT COUNT(*) FROM `msz_comments_votes` WHERE `comment_vote` > 0 ) AS `stat_comment_likes`, ( - SELECT COUNT(`user_id`) + SELECT COUNT(*) FROM `msz_comments_votes` WHERE `comment_vote` < 0 ) AS `stat_comment_dislikes`, ( - SELECT COUNT(`post_id`) + SELECT COUNT(*) FROM `msz_forum_posts` ) AS `stat_forum_posts_total`, ( - SELECT COUNT(`post_id`) + SELECT COUNT(*) FROM `msz_forum_posts` WHERE `post_deleted` IS NOT NULL ) AS `stat_forum_posts_deleted`, ( - SELECT COUNT(`post_id`) + SELECT COUNT(*) FROM `msz_forum_posts` WHERE `post_edited` IS NOT NULL ) AS `stat_forum_posts_edited`, ( - SELECT COUNT(`post_id`) + SELECT COUNT(*) FROM `msz_forum_posts` WHERE `post_parse` = 0 ) AS `stat_forum_posts_plain`, ( - SELECT COUNT(`post_id`) + SELECT COUNT(*) FROM `msz_forum_posts` WHERE `post_parse` = 1 ) AS `stat_forum_posts_bbcode`, ( - SELECT COUNT(`post_id`) + SELECT COUNT(*) FROM `msz_forum_posts` WHERE `post_parse` = 2 ) AS `stat_forum_posts_markdown`, ( - SELECT COUNT(`post_id`) + SELECT COUNT(*) FROM `msz_forum_posts` WHERE `post_display_signature` != 0 ) AS `stat_forum_posts_signature`, ( - SELECT COUNT(`topic_id`) + SELECT COUNT(*) FROM `msz_forum_topics` ) AS `stat_forum_topics_total`, ( - SELECT COUNT(`topic_id`) + SELECT COUNT(*) FROM `msz_forum_topics` WHERE `topic_type` = 0 ) AS `stat_forum_topics_normal`, ( - SELECT COUNT(`topic_id`) + SELECT COUNT(*) FROM `msz_forum_topics` WHERE `topic_type` = 1 ) AS `stat_forum_topics_pinned`, ( - SELECT COUNT(`topic_id`) + SELECT COUNT(*) FROM `msz_forum_topics` WHERE `topic_type` = 2 ) AS `stat_forum_topics_announce`, ( - SELECT COUNT(`topic_id`) + SELECT COUNT(*) FROM `msz_forum_topics` WHERE `topic_type` = 3 ) AS `stat_forum_topics_global_announce`, ( - SELECT COUNT(`topic_id`) + SELECT COUNT(*) FROM `msz_forum_topics` WHERE `topic_deleted` IS NOT NULL ) AS `stat_forum_topics_deleted`, ( - SELECT COUNT(`topic_id`) + SELECT COUNT(*) FROM `msz_forum_topics` WHERE `topic_locked` IS NOT NULL ) AS `stat_forum_topics_locked`, @@ -147,18 +147,35 @@ $statistics = DB::query(' WHERE `attempt_success` = 0 ) AS `stat_login_attempts_failed`, ( - SELECT COUNT(`session_id`) + SELECT COUNT(*) FROM `msz_sessions` ) AS `stat_user_sessions`, ( - SELECT COUNT(`user_id`) + SELECT COUNT(*) FROM `msz_users_password_resets` ) AS `stat_user_password_resets`, ( - SELECT COUNT(`warning_id`) - FROM `msz_user_warnings` - WHERE `warning_type` != 0 - ) AS `stat_user_warnings` + SELECT COUNT(*) + FROM `msz_users_modnotes` + ) AS `stat_user_modnotes`, + ( + SELECT COUNT(*) + FROM `msz_users_warnings` + ) AS `stat_user_warnings_total`, + ( + SELECT COUNT(*) + FROM `msz_users_warnings` + WHERE warn_created > NOW() - INTERVAL 90 DAY + ) AS `stat_user_warnings_visible`, + ( + SELECT COUNT(*) + FROM `msz_users_bans` + ) AS `stat_user_bans_total`, + ( + SELECT COUNT(*) + FROM `msz_users_bans` + WHERE ban_expires IS NULL OR ban_expires > NOW() + ) AS `stat_user_bans_active` ')->fetch(); Template::render('manage.general.overview', [ diff --git a/templates/manage/general/overview.twig b/templates/manage/general/overview.twig index 9d13330..33ab1bc 100644 --- a/templates/manage/general/overview.twig +++ b/templates/manage/general/overview.twig @@ -34,7 +34,11 @@ 'stat_login_attempts_failed': 'Failed Login Attempts', 'stat_user_sessions': 'Active User Sessions', 'stat_user_password_resets': 'Pending Password Resets', - 'stat_user_warnings': 'User Warnings', + 'stat_user_modnotes': 'Moderator Notes', + 'stat_user_warnings_total': 'Total User Warnings', + 'stat_user_warnings_visible': 'Visible User Warnings', + 'stat_user_bans_total': 'Total User Bans', + 'stat_user_bans_active': 'Active User Bans', } %} {% block manage_content %}