58 lines
2 KiB
PHP
58 lines
2 KiB
PHP
<?php
|
||
|
||
include 'config.php';
|
||
|
||
$query = "
|
||
SELECT * FROM data;
|
||
";
|
||
|
||
$qresp = pg_query($db, $query);
|
||
|
||
$rows = pg_fetch_all($qresp);
|
||
|
||
$properTitle = $pageTitle . " – all messages";
|
||
|
||
include 'boilerplate/pageStart.php';
|
||
|
||
echo("<link rel=\"stylesheet\" href=\"css/main.css\">");
|
||
|
||
echo("<h2 class=\"title\">" . $pageTitle . "</h2>");
|
||
|
||
if ($pageDomainEnabled) {
|
||
echo("<a class=\"goback\" href=\"https://{$pageDomainOther}{$pageRoot}\">(go back to " . $pageDomain . "?)</a>");
|
||
}
|
||
|
||
if ($_GET["sent"] == 1) {
|
||
echo("<span class=\"sentconf\"><br>message sent!</span>");
|
||
}
|
||
|
||
echo("<div class=\"sendmsg\"><details open=\"\"><summary class=\"sendsum\">send a message!</summary>");
|
||
|
||
echo("<form class=\"frm\" action=\"send.php\"><label for=\"questioninput\">enter your message: </label><input id=\"questioninput\" name=\"text\" required=\"\"><br><label for=\"cwinput\">cw if applicable: </label><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></form></details></div>");
|
||
|
||
echo("<hr>");
|
||
|
||
echo("<h3 class=\"sect\">all past messages</h3>");
|
||
|
||
asort($rows);
|
||
|
||
foreach (array_reverse($rows) as $i){
|
||
if ($i["ispublic"] === "t" && $i["isrespondedto"] === "t") {
|
||
echo("<div class=\"question\">");
|
||
if ($i["iscwed"] === "t") {
|
||
echo("<details><summary>cw: " . htmlspecialchars($i["cw"]) . "</summary><span class=\"cwfiller\"></span>");
|
||
}
|
||
echo(htmlspecialchars($i["text"]));
|
||
echo("<div class=\"time\">" . $i["time"] . "</div>");
|
||
echo("<div class=\"response\">" . htmlspecialchars($i["responsetext"]) . "");
|
||
echo("<div class=\"time\">" . $i["responsetime"] . "</div></div>");
|
||
echo("<a class=\"permalink\" href=\"fetch.php?id=" . $i["id"] . "\">permalink</a>");
|
||
if ($i["iscwed"] === "t") {
|
||
echo("</details></div>");
|
||
} else {
|
||
echo("</div>");
|
||
}
|
||
}
|
||
}
|
||
|
||
?>
|