Merge pull request 'Kategorien nicht statisch sondern dynamisch' (#20) from dynamicCategories into dev

Reviewed-on: #20
This commit was merged in pull request #20.
This commit is contained in:
2026-06-03 20:15:16 +02:00
9 changed files with 155 additions and 58 deletions
@@ -0,0 +1,21 @@
<?php
require_once 'php/model/Article.php';
require_once 'php/model/ArticleManager.php';
require_once 'php/validator/article-validator.php';
if (isset($_GET["category"]) && !empty($_GET["category"]) && articleCategoryValidator($_GET["category"])){
$category = $_GET["category"];
try {
$articleManager = ArticleManager::getInstance();
$articles = $articleManager->getArticlesByCategory($category);
} catch (Exception $e) {
$_SESSION["message"] = "internal_error";
include_once "content/404.php";
exit();
}
}else{
$_SESSION["message"] = "invalid_category";
include_once "content/404.php";
exit();
}
?>