function store($updateNulls = false) { if ($this->userid != 0 && empty($this->email)) { $user = JCommentsFactory::getUser($this->userid); $this->email = $user->email; unset($user); } if (empty($this->lang)) { $this->lang = JCommentsMultilingual::getLanguage(); } $this->hash = $this->getHash(); return parent::store($updateNulls); }
/** * @param JDatabase $db A database connector object * @return void */ function JCommentsTableCustomBBCode(&$db) { parent::__construct('#__jcomments_custom_bbcodes', 'id', $db); }
public function delete($oid = null) { $k = $this->_tbl_key; $id = $oid ? $oid : $this->{$k}; $result = parent::delete($oid); if ($result) { // process nested comments (threaded mode) $query = "SELECT id, parent" . "\n FROM #__jcomments" . "\n WHERE `object_group` = " . $this->_db->Quote($this->object_group) . "\n AND `object_id`= " . $this->object_id; $this->_db->setQuery($query); $rows = $this->_db->loadObjectList(); require_once JCOMMENTS_LIBRARIES . '/joomlatune/tree.php'; $tree = new JoomlaTuneTree($rows); $descendants = $tree->descendants($id); unset($rows); if (count($descendants)) { $query = "DELETE FROM #__jcomments WHERE id IN (" . implode(',', $descendants) . ')'; $this->_db->setQuery($query); $this->_db->query(); $descendants[] = $id; $query = "DELETE FROM #__jcomments_votes WHERE commentid IN (" . implode(',', $descendants) . ')'; $this->_db->setQuery($query); $this->_db->query(); $query = "DELETE FROM #__jcomments_reports WHERE commentid IN (" . implode(',', $descendants) . ')'; $this->_db->setQuery($query); $this->_db->query(); } else { // delete comment's vote info $query = "DELETE FROM #__jcomments_votes WHERE commentid = " . $id; $this->_db->setQuery($query); $this->_db->query(); // delete comment's reports info $query = "DELETE FROM #__jcomments_reports WHERE commentid = " . $id; $this->_db->setQuery($query); $this->_db->query(); } unset($descendants); } return $result; }
/** * @param JDatabase $db A database connector object * @return void */ function JCommentsTableReport(&$db) { parent::__construct('#__jcomments_reports', 'id', $db); }
/** * @param JDatabase $db A database connector object * @return void */ function JCommentsTableBlacklist(&$db) { parent::__construct('#__jcomments_blacklist', 'id', $db); }