summaryrefslogtreecommitdiff
path: root/src/emote.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/emote.php')
-rw-r--r--src/emote.php26
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