/** * {@inheritDoc} */ protected function validator($varInput) { if (is_array($varInput)) { return parent::validator($varInput); } return parent::validator(trim($varInput)); }
/** * Standardize the ID * * @param mixed $varInput * * @return mixed */ protected function validator($varInput) { if (isset($varInput['id'])) { $varInput['id'] = \StringUtil::standardize($varInput['id']); } return parent::validator($varInput); }
/** * Trim values * @param mixed * @return mixed */ protected function validator($varInput) { $varInput[0] = parent::validator($varInput[0]); $varInput[1] = parent::validator($varInput[1]); $varInput[2] = preg_replace('/[^a-z0-9_]+/', '', $varInput[2]); return $varInput; }
/** * Skip the field if "change selection" is not checked * @param mixed * @return mixed */ protected function validator($varInput) { $this->import('BackendUser', 'User'); if (!$this->Input->post($this->strName . '_save')) { $this->mandatory = false; $this->blnSubmitInput = false; } elseif ($varInput == '') { return parent::validator($varInput); } elseif (strlen($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['path'])) { $rgxp = '/^' . preg_quote($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['path'], '/') . '\\//i'; foreach ((array) $varInput as $strFile) { if (!preg_match($rgxp, $strFile)) { $this->addError('File or folder "' . $strFile . '" is not mounted!'); $this->log('File or folder "' . $strFile . '" is not mounted (hacking attempt)', 'FileTree validator()', TL_ERROR); } } } elseif (!$this->User->isAdmin) { foreach ((array) $varInput as $strFile) { if (!$this->User->hasAccess($strFile, 'filemounts')) { $this->addError('File or folder "' . $strFile . '" is not mounted!'); $this->log('File or folder "' . $strFile . '" is not mounted (hacking attempt)', 'FileTree validator()', TL_ERROR); } } } return parent::validator($varInput); }
/** * Ignore the field if nothing has been entered * @param mixed * @return mixed */ protected function validator($varInput) { if ($varInput == '*****') { $this->blnSubmitInput = false; return true; } return parent::validator(trim($varInput)); }
/** * Do not check stop fields. * * @param mixed $varInput * @return mixed */ protected function validator($varInput) { if ($this->conditionType == 'stop') { $this->mandatory = false; $this->blnSubmitInput = false; } return parent::validator($varInput); }
/** * Skip the field if "change selection" is not checked * @param mixed * @return mixed */ protected function validator($varInput) { if (!$this->Input->post($this->strName . '_save')) { $this->mandatory = false; $this->blnSubmitInput = false; } return parent::validator($varInput); }
/** * Trim values * @param mixed * @return mixed */ public function validator($varInput) { if (is_array($varInput)) { return parent::validator($varInput); } $varInput = $this->fixUuidToBinary($varInput); $varInput = trim($varInput); return parent::validator($varInput); }
/** * Do not validate unit fields * * @param mixed $varInput * * @return mixed */ protected function validator($varInput) { foreach ($varInput as $k => $v) { if ($k != 'unit') { $varInput[$k] = parent::validator($v); } } return $varInput; }
/** * Trim values * * @param mixed $varInput * * @return mixed */ protected function validator($varInput) { $this->import('BackendUser', 'User'); $varInput[0] = parent::validator($varInput[0]); $varInput[1] = parent::validator($varInput[1]); $varInput[2] = preg_replace('/[^a-z0-9_]+/', '', $varInput[2]); $imageSizes = \System::getContainer()->get('contao.image.image_sizes'); $this->arrAvailableOptions = $this->User->isAdmin ? $imageSizes->getAllOptions() : $imageSizes->getOptionsForUser($this->User); if (!$this->isValidOption($varInput[2])) { $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['invalid'], $varInput[2])); } return $varInput; }
/** * Validate input and set value * @param mixed * @return string */ protected function validator($varInput) { $this->blnSubmitInput = false; if (!strlen($varInput) && (strlen($this->varValue) || !$this->mandatory)) { return ''; } if ($varInput != $this->getPost($this->strName . '_confirm')) { $this->addError($GLOBALS['TL_LANG']['ERR']['confirmedEmailMismatch']); } $varInput = $this->idnaEncodeEmail($varInput); $varInput = parent::validator($varInput); if (!$this->hasErrors()) { $this->blnSubmitInput = true; return $varInput; } return ''; }
/** * Trim the values * * @param mixed $varInput The user input * * @return mixed The validated user input */ protected function validator($varInput) { if (is_array($varInput)) { return parent::validator($varInput); } // Convert to Punycode format (see #5571) if ($this->rgxp == 'url') { $varInput = \Idna::encodeUrl($varInput); } elseif ($this->rgxp == 'email' || $this->rgxp == 'friendly') { $varInput = \Idna::encodeEmail($varInput); } return parent::validator($varInput); }
/** * Validate input and set value * @param mixed * @return string */ protected function validator($varInput) { $this->blnSubmitInput = false; if (!strlen($varInput) && (strlen($this->varValue) || !$this->mandatory)) { return ''; } if (utf8_strlen($varInput) < $GLOBALS['TL_CONFIG']['minPasswordLength']) { $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['passwordLength'], $GLOBALS['TL_CONFIG']['minPasswordLength'])); } if ($varInput != $this->getPost($this->strName . '_confirm')) { $this->addError($GLOBALS['TL_LANG']['ERR']['passwordMatch']); } $varInput = parent::validator($varInput); if (!$this->hasErrors()) { $this->blnSubmitInput = true; $_SESSION['TL_CONFIRM'][] = $GLOBALS['TL_LANG']['MSC']['pw_changed']; $strSalt = substr(md5(uniqid(mt_rand(), true)), 0, 23); return sha1($strSalt . $varInput) . ':' . $strSalt; } return ''; }
/** * Trim the values and validate them. * * @param mixed $varInput The value to process. * * @return mixed The processed value */ protected function validator($varInput) { if (is_array($varInput)) { $value = array(); foreach ($varInput as $key => $input) { $value[$key] = parent::validator($input); } return $value; } return parent::validator(trim($varInput)); }
/** * Skip the field if "change selection" is not checked * @param mixed * @return mixed */ protected function validator($varInput) { if (!$this->Input->post($this->strName . '_save')) { $this->mandatory = false; $this->blnSubmitInput = false; } // Check if there is at least one value if ($this->fieldType == 'text') { if (is_array($varInput)) { foreach ($varInput as $k => $option) { if ($this->mandatory && $option != '') { $this->mandatory = false; } elseif ($option == '') { unset($varInput[$k]); } } } } return parent::validator($varInput); }
/** * Validate input and set value * * @param mixed $varInput * * @return string */ protected function validator($varInput) { $this->blnSubmitInput = false; if (($varInput == '' || $varInput == '*****') && $this->varValue != '') { return '*****'; } if (utf8_strlen($varInput) < \Config::get('minPasswordLength')) { $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['passwordLength'], \Config::get('minPasswordLength'))); } if ($varInput != $this->getPost($this->strName . '_confirm')) { $this->addError($GLOBALS['TL_LANG']['ERR']['passwordMatch']); } if ($varInput == $GLOBALS['TL_USERNAME']) { $this->addError($GLOBALS['TL_LANG']['ERR']['passwordName']); } $varInput = parent::validator($varInput); if (!$this->hasErrors()) { $this->blnSubmitInput = true; \Message::addConfirmation($GLOBALS['TL_LANG']['MSC']['pw_changed']); return \Encryption::hash($varInput); } return ''; }
/** * Skip the field if "change selection" is not checked. * * @param array $varInput The current value. * * @return array|string */ protected function validator($varInput) { if (!($this->Input->post($this->strName . '_save') || $this->alwaysSave)) { $this->blnSubmitInput = false; } return parent::validator($varInput); }
/** * Skip the field if "change selection" is not checked * @param mixed * @return mixed */ protected function validator($varInput) { //Todo: Change this code to support Contao 3.x /* if (!$this->Input->post($this->strName . '_save')) { $this->mandatory = false; $this->blnSubmitInput = false; } */ return parent::validator($varInput); }
/** * Trim the values * * @param mixed $varInput The user input * * @return mixed The validated user input */ protected function validator($varInput) { if (is_array($varInput)) { return parent::validator($varInput); } $varInput = \Idna::encodeUrl($varInput); return parent::validator(trim($varInput)); }
/** * Validate input and set value * * @param mixed $varInput The user input * * @return mixed The validated user input */ protected function validator($varInput) { $this->blnSubmitInput = false; if (!strlen($varInput) && (strlen($this->varValue) || !$this->mandatory)) { return ''; } if (utf8_strlen($varInput) < \Config::get('minPasswordLength')) { $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['passwordLength'], \Config::get('minPasswordLength'))); } if ($varInput != $this->getPost($this->strName . '_confirm')) { $this->addError($GLOBALS['TL_LANG']['ERR']['passwordMatch']); } $varInput = parent::validator($varInput); if (!$this->hasErrors()) { $this->blnSubmitInput = true; return \Encryption::hash($varInput); } return ''; }
/** * Validate input and set value * @param mixed * @return string */ protected function validator($varInput) { $this->blnSubmitInput = false; if (($varInput == '' || $varInput == '*****') && $this->varValue != '') { return '*****'; } if (utf8_strlen($varInput) < $GLOBALS['TL_CONFIG']['minPasswordLength']) { $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['passwordLength'], $GLOBALS['TL_CONFIG']['minPasswordLength'])); } if ($varInput != $this->getPost($this->strName . '_confirm')) { $this->addError($GLOBALS['TL_LANG']['ERR']['passwordMatch']); } if ($varInput == $GLOBALS['TL_USERNAME']) { $this->addError($GLOBALS['TL_LANG']['ERR']['passwordName']); } $varInput = parent::validator($varInput); if (!$this->hasErrors()) { $this->blnSubmitInput = true; \Message::addConfirmation($GLOBALS['TL_LANG']['MSC']['pw_changed']); $strSalt = substr(md5(uniqid(mt_rand(), true)), 0, 23); return sha1($strSalt . $varInput) . ':' . $strSalt; } return ''; }
/** * Trim values * @param mixed * @return mixed */ protected function validator($varInput) { $arrNames = array(); foreach ($varInput as $k => $size) { if (in_array($size['name'], $arrNames)) { $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['unique'], $GLOBALS['TL_LANG'][$this->strTable]['iwName'])); } $arrNames[] = $size['name']; $this->mandatory = true; $this->rgxp = 'alpha'; $this->spaceToUnderscore = true; $size['name'] = parent::validator($size['name']); $this->mandatory = false; $this->rgxp = 'digit'; $this->spaceToUnderscore = false; $size['width'] = parent::validator($size['width']); $size['height'] = parent::validator($size['height']); $varInput[$k] = $size; } return $varInput; }