diff options
| author | ilotterytea <iltsu@alright.party> | 2025-05-15 02:13:55 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-05-15 02:13:55 +0500 |
| commit | 2e84e2a301fe270f6911f597149cd88d9dc85abe (patch) | |
| tree | f30d5ff0cde32834f827f625a2d403b2f0ad39c4 | |
| parent | 53a2e84af1ef1f35d835ef439260157038c70a46 (diff) | |
feat: mod comments
| -rw-r--r-- | public/account/login/index.php | 3 | ||||
| -rw-r--r-- | public/static/style.css | 6 | ||||
| -rw-r--r-- | public/system/emotes/index.php | 46 | ||||
| -rw-r--r-- | public/system/emotes/verdict.php (renamed from public/system/emotes/manip.php) | 8 |
4 files changed, 38 insertions, 25 deletions
diff --git a/public/account/login/index.php b/public/account/login/index.php index f9e7125..ace116d 100644 --- a/public/account/login/index.php +++ b/public/account/login/index.php @@ -85,8 +85,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { <?php if (TWITCH_REGISTRATION_ENABLE): ?> <section class="box column"> - <a href="/account/login/twitch.php" class="button purple" - style="padding:8px 24px; font-size: 18px;">Login with Twitch</a> + <a href="/account/login/twitch.php" class="button purple big">Login with Twitch</a> <p style="font-size: 12px;">Logging in via Twitch gives you the ability to use <?php echo INSTANCE_NAME ?> emotes in your Twitch chat. </p> diff --git a/public/static/style.css b/public/static/style.css index 218df1a..0abe8d0 100644 --- a/public/static/style.css +++ b/public/static/style.css @@ -262,6 +262,12 @@ button.purple:hover, background: #ac88ea; } +button.big, +.button.big { + padding: 8px 24px; + font-size: 18px; +} + /** ---------- LIST diff --git a/public/system/emotes/index.php b/public/system/emotes/index.php index eaabf4d..bcc1441 100644 --- a/public/system/emotes/index.php +++ b/public/system/emotes/index.php @@ -131,19 +131,6 @@ if (isset($_GET["id"])) { </div> </div> </section> - <!-- Emote actions --> - <section class="box items center row"> - <form action="/system/emotes/manip.php" method="post"> - <input type="text" name="id" value="<?php echo $emote["id"] ?>" style="display: none;"> - <input type="text" name="action" value="approve" style="display: none;"> - <button type="submit" class="green">Approve</button> - </form> - <form action="/system/emotes/manip.php" method="post"> - <input type="text" name="id" value="<?php echo $emote["id"] ?>" style="display: none;"> - <input type="text" name="action" value="reject" style="display: none;"> - <button type="submit" class="red">Reject</button> - </form> - </section> <!-- Emote information --> <section class="box"> <table class="vertical"> @@ -208,15 +195,26 @@ if (isset($_GET["id"])) { <?php endif; ?> </table> </section> - <!-- Mod actions on emote --> - <section class="box"> - <div class="box navtab"> - Mod actions - </div> - <div class="box content"> - <p>No one has done anything on this emote...</p> + <!-- Emote actions --> + <form action="/system/emotes/verdict.php" method="post"> + <input type="text" name="id" value="<?php echo $emote["id"] ?>" style="display: none;"> + <input type="text" name="action" value="none" id="form-action" style="display: none;"> + <div class="column small-gap"> + <noscript>JavaScript is required!!!</noscript> + <div class="box row small-gap"> + <button type="submit" class="grow green big" onclick="set_verdict('approve')">Make it + public</button> + <button type="submit" class="grow red big" onclick="set_verdict('reject')">Make it + unlisted</button> + </div> + <div class="box"> + <div class="box navtab">Comment</div> + <div class="box content"> + <textarea name="comment" id="form-comment"></textarea> + </div> + </div> </div> - </section> + </form> </section> <?php endif; ?> </section> @@ -224,4 +222,10 @@ if (isset($_GET["id"])) { </div> </body> +<script> + function set_verdict(verdict) { + document.getElementById("form-action").setAttribute("value", verdict); + } +</script> + </html>
\ No newline at end of file diff --git a/public/system/emotes/manip.php b/public/system/emotes/verdict.php index 2e8c391..df2f5ba 100644 --- a/public/system/emotes/manip.php +++ b/public/system/emotes/verdict.php @@ -49,7 +49,7 @@ if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { } } - $comment = str_safe($_POST["comment"] ?? "", EMOTE_COMMENT_MAX_LENGTH, false); + $comment = str_safe($_POST["comment"] ?? "", null, false); if ($comment == "") { $comment = null; @@ -65,11 +65,15 @@ if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { default => 'We did something with your emote "' . $row["code"] . '"' }; + if ($comment != null) { + $contents .= " Mod's comment: $comment"; + } + $db->prepare("INSERT INTO inbox_messages(recipient_id, message_type, contents, link) VALUES (?, ?, ?, ?)") ->execute([$row["uploaded_by"], "1", $contents, "/emotes?id=" . $row["id"]]); } - generate_alert("/system/emotes", 'Emote "' . $row["code"] . '" has been ' . ($verdict == 0 ? 'rejected (unlisted)' : 'approved (public)') . '!', 200); + generate_alert("/system/emotes", 'Emote "' . $row["code"] . '" has been ' . ($verdict == 0 ? 'unlisted' : 'set to public') . '!', 200); exit; } |
