From 57472eab3c7b035392c6a5aa240593ecaa7d1ccf Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Mon, 8 Dec 2025 21:53:36 +0500 Subject: upd: moved all /public/ files to the root folder --- report/index.php | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ report/list.php | 81 ++++++++++++++++++++++++++++++++++++ report/send.php | 45 ++++++++++++++++++++ 3 files changed, 250 insertions(+) create mode 100644 report/index.php create mode 100644 report/list.php create mode 100644 report/send.php (limited to 'report') diff --git a/report/index.php b/report/index.php new file mode 100644 index 0000000..e5014c4 --- /dev/null +++ b/report/index.php @@ -0,0 +1,124 @@ +prepare("SELECT * FROM reports WHERE id = ? AND sender_id = ?"); + $stmt->execute([$report_id, $_SESSION["user_id"]]); + + if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $report = $row; + + if (CLIENT_REQUIRES_JSON) { + json_response([ + "status_code" => 201, + "message" => null, + "data" => $report + ], 201); + exit; + } + } else { + generate_alert("/report", "Report ID #" . $_GET["id"] . " not found or not accessable"); + exit; + } +} + +$contents = ""; + +if ($contents == "") { + if (isset($_GET["user_id"])) { + $contents = "Hi! I want to report user ID #" . $_GET["user_id"] . " because..."; + } else if (isset($_GET["emote_id"])) { + $contents = "Hi! I want to report emote ID #" . $_GET["emote_id"] . " because..."; + } +} +?> + + + + + <?php echo ($report == null ? "Send a message to MODS" : "A message to MODS") . ' - ' . INSTANCE_NAME ?> + + + + + + +
+
+ + +
+ +
+ + +
+
+ + +
+
+
+ +
+
+
+

Reported ago

+

Status: + Unresolved" : "Resolved" ?> +

+
+ +
+ +
+ +
+
+ + +
+ +
+
+ + + \ No newline at end of file diff --git a/report/list.php b/report/list.php new file mode 100644 index 0000000..f02731a --- /dev/null +++ b/report/list.php @@ -0,0 +1,81 @@ +prepare("SELECT * FROM reports WHERE sender_id = ? ORDER BY sent_at DESC"); +$stmt->execute([$_SESSION["user_id"]]); + +$reports = $stmt->fetchAll(PDO::FETCH_ASSOC); +?> + + + + + Report list - <?php echo INSTANCE_NAME ?> + + + + + +
+
+ +
+
+ +
+ + + + + + + '; + + echo ''; + + echo ''; + + echo ''; + + echo ''; + } + ?> +
ContentsStatus
' . substr($report["contents"], 0, 20) . "..."; + echo ' (' . format_timestamp(time() - strtotime($report["sent_at"])) . ' ago)'; + echo ''; + echo $report["resolved_by"] == null ? "Unresolved" : "Resolved"; + echo ''; + echo '[ View ]'; + echo '
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/report/send.php b/report/send.php new file mode 100644 index 0000000..ab136e1 --- /dev/null +++ b/report/send.php @@ -0,0 +1,45 @@ +prepare("INSERT INTO reports(sender_id, contents) VALUES (?, ?)"); +$stmt->execute([$_SESSION["user_id"], str_safe($_POST["contents"], 200)]); + +$report_id = $db->lastInsertId(); + +$stmt = $db->prepare("SELECT * FROM reports WHERE id = ?"); +$stmt->execute([$report_id]); + +if (CLIENT_REQUIRES_JSON) { + json_response([ + "status_code" => 201, + "message" => null, + "data" => $stmt->fetch(PDO::FETCH_ASSOC) + ], 201); + exit; +} + +generate_alert("/report?id=$report_id", "Thank you for your vigilance! MODS will take action as soon as possible.", 200); -- cgit v1.2.3