Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 625dd35b9e | |||
| f99b7bc8ab | |||
| e779162ec2 | |||
| 17345345b5 | |||
| 3df526d5b5 | |||
| d5f30176c4 | |||
| 308e5af6ff | |||
| 268fe6a6b9 | |||
| a24914126f | |||
| 1ca27bc072 | |||
| c96d93c2ce | |||
| cd38af22db | |||
| c440c25e41 | |||
| e105ab61b7 | |||
| 10b058afa0 | |||
| d18f33a87a | |||
| 62190fa821 | |||
| a6210c9d6e | |||
| fdece531af | |||
| 8073235466 | |||
| 7dc3c3b988 | |||
| 21793dffd7 | |||
| ca337c4fac | |||
| 76beb8d62e | |||
| c5bfd02f09 | |||
| 9f4ca058bd | |||
| 603c208ae4 | |||
| 754777d69e | |||
| 829a0e49d8 | |||
| f12babf2b1 | |||
| d6249169c6 | |||
| 6aa1cd9a63 | |||
| 09795c30dd | |||
| 59268dc102 | |||
| 979378d142 | |||
| 6ce7f0ef22 | |||
| 71a8dd5f17 | |||
| e86fef1766 | |||
| 3cb63f791a | |||
| f96415bfe6 | |||
| 365f70af98 | |||
| c1ddbfdf48 | |||
| e575e3dfa8 | |||
| 560f53cfb6 | |||
| d8c350c20f | |||
| 5b718f24ed | |||
| 6634bee77b | |||
| 2a3e73d409 | |||
| 2cd68873de | |||
| d987ca271f | |||
| 0a37dd4b8b | |||
| b4ca25db3d | |||
| 738b36c406 | |||
| c785363384 | |||
| 32cb8a9d9e | |||
| 29e23a8d3b | |||
| 1a6403963a | |||
| e096774233 | |||
| 222759a1bc | |||
| 7a3043f644 |
@@ -10,7 +10,7 @@ session_start();
|
|||||||
<main class="editor-main">
|
<main class="editor-main">
|
||||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||||
<p class="alert-message is-error">
|
<p class="alert-message is-error">
|
||||||
Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut.
|
Es ist ein interner Fehler beim Speichern aufgetreten. Bitte versuche es erneut.
|
||||||
</p>
|
</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
||||||
@@ -18,8 +18,40 @@ session_start();
|
|||||||
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
|
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
|
||||||
</p>
|
</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<input type="text" id="title" name="title" placeholder="Titel hier eingeben" required>
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_title"): ?>
|
||||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag..."></textarea>
|
<p class="alert-message is-error">
|
||||||
|
Der Titel enthält ungültige Zeichen oder erfüllt die Länge von 5-120 Zeichen nicht.
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_content"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Der Text erlaubt eine Länge von 10 bis maximal 7.000 Zeichen (ca. 1.000 Wörter).
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_category"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Die ausgewählte Kategorie ist ungültig.
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_tags"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Ungültige Schlagworte gefunden. Erlaubt sind nur Buchstaben, Zahlen, Leerzeichen und Bindestriche (2-50 Zeichen).
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "validation_missing"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Bei der Validierung deiner Daten ist ein Fehler aufgetreten. Bitte versuche es erneut.
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
unset($_SESSION["message"]);
|
||||||
|
?>
|
||||||
|
<input type="text" id="title" name="title"
|
||||||
|
value="<?php echo htmlspecialchars($_SESSION['old_title'] ?? ''); unset($_SESSION['old_title']); ?>"
|
||||||
|
placeholder="Titel hier eingeben" required>
|
||||||
|
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag...">
|
||||||
|
<?php echo htmlspecialchars($_SESSION['old_content'] ?? ''); unset($_SESSION['old_content']); ?>
|
||||||
|
</textarea>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<!-- Seitenleiste -->
|
<!-- Seitenleiste -->
|
||||||
@@ -76,7 +108,9 @@ session_start();
|
|||||||
|
|
||||||
<div class="sidebar-block">
|
<div class="sidebar-block">
|
||||||
<label for="tags">Schlagwörter</label>
|
<label for="tags">Schlagwörter</label>
|
||||||
<input type="text" id="tags" name="tags" placeholder="z.B. Technik, IT (mit Komma trennen)">
|
<input type="text" id="tags" name="tags"
|
||||||
|
value="<?php echo htmlspecialchars($_SESSION['old_tags'] ?? ''); unset($_SESSION['old_tags']); ?>"
|
||||||
|
placeholder="z.B. Technik, IT (mit Komma trennen)">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
+5
-5
@@ -45,10 +45,9 @@ include_once 'php/controller/profileArticles-controller.php';
|
|||||||
<div class="articles-list">
|
<div class="articles-list">
|
||||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||||
<p class="alert-message is-error">
|
<p class="alert-message is-error">
|
||||||
Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut.
|
Es ist ein interner Fehler aufgetreten. Bitte versuche es erneut.
|
||||||
</p>
|
</p>
|
||||||
<?php elseif (isset($userArticles) && count($userArticles) > 0): ?>
|
<?php elseif (isset($userArticles) && count($userArticles) > 0): ?>
|
||||||
|
|
||||||
<?php foreach ($userArticles as $userArticle): ?>
|
<?php foreach ($userArticles as $userArticle): ?>
|
||||||
<!-- Ein einzelner Artikel-Eintrag -->
|
<!-- Ein einzelner Artikel-Eintrag -->
|
||||||
<div class="article-item">
|
<div class="article-item">
|
||||||
@@ -57,7 +56,6 @@ include_once 'php/controller/profileArticles-controller.php';
|
|||||||
<span class="article-category"><?php echo htmlspecialchars($userArticle->getCategory()); ?></span>
|
<span class="article-category"><?php echo htmlspecialchars($userArticle->getCategory()); ?></span>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="article-title"><?php echo htmlspecialchars($userArticle->getTitle()); ?></h3>
|
<h3 class="article-title"><?php echo htmlspecialchars($userArticle->getTitle()); ?></h3>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$tags = $userArticle->getTags();
|
$tags = $userArticle->getTags();
|
||||||
if (isset($tags) && !empty($tags)): ?>
|
if (isset($tags) && !empty($tags)): ?>
|
||||||
@@ -78,16 +76,18 @@ include_once 'php/controller/profileArticles-controller.php';
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<a href="index.php?pfad=createArticle" class="edit-link-button">Bearbeiten</a>
|
<a href="index.php?pfad=updateArticle&id=<?php echo $userArticle->getID(); ?>" class="edit-link-button">Bearbeiten</a>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<p>Du hast noch keine Beiträge erstellt.</p>
|
<p>Du hast noch keine Beiträge erstellt.</p>
|
||||||
<button type="button" class="login-button" onclick="window.location.href='index.php?pfad=createArticle';">
|
<button type="button" class="login-button" onclick="window.location.href='index.php?pfad=createArticle';">
|
||||||
Beitrag erstellen!
|
Beitrag erstellen!
|
||||||
</button>
|
</button>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
unset($_SESSION["message"]);
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
+28
-4
@@ -1,14 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
include_once 'php/controller/showArticle-controller.php';
|
||||||
|
?>
|
||||||
<!--
|
<!--
|
||||||
Seite: Anzeige für Beiträge
|
Seite: Anzeige für Beiträge
|
||||||
Funktion: Stellt einen übergebenen Beitrag dar.
|
Funktion: Stellt einen übergebenen Beitrag dar.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<?php
|
|
||||||
include_once 'php/controller/showArticle-controller.php';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!-- Hauptcontainer für die Beitragsansicht (Ausschließlich der Content-Bereich) -->
|
<!-- Hauptcontainer für die Beitragsansicht (Ausschließlich der Content-Bereich) -->
|
||||||
<main class="article-view-container">
|
<main class="article-view-container">
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Es ist ein interner Fehler aufgetreten. Bitte versuche es erneut.
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_id"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Es ist ein Fehler aufgetreten. Die ID konnte nicht ausgelesen werden. Bitte versuche es erneut.
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "article_updated"): ?>
|
||||||
|
<p class="alert-message is-success">
|
||||||
|
Dein Beitrag wurde erfolgreich bearbeitet!
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
unset($_SESSION["message"]);
|
||||||
|
?>
|
||||||
|
|
||||||
<!-- Metadaten & Titel -->
|
<!-- Metadaten & Titel -->
|
||||||
<div class="article-view-top-section">
|
<div class="article-view-top-section">
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
include_once 'php/controller/showArticle-controller.php';
|
||||||
?>
|
?>
|
||||||
<!--
|
<!--
|
||||||
Seite: Beitrag erstellen
|
Seite: Beitrag erstellen
|
||||||
Inhalt: Formular für die Erstellung eines neuen Beitrags
|
Inhalt: Formular für die Erstellung eines neuen Beitrags
|
||||||
-->
|
-->
|
||||||
<form method="post" action="php/controller/updateArticle-controller.php" id="editor-form" class="article-editor-scope.editor-container article-editor-scope editor-container">
|
<form method="post" action="php/controller/updateArticle-controller.php?id=<?php if(isset($id) && !empty($id)){echo htmlspecialchars($id);}else{$_SESSION["message"] = "missing_id";} ?>" id="editor-form" class="article-editor-scope.editor-container article-editor-scope editor-container">
|
||||||
|
|
||||||
<main class="editor-main">
|
<main class="editor-main">
|
||||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||||
<p class="alert-message is-error">
|
<p class="alert-message is-error">
|
||||||
Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut.
|
Es ist ein interner Fehler beim Speichern aufgetreten. Bitte versuche es erneut.
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_id"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Es ist ein Fehler aufgetreten. Die ID konnte nicht ausgelesen werden. Bitte versuche es erneut.
|
||||||
</p>
|
</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
||||||
@@ -18,9 +23,52 @@ session_start();
|
|||||||
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
|
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
|
||||||
</p>
|
</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<input type="text" id="title" name="title" value="<?php if (isset($title) && !empty($title)){echo htmlspecialchars($title);} ?>" placeholder="Titel hier eingeben" required>
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_title"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Der Titel enthält ungültige Zeichen oder erfüllt die Länge von 5-120 Zeichen nicht.
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_content"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Der Text erlaubt eine Länge von 10 bis maximal 7.000 Zeichen (ca. 1.000 Wörter).
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_category"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Die ausgewählte Kategorie ist ungültig.
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_tags"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Ungültige Schlagworte gefunden. Erlaubt sind nur Buchstaben, Zahlen, Leerzeichen und Bindestriche (2-20 Zeichen).
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "validation_missing"): ?>
|
||||||
|
<p class="alert-message is-error">
|
||||||
|
Bei der Validierung deiner Daten ist ein Fehler aufgetreten. Bitte versuche es erneut.
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
unset($_SESSION["message"]);
|
||||||
|
?>
|
||||||
|
<input type="text" id="title" name="title"
|
||||||
|
value="<?php
|
||||||
|
if (isset($title) && !empty($title)){echo htmlspecialchars($title);
|
||||||
|
}elseif (isset($_SESSION['old_title']) && !empty($_SESSION['old_title'])){
|
||||||
|
echo htmlspecialchars($_SESSION['old_title']);
|
||||||
|
unset($_SESSION['old_title']);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>"
|
||||||
|
placeholder="Titel hier eingeben" required>
|
||||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag...">
|
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag...">
|
||||||
<?php if (isset($content) && !empty($content)){echo htmlspecialchars($content);} ?>
|
<?php
|
||||||
|
if (isset($content) && !empty($content)){echo htmlspecialchars($content);
|
||||||
|
}elseif (isset($_SESSION['old_content']) && !empty($_SESSION['old_content'])){
|
||||||
|
echo htmlspecialchars($_SESSION['old_content']);
|
||||||
|
unset($_SESSION['old_content']);
|
||||||
|
}
|
||||||
|
?>
|
||||||
</textarea>
|
</textarea>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
@@ -34,7 +82,7 @@ session_start();
|
|||||||
<div class="sidebar-block">
|
<div class="sidebar-block">
|
||||||
<label for="category">Kategorie <span class="required">*</span></label>
|
<label for="category">Kategorie <span class="required">*</span></label>
|
||||||
<select id="category" name="category" required>
|
<select id="category" name="category" required>
|
||||||
<option value="<?php if (isset($category) && !empty($category)){echo htmlspecialchars($category);} ?>" disabled selected>Kategorie wählen...</option>
|
<option disabled selected>Kategorie wählen...</option>
|
||||||
|
|
||||||
<optgroup label="Sprachen">
|
<optgroup label="Sprachen">
|
||||||
<option value="deutsch">Deutsch</option>
|
<option value="deutsch">Deutsch</option>
|
||||||
@@ -78,7 +126,15 @@ session_start();
|
|||||||
|
|
||||||
<div class="sidebar-block">
|
<div class="sidebar-block">
|
||||||
<label for="tags">Schlagwörter</label>
|
<label for="tags">Schlagwörter</label>
|
||||||
<input type="text" id="tags" name="tags" value="<?php if (isset($tags) && !empty($tags)){echo htmlspecialchars($tags);} ?>" placeholder="z.B. Technik, IT (mit Komma trennen)">
|
<input type="text" id="tags" name="tags"
|
||||||
|
value="<?php
|
||||||
|
if (isset($tags) && !empty($tags)){echo htmlspecialchars($tags);
|
||||||
|
} elseif (isset($_SESSION['old_tags']) && !empty($_SESSION['old_tags'])){
|
||||||
|
echo htmlspecialchars($_SESSION['old_tags']);
|
||||||
|
unset($_SESSION['old_tags']);
|
||||||
|
}
|
||||||
|
?>"
|
||||||
|
placeholder="z.B. Technik, IT (mit Komma trennen)">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// mit $_SERVER['DOCUMENT_ROOT'] später umbauen?
|
||||||
$abs_path = __DIR__;
|
$abs_path = __DIR__;
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -2,30 +2,84 @@
|
|||||||
session_start();
|
session_start();
|
||||||
require_once '../model/LocalArticleManager.php';
|
require_once '../model/LocalArticleManager.php';
|
||||||
require_once '../model/ArticleManager.php';
|
require_once '../model/ArticleManager.php';
|
||||||
|
require_once '../validator/article-validator.php';
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$_SESSION["old_title"] = $_POST["title"] ?? '';
|
||||||
|
$_SESSION["old_content"] = $_POST["content"] ?? '';
|
||||||
|
$_SESSION["old_category"] = $_POST["category"] ?? '';
|
||||||
|
$_SESSION["old_tags"] = $_POST["tags"] ?? '';
|
||||||
|
|
||||||
if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
|
if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
|
||||||
$_SESSION["message"] = "missing_parameters";
|
$_SESSION["message"] = "missing_parameters";
|
||||||
header("location: ../../index.php?pfad=createArticle");
|
header("location: ../../index.php?pfad=createArticle");
|
||||||
|
exit();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$title = $_POST["title"];
|
$title = $_POST["title"];
|
||||||
$content = $_POST["content"];
|
$content = $_POST["content"];
|
||||||
$category = $_POST["category"];
|
|
||||||
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
|
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
|
||||||
$tags = $_POST["tags"];
|
$category = $_POST["category"];
|
||||||
|
$tags = $_POST['tags'] ?? '';
|
||||||
|
|
||||||
|
// -------------------------------- Validierung der Daten: -------------------------
|
||||||
|
if (!articleAuthorValidator($author)) {
|
||||||
|
$_SESSION["message"] = "author_not_valid";
|
||||||
|
header("location: ../../index.php?pfad=createArticle");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!articleTitleValidator($title)) {
|
||||||
|
$_SESSION["message"] = "invalid_title";
|
||||||
|
header("location: ../../index.php?pfad=createArticle");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!articleContentValidator($content)) {
|
||||||
|
$_SESSION["message"] = "invalid_content";
|
||||||
|
header("location: ../../index.php?pfad=createArticle");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!articleCategoryValidator($category)) {
|
||||||
|
$_SESSION["message"] = "invalid_category";
|
||||||
|
header("location: ../../index.php?pfad=createArticle");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!articleTagValidator($tags)) {
|
||||||
|
$_SESSION["message"] = "invalid_tags";
|
||||||
|
header("location: ../../index.php?pfad=createArticle");
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
$cleanedTags = [];
|
||||||
|
$rawTags = explode(',', $tags);
|
||||||
|
foreach ($rawTags as $rawTag) {
|
||||||
|
// Leerzeichen am Anfang/Ende des einzelnen Tags entfernen:
|
||||||
|
$tag = trim($rawTag);
|
||||||
|
$cleanedTags[] = $tag;
|
||||||
|
}
|
||||||
|
// Duplikate entfernen:
|
||||||
|
$cleanedTags = array_unique($cleanedTags);
|
||||||
|
$cleanedTags = implode(',', $cleanedTags);
|
||||||
|
}
|
||||||
|
// ----------------- Übertragung der validierten Daten in ArticleManager: ---------------------------
|
||||||
try {
|
try {
|
||||||
$articleManager = ArticleManager::getInstance();
|
$articleManager = ArticleManager::getInstance();
|
||||||
$articleManager->addArticle($title, $content, $author, $category, $tags);
|
$articleManager->addArticle($title, $content, $author, $category, $cleanedTags);
|
||||||
|
|
||||||
|
// Formulardaten nach erfolgreichem Erstellen aus der Session löschen
|
||||||
|
unset($_SESSION["old_title"], $_SESSION["old_content"], $_SESSION["old_category"], $_SESSION["old_tags"]);
|
||||||
|
|
||||||
} catch (Exception $e){
|
} catch (Exception $e){
|
||||||
$_SESSION["message"] = "internal_error";
|
$_SESSION["message"] = "internal_error";
|
||||||
|
header("location: ../../index.php?pfad=createArticle");
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION["message"] = "new_article";
|
$_SESSION["message"] = "new_article";
|
||||||
// Weiterleitung zur Homepage
|
// Weiterleitung zur Homepage
|
||||||
header("location: ../../index.php");
|
header("location: ../../index.php");
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ session_start();
|
|||||||
require_once 'php/model/Article.php';
|
require_once 'php/model/Article.php';
|
||||||
require_once 'php/model/ArticleManager.php';
|
require_once 'php/model/ArticleManager.php';
|
||||||
|
|
||||||
if (isset($_GET["id"])){
|
if (isset($_GET["id"]) && !empty($_GET["id"])){
|
||||||
try {
|
try {
|
||||||
|
$id = $_GET["id"];
|
||||||
$articleManager = ArticleManager::getInstance();
|
$articleManager = ArticleManager::getInstance();
|
||||||
$article = $articleManager->getArticle($_GET["id"]);
|
$article = $articleManager->getArticle($id);
|
||||||
if($article != null){
|
if($article != null){
|
||||||
$title = $article->getTitle();
|
$title = $article->getTitle();
|
||||||
$content = $article->getContent();
|
$content = $article->getContent();
|
||||||
@@ -14,14 +15,15 @@ if (isset($_GET["id"])){
|
|||||||
$author = $article->getAuthor();
|
$author = $article->getAuthor();
|
||||||
$tags = $article->getTags();
|
$tags = $article->getTags();
|
||||||
}else{
|
}else{
|
||||||
$_SESSION["message"] = "article_not_found";
|
//header("location: index.php?pfad=404");
|
||||||
echo "article_not_found";
|
include_once "content/404.php";
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
} catch (Exception $e){
|
} catch (Exception $e){
|
||||||
$_SESSION["message"] = "internal_error";
|
$_SESSION["message"] = "internal_error";
|
||||||
echo "Fehler aufgetreten: " . $e->getMessage();
|
exit();
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$_SESSION["message"] = "article_not_found";
|
$_SESSION["message"] = "missing_id";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -3,55 +3,92 @@ session_start();
|
|||||||
require_once '../model/LocalArticleManager.php';
|
require_once '../model/LocalArticleManager.php';
|
||||||
require_once '../model/ArticleManager.php';
|
require_once '../model/ArticleManager.php';
|
||||||
require_once '../model/Article.php';
|
require_once '../model/Article.php';
|
||||||
|
require_once '../validator/article-validator.php';
|
||||||
|
|
||||||
// Angaben aus übergebener ID setzen:
|
|
||||||
if (isset($_GET["id"])){ // TODO: Später aus Session den Nutzer auslesen und Autorenrechte prüfen!
|
|
||||||
try {
|
|
||||||
$articleManager = ArticleManager::getInstance();
|
|
||||||
$article = $articleManager->getArticle($_GET["id"]);
|
|
||||||
if($article != null){
|
|
||||||
$title = $article->getTitle();
|
|
||||||
$content = $article->getContent();
|
|
||||||
$category = $article->getCategory();
|
|
||||||
$author = $article->getAuthor();
|
|
||||||
$tags = $article->getTags();
|
|
||||||
}else{
|
|
||||||
$_SESSION["message"] = "article_not_found";
|
|
||||||
echo "article_not_found";
|
|
||||||
}
|
|
||||||
} catch (Exception $e){
|
|
||||||
$_SESSION["message"] = "internal_error";
|
|
||||||
echo "Fehler aufgetreten: " . $e->getMessage();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$_SESSION["message"] = "article_not_found";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wenn "speichern" gedrückt wurde:
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
|
$_SESSION["old_title"] = $_POST["title"] ?? '';
|
||||||
|
$_SESSION["old_content"] = $_POST["content"] ?? '';
|
||||||
|
$_SESSION["old_category"] = $_POST["category"] ?? '';
|
||||||
|
$_SESSION["old_tags"] = $_POST["tags"] ?? '';
|
||||||
|
|
||||||
|
if (isset($_GET["id"]) && !empty($_GET["id"])) {
|
||||||
|
$id = $_GET["id"];
|
||||||
|
} else {
|
||||||
|
$_SESSION["message"] = "missing_id";
|
||||||
|
header("location: ../../index.php?pfad=updateArticle");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
|
||||||
$_SESSION["message"] = "missing_parameters";
|
$_SESSION["message"] = "missing_parameters";
|
||||||
header("location: ../../index.php?pfad=updateArticle");
|
header("location: ../../index.php?pfad=updateArticle");
|
||||||
exit();
|
exit();
|
||||||
} else {
|
}else{
|
||||||
|
$title = $_POST["title"];
|
||||||
$newTitle = $_POST["title"];
|
$content = $_POST["content"];
|
||||||
$newContent = $_POST["content"];
|
|
||||||
$newCategory = $_POST["category"];
|
|
||||||
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
|
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
|
||||||
$newTags = $_POST["tags"];
|
$category = $_POST["category"];
|
||||||
|
$tags = $_POST['tags'] ?? '';
|
||||||
|
|
||||||
|
// -------------------------------- Validierung der Daten: -------------------------
|
||||||
|
if (!articleAuthorValidator($author)) {
|
||||||
|
$_SESSION["message"] = "author_not_valid";
|
||||||
|
header("location: ../../index.php?pfad=updateArticle");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!articleTitleValidator($title)) {
|
||||||
|
$_SESSION["message"] = "invalid_title";
|
||||||
|
header("location: ../../index.php?pfad=updateArticle");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!articleContentValidator($content)) {
|
||||||
|
$_SESSION["message"] = "invalid_content";
|
||||||
|
header("location: ../../index.php?pfad=updateArticle");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!articleCategoryValidator($category)) {
|
||||||
|
$_SESSION["message"] = "invalid_category";
|
||||||
|
header("location: ../../index.php?pfad=updateArticle");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!articleTagValidator($tags)) {
|
||||||
|
$_SESSION["message"] = "invalid_tags";
|
||||||
|
header("location: ../../index.php?pfad=updateArticle");
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
$cleanedTags = [];
|
||||||
|
$rawTags = explode(',', $tags);
|
||||||
|
foreach ($rawTags as $rawTag) {
|
||||||
|
// Leerzeichen am Anfang/Ende des einzelnen Tags entfernen:
|
||||||
|
$tag = trim($rawTag);
|
||||||
|
$cleanedTags[] = $tag;
|
||||||
|
}
|
||||||
|
// Duplikate entfernen:
|
||||||
|
$cleanedTags = array_unique($cleanedTags);
|
||||||
|
$cleanedTags = implode(',', $cleanedTags);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------- Übertragung der validierten Daten in ArticleManager: ---------------------------
|
||||||
try {
|
try {
|
||||||
$articleManager = ArticleManager::getInstance();
|
$articleManager = ArticleManager::getInstance();
|
||||||
$articleManager->updateArticle(new Article($newTitle, $newContent, $newCategory, $author, $newTags), $author);
|
$article = $articleManager->getArticle($id);
|
||||||
|
$article->setTitle($title);
|
||||||
|
$article->setContent($content);
|
||||||
|
$article->setCategory($category);
|
||||||
|
$article->setTags($cleanedTags);
|
||||||
|
$articleManager->updateArticle($id ,$article, $author);
|
||||||
} catch (Exception $e){
|
} catch (Exception $e){
|
||||||
$_SESSION["message"] = "internal_error";
|
$_SESSION["message"] = "internal_error";
|
||||||
|
header("location: ../../index.php?pfad=updateArticle");
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
$_SESSION["message"] = "new_article";
|
$_SESSION["message"] = "article_updated";
|
||||||
// Weiterleitung zur Homepage
|
// Weiterleitung zur Homepage
|
||||||
header("location: ../../index.php");
|
header("location: ../../index.php?pfad=showArticle&id=$id");
|
||||||
exit();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+21
-11
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Klasse: Artikel
|
* Klasse: Artikel
|
||||||
* Diese Klasse stellt alle Daten eines Artikels (Beitrag) bereit
|
* Diese Klasse stellt alle Daten eines Beitrags (Beitrag) bereit
|
||||||
*
|
*
|
||||||
* @author Niklas Ortmann
|
* @author Niklas Ortmann
|
||||||
*/
|
*/
|
||||||
@@ -38,7 +38,7 @@ class Article
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt die ID eines Artikels zurück.
|
* Gibt die ID eines Beitrags zurück.
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getId(): int
|
public function getId(): int
|
||||||
@@ -47,7 +47,7 @@ class Article
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt den Titel eines Artikels zurück.
|
* Gibt den Titel eines Beitrags zurück.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
@@ -56,7 +56,7 @@ class Article
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setzt den Titel eines Artikels
|
* Setzt den Titel eines Beitrags
|
||||||
* @param $title
|
* @param $title
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@@ -66,7 +66,7 @@ class Article
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt den Content eines Artikels zurück.
|
* Gibt den Content eines Beitrags zurück.
|
||||||
* TODO: Content muss noch definiert werden.
|
* TODO: Content muss noch definiert werden.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -76,7 +76,7 @@ class Article
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setzt den Content eines Artikels.
|
* Setzt den Content eines Beitrags.
|
||||||
* TODO: Content muss noch definiert werden.
|
* TODO: Content muss noch definiert werden.
|
||||||
* @param $content
|
* @param $content
|
||||||
* @return void
|
* @return void
|
||||||
@@ -87,7 +87,7 @@ class Article
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt den Autor eines Artikels zurück.
|
* Gibt den Autor eines Beitrags zurück.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAuthor(): string
|
public function getAuthor(): string
|
||||||
@@ -96,7 +96,7 @@ class Article
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt das Veröffentlichungsdatum des Artikels zurück.
|
* Gibt das Veröffentlichungsdatum des Beitrags zurück.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCreationDate(): string
|
public function getCreationDate(): string
|
||||||
@@ -105,7 +105,7 @@ class Article
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt die Kategorie eines Artikels zurück.
|
* Gibt die Kategorie eines Beitrags zurück.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCategory(): string
|
public function getCategory(): string
|
||||||
@@ -114,7 +114,17 @@ class Article
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt die Schlagworte eines Artikels zurück.
|
* Setzt die Kategorie eines Beitrags.
|
||||||
|
* @param string $category
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setCategory(string $category)
|
||||||
|
{
|
||||||
|
$this->category = $category;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt die Schlagworte eines Beitrags zurück.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getTags(): string
|
public function getTags(): string
|
||||||
@@ -123,7 +133,7 @@ class Article
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setzt die Schlagworte eines Artikels.
|
* Setzt die Schlagworte eines Beitrags.
|
||||||
* @param string $tags
|
* @param string $tags
|
||||||
*/
|
*/
|
||||||
public function setTags(string $tags)
|
public function setTags(string $tags)
|
||||||
|
|||||||
@@ -24,13 +24,14 @@ interface ArticleManagerDAO
|
|||||||
* Ändert den gespeicherten Beitrag eines übergebenen Beitrags und eines Autors.
|
* Ändert den gespeicherten Beitrag eines übergebenen Beitrags und eines Autors.
|
||||||
* Es wird geprüft, ob der zu änderne Beitrag existiert und ob der übergebene Autor der Autor des originalen
|
* Es wird geprüft, ob der zu änderne Beitrag existiert und ob der übergebene Autor der Autor des originalen
|
||||||
* Beitrages ist.
|
* Beitrages ist.
|
||||||
|
* @param $id
|
||||||
* @param $article
|
* @param $article
|
||||||
* @param $author
|
* @param $author
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* TODO: Fehlerbeschreibung hinzufügen
|
* TODO: Fehlerbeschreibung hinzufügen
|
||||||
*/
|
*/
|
||||||
public function updateArticle($article, $author);
|
public function updateArticle($id, $article, $author);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Löscht einen Beitrag aus übergebener ID.
|
* Löscht einen Beitrag aus übergebener ID.
|
||||||
|
|||||||
@@ -62,35 +62,39 @@ class LocalArticleManager implements ArticleManagerDAO {
|
|||||||
$this->saveArticle($articles);
|
$this->saveArticle($articles);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateArticle($article, $author)
|
public function updateArticle($id, $article, $author)
|
||||||
{
|
{
|
||||||
if (empty($article)) {
|
if (empty($article)) {
|
||||||
|
// TODO: Implement Exception.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Berechtigungsprüfung:
|
// Berechtigungsprüfung:
|
||||||
if ($article->getAuthor() !== $author) {
|
if ($article->getAuthor() !== $author) {
|
||||||
// TODO: Implement Exception (z.B. throw new Exception("Nicht autorisiert"));
|
// TODO: Implement Exception.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Beitrag aktualisieren:
|
||||||
$articles = $this->getAllArticles();
|
$articles = $this->getAllArticles();
|
||||||
$updated = false;
|
$updated = false;
|
||||||
|
|
||||||
// Beitrag aktualisieren:
|
|
||||||
foreach ($articles as $index => $storedArticle) {
|
foreach ($articles as $index => $storedArticle) {
|
||||||
if (isset($storedArticle['id']) && $storedArticle['id'] == $article->getId()) {
|
if (isset($storedArticle['id']) && $storedArticle['id'] == $id) {
|
||||||
$articles[$index] = [
|
$articles[$index] = [
|
||||||
"id" => $article->getId(),
|
"id" => $id,
|
||||||
"title" => $article->getTitle(),
|
"title" => $article->getTitle(),
|
||||||
"content" => $article->getContent(),
|
"content" => $article->getContent(),
|
||||||
"author" => $article->getAuthor(),
|
"author" => $author,
|
||||||
"category" => $article->getCategory(),
|
"category" => $article->getCategory(),
|
||||||
"tags" => $article->getTags(),
|
"tags" => $article->getTags(),
|
||||||
"creationDate" => $article->getCreationDate() // Behält das originale Erstelldatum bei
|
"creationDate" => $article->getCreationDate()
|
||||||
];
|
];
|
||||||
$updated = true;
|
$updated = true;
|
||||||
break;
|
break;
|
||||||
|
}else{
|
||||||
|
// TODO: Implement Exception.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Prüft, ob der Autor auch der Eigentümer des Beitrags ist.
|
||||||
|
* @param $author
|
||||||
|
* @return true
|
||||||
|
* TODO: Implement this.
|
||||||
|
*/
|
||||||
|
function articleAuthorValidator($author)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prüft, ob der Titel die folgenden Bedingungen erfüllt:
|
||||||
|
* Buchstaben von a-z; A-Z
|
||||||
|
* Zahlen von 0-9
|
||||||
|
* Umlaute äöüÄÖÜß
|
||||||
|
* Satzeichen .,!?:;()"„“«»_+-
|
||||||
|
* 5-120 Zeichen
|
||||||
|
* @param $title
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function articleTitleValidator($title)
|
||||||
|
{
|
||||||
|
$title = trim($title);
|
||||||
|
$titlePattern = '/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u';
|
||||||
|
if (preg_match($titlePattern, $title)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prüft, ob der Contenttext 10-7000 Zeichen enthält.
|
||||||
|
* @param $content
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function articleContentValidator($content)
|
||||||
|
{
|
||||||
|
$content = trim($content);
|
||||||
|
$zeichenAnzahl = mb_strlen($content);
|
||||||
|
if ($zeichenAnzahl <= 7000 && $zeichenAnzahl >= 10) {
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prüft, ob die Kategorie eine erlaubt Kategorie ist.
|
||||||
|
* @param $category
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function articleCategoryValidator($category)
|
||||||
|
{
|
||||||
|
$allowedCategories = [
|
||||||
|
'deutsch', 'englisch', 'franzoesisch', 'latein', 'literatur',
|
||||||
|
'mathe', 'biologie', 'chemie', 'physik', 'informatik', 'astronomie',
|
||||||
|
'geschichte', 'erdkunde', 'sozialkunde', 'wirtschaft', 'religion',
|
||||||
|
'ethik', 'philosophie', 'psychologie', 'kunst', 'musik', 'theater',
|
||||||
|
'technik', 'werken', 'hauswirtschaft', 'sport'
|
||||||
|
];
|
||||||
|
if (in_array($category, $allowedCategories, true)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prüft, ob die Tags die folgenden Bedingungen erfüllen:
|
||||||
|
* Buchstaben von a-z; A-Z
|
||||||
|
* Zahlen von 0-9
|
||||||
|
* Umlaute äöüÄÖÜß
|
||||||
|
* Satzeichen -
|
||||||
|
* 2-50 Zeichen
|
||||||
|
* @param $tags
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function articleTagValidator($tags)
|
||||||
|
{
|
||||||
|
if (!isset($tags)) {
|
||||||
|
$tags = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$rawTags = explode(',', $tags);
|
||||||
|
|
||||||
|
foreach ($rawTags as $rawTag) {
|
||||||
|
// Leerzeichen am Anfang/Ende des einzelnen Tags entfernen:
|
||||||
|
$tag = trim($rawTag);
|
||||||
|
|
||||||
|
// leere Elemente überspringen:
|
||||||
|
if ($tag === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tag mit Regex prüfen:
|
||||||
|
$tagPattern = '/^[a-zA-Z0-9äöüÄÖÜß\s-]{2,50}$/u';
|
||||||
|
if (!preg_match($tagPattern, $tag)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user