/** * @see \wcf\form\IForm::validate() */ public function validate() { parent::validate(); // validate class name if (empty($this->className)) { throw new UserInputException('className'); } if (!class_exists($this->className)) { throw new UserInputException('className', 'doesNotExist'); } // validate description if (!I18nHandler::getInstance()->validateValue('description')) { if (I18nHandler::getInstance()->isPlainValue('description')) { throw new UserInputException('description'); } else { throw new UserInputException('description', 'multilingual'); } } try { CronjobUtil::validate($this->startMinute, $this->startHour, $this->startDom, $this->startMonth, $this->startDow); } catch (SystemException $e) { // extract field name $fieldName = ''; if (preg_match("/cronjob attribute '(.*)'/", $e->getMessage(), $match)) { $fieldName = $match[1]; } throw new UserInputException($fieldName, 'notValid'); } }
/** * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::validateImport() */ protected function validateImport(array $data) { CronjobUtil::validate($data['startMinute'], $data['startHour'], $data['startDom'], $data['startMonth'], $data['startDow']); }
/** * @see wcf\form\IForm::validate() */ public function validate() { parent::validate(); // validate class name if (empty($this->className)) { throw new UserInputException('className'); } if (!class_exists($this->className)) { throw new UserInputException('className', 'doesNotExist'); } try { CronjobUtil::validate($this->startMinute, $this->startHour, $this->startDom, $this->startMonth, $this->startDow); } catch (SystemException $e) { // extract field name $fieldName = ''; if (preg_match("/cronjob attribute '(.*)'/", $e->getMessage(), $match)) { $fieldName = $match[1]; } throw new UserInputException($fieldName, 'notValid'); } }