From c2430c30469e89ddb7871280424af97c9d338fab Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 22 May 2024 16:01:34 +0200 Subject: [PATCH] Fix validation of custom page urls It was not checked whether a URL was defined for each language. --- .../install/files/lib/acp/form/PageAddForm.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php b/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php index ded244a96a..5ef26f42e7 100644 --- a/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php @@ -467,8 +467,12 @@ class PageAddForm extends AbstractForm } } - foreach ($this->customURL as $languageID => $customURL) { - $this->validateCustomUrl($languageID, $customURL); + if ($this->isMultilingual) { + foreach ($this->availableLanguages as $language) { + $this->validateCustomUrl($language->languageID, $this->customURL[$language->languageID] ?? ''); + } + } else { + $this->validateCustomUrl(0, $this->customURL[0] ?? ''); } } @@ -484,7 +488,7 @@ class PageAddForm extends AbstractForm { if (empty($customURL)) { if ($this->pageType != 'system') { - throw new UserInputException('customURL_' . $languageID, 'invalid'); + throw new UserInputException('customURL_' . $languageID); } } elseif (!RouteHandler::isValidCustomUrl($customURL)) { throw new UserInputException('customURL_' . $languageID, 'invalid'); -- 2.20.1