summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-22 22:39:58 +0500
committerilotterytea <iltsu@alright.party>2025-04-22 22:39:58 +0500
commit999bfa6cad76900d4550e00e8e29f0252fb006b5 (patch)
tree3c13a1fb18f95fceff320ae1086318ab9c53d913 /public
parent0e261a67be8f770d7a3d4ca8d9bc12c02dd2b93a (diff)
feat: inbox system
Diffstat (limited to 'public')
-rw-r--r--public/inbox.php76
-rw-r--r--public/static/img/icons/inbox/0.pngbin0 -> 587 bytes
-rw-r--r--public/static/img/icons/inbox/1.pngbin0 -> 781 bytes
-rw-r--r--public/static/img/icons/inbox/2.pngbin0 -> 641 bytes
4 files changed, 76 insertions, 0 deletions
diff --git a/public/inbox.php b/public/inbox.php
new file mode 100644
index 0000000..878bfe4
--- /dev/null
+++ b/public/inbox.php
@@ -0,0 +1,76 @@
+<?php
+include_once "../src/accounts.php";
+include_once "../src/config.php";
+include_once "../src/partials.php";
+include_once "../src/utils.php";
+
+if (!authorize_user(true)) {
+ exit;
+}
+
+$db = new PDO(DB_URL, DB_USER, DB_PASS);
+
+$stmt = $db->prepare("SELECT * FROM inbox_messages WHERE recipient_id = ? ORDER BY sent_at DESC");
+$stmt->execute([$_SESSION["user_id"]]);
+
+$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+$stmt = $db->prepare("UPDATE inbox_messages SET has_read = true WHERE recipient_id = ?");
+$stmt->execute([$_SESSION["user_id"]]);
+
+?>
+
+<html>
+
+<head>
+ <title>Inbox - alright.party</title>
+ <link rel="stylesheet" href="/static/style.css">
+</head>
+
+<body>
+ <div class="container">
+ <div class="wrapper">
+ <?php html_navigation_bar() ?>
+ <section class="content">
+ <section class="box" style="width: 50%;">
+ <section class="box navtab">
+ Inbox
+ </section>
+ <section class="box content">
+ <table>
+ <tr>
+ <th style="width: 16px;"></th>
+ <th>Contents</th>
+ <th style="min-width: 96px;"></th>
+ </tr>
+ <?php
+ foreach ($messages as $message) {
+ echo '<tr';
+ if (!$message["has_read"]) {
+ echo ' style="background-color: yellow;"';
+ }
+ echo '>';
+
+ echo '<td><img src="/static/img/icons/inbox/' . $message["message_type"] . '.png"></td>';
+ echo '<td>' . $message["contents"];
+ echo ' <span style="font-size:12px; color: gray;">(' . format_timestamp(time() - strtotime($message["sent_at"])) . ' ago)</span>';
+ echo '</td>';
+
+ echo '<td style="text-align:center;">';
+ if ($message["link"]) {
+ echo '<a href="' . $message["link"] . '">[ View ]</a>';
+ }
+ echo '</td>';
+
+ echo '</tr>';
+ }
+ ?>
+ </table>
+ </section>
+ </section>
+ </section>
+ </div>
+ </div>
+</body>
+
+</html> \ No newline at end of file
diff --git a/public/static/img/icons/inbox/0.png b/public/static/img/icons/inbox/0.png
new file mode 100644
index 0000000..c149c2b
--- /dev/null
+++ b/public/static/img/icons/inbox/0.png
Binary files differ
diff --git a/public/static/img/icons/inbox/1.png b/public/static/img/icons/inbox/1.png
new file mode 100644
index 0000000..89c8129
--- /dev/null
+++ b/public/static/img/icons/inbox/1.png
Binary files differ
diff --git a/public/static/img/icons/inbox/2.png b/public/static/img/icons/inbox/2.png
new file mode 100644
index 0000000..7348aed
--- /dev/null
+++ b/public/static/img/icons/inbox/2.png
Binary files differ