summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-12-09 16:50:07 +0500
committerilotterytea <iltsu@alright.party>2025-12-09 16:50:07 +0500
commit8925a9526a1d3eac914030b3069713f56c37e55a (patch)
tree2811f088ab13168658d8ac8ba9f15d01ffb49249 /lib
parent77c7d534f46392f62b56305ec8b71eecff3b9221 (diff)
feat: emoteset editors
Diffstat (limited to 'lib')
-rw-r--r--lib/emote.php13
-rw-r--r--lib/partials.php2
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/emote.php b/lib/emote.php
index a724914..38e4f01 100644
--- a/lib/emote.php
+++ b/lib/emote.php
@@ -107,7 +107,7 @@ class Emoteset
public string $id;
public string $name;
public User|null $owner;
- public array $emotes;
+ public array $emotes, $editors;
public bool $is_default;
@@ -119,6 +119,7 @@ class Emoteset
$s->name = $arr["name"];
$s->owner = $arr["owner_id"];
$s->emotes = $arr["emotes"] ?? [];
+ $s->editors = $arr["editors"] ?? [];
$s->is_default = $arr["is_default"] ?? false;
return $s;
@@ -132,6 +133,14 @@ class Emoteset
$arr["emotes"] = fetch_all_emotes_from_emoteset($db, $arr["id"], $user_id);
+ $stmt = $db->prepare('SELECT u.id, u.username FROM users u
+ INNER JOIN emote_sets es ON es.id = ?
+ INNER JOIN acquired_emote_sets aes ON aes.emote_set_id = es.id
+ WHERE aes.user_id = u.id
+ ');
+ $stmt->execute([$arr["id"]]);
+ $arr["editors"] = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
return Emoteset::from_array($arr);
}
@@ -281,7 +290,7 @@ function html_display_emotes(array $emotes, int $scale = 3)
function html_display_emoteset(array $emotesets)
{
foreach ($emotesets as $es) {
- echo "<a href='/emotesets.php?id={$es->id}' class='box column small-gap'>";
+ echo "<a href='/emotesets/?id={$es->id}' class='box column small-gap'>";
echo '<div>';
echo "<p>$es->name</p>";
diff --git a/lib/partials.php b/lib/partials.php
index 60d1325..71a429a 100644
--- a/lib/partials.php
+++ b/lib/partials.php
@@ -13,7 +13,7 @@ function html_navigation_bar()
<a href="/emotes" class="button">Emotes</a>
<?php if (CONFIG['emoteset']['public']): ?>
- <a href="/emotesets.php" class="button">Emotesets</a>
+ <a href="/emotesets/" class="button">Emotesets</a>
<?php endif; ?>
<?php if (CONFIG['account']['publiclist']): ?>