diff options
Diffstat (limited to 'public/system/emotes')
| -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 |
2 files changed, 31 insertions, 23 deletions
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; } |
