Korrektur
This commit is contained in:
@@ -195,7 +195,7 @@ if ($replyAuthor === null) {
|
||||
): ?>
|
||||
|
||||
<form method="post"
|
||||
action="php/controller/deleteComment-controller.php"
|
||||
action="index.php?pfad=deleteComment"
|
||||
class="delete-comment-form">
|
||||
|
||||
<input type="hidden"
|
||||
@@ -285,7 +285,7 @@ if ($replyAuthor === null) {
|
||||
): ?>
|
||||
|
||||
<form method="post"
|
||||
action="php/controller/deleteComment-controller.php"
|
||||
action="index.php?pfad=deleteComment"
|
||||
class="delete-comment-form">
|
||||
|
||||
<input type="hidden"
|
||||
|
||||
@@ -39,6 +39,10 @@ if ($pfad === "deleteAccount") {
|
||||
include_once "php/controller/deleteAccount-controller.php";
|
||||
exit();
|
||||
}
|
||||
if ($pfad === "deleteComment") {
|
||||
include_once "php/controller/deleteComment-controller.php";
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
|
||||
<!--
|
||||
|
||||
+34
-7
@@ -92,12 +92,39 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
commentElement.classList.add("comment-reply");
|
||||
|
||||
commentElement.innerHTML = `
|
||||
<p>
|
||||
<strong>${escapeHtml(data.author)}</strong>
|
||||
<span>${escapeHtml(data.created)}</span>
|
||||
</p>
|
||||
<p>${escapeHtml(data.content).replace(/\n/g, "<br>")}</p>
|
||||
`;
|
||||
<p>
|
||||
<strong>${escapeHtml(data.author)}</strong>
|
||||
<span>${escapeHtml(data.created)}</span>
|
||||
</p>
|
||||
|
||||
<p>${escapeHtml(data.content).replace(/\n/g, "<br>")}</p>
|
||||
|
||||
<form
|
||||
method="post"
|
||||
action="index.php?pfad=deleteComment"
|
||||
class="delete-comment-form"
|
||||
>
|
||||
<input
|
||||
type="hidden"
|
||||
name="comment_id"
|
||||
value="${escapeHtml(data.commentId)}"
|
||||
>
|
||||
|
||||
<input
|
||||
type="hidden"
|
||||
name="article_id"
|
||||
value="${escapeHtml(formData.get("article_id"))}"
|
||||
>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="delete-comment-button"
|
||||
onclick="return confirm('Möchtest du diesen Kommentar wirklich löschen?');"
|
||||
>
|
||||
Kommentar löschen
|
||||
</button>
|
||||
</form>
|
||||
`;
|
||||
|
||||
const parentReplies = commentsList.querySelector(
|
||||
`.comment-item[data-comment-id="${parentCommentId}"] .comment-replies`
|
||||
@@ -119,7 +146,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
<form
|
||||
method="post"
|
||||
action="php/controller/deleteComment-controller.php"
|
||||
action="index.php?pfad=deleteComment"
|
||||
class="delete-comment-form"
|
||||
>
|
||||
<input
|
||||
|
||||
@@ -10,7 +10,7 @@ require_once __DIR__ . "/../model/CommentManager.php";
|
||||
* Kommentare dürfen nur über ein POST-Formular gelöscht werden.
|
||||
*/
|
||||
if ($_SERVER["REQUEST_METHOD"] !== "POST") {
|
||||
header("Location: ../../index.php");
|
||||
header("Location: index.php");
|
||||
exit();
|
||||
}
|
||||
$commentId = filter_input(
|
||||
@@ -97,7 +97,7 @@ try {
|
||||
* Anschließend wird wieder zum Beitrag und zu den Kommentaren geleitet.
|
||||
*/
|
||||
header(
|
||||
"Location: ../../index.php?pfad=showArticle&id="
|
||||
"Location: index.php?pfad=showArticle&id="
|
||||
. urlencode((string) $articleId)
|
||||
. "#comments"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user