Fix validation of custom page urls
authorMarcel Werk <burntime@woltlab.com>
Wed, 22 May 2024 14:01:34 +0000 (16:01 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 22 May 2024 14:01:34 +0000 (16:01 +0200)
It was not checked whether a URL was defined for each language.

wcfsetup/install/files/lib/acp/form/PageAddForm.class.php

index ded244a96aba66d75530dbd94c30d23a8dccf677..5ef26f42e7442d2d95eb719581b47361227b6e49 100644 (file)
@@ -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');