Exemplo n.º 1
0
 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');
 }
Exemplo n.º 3
0
 public static function redirectToObject()
 {
     $app = JCommentsFactory::getApplication('site');
     $object_id = (int) JCommentsInput::getVar('object_id', 0);
     $object_group = trim(strip_tags(JCommentsInput::getVar('object_group', 'com_content')));
     $lang = trim(strip_tags(JCommentsInput::getVar('lang')));
     if ($object_id != 0 && $object_group != '') {
         $link = JCommentsObjectHelper::getLink($object_id, $object_group, $lang);
         $link = str_replace('amp;', '', $link);
         if ($link == '') {
             $link = $app->getCfg('live_site');
         }
     } else {
         $link = $app->getCfg('live_site');
     }
     JCommentsRedirect($link);
 }
Exemplo n.º 4
0
 function redirectToObject()
 {
     global $mainframe;
     $object_id = (int) JCommentsInput::getVar('object_id', 0);
     $object_group = trim(strip_tags(JCommentsInput::getVar('object_group', 'com_content')));
     if ($object_id != 0 && $object_group != '') {
         $link = JCommentsObjectHelper::getLink($object_id, $object_group);
         $link = str_replace('amp;', '', $link);
         if ($link == '') {
             $link = $mainframe->getCfg('live_site');
         }
     } else {
         $link = $mainframe->getCfg('live_site');
     }
     JCommentsRedirect($link);
 }
 function order($inc)
 {
     $id = JCommentsInput::getVar('cid', 0);
     $id = count($id) ? $id[0] : 0;
     $db =& JCommentsFactory::getDBO();
     $row = new JCommentsCustomBBCodeDB($db);
     if ($row->load($id)) {
         $row->move($inc);
         JCommentsCache::cleanCache('com_jcomments');
     }
     JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=custombbcodes');
 }
 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');
 }
Exemplo n.º 7
0
 function rebuildTree()
 {
     require_once dirname(__FILE__) . DS . 'install' . DS . 'helpers' . DS . 'database.php';
     JCommentsInstallerDatabaseHelper::updateCommentsLevel();
     JCommentsInstallerDatabaseHelper::updateCommentsPath();
     JCommentsCache::cleanCache('com_jcomments');
     $message = JText::_('Tree structure successfully updated!');
     JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=comments', $message);
 }