Esempio n. 1
0
 public static function deleteComments($object_id, $object_group = 'com_content')
 {
     $object_group = trim($object_group);
     $oids = is_array($object_id) ? implode(',', $object_id) : $object_id;
     $db = JFactory::getDbo();
     $query = "SELECT id FROM #__jcomments " . "\n WHERE object_group = " . $db->Quote($object_group) . "\n AND object_id IN (" . $oids . ")";
     $db->setQuery($query);
     $cids = $db->loadColumn();
     JCommentsModel::deleteCommentsByIds($cids);
     $query = "DELETE FROM #__jcomments_objects " . " WHERE object_group = " . $db->Quote($object_group) . " AND object_id = " . $db->Quote($object_id);
     $db->setQuery($query);
     $db->execute();
     return true;
 }
Esempio n. 2
0
 function deleteComments($object_id, $object_group = 'com_content')
 {
     $object_group = trim($object_group);
     $oids = is_array($object_id) ? $object_id : array($object_id);
     $oids = implode(',', $oids);
     $db =& JCommentsFactory::getDBO();
     $query = "SELECT id FROM #__jcomments " . "\n WHERE object_group = '" . $db->getEscaped($object_group) . "'" . "\n AND object_id IN (" . $oids . ")";
     $db->setQuery($query);
     $cids = $db->loadResultArray();
     JCommentsModel::deleteCommentsByIds($cids);
     return true;
 }
Esempio n. 3
0
 public static function remove()
 {
     JCommentsSecurity::checkToken();
     $cid = JCommentsInput::getVar('cid', array());
     if (is_array($cid)) {
         $db = JCommentsFactory::getDBO();
         $config = JCommentsFactory::getConfig();
         if ($config->getInt('delete_mode') == 0) {
             JCommentsModel::deleteCommentsByIds($cid);
         } else {
             $comment = new JCommentsTableComment($db);
             foreach ($cid as $id) {
                 $comment->reset();
                 if ($comment->load($id)) {
                     $comment->markAsDeleted();
                 }
             }
         }
         $cache = JCommentsFactory::getCache('com_jcomments');
         $cache->clean();
     }
     JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=comments');
 }
Esempio n. 4
0
 function remove()
 {
     $id = JCommentsInput::getVar('cid', array());
     if (is_array($id) && count($id) > 0) {
         JCommentsModel::deleteCommentsByIds($id);
         JCommentsCache::cleanCache('com_jcomments');
     }
     JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=comments');
 }