diff options
| author | ilotterytea <iltsu@alright.party> | 2025-04-28 00:58:53 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-04-28 00:58:53 +0500 |
| commit | 5ab2480c609b3f2540f5eb840e9cf3eb0589317d (patch) | |
| tree | 1933c6f206767c60515d85993bc9ef023fdd4a12 /public/emotes | |
| parent | 067348835299febed3080ab61ffca365cd07743f (diff) | |
feat: display emote's author name
Diffstat (limited to 'public/emotes')
| -rw-r--r-- | public/emotes/index.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/public/emotes/index.php b/public/emotes/index.php index c278e93..d37b3f5 100644 --- a/public/emotes/index.php +++ b/public/emotes/index.php @@ -51,12 +51,20 @@ function display_list_emotes(PDO &$db, int $page, int $limit): array $rows = $stmt->fetchAll(); foreach ($rows as $row) { + $uploader = null; + + if ($row["uploaded_by"]) { + $stmt = $db->prepare("SELECT id, username FROM users WHERE id = ?"); + $stmt->execute([$row["uploaded_by"]]); + $uploader = $stmt->fetch(PDO::FETCH_ASSOC); + } + array_push($emotes, new Emote( $row["id"], $row["code"], $row["ext"], intval(strtotime($row["created_at"])), - $row["uploaded_by"], + $uploader, $row["is_in_user_set"], $row["rating"] )); @@ -357,7 +365,8 @@ if (CLIENT_REQUIRES_JSON) { } echo '<img src="/static/userdata/emotes/' . $e->get_id() . '/2x.' . $e->get_ext() . '" alt="' . $e->get_code() . '"/>'; - echo '<p>' . $e->get_code() . '</p>'; + echo '<h1>' . $e->get_code() . '</h1>'; + echo '<p>' . ($e->get_uploaded_by() == null ? (ANONYMOUS_DEFAULT_NAME . "*") : $e->get_uploaded_by()["username"]) . '</p>'; echo '</a>'; } ?> |
