Пример #1
0
 /**
  * @see	\wcf\form\AbstractForm::validate()
  */
 public function validate()
 {
     parent::validate();
     // dynamic options
     $optionErrors = $this->optionHandler->validate();
     if (!empty($optionErrors)) {
         $this->errorType = $optionErrors;
         throw new UserInputException('options', $this->errorType);
     }
     // static options
     if ($this->category == 'general') {
         // validate language id
         if (!isset($this->availableLanguages[$this->languageID])) {
             $this->languageID = LanguageFactory::getInstance()->getDefaultLanguageID();
         }
         // validate content language ids
         foreach ($this->contentLanguageIDs as $key => $languageID) {
             if (!isset($this->availableContentLanguages[$languageID])) {
                 unset($this->contentLanguageIDs[$key]);
             }
         }
         if (empty($this->contentLanguageIDs) && isset($this->availableContentLanguages[$this->languageID])) {
             $this->contentLanguageIDs[] = $this->languageID;
         }
         // validate style id
         if (!isset($this->availableStyles[$this->styleID])) {
             $this->styleID = 0;
         }
     }
 }
 /**
  * @see	\wcf\form\AbstractForm::validate()
  */
 public function validate()
 {
     parent::validate();
     $this->optionHandler->validate();
 }