blob: 0b21b505816c5d958be17601c620712106e24026 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
<?php
function html_navigation_bar()
{
echo '' ?>
<section class="navbar">
<a href="/" class="brand" style="color:black;text-decoration:none;">
<img src="/static/img/brand/mini.webp" alt="">
<h2 style="margin-left:8px;font-size:24px;"><b><?php echo "alright.party" ?></b></h2>
</a>
<div class="links">
<a href="/emotes" class="button">Emotes</a>
<a href="/emotesets.php" class="button">Emotesets</a>
<a href="/users.php" class="button">Users</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"])) {
$db = new PDO(DB_URL, DB_USER, DB_PASS);
// getting inbox
$stmt = $db->prepare("SELECT COUNT(*) FROM inbox_messages WHERE recipient_id = ? AND has_read = false");
$stmt->execute([$_SESSION["user_id"]]);
$unread_count = intval($stmt->fetch()[0]);
echo '' ?>
<a href="/inbox.php" class="button">
Inbox <?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;
}
?>
</div>
<?php
if (isset($_SESSION["user_id"])) {
echo '' ?>
<a href="/users.php?id=<?php echo $_SESSION["user_id"] ?>" class="links" style="margin-left:auto;">
Signed in as <?php echo $_SESSION["user_name"] ?> <img
src="/static/userdata/avatars/<?php echo $_SESSION["user_id"] ?>" width="24" height="24" />
</a>
<?php ;
}
?>
</section>
<?php ;
}
function html_navigation_search()
{
echo '' ?>
<section class="box">
<div class="box navtab">
Search...
</div>
<div class="box content">
<form action="<?php echo $_SERVER["REQUEST_URI"] ?>" method="GET">
<input type="text" name="q" style="padding:4px;" value="<?php echo $_GET["q"] ?? "" ?>"><br>
<?php
if (str_starts_with($_SERVER["REQUEST_URI"], "/emotes")) {
?>
<label for="sort_by">Sort by</label>
<select name="sort_by">
<option value="high_ratings" <?php echo ($_GET["sort_by"] ?? "") == "high_ratings" ? "selected" : "" ?>>
High ratings</option>
<option value="low_ratings" <?php echo ($_GET["sort_by"] ?? "") == "low_ratings" ? "selected" : "" ?>>Low
ratings</option>
<option value="recent" <?php echo ($_GET["sort_by"] ?? "") == "recent" ? "selected" : "" ?>>Recent
</option>
<option value="oldest" <?php echo ($_GET["sort_by"] ?? "") == "oldest" ? "selected" : "" ?>>Oldest
</option>
</select>
<?php
}
?>
<button type="submit" style="width:100%;margin-top:6px;">Find</button>
</form>
</div>
</section>
<?php ;
}
|