editing cws as admin

This commit is contained in:
trinkey 2025-03-17 16:32:59 -04:00
parent b8c0824bda
commit ddbd3134d6
5 changed files with 37 additions and 20 deletions

View file

@ -18,7 +18,10 @@ if ($_GET["pw"] === $adminPassword) {
echo("
<h2 class=\"sect\">enter password</h2>
<form class=\"frm\" action=\"index.php\"><input id=\"passinput\" name=\"pw\" required=\"\"><br><button class=\"submitbutton\" type=\"submit\">login</button></form>
<form class=\"frm\" action=\"index.php\">
<input name=\"pw\" required=\"\"><br>
<input type=\"submit\" value=\"login\">
</form>
");
include "../boilerplate/pageEnd.php";

View file

@ -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";

View file

@ -70,15 +70,20 @@ function getQuestion(
$q .= "<h3>enter a response</h3>";
}
$q .= "
<form class=\"frm\" action=\"index.php\">
<input hidden name=\"id\" value=\"{$question['id']}\">
<input hidden name=\"page\" value=\"respond\">
<input hidden name=\"pw\" value=\"{$adminPassword}\">
<input id=\"passinput\" name=\"text\" value=\"{$question['responsetext']}\" autofocus required><br>
<button class=\"submitbutton\" type=\"submit\">send</button>
</form>
$q .= "<form class=\"frm\" action=\"index.php\">
<input hidden name=\"id\" value=\"{$question['id']}\">
<input hidden name=\"page\" value=\"respond\">
<input hidden name=\"pw\" value=\"{$adminPassword}\">
<input name=\"text\" value=\"{$question['responsetext']}\" autofocus required><br>
";
if ($question["iscwed"] === "t") {
$q .= "cw: <input name=\"cw\" value=\"{$question['cw']}\"><br>";
} else {
$q .= "cw: <input name=\"cw\"><br>";
}
$q .= "<input type=\"submit\" value=\"send\"></form>";
}
if ($includePermalink === 1) {

View file

@ -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;
}

View file

@ -38,7 +38,7 @@ if ($_GET["sent"] == 1) {
<input id="cwinput" name="cw"><br>
<input type="checkbox" id="pubbox" name="public" value="1" checked>
<label for="pubbox">if this is checked, your message will be available publicly</label><br>
<button class="submitbutton" type="submit">send!</button>
<input type="submit" value="send">
</form>
</details>
</div>