Merge branch 'visuelles-Feedback' into devNachCSRF

This commit is contained in:
2026-07-19 23:54:44 +02:00
5 changed files with 348 additions and 21 deletions
+10 -11
View File
@@ -76,10 +76,7 @@ class DatabaseArticleManager implements ArticleManagerDAO {
return intval($db->lastInsertId());
} catch (PDOException $e) {
// NEU: Die rohe PDO-Fehlermeldung wird nicht mehr direkt in die
// eigene Exception übernommen (Kapselung), sondern durch eine
// generische, sprechende Meldung ersetzt - analog zu den übrigen
// Methoden dieser Klasse und zu DatabaseUserManager.
throw new InternalServerErrorException("internal_error");
}
}
@@ -284,14 +281,14 @@ class DatabaseArticleManager implements ArticleManagerDAO {
$db = $this->getConnection();
$sql = "SELECT id, title, content, author, category, tags, created
FROM articles
WHERE title LIKE :keyword
OR content LIKE :keyword
OR tags LIKE :keyword";
FROM articles
WHERE title LIKE :keyword
OR content LIKE :keyword
OR tags LIKE :keyword;";
$command = $db->prepare($sql);
// Wildcards für die Suche hinzufügen
// Wildcards für die SQL-Suche hinzufügen
$searchParam = '%' . $cleankeyword . '%';
$command->execute([
@@ -302,10 +299,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'] ?? '',
@@ -323,6 +321,7 @@ class DatabaseArticleManager implements ArticleManagerDAO {
}
}
/**
* Holt alle User-IDs, die einen bestimmten Beitrag geliked haben.
*