From ddbd3134d6dc1da7f1a295ba1638d37a9ac27d87 Mon Sep 17 00:00:00 2001 From: trinkey Date: Mon, 17 Mar 2025 16:32:59 -0400 Subject: [PATCH] editing cws as admin --- admin/index.php | 5 ++++- admin/respond.php | 13 ++++++++++++- boilerplate/question.php | 21 +++++++++++++-------- css/base.css | 16 +++++++--------- index.php | 2 +- 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/admin/index.php b/admin/index.php index 85ebfb6..9952a9d 100644 --- a/admin/index.php +++ b/admin/index.php @@ -18,7 +18,10 @@ if ($_GET["pw"] === $adminPassword) { echo("

enter password

-

+
+
+ +
"); include "../boilerplate/pageEnd.php"; diff --git a/admin/respond.php b/admin/respond.php index ea9a49e..9ea8fb6 100644 --- a/admin/respond.php +++ b/admin/respond.php @@ -16,8 +16,19 @@ if ($_GET["text"] !== null) { WHERE id = {$id}; "; + $cw = $_GET["cw"]; + $cwEnabled = strlen($cw) !== 0; + pg_query($db, $query); - pg_update($db, "data", array("responsetext" => $text), array("id" => $id)); + pg_update( + $db, "data", + array( + "responsetext" => $text, + "iscwed" => $cwEnabled, + "cw" => $cw + ), + array("id" => $id) + ); if ($fediEnabled) { include "fedi.php"; diff --git a/boilerplate/question.php b/boilerplate/question.php index a8dcca3..f7afd0c 100644 --- a/boilerplate/question.php +++ b/boilerplate/question.php @@ -70,15 +70,20 @@ function getQuestion( $q .= "

enter a response

"; } - $q .= " -
- - - -
- -
+ $q .= "
+ + + +
"; + + if ($question["iscwed"] === "t") { + $q .= "cw:
"; + } else { + $q .= "cw:
"; + } + + $q .= "
"; } if ($includePermalink === 1) { diff --git a/css/base.css b/css/base.css index 135935e..95aa011 100644 --- a/css/base.css +++ b/css/base.css @@ -102,24 +102,22 @@ img.emoji { padding: .7em; } -#passinput, -#questioninput, -#cwinput, -.submitbutton { +input:not( + [type="checkbox"] +) { background-color: var(--input-background); color: var(--input-text); margin-bottom: .3em; border: var(--input-border); } -#passinput:focus, -#questioninput:focus, -#cwinput:focus, -.submitbutton:focus { +input:not( + [type="checkbox"] +):focus { outline: var(--input-focus-outline); } -.submitbutton { +input[type="submit"] { font-size: 1.17em; margin-top: .3em; } diff --git a/index.php b/index.php index c11021f..def1016 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,7 @@ if ($_GET["sent"] == 1) {

- +