diff options
| author | ilotterytea <iltsu@alright.party> | 2025-04-27 21:12:02 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-04-27 21:12:02 +0500 |
| commit | 9f1906c4cbb9878c5888723b7923fa8e4bebb51f (patch) | |
| tree | 25f838ee0bb91f2a14d061906dde96967dd72a95 /src/partials.php | |
| parent | 00ab9aeaf0eac4c82e6480faee70add916db514f (diff) | |
feat: roles
Diffstat (limited to 'src/partials.php')
| -rw-r--r-- | src/partials.php | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/partials.php b/src/partials.php index 2e7ee56..0b21b50 100644 --- a/src/partials.php +++ b/src/partials.php @@ -11,7 +11,9 @@ function html_navigation_bar() <a href="/emotes" class="button">Emotes</a> <a href="/emotesets.php" class="button">Emotesets</a> <a href="/users.php" class="button">Users</a> - <a href="/emotes/upload.php" class="button">Upload</a> + <?php if (ANONYMOUS_UPLOAD || (isset($_SESSION["user_role"]) && $_SESSION["user_role"]["permission_upload"])) { + echo '<a href="/emotes/upload.php" class="button">Upload</a>'; + } ?> <a href="/account" class="button">Account</a> <?php if (isset($_SESSION["user_id"])) { @@ -28,18 +30,20 @@ function html_navigation_bar() <?php ; $stmt = null; - // 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 ; - $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]); + echo '' ?> + <a href="/report/list.php" class="button"> + Reports <?php echo $unread_count > 0 ? "($unread_count)" : "" ?> + </a> + <?php ; + } + $stmt = null; $db = null; } ?> |
