summaryrefslogtreecommitdiff
path: root/public/emotesets.php
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-28 00:58:53 +0500
committerilotterytea <iltsu@alright.party>2025-04-28 00:58:53 +0500
commit5ab2480c609b3f2540f5eb840e9cf3eb0589317d (patch)
tree1933c6f206767c60515d85993bc9ef023fdd4a12 /public/emotesets.php
parent067348835299febed3080ab61ffca365cd07743f (diff)
feat: display emote's author name
Diffstat (limited to 'public/emotesets.php')
-rw-r--r--public/emotesets.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/public/emotesets.php b/public/emotesets.php
index 69df158..ebec077 100644
--- a/public/emotesets.php
+++ b/public/emotesets.php
@@ -55,6 +55,13 @@ if ($id == "global") {
$stmt->execute([$e["id"]]);
$e["emotes"] = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ foreach ($e["emotes"] as &$em) {
+ if ($em["uploaded_by"]) {
+ $stmt = $db->prepare("SELECT id, username FROM users WHERE id = ?");
+ $stmt->execute([$em["uploaded_by"]]);
+ $em["uploaded_by"] = $stmt->fetch(PDO::FETCH_ASSOC);
+ }
+ }
}
} else if (intval($alias_id) > 0) {
$alias_id = intval($alias_id);
@@ -96,6 +103,13 @@ if ($id == "global") {
$stmt->execute([$emote_set["id"]]);
$emote_set["emotes"] = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ foreach ($emote_set["emotes"] as &$e) {
+ if ($e["uploaded_by"]) {
+ $stmt = $db->prepare("SELECT id, username FROM users WHERE id = ?");
+ $stmt->execute([$e["uploaded_by"]]);
+ $e["uploaded_by"] = $stmt->fetch(PDO::FETCH_ASSOC);
+ }
+ }
}
}
@@ -175,7 +189,8 @@ if (CLIENT_REQUIRES_JSON) {
foreach ($emote_set["emotes"] as $emote_row) {
echo '<a class="box emote" href="/emotes?id=' . $emote_row["id"] . '">';
echo '<img src="/static/userdata/emotes/' . $emote_row["id"] . '/2x.' . $emote_row["ext"] . '" alt="' . $emote_row["code"] . '"/>';
- echo '<p>' . $emote_row["code"] . '</p>';
+ echo '<h1>' . $emote_row["code"] . '</h1>';
+ echo '<p>' . ($emote_row["uploaded_by"] == null ? (ANONYMOUS_DEFAULT_NAME . "*") : $emote_row["uploaded_by"]["username"]) . '</p>';
echo '</a>';
}
}