Antwortmöglichkeit

This commit is contained in:
2026-06-15 22:32:00 +02:00
parent f13a2c6f1e
commit 6f6e53a483
6 changed files with 213 additions and 29 deletions
+10 -3
View File
@@ -15,6 +15,11 @@ if (!isset($_SESSION["user_email"])) {
$articleId = $_POST["article_id"] ?? null;
$content = trim($_POST["content"] ?? "");
$parentCommentId = $_POST["parent_comment_id"] ?? null;
if ($parentCommentId === "") {
$parentCommentId = null;
}
if (empty($articleId) || empty($content)) {
echo json_encode([
@@ -30,14 +35,16 @@ try {
$commentManager->addComment(
$articleId,
$_SESSION["user_email"],
$content
$content,
$parentCommentId
);
echo json_encode([
"success" => true,
"author" => $_SESSION["user_email"],
"content" => $content,
"created" => date("Y-m-d H:i:s")
"created" => date("Y-m-d H:i:s"),
"parentCommentId" => $parentCommentId
]);
} catch (Exception $e) {
@@ -45,4 +52,4 @@ try {
"success" => false,
"message" => "Kommentar konnte nicht gespeichert werden."
]);
}
}