From 8c148952a95ee756038bc0e7afbf52f63249227f Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Wed, 30 Apr 2025 00:49:05 +0500 Subject: feat: emote visibility --- public/emotes/upload.php | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'public/emotes/upload.php') diff --git a/public/emotes/upload.php b/public/emotes/upload.php index 4e90632..5563323 100644 --- a/public/emotes/upload.php +++ b/public/emotes/upload.php @@ -70,16 +70,15 @@ if ($_SERVER['REQUEST_METHOD'] != "POST") {
- + +
- +

test

+
- @@ -162,6 +161,23 @@ if ($_SERVER['REQUEST_METHOD'] != "POST") { e.target.value = validCode; } }); + + const visibility = document.getElementById("form-visibility"); + visibility.addEventListener("change", (e) => { + set_form_visibility_description(visibility.value); + }); + + function set_form_visibility_description(visibility) { + const p = document.getElementById("form-visibility-description"); + + if (visibility == 1) { + p.innerHTML = "Emote won't appear on the public list until it passes a moderator's review. It still can be added to chats."; + } else { + p.innerHTML = "Emote doesn't appear on the public list and won't be subject to moderation checks. It still can be added to chats."; + } + } + + set_form_visibility_description(visibility.value); @@ -204,11 +220,13 @@ if (is_null(list($mime, $ext) = get_mime_and_ext($image["tmp_name"]))) { exit; } +$visibility = intval($_GET["visibility"], "0"); + // creating a new emote record $db = new PDO(DB_URL, DB_USER, DB_PASS); -$stmt = $db->prepare("INSERT INTO emotes(code, mime, ext, uploaded_by) VALUES (?, ?, ?, ?)"); -$stmt->execute([$code, $mime, $ext, $uploaded_by]); +$stmt = $db->prepare("INSERT INTO emotes(code, mime, ext, uploaded_by, visibility) VALUES (?, ?, ?, ?, ?)"); +$stmt->execute([$code, $mime, $ext, $uploaded_by, $visibility]); $id = $db->lastInsertId(); -- cgit v1.2.3