public static function saveSmiles() { JCommentsSecurity::checkToken(); $app = JCommentsFactory::getApplication('administrator'); $db = JCommentsFactory::getDBO(); $smileCodes = JCommentsInput::getVar('cfg_smile_codes', array()); $smileImages = JCommentsInput::getVar('cfg_smile_images', array()); $smilesValues = array(); foreach ($smileCodes as $k => $code) { $image = trim($smileImages[$k]); $code = trim($code); if ($code != '' && $image != '') { $smilesValues[] = $code . "\t" . $image; } } $values = count($smilesValues) ? implode("\n", $smilesValues) : ''; $db->setQuery("SELECT name FROM #__jcomments_settings WHERE component=''"); $dbParams = $db->loadResultArray(); if (in_array('smiles', $dbParams)) { $query = "UPDATE #__jcomments_settings SET `value` = " . $db->Quote($values) . " WHERE `name` = 'smiles'"; } else { $query = "INSERT INTO #__jcomments_settings SET `value` = " . $db->Quote($values) . ", `name` = 'smiles'"; } $db->setQuery($query); $db->query(); $message = JText::_('A_SETTINGS_SAVED'); // Clean all caches for components with comments if ($app->getCfg('caching') == 1) { $db->setQuery("SELECT DISTINCT(object_group) AS name FROM #__jcomments"); $rows = $db->loadObjectList(); foreach ($rows as $row) { $cache = JCommentsFactory::getCache($row->name); $cache->clean(); } unset($rows); } $cache = JCommentsFactory::getCache('com_jcomments'); $cache->clean(); JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=smiles', $message); }
public static function remove() { JCommentsSecurity::checkToken(); $id = JCommentsInput::getVar('cid', array()); if (is_array($id) && count($id) > 0) { $ids = implode(',', $id); $db = JCommentsFactory::getDBO(); $db->setQuery("DELETE FROM #__jcomments_subscriptions WHERE id IN ({$ids})"); $db->query(); } JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=subscriptions'); }
public static function order($inc) { JCommentsSecurity::checkToken(); $id = JCommentsInput::getVar('cid', 0); $id = count($id) ? $id[0] : 0; $db = JCommentsFactory::getDBO(); $row = new JCommentsTableCustomBBCode($db); if ($row->load($id)) { $row->move($inc); $cache = JCommentsFactory::getCache('com_jcomments'); $cache->clean(); } JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=custombbcodes'); }