80 lines
1.6 KiB
PHP
80 lines
1.6 KiB
PHP
<?php
|
|
|
|
$id = (int)$_GET["id"];
|
|
|
|
if ($id === null) {
|
|
exit();
|
|
}
|
|
|
|
if ($_GET["text"] !== null) {
|
|
$cdate = date("Y-m-d H:i:sP");
|
|
|
|
$query = "
|
|
UPDATE data
|
|
SET \"responsetime\" = timestamptz'{$cdate}', isrespondedto = True
|
|
WHERE id = {$id};
|
|
";
|
|
|
|
$text = $_GET["text"];
|
|
$cw = $_GET["cw"];
|
|
$cwEnabled = strlen($cw) !== 0;
|
|
|
|
$parsed_response = NULL;
|
|
$parsed_cw = NULL;
|
|
|
|
if ($emojiEnabled) {
|
|
include "../boilerplate/question.php";
|
|
$parsed_response = insertEmoji($_GET["text"]);
|
|
$parsed_cw = insertEmoji($_GET["cw"]);
|
|
}
|
|
|
|
pg_query($db, $query);
|
|
pg_update(
|
|
$db, "data",
|
|
array(
|
|
"responsetext" => $text,
|
|
"parsedresponsetext" => $parsed_response,
|
|
"iscwed" => $cwEnabled,
|
|
"cw" => $cw,
|
|
"parsedcw" => $parsed_cw
|
|
),
|
|
array("id" => $id)
|
|
);
|
|
|
|
if ($fediEnabled) {
|
|
include "fedi.php";
|
|
}
|
|
|
|
header("Location: index.php?responded=1&pw={$adminPassword}");
|
|
exit();
|
|
}
|
|
|
|
$query = "
|
|
SELECT * FROM data
|
|
WHERE id = {$id};
|
|
";
|
|
|
|
$queryResponse = pg_query($db, $query);
|
|
$question = pg_fetch_array($queryResponse);
|
|
|
|
$properTitle = $pageTitle . " — respond to question #" . $id;
|
|
$CSSdownDirectory = 1;
|
|
include "../boilerplate/pageStart.php";
|
|
include "../boilerplate/question.php";
|
|
|
|
if ($question["ispublic"] === "f") {
|
|
echo("
|
|
<h2 class=\"title\">{$pageTitle} — no such question exists</h2>
|
|
<a href=\"index.php\">(go back?)</a>
|
|
");
|
|
http_response_code(404);
|
|
} else {
|
|
echo("
|
|
<h2 class=\"title\">{$pageTitle} — question number {$question['id']}</h2>
|
|
<a href=\"index.php?pw={$adminPassword}\">(go back?)</a>
|
|
");
|
|
|
|
echo(getQuestion($question, 0, 0, 1, $adminPassword));
|
|
}
|
|
|
|
?>
|