function getObjectLink($id) { global $mainframe; if (!isset($GLOBALS['jc_sobi2itemid'])) { $_requestOption = JCommentsInput::getVar('option', ''); $_requestItemid = (int) JCommentsInput::getVar('Itemid', 0); $_Itemid = null; $db =& JCommentsFactory::getDBO(); $query = "SELECT `configValue`" . "\nFROM `#__sobi2_config`" . "\nWHERE `configKey` = 'forceMenuId'" . "\n AND `sobi2Section` = 'general'"; $db->setQuery($query); $forceMenuId = (int) $db->loadResult(); if ($_requestOption == 'com_sobi2' && !$forceMenuId) { $_Itemid = $_requestItemid; } else { $_Itemid = JCommentsPlugin::getItemid('com_sobi2'); } $GLOBALS['jc_sobi2itemid'] = $_Itemid; } $_Itemid = $GLOBALS['jc_sobi2itemid']; if ($_Itemid != null) { $_Itemid = '&Itemid=' . $_Itemid; } else { $_Itemid = ''; } $link = JoomlaTuneRoute::_('index.php?option=com_sobi2&sobi2Task=sobi2Details&sobi2Id=' . $id . $_Itemid); return $link; }
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'); }
function feedLastCommentsGlobal() { global $mainframe; $object_group = trim(strip_tags(JCommentsInput::getVar('object_group', ''))); $object_group = preg_replace('#[^0-9A-Za-z\\-\\_\\,\\.]#is', '', $object_group); $limit = (int) JCommentsInput::getVar('limit', 100); $config =& JCommentsFactory::getConfig(); if ($config->get('enable_rss') == '1') { $iso = explode('=', _ISO); $charset = strtolower((string) $iso[1]); if (JCOMMENTS_JVERSION == '1.5') { $offset = $mainframe->getCfg('offset'); } else { $offset = $mainframe->getCfg('offset') + date('O') / 100; } $object_group = preg_replace('#[\'\\"]#ism', '', $object_group); $og = $object_group ? '&object_group=' . $object_group : ''; $lm = $limit != 100 ? '&limit=' . $limit : ''; if (JCOMMENTS_JVERSION == '1.5') { $syndicationURL = JoomlaTuneRoute::_('index.php?option=com_jcomments&task=rss_full' . $og . $lm . '&tmpl=component'); } else { $syndicationURL = $mainframe->getCfg('live_site') . '/index2.php?option=com_jcomments&task=rss_full' . $og . $lm . '&no_html=1'; } $rss = new JoomlaTuneFeed(); $rss->setOffset($offset); $rss->encoding = $charset; $rss->title = JText::_('Comments'); $rss->link = $mainframe->getCfg('live_site'); $rss->syndicationURL = $syndicationURL; $rss->description = JText::_('COMMENTS_FOR') . ' ' . $mainframe->getCfg('sitename'); if ($object_group != '') { $groups = explode(',', $object_group); } else { $groups = array(); } $db =& JCommentsFactory::getDBO(); $query = "SELECT id, title, object_id, object_group, userid, name, username, date, UNIX_TIMESTAMP(date) as date_ts, comment" . "\nFROM #__jcomments " . "\nWHERE published = '1'" . (count($groups) > 0 ? "\n AND (object_group = '" . implode("' OR object_group='", $groups) . "')" : '') . (JCommentsMultilingual::isEnabled() ? "\nAND lang = '" . JCommentsMultilingual::getLanguage() . "'" : "") . "\nORDER BY date DESC"; $db->setQuery($query, 0, $limit); $rows = $db->loadObjectList(); $word_maxlength = $config->getInt('word_maxlength'); $lang = JCommentsMultilingual::isEnabled() ? JCommentsMultilingual::getLanguage() : null; foreach ($rows as $row) { $comment = JCommentsText::cleanText($row->comment); $author = JComments::getCommentAuthorName($row); if ($comment != '') { $object_title = JCommentsObjectHelper::getTitle($row->object_id, $row->object_group, $lang); $object_link = JCommentsObjectHelper::getLink($row->object_id, $row->object_group); $object_link = str_replace('amp;', '', $object_link); $object_link = JCommentsFactory::getAbsLink($object_link); // apply censor filter $object_title = JCommentsText::censor($object_title); $comment = JCommentsText::censor($comment); // fix long words problem if ($word_maxlength > 0) { $comment = JCommentsText::fixLongWords($comment, $word_maxlength, ' '); if ($comment != '') { $comment = JCommentsText::fixLongWords($comment, $word_maxlength, ' '); } } $item = new JoomlaTuneFeedItem(); $item->title = $object_title; $item->link = $object_link . '#comment-' . $row->id; $item->description = $author . ' ' . JText::_('Wrote') . ' "' . $comment . '"'; $item->source = $object_link; if (JCOMMENTS_JVERSION == '1.5') { $item->pubDate = $row->date; } else { $date = strtotime((string) $row->date) - $offset * 3600; $item->pubDate = date('Y-m-d H:i:s', $date); } $item->author = $author; $rss->addItem($item); } } $rss->display(); unset($rows, $rss); exit; } }
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); }
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); }
public static function showUserComments() { $config = JCommentsFactory::getConfig(); if ($config->get('enable_rss') == '1') { $app = JCommentsFactory::getApplication('site'); $acl = JCommentsFactory::getACL(); $userid = (int) JCommentsInput::getVar('userid', 0); $limit = (int) JCommentsInput::getVar('limit', $config->getInt('feed_limit', 100)); $user = JCommentsFactory::getUser($userid); if (!isset($user->id)) { self::showNotFound(); return; } if (JCOMMENTS_JVERSION == '1.0') { $offset = $app->getCfg('offset') + date('O') / 100; } else { $offset = $app->getCfg('offset'); } $lm = $limit != $config->getInt('feed_limit') ? '&limit=' . $limit : ''; if (JCommentsMultilingual::isEnabled()) { $language = JCommentsMultilingual::getLanguage(); $lp = '&lang=' . $language; } else { $language = null; $lp = ''; } if (JCOMMENTS_JVERSION == '1.0') { $syndicationURL = $app->getCfg('live_site') . '/index2.php?option=com_jcomments&task=rss_user&userid=' . $userid . $lm . $lp . '&no_html=1'; } else { $liveSite = str_replace(JURI::root(true), '', $app->getCfg('live_site')); $syndicationURL = $liveSite . JRoute::_('index.php?option=com_jcomments&task=rss_user&userid=' . $userid . $lm . $lp . '&tmpl=raw'); } $user->userid = $user->id; $username = JComments::getCommentAuthorName($user); $rss = new JoomlaTuneFeed(); $rss->setOffset($offset); $rss->encoding = JCOMMENTS_ENCODING; $rss->title = JText::sprintf('USER_FEED_TITLE', $username); $rss->link = $app->getCfg('live_site'); $rss->syndicationURL = $syndicationURL; $rss->description = JText::sprintf('USER_FEED_DESCRIPTION', $username); $options = array(); $options['lang'] = $language; $options['userid'] = $userid; $options['published'] = 1; $options['filter'] = 'c.deleted = 0'; $options['orderBy'] = 'c.date DESC'; $options['votes'] = false; $options['limit'] = $limit; $options['limitStart'] = 0; $options['objectinfo'] = true; $options['access'] = $acl->getUserAccess(); $rows = JCommentsModel::getCommentsList($options); $word_maxlength = $config->getInt('word_maxlength'); $lang = JCommentsMultilingual::isEnabled() ? JCommentsMultilingual::getLanguage() : null; foreach ($rows as $row) { $comment = JCommentsText::cleanText($row->comment); if ($comment != '') { // getting object's information (title and link) $object_title = empty($row->object_title) ? JCommentsObjectHelper::getTitle($row->object_id, $row->object_group, $lang) : $row->object_title; $object_link = empty($row->object_link) ? JCommentsObjectHelper::getLink($row->object_id, $row->object_group, $lang) : $row->object_link; $object_link = JCommentsFactory::getAbsLink(str_replace('amp;', '', $object_link)); // apply censor filter $object_title = JCommentsText::censor($object_title); $comment = JCommentsText::censor($comment); // fix long words problem if ($word_maxlength > 0) { $comment = JCommentsText::fixLongWords($comment, $word_maxlength, ' '); if ($object_title != '') { $object_title = JCommentsText::fixLongWords($object_title, $word_maxlength, ' '); } } $author = JComments::getCommentAuthorName($row); $item = new JoomlaTuneFeedItem(); $item->title = $object_title; $item->link = $object_link . '#comment-' . $row->id; $item->description = JText::sprintf('USER_FEED_ITEM_DESCRIPTION', $author, $comment); $item->source = $object_link; if (JCOMMENTS_JVERSION == '1.0') { $date = strtotime((string) $row->date) - $offset * 3600; $item->pubDate = date('Y-m-d H:i:s', $date); } else { $item->pubDate = $row->date; } $item->author = $author; $rss->addItem($item); } } $rss->display(); unset($rows, $rss); exit; } }
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'); }
function doImport() { $vars = JCommentsInput::getVar('vars', array()); $source = trim(strtolower($vars['import'])); $cnt = 0; if ($source != '' && $source != 'com_jcomments') { JCommentsMigrationTool::deleteCommentsBySource($source); $language = JCommentsInput::getVar($source . '_lang', ''); switch ($source) { case 'akocomment': JCommentsMigrationTool::importAkoComment($source, $language); break; case 'moscom': JCommentsMigrationTool::importMosCom($source, $language); break; case 'combomax': JCommentsMigrationTool::importComboMax($source, $language); break; case 'joomlacomment': JCommentsMigrationTool::importJoomlaComment($source, $language); break; case 'jomcomment': JCommentsMigrationTool::importJomComment($source, $language); break; case 'urcomment': JCommentsMigrationTool::importUrComment($source, $language); break; case 'datsogallery': JCommentsMigrationTool::importDatsoGalleryComment($source, $language); break; case 'joomgallery': JCommentsMigrationTool::importJoomGalleryComment($source, $language); break; case 'icegallery': JCommentsMigrationTool::importIceGalleryComment($source, $language); break; case 'remository': JCommentsMigrationTool::importRemositoryComment($source, $language); break; case 'paxxgallery': JCommentsMigrationTool::importPAXXGalleryComment($source, $language); break; case 'phocagallery': JCommentsMigrationTool::importPhocaGalleryComment($source, $language); break; case 'cinema': JCommentsMigrationTool::importCinemaComment($source, $language); break; case 'jmovies': JCommentsMigrationTool::importJMoviesComment($source, $language); break; case 'mosetstree': JCommentsMigrationTool::importMosetsTree($source, $language); break; case 'linkdirectory': JCommentsMigrationTool::importLinkDirectory($source, $language); break; case 'mxcomment': JCommentsMigrationTool::importmXcomment($source, $language); break; case 'zoommediagallery': JCommentsMigrationTool::importZoom($source, $language); break; case 'rsgallery2': JCommentsMigrationTool::importRSGallery2($source, $language); break; case 'hotornot2': JCommentsMigrationTool::importHotOrNot2($source, $language); break; case 'easycomments': JCommentsMigrationTool::importEasyComments($source, $language); break; case 'musicbox': JCommentsMigrationTool::importMusicBox($source, $language); break; case 'jreviews': JCommentsMigrationTool::importJReviews($source, $language); break; case 'tutorials': JCommentsMigrationTool::importTutorialsComments($source, $language); break; case 'idoblog': JCommentsMigrationTool::importIDoBlogComments($source, $language); break; case 'sobi2reviews': JCommentsMigrationTool::importSobi2Reviews($source, $language); break; case 'jreactions': JCommentsMigrationTool::importJReactions($source, $language); break; case 'virtuemart': JCommentsMigrationTool::importVirtueMart($source, $language); break; case 'jxtendedcomments': JCommentsMigrationTool::importJXtendedComments($source, $language); break; case 'chronocomments': JCommentsMigrationTool::importChronoComments($source, $language); break; case 'akobook': JCommentsMigrationTool::importAkoBook($source, $language); break; case 'jambook': JCommentsMigrationTool::importJamBook($source, $language); break; case 'k2': JCommentsMigrationTool::importK2($source, $language); break; case 'smartblog': JCommentsMigrationTool::importSmartBlog($source, $language); break; case 'yvcomment': JCommentsMigrationTool::importYvComment($source, $language); break; case 'zimb': JCommentsMigrationTool::importZimbComment($source, $language); break; case 'rdbscomment': JCommentsMigrationTool::importRDBSComment($source, $language); break; case 'lyftenbloggie': JCommentsMigrationTool::importLyftenBloggie($source, $language); break; case 'webee': JCommentsMigrationTool::importWebeeComment($source, $language); break; case 'resource': JCommentsMigrationTool::importResourceComments($source, $language); break; case 'jacomment': JCommentsMigrationTool::importJAComment($source, $language); break; case 'tpdugg': JCommentsMigrationTool::importTPDuggComments($source, $language); break; case 'zoo': JCommentsMigrationTool::importZooComments($source, $language); break; case 'beeheard': JCommentsMigrationTool::importBeeHeardComments($source, $language); break; case 'jmylife': JCommentsMigrationTool::importJMyLifeComments($source, $language); break; case 'muscol': JCommentsMigrationTool::importMusicCollectionsComments($source, $language); break; case 'rscomments': JCommentsMigrationTool::importRSComments($source, $language); break; } $cnt = JCommentsMigrationTool::countCommentsBySource($source); } if ($cnt > 0) { JCommentsMigrationTool::updateParent($source); $message = sprintf(JText::_('A_IMPORT_DONE'), $cnt); } else { $message = JText::_('A_IMPORT_FAILED'); } return $message; }
function restoreSettingsDefault() { $lang = JCommentsInput::getVar('lang', ''); $message = JCommentsAdmin::restoreSettings(); JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=settings' . ($lang != '' ? "&lang={$lang}" : ''), $message); }
/** * Deprecated, use JCommentsInput::get() instead. * * @deprecated As of version 2.1.0.5 * @see JCommentsInput::getVar() */ function getParam(&$arr, $name, $def = null, $mask = 0) { return JCommentsInput::getVar($name, $def, 'default', 'none', $mask); }