コード例 #1
0
ファイル: ticket.php プロジェクト: sumudinie/hubzero-cms
 /**
  * Store changes to this database entry
  *
  * @param   boolean  $check  Perform data validation check?
  * @return  boolean  False if error, True on success
  */
 public function store($check = true)
 {
     $this->set('open', $this->status('open'));
     if ($this->get('open')) {
         $this->set('resolved', '');
     }
     $result = parent::store($check);
     if ($result && !$this->_tbl->id) {
         $this->_tbl->getId();
     }
     return $result;
 }
コード例 #2
0
ファイル: base.php プロジェクト: mined-gatech/hubzero-cms
 /**
  * Delete a record
  *
  * @return  boolean True on success, false on error
  */
 public function delete()
 {
     // Get some data for the log
     $log = new \stdClass();
     foreach ($this->_tbl->getProperties() as $key => $value) {
         $log->{$key} = $value;
     }
     $log = json_encode($log);
     // Get the scope ID
     $scope_id = $this->get('id');
     if ($res = parent::delete()) {
         // Log the event
         $this->log($scope_id, $this->_scope, 'delete', $log);
     }
     return $res;
 }
コード例 #3
0
ファイル: comment.php プロジェクト: mined-gatech/hubzero-cms
 /**
  * Delete the record and all associated data
  *
  * @return    boolean False if error, True on success
  */
 public function delete()
 {
     // Can't delete what doesn't exist
     if (!$this->exists()) {
         return true;
     }
     // Remove comments
     foreach ($this->replies('list') as $comment) {
         if (!$comment->delete()) {
             $this->setError($comment->getError());
             return false;
         }
     }
     return parent::delete();
 }
コード例 #4
0
ファイル: calendar.php プロジェクト: sumudinie/hubzero-cms
 /**
  * Delete Calendar
  *
  * @return [type] [description]
  */
 public function delete($deleteEvents = false)
 {
     // if subscription delete events
     if ($this->isSubscription() || $deleteEvents) {
         // delete events
         $sql = "DELETE FROM `#__events` WHERE `calendar_id`=" . $this->_db->quote($this->get('id'));
         $this->_db->setQuery($sql);
         $this->_db->query();
     } else {
         // update all events, resetting their calendar
         $sql = "UPDATE `#__events` SET `calendar_id`=0 WHERE `calendar_id`=" . $this->_db->quote($this->get('id'));
         $this->_db->setQuery($sql);
         $this->_db->query();
     }
     // delete calendar
     parent::delete();
 }
コード例 #5
0
ファイル: module.php プロジェクト: kevinwojo/hubzero-cms
 /**
  * Overload Store method so we can run some purifying before save
  *
  * @param   boolean  $check           Run the Table Check Method
  * @param   boolean  $trustedContent  Is content trusted
  * @return  void
  */
 public function store($check = true, $trustedContent = false)
 {
     if (!$this->get('page_trusted', 0)) {
         //get content
         $content = $this->get('content');
         // if content is not trusted, strip php and scripts
         if (!$trustedContent) {
             $content = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $content);
             $content = preg_replace('/<\\?[\\s\\S]*?\\?>/', '', $content);
         }
         // purify content
         $content = $this->purify($content, $trustedContent);
         // set the purified content
         $this->set('content', $content);
     }
     // call parent store
     if (!parent::store($check)) {
         return false;
     }
     return true;
 }
コード例 #6
0
 /**
  * Delete record and associated file
  *
  * @return  boolean
  */
 public function delete()
 {
     if (!parent::delete()) {
         return false;
     }
     if ($this->hasFile()) {
         $file = $this->get('filename');
         $path = $this->link('filepath');
         if (!\Filesystem::delete($path)) {
             $this->setError(Lang::txt('COM_SUPPORT_ERROR_UNABLE_TO_DELETE_FILE', $file));
             return false;
         }
     }
     return true;
 }