From 0c25e3dd54225b126ad8e48e10f4fbde8ce26ec5 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Fri, 2 May 2025 18:35:09 +0500 Subject: feat: emote approval --- src/partials.php | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'src/partials.php') diff --git a/src/partials.php b/src/partials.php index 9b02a7b..2a560df 100644 --- a/src/partials.php +++ b/src/partials.php @@ -30,17 +30,37 @@ function html_navigation_bar() prepare("SELECT COUNT(*) FROM reports WHERE sender_id = ? AND resolved_by IS NULL"); - $stmt->execute([$_SESSION["user_id"]]); - $unread_count = intval($stmt->fetch()[0]); + if (isset($_SESSION["user_role"])) { + if ($_SESSION["user_role"]["permission_report"]) { + // getting reports + $stmt = $db->prepare("SELECT COUNT(*) FROM reports WHERE sender_id = ? AND resolved_by IS NULL"); + $stmt->execute([$_SESSION["user_id"]]); + $unread_count = intval($stmt->fetch()[0]); - echo '' ?> - - Reports 0 ? "($unread_count)" : "" ?> - - + + Reports 0 ? "($unread_count)" : "" ?> + + query("SELECT COUNT(*) FROM emotes WHERE visibility = 2")->fetch()[0]); + } + + if ($_SESSION["user_role"]["permission_report_review"]) { + $system_count += intval($db->query("SELECT COUNT(*) FROM reports WHERE resolved_by IS NULL")->fetch()[0]); + } + + echo 'System'; + if ($system_count > 0) { + echo " ($system_count)"; + } + echo ''; + } } $stmt = null; -- cgit v1.2.3