Beispiel #1
0
 /**
  * validate
  *
  * Run validation process
  *
  * @return null
  */
 public function validate()
 {
     parent::validate();
     // compare protection code
     if (property_exists($this->_data, 'protection_code')) {
         $protectionCode = \Storage::read('protection-code-register');
         \Storage::remove('protection-code-register');
         if ($this->_data->protection_code !== $protectionCode) {
             $this->addMessage('protection_code', \View::$language->register_form_protection_code_invalid);
         }
     }
     // compare password confirmation
     if (property_exists($this->_data, 'password') && property_exists($this->_data, 'confirm_password') && $this->_data->password !== $this->_data->confirm_password) {
         $this->addMessage('confirm_password', \View::$language->register_form_password_confirm_mismatch);
     }
     // check for existence
     if ($this->isValid()) {
         $checkedFields = array('email', 'login');
         $UserModel = \App::getInstance('common\\UserModel');
         foreach ($checkedFields as $fName) {
             if ($UserModel->isExists($fName, $this->_data->{$fName})) {
                 $mKey = 'register_form_' . $fName . '_is_exists';
                 $this->addMessage($fName, \View::$language->{$mKey});
             }
         }
     }
 }
Beispiel #2
0
 /**
  * validate
  *
  * Run validation process
  *
  * @return null
  */
 public function validate()
 {
     parent::validate();
     $availableFilters = \App::getConfig('forum')->tracker_filters;
     if (!in_array($this->_data->by, $availableFilters, true)) {
         $this->_isValid = false;
     }
 }
Beispiel #3
0
 /**
  * __construct
  *
  * Topic request process validation class constructor.
  * Definition of validation rules
  *
  * @return null
  */
 public function __construct()
 {
     parent::__construct();
     $this->_rules = array('id' => array(array('negation', 'IsNaturalNumber', null), array('filter', 'ToInt'), array('negation', 'GreatThanZero', null)));
     // append unrequired page number
     if (\Request::getParam('page') !== null) {
         $this->_rules['page'] = array(array('negation', 'IsNaturalNumber', null), array('filter', 'ToInt'), array('negation', 'GreatThanZero', null));
     } else {
         $this->_data->page = 1;
     }
 }
Beispiel #4
0
 public function __construct($name = null)
 {
     // we want to ignore the name passed
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->getInputFilter();
     $this->add(array('name' => 'email', 'attributes' => array('class' => 'form-control', 'placeholder' => 'Email', 'required' => true, 'type' => 'email')));
     $this->add(array('name' => 'password', 'attributes' => array('class' => 'form-control', 'placeholder' => 'Password', 'required' => true, 'type' => 'password')));
     // set input filter
     $this->setInputFilter($this->createInputFilter());
 }
Beispiel #5
0
 /**
  * validate
  *
  * Run validation process
  *
  * @return null
  */
 public function validate()
 {
     parent::validate();
     // compare protection code
     if (property_exists($this->_data, 'protection_code')) {
         $protectionCode = \Storage::read('protection-code-sign-in');
         \Storage::remove('protection-code-sign-in');
         if ($this->_data->protection_code !== $protectionCode) {
             $this->addMessage('protection_code', \View::$language->sign_in_form_protection_code_invalid);
         }
     }
     // remove sign in counter data
     if ($this->isValid()) {
         \Storage::remove('sign-in-tries');
     }
 }
Beispiel #6
0
 /**
  * __construct
  *
  * Forum request process validation class constructor.
  * Definition of validation rules
  *
  * @return null
  */
 public function __construct()
 {
     parent::__construct();
     $this->_rules['id'] = array(array('negation', 'IsNaturalNumber', null), array('filter', 'ToInt'), array('negation', 'GreatThanZero', null));
 }