summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-20 18:02:53 +0500
committerilotterytea <iltsu@alright.party>2025-04-20 18:02:53 +0500
commitac5b69edf724d164c2150dfc96129335b9225299 (patch)
tree3968df45db02ff04f9a266bee8d47a9136811e91 /src
parentac515bdb95db1b3628381a7356dbae1d2715e0a8 (diff)
feat: emote addition
Diffstat (limited to 'src')
-rw-r--r--src/emotes/single_page.php33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/emotes/single_page.php b/src/emotes/single_page.php
index 900003c..b76fda8 100644
--- a/src/emotes/single_page.php
+++ b/src/emotes/single_page.php
@@ -17,6 +17,7 @@ include_once "../../src/config.php";
<?php html_navigation_search(); ?>
</section>
<section class="content">
+ <?php display_alert() ?>
<section class="box">
<div class="box navtab">
Emote - <?php echo $emote->get_code() ?>
@@ -37,11 +38,33 @@ include_once "../../src/config.php";
<?php if (isset($_SESSION["user_id"])) {
echo '' ?>
<div class="items row left full">
- <form action="/emotes/add.php" method="POST">
- <input type="text" name="id" value="<?php echo $emote->get_id() ?>"
- style="display: none;">
- <button type="submit" class="green">Add to my channel</button>
- </form>
+ <?php
+ $db = new PDO(DB_URL, DB_USER, DB_PASS);
+ $added = false;
+
+ if (isset($_SESSION["user_emote_set_id"])) {
+ $stmt = $db->prepare("SELECT id FROM emote_set_contents WHERE emote_set_id = ? AND emote_id = ?");
+ $stmt->execute([$_SESSION["user_emote_set_id"], $emote->get_id()]);
+ $added = $stmt->rowCount() > 0;
+ }
+
+ $db = null;
+ ?>
+ <?php
+ if ($added) { ?>
+ <form action="/emotes/remove.php" method="POST">
+ <input type="text" name="id" value="<?php echo $emote->get_id() ?>"
+ style="display: none;">
+ <button type="submit" class="red">Remove from my channel</button>
+ </form><?php
+ } else { ?>
+ <form action="/emotes/add.php" method="POST">
+ <input type="text" name="id" value="<?php echo $emote->get_id() ?>"
+ style="display: none;">
+ <button type="submit" class="green">Add to my channel</button>
+ </form><?php
+ }
+ ?>
</div>
<div class="items row right full">
<form action="/emotes/rate.php" method="POST">