Update article-validator.php

This commit is contained in:
2026-06-01 13:54:02 +02:00
parent d5f30176c4
commit 3df526d5b5
+4 -1
View File
@@ -3,6 +3,7 @@
* Prüft, ob der Autor auch der Eigentümer des Beitrags ist. * Prüft, ob der Autor auch der Eigentümer des Beitrags ist.
* @param $author * @param $author
* @return true * @return true
* TODO: Implement this.
*/ */
function articleAuthorValidator($author) function articleAuthorValidator($author)
{ {
@@ -21,6 +22,7 @@ function articleAuthorValidator($author)
*/ */
function articleTitleValidator($title) function articleTitleValidator($title)
{ {
$title = trim($title);
$titlePattern = '/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u'; $titlePattern = '/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u';
if (preg_match($titlePattern, $title)) { if (preg_match($titlePattern, $title)) {
return true; return true;
@@ -36,8 +38,9 @@ function articleTitleValidator($title)
*/ */
function articleContentValidator($content) function articleContentValidator($content)
{ {
$content = trim($content);
$zeichenAnzahl = mb_strlen($content); $zeichenAnzahl = mb_strlen($content);
if ($zeichenAnzahl <= 7000 && $zeichenAnzahl > 10) { if ($zeichenAnzahl <= 7000 && $zeichenAnzahl >= 10) {
return true; return true;
}else{ }else{
return false; return false;