svrjs-mods-directory/moderation/index.php
2024-12-27 15:05:54 +01:00

78 lines
No EOL
3 KiB
PHP

<?php
define("SVRJS_MOD_DIRECTORY", null);
define("SVRJS_MOD_DIRECTORY_MODERATION", null);
include '../config.php';
$appModerationRoot = dirname($_SERVER['SCRIPT_NAME']);
if ($appModerationRoot[strlen($appModerationRoot) - 1] != "/") $appModerationRoot = $appModerationRoot . '/';
$appRoot = dirname($_SERVER['SCRIPT_NAME'], 2);
if ($appRoot[strlen($appRoot) - 1] != "/") $appRoot = $appRoot . '/';
define('APP_ROOT', $appRoot);
define('APP_FSROOT', dirname(__FILE__, 2));
define('APP_MODERATION_FILENAME', basename($_SERVER['SCRIPT_NAME']));
define('APP_MODERATION_ROOT', $appModerationRoot);
include '../vendor/autoload.php';
include '../includes/init.php';
include '../includes/moderation_init.php';
include '../includes/moderation_header.php';
?>
<h1>Welcome to the SVR.JS Mods moderation panel!</h1>
<p>Navigate to one of the sections in SVR.JS Mods moderation panel.</p>
<h2>Statistics</h2>
<ul>
<?php
$activeUsersResult = $connection->query("SELECT COUNT(id) AS count FROM users WHERE is_suspended = 0 AND is_verified = 1 AND is_deleted = 0");
if (!$activeUsersResult) {
echo "<li>An unexcepted error occurred when fetching the active user count.</li>";
} else {
$activeUsersRow = $activeUsersResult->fetch_assoc();
if (!$activeUsersRow || is_null($activeUsersRow['count'])) {
echo "<li>An unexcepted error occurred when fetching the active user count.</li>";
} else {
echo "<li><strong>Active users:</strong> " . htmlspecialchars($activeUsersRow['count']) . "</li>";
}
}
$pendingModsResult = $connection->query("SELECT
COUNT(mods_pending.id) AS count
FROM mods_pending
JOIN users ON users.id = mods_pending.user
WHERE mods_pending.is_rejected = 0
AND users.is_suspended = 0
AND users.is_verified = 1
AND users.is_deleted = 0");
if (!$pendingModsResult) {
echo "<li>An unexcepted error occurred when fetching the pending mod count.</li>";
} else {
$pendingModsRow = $pendingModsResult->fetch_assoc();
if (!$pendingModsRow || is_null($pendingModsRow['count'])) {
echo "<li>An unexcepted error occurred when fetching the pending mod count.</li>";
} else {
echo "<li><strong>Pending mods:</strong> " . htmlspecialchars($pendingModsRow['count']) . "</li>";
}
}
$listedModsResult = $connection->query("SELECT
COUNT(mods.id) AS count
FROM mods
JOIN users ON users.id = mods.user
WHERE mods.is_removed = 0
AND users.is_suspended = 0
AND users.is_verified = 1
AND users.is_deleted = 0");
if (!$listedModsResult) {
echo "<li>An unexcepted error occurred when fetching the listed mod count.</li>";
} else {
$listedModsRow = $listedModsResult->fetch_assoc();
if (!$listedModsRow || is_null($listedModsRow['count'])) {
echo "<li>An unexcepted error occurred when fetching the listed mod count.</li>";
} else {
echo "<li><strong>Listed mods:</strong> " . htmlspecialchars($listedModsRow['count']) . "</li>";
}
}
?>
</ul>
<?php
include '../includes/moderation_footer.php';
include '../includes/moderation_final.php';
include '../includes/final.php';
?>