예제 #1
0
 /**
  * ÃÜÂëΪ¿Õʱ£¬ÃÜÂë×Ö¶ÎʹÓÃÔ­À´µÄÃÜÂë
  */
 function beforeSave($insert)
 {
     parent::beforeSave($insert);
     if ($this->from_password) {
         $this->from_password = base64_encode(SecurityHelper::encrypt($this->from_password, \Yii::$app->params['SecurityHelper']));
     } else {
         $this->from_password = $this->old;
     }
     return true;
 }
예제 #2
0
파일: User.php 프로젝트: rocketyang/mincms
 function beforeSave($insert)
 {
     parent::beforeSave($insert);
     if ($this->isNewRecord) {
         $this->password = SecurityHelper::generatePasswordHash($this->password);
     } else {
         //更新密码
         $this->password = SecurityHelper::generatePasswordHash($this->new_password);
     }
     return true;
 }
예제 #3
0
파일: Send.php 프로젝트: rocketyang/mincms
 function beforeSave($insert)
 {
     parent::beforeSave($insert);
     if ($this->attach) {
         if (is_array($this->attach)) {
             $this->attach = serialize($this->attach);
         }
     } else {
         $this->attach = "";
     }
     return true;
 }
예제 #4
0
파일: Group.php 프로젝트: rocketyang/mincms
 /**
  * 保存数据前,对pid判断,是否是正确的移动
  * 如移到到自己及自己所属的子分类将提示移动失败
  * pid 值将不会被保存
  */
 function beforeSave($insert)
 {
     parent::beforeSave($insert);
     if ($this->id) {
         $data = static::find()->all();
         if ($data) {
             $out = \app\core\Arr::model_tree($data, $value = 'name', $id = 'id', $pid = 'pid', $this->id);
             $out[$this->id] = $this->id;
         } else {
             $out[$this->id] = $this->id;
         }
         if ($out[$this->pid]) {
             $this->pid = $this->old_pid;
             flash('error', __('try change tree error'));
         }
     }
     return true;
 }