本文整理汇总了PHP中wcf\form\AbstractForm::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractForm::validate方法的具体用法?PHP AbstractForm::validate怎么用?PHP AbstractForm::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wcf\form\AbstractForm
的用法示例。
在下文中一共展示了AbstractForm::validate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
if (!$this->accept) {
throw new UserInputException('accept');
}
}
示例2: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
if ($this->timeframe < 1) {
throw new UserInputException('timeframe');
}
}
示例3: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
// valid event ids
$validEventIDs = array();
foreach ($this->events as $events) {
foreach ($events as $event) {
$validEventIDs[] = $event->eventID;
if (!isset($this->settings[$event->eventID]['enabled'])) {
$this->settings[$event->eventID]['enabled'] = 0;
}
}
}
foreach ($this->settings as $eventID => &$settings) {
// validate event id
if (!in_array($eventID, $validEventIDs)) {
throw new UserInputException();
}
// ensure 'enabled' exists
if (!isset($settings['enabled'])) {
$settings['enabled'] = 0;
}
// ensure 'mailNotificationType' exists
if (!isset($settings['mailNotificationType']) || !in_array($settings['mailNotificationType'], self::$validMailNotificationTypes)) {
$settings['mailNotificationType'] = 'none';
}
}
unset($settings);
}
示例4: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
if (!I18nHandler::getInstance()->validateValue('categoryName', true)) {
throw new UserInputException('categoryName', 'multilingual');
}
}
示例5: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
// check if file is uploaded or linked
if (!empty($this->file['tmp_name'])) {
$this->backup = $this->file['tmp_name'];
} else {
if ($this->fileLink != '') {
//check if file is external url
if (FileUtil::isURL($this->fileLink)) {
try {
//download file
$this->backup = FileUtil::downloadFileFromHttp($this->fileLink, 'cms_backup');
} catch (SystemException $e) {
//download failed
throw new UserInputException('fileLink', 'downloadFailed');
}
} else {
//file not found
if (!file_exists($this->fileLink)) {
throw new UserInputException('fileLink', 'notFound');
} else {
$this->backup = $this->fileLink;
}
}
} else {
throw new UserInputException('file', 'empty');
}
}
}
示例6: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
if (WCF::getUser()->disableAvatar) {
throw new PermissionDeniedException();
}
if ($this->avatarType != 'custom' && $this->avatarType != 'gravatar') {
$this->avatarType = 'none';
}
switch ($this->avatarType) {
case 'custom':
if (!WCF::getUser()->avatarID) {
throw new UserInputException('custom');
}
break;
case 'gravatar':
if (!MODULE_GRAVATAR) {
$this->avatarType = 'none';
break;
}
// test gravatar
if (!Gravatar::test(WCF::getUser()->email)) {
throw new UserInputException('gravatar', 'notFound');
}
break;
}
}
示例7: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
AbstractForm::validate();
if (empty($this->masterPassword)) {
throw new UserInputException('masterPassword');
}
// check password security
if (mb_strlen($this->masterPassword) < 12) {
throw new UserInputException('masterPassword', 'notSecure');
}
// digits
if (!Regex::compile('\\d')->match($this->masterPassword)) {
throw new UserInputException('masterPassword', 'notSecure');
}
// latin characters (lower-case)
if (!Regex::compile('[a-z]')->match($this->masterPassword)) {
throw new UserInputException('masterPassword', 'notSecure');
}
// latin characters (upper-case)
if (!Regex::compile('[A-Z]')->match($this->masterPassword)) {
throw new UserInputException('masterPassword', 'notSecure');
}
// password equals username
if ($this->masterPassword == WCF::getUser()->username) {
throw new UserInputException('masterPassword', 'notSecure');
}
// confirm master password
if (empty($this->confirmMasterPassword)) {
throw new UserInputException('confirmMasterPassword');
}
if ($this->confirmMasterPassword != $this->masterPassword) {
throw new UserInputException('confirmMasterPassword', 'notEqual');
}
}
示例8: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
$this->errorType = array_merge($this->optionHandler->validate(), $this->errorType);
parent::validate();
if (!empty($this->errorType)) {
throw new UserInputException('options', $this->errorType);
}
}
示例9: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
$this->validateName();
$this->validateFolderName();
if ($this->parentTemplateGroupID && !isset($this->availableTemplateGroups[$this->parentTemplateGroupID])) {
throw new UserInputException('parentTemplateGroupID', 'notValid');
}
}
示例10: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
foreach ($this->points as $objectTypeID => $points) {
if ($points < 0) {
throw new UserInputException($objectTypeID, 'greaterThan');
}
}
}
示例11: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
if (empty($this->server)) {
throw new UserInputException('server');
}
if (!PackageUpdateServer::isValidServerURL($this->server)) {
throw new UserInputException('server', 'notValid');
}
}
示例12: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
// username
$this->validateUsername();
// password
$this->validatePassword();
// email
$this->validateEmail();
}
示例13: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
if (WCF::getUser()->disableSignature) {
throw new PermissionDeniedException();
}
AbstractForm::validate();
if (!empty($this->text)) {
$this->validateText();
}
}
示例14: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
if (empty($this->masterPassword)) {
throw new UserInputException('masterPassword');
}
// check password
if (!PasswordUtil::secureCompare(MASTER_PASSWORD, PasswordUtil::getDoubleSaltedHash($this->masterPassword, MASTER_PASSWORD))) {
throw new UserInputException('masterPassword', 'notValid');
}
}
示例15: validate
/**
* @see \wcf\form\IForm::validate()
*/
public function validate()
{
parent::validate();
// validate title
if (empty($this->title)) {
throw new UserInputException('title');
}
// validate less
if (empty($_POST['less'])) {
throw new UserInputException('less');
}
}