Example #1
0
 protected function afterValidate()
 {
     if (!$this->getDateRegMatch()) {
         $this->addError('datum', 'Datum muss das Format: TT.MM.JJJJ oder TT-TT.MM.JJJJ oder TT/TT.MM.JJJJ oder TT.MM.JJJJ-TT.MM.JJJJ haben.');
     }
     return parent::afterValidate();
 }
Example #2
0
 protected function afterValidate()
 {
     if ($this->isNewRecord || $this->newPassword) {
         $this->password = $this->encrypt($this->password);
     }
     return parent::afterValidate();
 }
 protected function afterValidate()
 {
     $highlighter = new CTextHighlighter();
     $highlighter->language = $this->language;
     $this->html = $highlighter->highlight($this->code);
     return parent::afterValidate();
 }
 protected function afterValidate()
 {
     parent::afterValidate();
     if (!$this->hasErrors()) {
         $this->password = $this->hashPassword($this->password);
     }
 }
Example #5
0
 public function afterValidate()
 {
     $this->onBeforeSave = function ($event) {
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
         $event->sender->mime_type = finfo_file($finfo, 'files/_user/bloc_document/' . $event->sender->file);
         finfo_close($finfo);
     };
     return parent::afterValidate();
 }
Example #6
0
 protected function afterValidate()
 {
     foreach (array_keys(Yii::app()->params["ac_areas_chap"]) as $ac) {
         if ($this->{$ac} == "") {
             $this->{$ac} = null;
         }
     }
     // Если нам указали особые права доступа, проверяем, есть ли уже такие в переводе?
     if ($this->ac_read . $this->ac_gen . $this->ac_rate . $this->ac_comment . $this->ac_tr != "") {
         $r = Yii::app()->db->createCommand("SELECT 1 FROM chapters WHERE book_id = :book_id AND id != :id AND (ac_read || ac_gen || ac_rate || ac_comment || ac_tr != '')")->query(array("book_id" => $this->book_id, "id" => $this->id));
         if ($r->rowCount > 0) {
             $this->addError("ac_read", "В переводе только одна глава может иметь особые права доступа.");
         }
     }
     parent::afterValidate();
 }
Example #7
0
 protected function afterValidate()
 {
     // Аватар
     if ($this->scenario == "info" && $this->rm_img) {
         $this->img->delete();
     }
     if ($this->scenario == "info" && $this->new_img) {
         $new_img = new UploadedImage("book");
         if (!$new_img->upload($this->new_img, 200, 500)) {
             $this->addError("new_img", "Не удалось загрузить картинку, попробуйте другую.");
             return;
         }
         if ($this->img instanceof UploadedImage) {
             $this->img->delete();
         }
         $this->img = $new_img;
     }
     parent::afterValidate();
 }
Example #8
0
 protected function afterValidate()
 {
     if ($this->hasErrors()) {
         $this->instrumento_juridico = InstrumentoJuridico::load(json_decode($this->instrumento_juridico));
         $this->convenio = Convenio::load(json_decode($this->convenio));
     }
     parent::afterValidate();
 }
Example #9
0
 protected function afterValidate()
 {
     if ($this->scenario == 'buy') {
         return true;
     }
     if (!$this->access) {
         $this->addError('access', 'Выберите флаги доступа');
     }
     if ($this->isNewRecord && $this->flags === 'a' && !$this->password) {
         $this->addError('password', 'Для админки по нику нужно обязательно указывать пароль');
     }
     if ($this->flags === 'd' && !filter_var($this->steamid, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4))) {
         $this->addError('steamid', 'Неверно введен IP');
     }
     if ($this->flags === 'c' && !Prefs::validate_value($this->steamid, 'steamid')) {
         $this->addError('steamid', 'Неверно введен SteamID');
     }
     if ($this->password && !preg_match('#^([a-z0-9]+)$#i', $this->password)) {
         $this->addError('password', 'Пароль может содержать только буквы латинского алфавита и цифры');
     }
     if (!$this->isNewRecord && $this->days < $this->change && $this->addtake === '1') {
         $this->addError('', 'Ошибка! Нельзя забрать дней больше, чем у него уже есть');
     }
     if (empty($this->servers)) {
         $this->addError('servers', 'Выберите хотябы один сервер');
     }
     if ($this->hasErrors()) {
         return $this->getErrors();
     }
     return parent::afterValidate();
 }
 public function afterValidate()
 {
     parent::afterValidate();
     if (isset($this->cert_image) && $this->cert_image != null) {
     }
 }
Example #11
0
 public function afterValidate()
 {
     parent::afterValidate();
     $this->dbDate();
 }
Example #12
0
 protected function afterValidate()
 {
     parent::afterValidate();
     //$this->password = $this->encrypt($this->password,Yii::app()->params->hashkey);
     $this->ip = $_SERVER['REMOTE_ADDR'];
 }
 /**
  * apply a hash on the password before we store it in the database
  */
 protected function afterValidate()
 {
     parent::afterValidate();
     //ensure we don't have any other errors
     if (!$this->hasErrors()) {
         $this->password = $this->hashPassword($this->password);
     }
 }
Example #14
0
 protected function afterValidate()
 {
     parent::afterValidate();
     //lakukan enkripsi pada password yang di input
 }
Example #15
0
 protected function afterValidate()
 {
     parent::afterValidate();
     $this->pwd_hash = $this->hash($this->password);
 }
Example #16
0
 public function afterValidate()
 {
     parent::afterValidate();
     $this->password = $this->encrypt($this->password);
 }
Example #17
0
 public function afterValidate()
 {
     if ($this->isNewRecord) {
         $auth = Yii::app()->authManager;
         $module = Yii::createComponent('application.modules.' . $this->module . '.' . ucfirst($this->module) . 'Module', null, null);
         if (!$module->instantiable && CmsSection::model()->findAllByAttributes(array('module' => $this->module)) != null) {
             $this->addError('module', Yii::t('admin', 'Ce module ne peut être instancié.'));
         }
     }
     return parent::afterValidate();
 }
 public function afterValidate(){
     if(empty($this->date)){
         $this->date = new CDbExpression('NOW()');
     }
     return parent::afterValidate();
 }
Example #19
0
 /**
  * This method is invoked after validation.
  */
 public function afterValidate()
 {
     parent::afterValidate();
     if (!$this->hasErrors()) {
         if ($this->isNewRecord) {
             $currentTimestamp = date('Y-m-d H:i:s');
             $this->student_id = Yii::app()->user->id;
             $this->upload_timestamp = $currentTimestamp;
             $this->edit_timestamp = $currentTimestamp;
         } else {
             $currentTimestamp = date('Y-m-d H:i:s');
             $this->edit_timestamp = $currentTimestamp;
         }
     }
 }
Example #20
0
 /**
  * This method is invoked after validation.
  */
 public function afterValidate()
 {
     parent::afterValidate();
     if (!$this->hasErrors()) {
         if ($this->isNewRecord) {
             $this->timestamp = date('Y-m-d H:i:s');
         }
     }
 }
Example #21
0
 /**
  * perform one-way encryption on the password before we store it in database
  */
 protected function afterValidate()
 {
     parent::afterValidate();
     $this->password = $this->encrypt($this->password);
     $this->user_type = 1;
 }
 protected function afterValidate()
 {
     parent::afterValidate();
     $this->password = $this->result($this->password);
 }