示例#1
0
文件: Model.php 项目: ukrcms/ukrcms
 protected function beforeSave()
 {
     if (is_object($this->image)) {
         $newImageData = (string) $this->image;
     } else {
         $newImageData = '';
     }
     if ($newImageData != $this->imageData) {
         $this->imageData = $newImageData;
     }
     if (empty($this->date)) {
         $this->date = time();
     }
     return parent::beforeSave();
 }
示例#2
0
文件: Model.php 项目: ukrcms/ukrcms
 /**
  *
  * @return boolean
  */
 protected function beforeSave()
 {
     # automatically approve comments from good users
     if (!empty($this->email) and !$this->stored()) {
         $previousComment = $this->getTable()->fetchOne(array('email' => $this->email));
         if (!empty($previousComment) and $previousComment->status == self::STATUS_APPROVED) {
             # previous comment is approved so user is good
             $this->status = self::STATUS_APPROVED;
         }
     }
     $this->comment = strip_tags($this->comment);
     if (empty($this->time)) {
         $this->time = time();
     }
     return parent::beforeSave();
 }