예제 #1
0
파일: User.php 프로젝트: merlinxie/lulublog
 public function scenarios()
 {
     $parent = parent::scenarios();
     $parent['login'] = ['username', 'password'];
     $parent['register'] = ['username', 'password', 'email'];
     return $parent;
 }
예제 #2
0
 public function init()
 {
     parent::init();
     if (LsYii::getActionId() != 'index') {
         $this->sort = 0;
         $this->parent_id = 0;
         $this->status = \source\libs\Constants::Dict_Status_Enable;
     }
 }
예제 #3
0
 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         if ($this->hasAttribute('sort_num')) {
             if ($this->sort_num == null || $this->sort_num == '') {
                 $this->sort_num = 0;
             }
         }
         if ($this->hasAttribute('created_at')) {
             if ($this->created_at == null || $this->created_at == '') {
                 $this->created_at = time();
             }
         }
         if ($this->hasAttribute('updated_at')) {
             $this->updated_at = time();
         }
         return true;
     }
     return false;
 }
예제 #4
0
 public function init()
 {
     $this->target = Constants::Target_Self;
     $this->status = Constants::Status_Enable;
     parent::init();
 }
예제 #5
0
 public function beforeSave($insert)
 {
     $uploadedFile = Common::uploadFile('Content[thumb]');
     if ($uploadedFile != null) {
         $this->thumb = $uploadedFile['url'] . $uploadedFile['new_name'];
     }
     return parent::beforeSave($insert);
 }
예제 #6
0
 /**
  * 获取分类切换列表
  * @param type $defaultId
  * @return type
  */
 public static function getItems($defaultId, $url)
 {
     $model = self::getOneMenu();
     return parent::getItemsInternal($model, $defaultId, $url);
 }
예제 #7
0
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     Fragment::clearCachedData($this->fragment_id);
 }
예제 #8
0
파일: User.php 프로젝트: phpsong/lulucms2
 public function beforeSave($insert)
 {
     if ($insert) {
         //$this->generateAuthKey();
         $this->generatePasswordHash();
         //$this->generatePasswordResetToken();
     }
     if (!$insert && !empty($this->password)) {
         $this->generatePasswordHash();
     }
     return parent::beforeSave($insert);
 }
예제 #9
0
 public function beforeSave($insert)
 {
     $uploadedFile = Common::uploadFile('Content[thumb]');
     if ($uploadedFile != null) {
         $this->thumb = $uploadedFile['url'] . $uploadedFile['new_name'];
     }
     if ($this->views == null) {
         $this->views = 0;
     }
     if ($this->comments == null) {
         $this->comments = 0;
     }
     if ($this->summary == null || empty($this->summary)) {
         $content = strip_tags($this->content);
         $pattern = '/\\s/';
         //去除空白
         $content = preg_replace($pattern, '', $content);
         $this->summary = StringHelper::subStr($content, 250);
     }
     return parent::beforeSave($insert);
 }
예제 #10
0
파일: Content.php 프로젝트: sym660/lulucms2
 public function beforeSave($insert)
 {
     $uploadedFile = Common::uploadFile('Content[thumb]');
     if ($uploadedFile['message'] === 'ok') {
         $this->thumb = $uploadedFile['full_name'];
     }
     return parent::beforeSave($insert);
 }