/** * 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; }
/** * 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; }
/** * 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(); }
/** * 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(); }
/** * 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; }
/** * 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; }