示例#1
0
 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);
 }
示例#2
0
 /**
  * @param JDatabase $db A database connector object
  * @return void
  */
 function JCommentsTableCustomBBCode(&$db)
 {
     parent::__construct('#__jcomments_custom_bbcodes', 'id', $db);
 }
示例#3
0
 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;
 }
示例#4
0
 /**
  * @param JDatabase $db A database connector object
  * @return void
  */
 function JCommentsTableReport(&$db)
 {
     parent::__construct('#__jcomments_reports', 'id', $db);
 }
示例#5
0
 /**
  * @param JDatabase $db A database connector object
  * @return void
  */
 function JCommentsTableBlacklist(&$db)
 {
     parent::__construct('#__jcomments_blacklist', 'id', $db);
 }