diff options
| author | ilotterytea <iltsu@alright.party> | 2025-04-30 01:25:44 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-04-30 01:25:44 +0500 |
| commit | ef16637d0f6822f326266f50b496f294ecd53cba (patch) | |
| tree | 7e7353e8fab299a53fff0282f8a2f816a728f000 /src | |
| parent | ea85d9383460d1957158b023b3b3647d3026687f (diff) | |
feat: featured emotes
Diffstat (limited to 'src')
| -rw-r--r-- | src/emote.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/emote.php b/src/emote.php index 42cd2ac..769d62a 100644 --- a/src/emote.php +++ b/src/emote.php @@ -65,7 +65,7 @@ class Emote function html_random_emote(PDO &$db) { - $stmt = $db->prepare("SELECT id, ext, code FROM emotes WHERE visibility = 1 ORDER BY RAND() LIMIT 1"); + $stmt = $db->prepare("SELECT id, ext, code FROM emotes WHERE visibility = 1 AND is_featured = false ORDER BY RAND() LIMIT 1"); $stmt->execute(); if ($row = $stmt->fetch()) { @@ -85,4 +85,28 @@ function html_random_emote(PDO &$db) <?php ; } +} + +function html_featured_emote(PDO &$db) +{ + $stmt = $db->prepare("SELECT id, ext, code FROM emotes WHERE visibility = 1 AND is_featured = true ORDER BY updated_at DESC LIMIT 1"); + $stmt->execute(); + + if ($row = $stmt->fetch()) { + echo '' + ?> + <section class="box" id="box-featured-emote"> + <div class="box navtab"> + <p>Featured emote</p> + </div> + <div class="box content center"> + <a href="/emotes?id=<?php echo $row["id"] ?>"> + <img src="/static/userdata/emotes/<?php echo $row["id"] . '/3x.' . $row["ext"] ?>" + alt="<?php echo $row["code"] ?>" width="192"> + </a> + </div> + </section> + <?php + ; + } }
\ No newline at end of file |
