From c474b61f3c741e86a3273b2f4c2017de05eb1085 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 20 Apr 2025 10:48:08 +0500 Subject: feat: show emote uploader --- public/emotes/index.php | 8 +++-- src/emote.php | 9 ++++- src/emotes/single_page.php | 83 +++++++++++++++++++++++++++++++--------------- 3 files changed, 70 insertions(+), 30 deletions(-) diff --git a/public/emotes/index.php b/public/emotes/index.php index c73b3d0..b603cc0 100644 --- a/public/emotes/index.php +++ b/public/emotes/index.php @@ -1,5 +1,7 @@ id = $id; $this->code = $code; $this->ext = $ext; $this->created_at = $created_at; + $this->uploaded_by = $uploaded_by; } function get_id() @@ -33,4 +35,9 @@ class Emote { return $this->created_at; } + + function get_uploaded_by() + { + return $this->uploaded_by; + } } diff --git a/src/emotes/single_page.php b/src/emotes/single_page.php index db4f332..fb87789 100644 --- a/src/emotes/single_page.php +++ b/src/emotes/single_page.php @@ -31,31 +31,40 @@
-
-
- - -
-
-
-
- - - -
-
- - - -
- Report - emote -
+ +
+
+ + +
+
+
+
+ + + +
+
+ + + +
+ Report + emote +
+ +

Log in to get additional features...

+
@@ -63,8 +72,28 @@ Uploader ' . "someone" . ', '; - echo date("d M Y", $emote->get_created_at()); + $username = "anonymous"; + $link = "#"; + + if ($emote->get_uploaded_by()) { + $db = new SQLite3("../../database.db"); + $stmt = $db->prepare("SELECT username FROM users WHERE id = :id"); + $stmt->bindValue(":id", $emote->get_uploaded_by()); + $results = $stmt->execute(); + + if ($row = $results->fetchArray()) { + $username = $row["username"]; + $link = "/users/" . $emote->get_uploaded_by(); + } + + $db->close(); + } + + echo ""; + echo $username; + echo ""; + + echo ", " . date("d M Y", $emote->get_created_at()); ?> -- cgit v1.2.3