diff options
| author | ilotterytea <iltsu@alright.party> | 2025-05-02 18:35:09 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-05-02 18:35:09 +0500 |
| commit | 0c25e3dd54225b126ad8e48e10f4fbde8ce26ec5 (patch) | |
| tree | db7fc3d7c73f96a236eafd12c4255b1835ab3cdd /src/partials.php | |
| parent | 9c7e8c24f8273f70d743ae44034a01da352a88e9 (diff) | |
feat: emote approval
Diffstat (limited to 'src/partials.php')
| -rw-r--r-- | src/partials.php | 40 |
1 files changed, 30 insertions, 10 deletions
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() <?php ; $stmt = null; - if (isset($_SESSION["user_role"]) && $_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]); + 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 '' ?> - <a href="/report/list.php" class="button"> - Reports <?php echo $unread_count > 0 ? "($unread_count)" : "" ?> - </a> - <?php ; + echo '' ?> + <a href="/report/list.php" class="button"> + Reports <?php echo $unread_count > 0 ? "($unread_count)" : "" ?> + </a> + <?php ; + } + + if (MOD_SYSTEM_DASHBOARD && ($_SESSION["user_role"]["permission_approve_emotes"] || $_SESSION["user_role"]["permission_report_review"])) { + $system_count = 0; + + if ($_SESSION["user_role"]["permission_approve_emotes"] && MOD_EMOTES_APPROVE) { + $system_count += intval($db->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 '<a href="/system" class="button">System'; + if ($system_count > 0) { + echo " ($system_count)"; + } + echo '</a>'; + } } $stmt = null; |
