diff --git a/TODO.md b/TODO.md
new file mode 100644
index 0000000..5e8b63e
--- /dev/null
+++ b/TODO.md
@@ -0,0 +1,4 @@
+- modifying whether a cw is used or not?
+- POSSIBLY editing messages / changing their visibility? idk
+- some way to automatically get notified
+- some way to automatically post to fedi on response
\ No newline at end of file
diff --git a/admin/all.php b/admin/all.php
index 7c62451..84ae68a 100644
--- a/admin/all.php
+++ b/admin/all.php
@@ -11,54 +11,64 @@ $rows = pg_fetch_all($qresp);
$totalUnresponded = 0;
$totalPriv = 0;
$totalRespondedPub = 0;
-for ($i=count($rows); $i>=0; $i--) {
- if ($rows[$i]["isrespondedto"] === "f" && $rows[$i]["ispublic"] === "t") {
+foreach (array_reverse($rows) as $i) {
+ if ($i["isrespondedto"] === "f" && $i["ispublic"] === "t") {
$totalUnresponded++;
- } else if ($rows[$i]["ispublic"] === "f") {
+ } else if ($i["ispublic"] === "f") {
$totalPriv++;
} else {
$totalRespondedPub++;
}
}
+echo("
" . $pageTitle . " – admin
");
+
+if ($_GET["deleted"] == 1) {
+ echo("deleted!");
+}
+
+if ($_GET["responded"] == 1) {
+ echo("response sent!");
+}
+
echo("not responded to ({$totalUnresponded})
");
-for ($i=count($rows); $i>=0; $i--) {
- if ($rows[$i]["isrespondedto"] === "f" && $rows[$i]["ispublic"] == "t") {
+foreach (array_reverse($rows) as $i){
+ if ($i["isrespondedto"] === "f" && $i["ispublic"] == "t") {
echo("");
- if ($rows[$i]["iscwed"] === "t") {
- echo("
cw: " . $rows[$i]["cw"] . "
");
+ if ($i["iscwed"] === "t") {
+ echo("cw: " . $i["cw"] . "
");
}
- echo(htmlspecialchars($rows[$i]["text"]));
- echo("" . $rows[$i]["time"] . "
");
- echo("edit / respond / delete ");
+ echo(htmlspecialchars($i["text"]));
+ echo("" . $i["time"] . "
");
+ echo("respond / delete");
}
}
echo("private ({$totalPriv})
");
-for ($i=count($rows); $i>=0; $i--) {
- if ($rows[$i]["ispublic"] === "f") {
+foreach (array_reverse($rows) as $i){
+ if ($i["ispublic"] === "f") {
echo("");
- if ($rows[$i]["iscwed"] === "t") {
- echo("
cw: " . $rows[$i]["cw"] . "
");
+ if ($i["iscwed"] === "t") {
+ echo("cw: " . $i["cw"] . "
");
}
- echo(htmlspecialchars($rows[$i]["text"]));
- echo("" . $rows[$i]["time"] . "
");
- echo("edit ");
+ echo(htmlspecialchars($i["text"]));
+ echo("" . $i["time"] . "
");
+ echo("delete");
}
}
echo("public ({$totalRespondedPub})
");
-for ($i=count($rows); $i>=0; $i--) {
- if ($rows[$i]["ispublic"] === "t" && $rows[$i]["isrespondedto"] === "t") {
+foreach (array_reverse($rows) as $i){
+ if ($i["ispublic"] === "t" && $i["isrespondedto"] === "t") {
echo("");
- if ($rows[$i]["iscwed"] === "t") {
- echo("
cw: " . $rows[$i]["cw"] . "
");
+ if ($i["iscwed"] === "t") {
+ echo("cw: " . $i["cw"] . "
");
}
- echo(htmlspecialchars($rows[$i]["text"]));
- echo("" . $rows[$i]["time"] . "
");
- echo("" . htmlspecialchars($rows[$i]["responsetext"]) . "");
- echo("
" . $rows[$i]["responsetime"] . "
");
- echo("edit ");
+ echo(htmlspecialchars($i["text"]));
+ echo("" . $i["time"] . "
");
+ echo("" . htmlspecialchars($i["responsetext"]) . "");
+ echo("
" . $i["responsetime"] . "
");
+ echo("edit response / delete");
}
}
diff --git a/admin/delete.php b/admin/delete.php
new file mode 100644
index 0000000..69cd860
--- /dev/null
+++ b/admin/delete.php
@@ -0,0 +1,20 @@
+
\ No newline at end of file
diff --git a/admin/index.php b/admin/index.php
index dd790e0..8f3aea2 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -5,10 +5,10 @@ include '../config.php';
echo("");
if ($_GET["pw"] === $adminPassword) {
- if ($_GET["page"] === "all") {
- include 'all.php';
- } elseif ($_GET["page" === "edit"]) {
- include 'edit.php';
+ if ($_GET["page"] === "delete") {
+ include 'delete.php';
+ } elseif ($_GET["page"] === "respond") {
+ include 'respond.php';
} else {
include 'all.php';
}
diff --git a/admin/respond.php b/admin/respond.php
new file mode 100644
index 0000000..189dffa
--- /dev/null
+++ b/admin/respond.php
@@ -0,0 +1,57 @@
+");
+
+if ($arr["ispublic"] === "f") {
+ echo("{$pageTitle} – no such question exists
");
+ echo("(go back?)");
+ http_response_code(404);
+} else {
+ echo("{$pageTitle} – question number " . $arr["id"] . "
");
+
+ echo("(go back?)");
+ echo("");
+ if ($arr["iscwed"] === "t") {
+ echo("
cw: " . $arr["cw"] . "
");
+ }
+ echo(htmlspecialchars($arr["text"]));
+ echo("" . $arr["time"] . "
");
+ if ($_GET["responded"] == 1) {
+ echo("" . htmlspecialchars($arr["responsetext"]) . "");
+ echo("
" . $arr["responsetime"] . "
");
+ echo("enter your edits
");
+ } else {
+ echo("enter a response
");
+ }
+ echo("");
+}
+
+?>
\ No newline at end of file
diff --git a/css/admin.css b/css/admin.css
index 3c64e82..74c0ff3 100644
--- a/css/admin.css
+++ b/css/admin.css
@@ -50,7 +50,6 @@ body {
.sentconf {
color: lime;
- margin-top: .3em;
margin-bottom: .3em;
}
diff --git a/index.php b/index.php
index 987c32e..f11ac13 100644
--- a/index.php
+++ b/index.php
@@ -30,17 +30,17 @@ echo("
");
echo("all past messages
");
-for ($i=count($rows); $i>=0; $i--) {
- if ($rows[$i]["ispublic"] === "t" && $rows[$i]["isrespondedto"] === "t") {
+foreach (array_reverse($rows) as $i){
+ if ($i["ispublic"] === "t" && $i["isrespondedto"] === "t") {
echo("");
- if ($rows[$i]["iscwed"] === "t") {
- echo("
cw: " . $rows[$i]["cw"] . "
");
+ if ($i["iscwed"] === "t") {
+ echo("cw: " . $i["cw"] . "
");
}
- echo(htmlspecialchars($rows[$i]["text"]));
- echo("" . $rows[$i]["time"] . "
");
- echo("" . htmlspecialchars($rows[$i]["responsetext"]) . "");
- echo("
" . $rows[$i]["responsetime"] . "
");
- echo("permalink ");
+ echo(htmlspecialchars($i["text"]));
+ echo("" . $i["time"] . "
");
+ echo("" . htmlspecialchars($i["responsetext"]) . "");
+ echo("
" . $i["responsetime"] . "
");
+ echo("permalink ");
}
}
diff --git a/respond.php b/respond.php
deleted file mode 100644
index ab53918..0000000
--- a/respond.php
+++ /dev/null
@@ -1,16 +0,0 @@
-
\ No newline at end of file
diff --git a/send.php b/send.php
index 644324f..136b299 100644
--- a/send.php
+++ b/send.php
@@ -18,7 +18,7 @@ if ($_GET["public"] == 1) {
$isPublic = False;
}
-$curTime = date("Y-m-d h:i:sP");
+$curTime = date("Y-m-d H:i:sP");
$dataArray = array(
"text" => $_GET["text"],