Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ef3699d5f5 | |||
| fedb6f59f5 | |||
| 5eca2f162b | |||
| d7d121b541 | |||
| 96f38ce72e | |||
| b81f0c9e5c | |||
| f8aed4283e | |||
| afd90086d8 | |||
| a7a54f877c |
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="dataSourceStorageLocal" created-in="IU-261.24374.151">
|
||||
<component name="dataSourceStorageLocal" created-in="IU-253.32098.101">
|
||||
<data-source name="articles" uuid="315cb5c9-2b0f-435b-b602-59823b160908">
|
||||
<database-info product="SQLite" version="3.51.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.51.1.0" dbms="SQLITE" exact-version="3.51.1" exact-driver-version="3.51">
|
||||
<identifier-quote-string>"</identifier-quote-string>
|
||||
|
||||
+12
-10
@@ -81,10 +81,12 @@ $isEditMode = (isset($_GET["edit"]) && $_GET["edit"] === "1") || !empty($error);
|
||||
|
||||
<br>
|
||||
|
||||
<form action="php/controller/deleteAccount-controller.php" method="POST">
|
||||
<form action="php/controller/deleteAccount-controller.php"
|
||||
method="POST"
|
||||
class="confirm-delete-account">
|
||||
|
||||
<button type="submit"
|
||||
class="button"
|
||||
onclick="return confirm('Möchtest du deinen Account wirklich unwiderruflich löschen?');">
|
||||
class="button">
|
||||
Account löschen
|
||||
</button>
|
||||
</form>
|
||||
@@ -154,14 +156,16 @@ $isEditMode = (isset($_GET["edit"]) && $_GET["edit"] === "1") || !empty($error);
|
||||
Bearbeiten
|
||||
</a>
|
||||
|
||||
<form action="php/controller/deleteArticle-controller.php" method="POST">
|
||||
<form action="php/controller/deleteArticle-controller.php"
|
||||
method="POST"
|
||||
class="confirm-delete-article">
|
||||
|
||||
<input type="hidden"
|
||||
name="id"
|
||||
value="<?php echo htmlspecialchars($userArticle->getID()); ?>">
|
||||
|
||||
<button type="submit"
|
||||
class="button"
|
||||
onclick="return confirm('Möchtest du diesen Artikel wirklich löschen?');">
|
||||
class="button">
|
||||
Löschen
|
||||
</button>
|
||||
</form>
|
||||
@@ -172,11 +176,9 @@ $isEditMode = (isset($_GET["edit"]) && $_GET["edit"] === "1") || !empty($error);
|
||||
|
||||
<p>Du hast noch keine Beiträge erstellt.</p>
|
||||
|
||||
<button type="button"
|
||||
class="button"
|
||||
onclick="window.location.href='index.php?pfad=createArticle';">
|
||||
<a href="index.php?pfad=createArticle" class="button">
|
||||
Beitrag erstellen!
|
||||
</button>
|
||||
</a>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
@@ -124,7 +124,9 @@ $categories = [
|
||||
</div>
|
||||
|
||||
<noscript>
|
||||
<button type="submit" class="nav__search-button">Filter anwenden</button>
|
||||
<button type="submit" class="nav__search-button">
|
||||
Filter anwenden
|
||||
</button>
|
||||
</noscript>
|
||||
</form>
|
||||
|
||||
@@ -193,17 +195,34 @@ $categories = [
|
||||
</div>
|
||||
|
||||
<nav class="s-res-page-navigation" aria-label="Seitennavigation">
|
||||
<!-- No-JS-Fallback: -->
|
||||
|
||||
<noscript>
|
||||
<?php echo renderNoJsPagination($currentPage, $totalPages, $query, $currentSort, $currentCategory, $limit); ?>
|
||||
<?php echo renderNoJsPagination(
|
||||
$currentPage,
|
||||
$totalPages,
|
||||
$query,
|
||||
$currentSort,
|
||||
$currentCategory,
|
||||
$limit
|
||||
); ?>
|
||||
</noscript>
|
||||
|
||||
<!-- JS-Version: wird per search-results.js befüllt/eingeblendet: -->
|
||||
<div id="js-page-navigation" style="display: none;">
|
||||
<button type="button" class="s-res-page-btn" id="prev-page-btn">«</button>
|
||||
<button type="button"
|
||||
class="s-res-page-btn"
|
||||
id="prev-page-btn">
|
||||
«
|
||||
</button>
|
||||
|
||||
<span id="dynamic-page-numbers"></span>
|
||||
<button type="button" class="s-res-page-btn" id="next-page-btn">»</button>
|
||||
|
||||
<button type="button"
|
||||
class="s-res-page-btn"
|
||||
id="next-page-btn">
|
||||
»
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -237,7 +237,7 @@ if ($replyAuthor === null) {
|
||||
|
||||
<form method="post"
|
||||
action="index.php?pfad=deleteComment"
|
||||
class="delete-comment-form">
|
||||
class="delete-comment-form confirm-delete-comment">
|
||||
|
||||
<input type="hidden"
|
||||
name="comment_id"
|
||||
@@ -252,8 +252,7 @@ if ($replyAuthor === null) {
|
||||
); ?>">
|
||||
|
||||
<button type="submit"
|
||||
class="delete-comment-button"
|
||||
onclick="return confirm('Möchtest du diesen Kommentar wirklich löschen?');">
|
||||
class="delete-comment-button">
|
||||
Kommentar löschen
|
||||
</button>
|
||||
</form>
|
||||
@@ -369,7 +368,7 @@ if ($replyAuthor === null) {
|
||||
|
||||
<form method="post"
|
||||
action="index.php?pfad=deleteComment"
|
||||
class="delete-comment-form">
|
||||
class="delete-comment-form confirm-delete-comment">
|
||||
|
||||
<input type="hidden"
|
||||
name="comment_id"
|
||||
@@ -384,9 +383,8 @@ if ($replyAuthor === null) {
|
||||
); ?>">
|
||||
|
||||
<button type="submit"
|
||||
class="delete-comment-button"
|
||||
onclick="return confirm('Möchtest du diesen Kommentar wirklich löschen?');">
|
||||
Kommentar löschen
|
||||
class="delete-comment-button">
|
||||
Antwort löschen
|
||||
</button>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -24,9 +24,10 @@ include_once "php/controller/index-controller.php";
|
||||
<link rel="stylesheet" href="css/showCategory.css">
|
||||
|
||||
<script src="js/comments.js" defer></script>
|
||||
<script src="js/profile.js" defer></script>
|
||||
<script src="js/editor.js" async></script>
|
||||
<script src="js/search-results.js" async></script>
|
||||
<script src="js/showCategory.js" async></script>
|
||||
<script src="js/search.js" async></script>
|
||||
|
||||
|
||||
<title>EduForge</title>
|
||||
|
||||
+20
-2
@@ -11,6 +11,26 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
const parentCommentInput = document.getElementById("parent-comment-id");
|
||||
const replyInfo = document.getElementById("reply-info");
|
||||
|
||||
/**
|
||||
* Fragt vor dem Löschen eines Kommentars nach einer Bestätigung.
|
||||
*
|
||||
* Der Listener funktioniert auch für Kommentare,
|
||||
* die später per AJAX eingefügt werden.
|
||||
*/
|
||||
document.addEventListener("submit", function (event) {
|
||||
if (!event.target.classList.contains("delete-comment-form")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const confirmed = confirm(
|
||||
"Möchtest du diesen Kommentar wirklich löschen?"
|
||||
);
|
||||
|
||||
if (!confirmed) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
if (!form || !commentsList || !commentContent || !parentCommentInput) {
|
||||
return;
|
||||
}
|
||||
@@ -152,7 +172,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
<button
|
||||
type="submit"
|
||||
class="delete-comment-button"
|
||||
onclick="return confirm('Möchtest du diesen Kommentar wirklich löschen?');"
|
||||
>
|
||||
Kommentar löschen
|
||||
</button>
|
||||
@@ -230,7 +249,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
<button
|
||||
type="submit"
|
||||
class="delete-comment-button"
|
||||
onclick="return confirm('Möchtest du diesen Kommentar wirklich löschen?');"
|
||||
>
|
||||
Kommentar löschen
|
||||
</button>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
const deleteAccountForm = document.querySelector(".confirm-delete-account");
|
||||
|
||||
if (deleteAccountForm) {
|
||||
deleteAccountForm.addEventListener("submit", function (event) {
|
||||
|
||||
if (!confirm("Möchtest du deinen Account und alle deine Beiträge wirklich unwiderruflich löschen?")) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
const deleteArticleForms = document.querySelectorAll(".confirm-delete-article");
|
||||
|
||||
deleteArticleForms.forEach(function (form) {
|
||||
|
||||
form.addEventListener("submit", function (event) {
|
||||
|
||||
if (!confirm("Möchtest du diesen Artikel wirklich löschen?")) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -315,16 +315,15 @@ class DatabaseArticleManager implements ArticleManagerDAO {
|
||||
FROM articles
|
||||
WHERE title LIKE :keyword
|
||||
OR content LIKE :keyword
|
||||
OR tags LIKE :keyword";
|
||||
OR tags LIKE :keyword;";
|
||||
|
||||
$command = $db->prepare($sql);
|
||||
if (!$command) {
|
||||
throw new InternalServerErrorException("internal_error");
|
||||
}
|
||||
|
||||
// Wildcards für die Suche hinzufügen
|
||||
// Wildcards für die SQL-Suche hinzufügen
|
||||
$searchParam = '%' . $cleankeyword . '%';
|
||||
|
||||
$success = $command->execute([
|
||||
":keyword" => $searchParam
|
||||
]);
|
||||
@@ -337,10 +336,11 @@ class DatabaseArticleManager implements ArticleManagerDAO {
|
||||
$filteredArticles = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$likes = $this->getLikesForArticle(intval($row['id']));
|
||||
$articleId = intval($row['id']);
|
||||
$likes = $this->getLikesForArticle($articleId);
|
||||
|
||||
$filteredArticles[] = new Article(
|
||||
intval($row['id']),
|
||||
$articleId,
|
||||
$row['title'] ?? '',
|
||||
$row['content'] ?? '',
|
||||
$row['author'] ?? '',
|
||||
@@ -358,6 +358,7 @@ class DatabaseArticleManager implements ArticleManagerDAO {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Holt alle User-IDs, die einen bestimmten Beitrag geliked haben.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user