예제 #1
0
 function reportComment()
 {
     if (JCommentsSecurity::badRequest() == 1) {
         JCommentsSecurity::notAuth();
     }
     $acl =& JCommentsFactory::getACL();
     $db =& JCommentsFactory::getDBO();
     $config =& JCommentsFactory::getConfig();
     $response =& JCommentsFactory::getAjaxResponse();
     $values = JCommentsAJAX::prepareValues($_POST);
     $id = (int) $values['commentid'];
     $reason = trim(strip_tags($values['reason']));
     $name = trim(strip_tags($values['name']));
     $ip = $acl->getUserIP();
     if ($reason == '') {
         JCommentsAJAX::showErrorMessage(JText::_('Please enter the reason for your report!'), '', 'comments-report-form');
         return $response;
     }
     $query = 'SELECT COUNT(*) FROM `#__jcomments_reports` WHERE commentid = ' . $id;
     if ($acl->getUserId()) {
         $query .= ' AND userid = ' . $acl->getUserId();
     } else {
         $query .= ' AND ip = "' . $ip . '"';
     }
     $db->setQuery($query);
     $reported = $db->loadResult();
     if (!$reported) {
         $query = 'SELECT COUNT(*) FROM `#__jcomments_reports` WHERE commentid = ' . $id;
         $db->setQuery($query);
         $reported = $db->loadResult();
         if (!$reported) {
             $comment = new JCommentsDB($db);
             if ($comment->load($id)) {
                 if ($acl->canReport($comment)) {
                     $allowed = true;
                     if ($config->getInt('enable_mambots') == 1) {
                         require_once JCOMMENTS_HELPERS . DS . 'plugin.php';
                         JCommentsPluginHelper::importPlugin('jcomments');
                         JCommentsPluginHelper::trigger('onReportComment', array(&$comment, &$response, &$allowed, &$value));
                     }
                     if ($allowed !== false) {
                         if ($acl->getUserId()) {
                             $user = JCommentsFactory::getUser();
                             $name = $user->name;
                         } else {
                             if ($name == '') {
                                 $name = JText::_('Guest');
                             }
                         }
                         $query = "INSERT INTO `#__jcomments_reports`(`commentid`,`userid`, `name`,`ip`,`date`,`reason`)" . "VALUES('" . $comment->id . "', '" . $acl->getUserId() . "', '" . $db->getEscaped($name) . "', '" . $db->getEscaped($ip) . "', now(), '" . $db->getEscaped($reason) . "')";
                         $db->setQuery($query);
                         $db->query();
                         if ($config->getInt('enable_notification') == 1) {
                             if ($config->check('notification_type', 2)) {
                                 $comment->datetime = $comment->date;
                                 if (is_string($comment->datetime)) {
                                     $comment->datetime = strtotime($comment->datetime);
                                 }
                                 JComments::sendReport($comment, $name, $reason);
                             }
                         }
                         $html = JText::_('Report successfully sent!');
                         $html = str_replace("\n", '\\n', $html);
                         $html = str_replace('\\n', '<br />', $html);
                         $html = JCommentsText::jsEscape($html);
                         $response->addScript("jcomments.closeReport('{$html}');");
                     }
                 } else {
                     JCommentsAJAX::showErrorMessage(JText::_('You have no rights to report comment!'), '', 'comments-report-form');
                 }
             } else {
                 $response->addAlert(JText::_('ERROR_NOT_FOUND'));
             }
             unset($comment);
         } else {
             JCommentsAJAX::showErrorMessage(JText::_('Comment already reported to the site administrator'), '', 'comments-report-form');
         }
     } else {
         JCommentsAJAX::showErrorMessage(JText::_('You can\'t report the same comment more than once!'), '', 'comments-report-form');
     }
     return $response;
 }
예제 #2
0
 function prepareComment(&$comment)
 {
     if (isset($comment->_skip_prepare) && $comment->_skip_prepare == 1) {
         return;
     }
     $config =& JCommentsFactory::getConfig();
     $bbcode =& JCommentsFactory::getBBCode();
     $acl =& JCommentsFactory::getACL();
     // convert to datetime if variable contains string value
     if (is_string($comment->datetime)) {
         $comment->datetime = strtotime($comment->datetime);
     }
     // run autocensor
     if ($acl->check('enable_autocensor')) {
         $comment->comment = JCommentsText::censor($comment->comment);
     }
     // replace BBCode tags
     $comment->comment = $bbcode->replace($comment->comment);
     if ($config->getInt('enable_custom_bbcode')) {
         $customBBCode =& JCommentsFactory::getCustomBBCode();
         $comment->comment = $customBBCode->replace($comment->comment);
     }
     // fix long words problem
     $word_maxlength = $config->getInt('word_maxlength');
     if ($word_maxlength > 0) {
         $comment->comment = JCommentsText::fixLongWords($comment->comment, $word_maxlength);
         if ($comment->title != '') {
             $comment->title = JCommentsText::fixLongWords($comment->title, $word_maxlength);
         }
     }
     if ($acl->check('emailprotection')) {
         $comment->comment = JComments::maskEmail($comment->id, $comment->comment);
     }
     // autolink urls
     if ($acl->check('autolinkurls')) {
         $comment->comment = preg_replace_callback(_JC_REGEXP_LINK, array('JComments', 'urlProcessor'), $comment->comment);
         if ($acl->check('emailprotection') != 1) {
             $comment->comment = preg_replace(_JC_REGEXP_EMAIL, '<a href="mailto:\\1@\\2">\\1@\\2</a>', $comment->comment);
         }
     }
     // replace smile codes with images
     if ($config->get('enable_smiles') == '1') {
         $smiles =& JCommentsFactory::getSmiles();
         $comment->comment = $smiles->replace($comment->comment);
     }
     // Gravatar support
     $comment->gravatar = md5(strtolower($comment->email));
     if (empty($comment->avatar)) {
         $comment->avatar = '<img src="http://www.gravatar.com/avatar.php?gravatar_id=' . $comment->gravatar . '&amp;default=' . urlencode(JCommentsFactory::getLink('noavatar')) . '" alt="" />';
     }
     $comment->author = JComments::getCommentAuthorName($comment);
     if ($config->getInt('enable_mambots') == 1) {
         JCommentsPluginHelper::trigger('onAfterPrepareComment', array(&$comment));
     }
 }
예제 #3
0
 function getCommentsTree($object_id, $object_group = 'com_content', $search_text = '')
 {
     global $my;
     $object_id = (int) $object_id;
     $object_group = trim($object_group);
     $acl =& JCommentsFactory::getACL();
     $dbo =& JCommentsFactory::getDBO();
     $config =& JCommentsFactory::getConfig();
     $canPublish = $acl->canPublish();
     $canComment = $acl->canComment();
     $where = '';
     if ($search_text) {
         $words = explode(' ', $search_text);
         $wheres = array();
         foreach ($words as $word) {
             $wheres2 = array();
             $wheres2[] = "LOWER(name) LIKE '%{$word}%'";
             $wheres2[] = "LOWER(comment) LIKE '%{$word}%'";
         }
         if (isset($wheres2) && count($wheres2)) {
             $where .= ' AND (';
             $where .= implode(' OR ', $wheres2);
             $where .= ' )';
         }
     }
     if ($canComment == 0) {
         $total = JLMS_JComments::getCommentsCount($object_id, $object_group, $where);
         if ($total == 0) {
             return '';
         }
     }
     $query = "SELECT c.id, c.parent, c.object_id, c.object_group, c.userid, c.name, c.username, c.title, c.comment" . "\n , c.email, c.homepage, c.date as datetime, c.ip, c.published, c.checked_out, c.checked_out_time" . "\n , c.isgood, c.ispoor" . "\n , v.value as voted" . "\n FROM #__jcomments AS c" . "\n LEFT JOIN #__jcomments_votes AS v ON c.id = v.commentid " . ($my->id ? " AND  v.userid = " . $my->id : " AND  v.ip = '" . $acl->getUserIP() . "'") . "\n WHERE c.object_id = " . $object_id . "\n AND c.object_group = '" . $object_group . "'" . (JCommentsMultilingual::isEnabled() ? "\nAND c.lang = '" . JCommentsMultilingual::getLanguage() . "'" : "") . ($canPublish == 0 ? "\nAND c.published = 1" : "") . $where . "\n ORDER BY c.parent, c.date ASC";
     $dbo->setQuery($query);
     $rows = $dbo->loadObjectList();
     $tmpl =& JCommentsFactory::getTemplate($object_id, $object_group);
     $tmpl->load('tpl_tree');
     $tmpl->load('tpl_comment');
     if (count($rows)) {
         $isLocked = $config->getInt('object_locked', 0) == 1;
         $tmpl->addVar('tpl_tree', 'comments-refresh', intval(!$isLocked));
         $tmpl->addVar('tpl_tree', 'comments-rss', intval($config->getInt('enable_rss') && !$isLocked));
         $tmpl->addVar('tpl_tree', 'comments-can-subscribe', intval($my->id && $acl->check('enable_subscribe') && !$isLocked));
         if ($my->id && $acl->check('enable_subscribe')) {
             require_once JCOMMENTS_BASE . DS . 'jcomments.subscription.php';
             $manager =& JCommentsSubscriptionManager::getInstance();
             $isSubscribed = $manager->isSubscribed($object_id, $object_group, $my->id);
             $tmpl->addVar('tpl_tree', 'comments-user-subscribed', $isSubscribed);
         }
         $i = 1;
         if ($config->getInt('enable_mambots') == 1) {
             require_once JCOMMENTS_HELPERS . DS . 'plugin.php';
             JCommentsPluginHelper::importPlugin('jcomments');
             JCommentsPluginHelper::trigger('onBeforeDisplayCommentsList', array(&$rows));
             if ($acl->check('enable_gravatar')) {
                 JCommentsPluginHelper::trigger('onPrepareAvatars', array(&$rows));
             }
         }
         require_once JCOMMENTS_LIBRARIES . DS . 'joomlatune' . DS . 'tree.php';
         $tree = new JoomlaTuneTree($rows);
         $items = $tree->get();
         foreach ($rows as $row) {
             if ($config->getInt('enable_mambots') == 1) {
                 JCommentsPluginHelper::trigger('onBeforeDisplayComment', array(&$row));
             }
             // run autocensor, replace quotes, smiles and other pre-view processing
             JComments::prepareComment($row);
             // setup toolbar
             if (!$acl->canModerate($row)) {
                 $tmpl->addVar('tpl_comment', 'comments-panel-visible', 0);
             } else {
                 $tmpl->addVar('tpl_comment', 'comments-panel-visible', 1);
                 $tmpl->addVar('tpl_comment', 'button-edit', $acl->canEdit($row));
                 $tmpl->addVar('tpl_comment', 'button-delete', $acl->canDelete($row));
                 $tmpl->addVar('tpl_comment', 'button-publish', $acl->canPublish($row));
                 $tmpl->addVar('tpl_comment', 'button-ip', $acl->canViewIP($row));
             }
             $tmpl->addVar('tpl_comment', 'comment-show-vote', $config->getInt('enable_voting'));
             $tmpl->addVar('tpl_comment', 'comment-show-email', $acl->canViewEmail($row));
             $tmpl->addVar('tpl_comment', 'comment-show-homepage', $acl->canViewHomepage($row));
             $tmpl->addVar('tpl_comment', 'comment-show-title', $config->getInt('comment_title'));
             $tmpl->addVar('tpl_comment', 'button-vote', $acl->canVote($row));
             $tmpl->addVar('tpl_comment', 'button-quote', $acl->canQuote($row));
             $tmpl->addVar('tpl_comment', 'button-reply', $acl->canReply($row));
             $tmpl->addVar('tpl_comment', 'avatar', $acl->check('enable_gravatar'));
             if (isset($items[$row->id])) {
                 $tmpl->addVar('tpl_comment', 'comment-number', '');
                 $tmpl->addObject('tpl_comment', 'comment', $row);
                 $items[$row->id]->html = $tmpl->renderTemplate('tpl_comment');
                 $i++;
             }
         }
         $tmpl->addObject('tpl_tree', 'comments-items', $items);
         unset($rows);
     }
     return $tmpl->renderTemplate('tpl_tree');
 }
예제 #4
0
 function showSettings()
 {
     $db =& JCommentsFactory::getDBO();
     $config =& JCommentsFactory::getConfig();
     // check current site template for afterDisplayContent event
     if (JCOMMENTS_JVERSION == '1.5') {
         $db->setQuery('SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0', 0, 1);
         $template = $db->loadResult();
         $articleTemplate = JPATH_SITE . DS . 'templates' . DS . $template . DS . 'html' . DS . 'com_content' . DS . 'article' . DS . 'default.php';
         if (is_file($articleTemplate)) {
             $tmpl = implode('', file($articleTemplate));
             if (strpos($tmpl, 'afterDisplayContent') === false) {
                 JError::raiseWarning(500, JText::_('Your current site template doesn\'t have afterDisplayContent event!'));
             }
         }
     }
     $languages = array();
     $joomfish = JOOMLATUNE_JPATH_SITE . DS . 'components' . DS . 'com_joomfish' . DS . 'joomfish.php';
     if (is_file($joomfish)) {
         $db =& JCommentsFactory::getDBO();
         $db->setQuery("SELECT `name`, `code` as value FROM `#__languages` WHERE `active` = 1");
         $languages = $db->loadObjectList();
         if (is_array($languages)) {
             $lang = trim(JCommentsInput::getVar('lang', ''));
             if ($lang == '') {
                 if (JCOMMENTS_JVERSION == '1.5') {
                     $params = JComponentHelper::getParams('com_languages');
                     $lang = $params->get("site", 'en-GB');
                 }
                 if ($lang == '') {
                     $lang = JCommentsMultilingual::getLanguage();
                 }
             }
             // reload configuration
             $config =& JCommentsFactory::getConfig($lang);
             $lists['languages'] = JCommentsHTML::selectList($languages, 'lang', 'class="inputbox" size="1" onchange="submitform(\'settings\');"', 'value', 'name', $lang);
         }
     }
     $forbiddenNames = $config->get('forbidden_names');
     $forbiddenNames = preg_replace('#,+#', "\n", $forbiddenNames);
     $config->set('forbidden_names', $forbiddenNames);
     $badWords = $config->get('badwords');
     if ($badWords != '') {
         $config->set('badwords', implode("\n", $badWords));
     }
     require_once JCOMMENTS_LIBRARIES . DS . 'joomlatune' . DS . 'filesystem.php';
     // path to images directory
     $path = JCOMMENTS_BASE . DS . 'tpl' . DS;
     $items = JoomlaTuneFS::readDirectory($path);
     $templates = array();
     foreach ($items as $item) {
         if (is_dir($path . $item)) {
             $tpl = new StdClass();
             $tpl->text = $item;
             $tpl->value = $item;
             $templates[] = $tpl;
         }
     }
     $currentTemplate = $config->get('template');
     $lists['templates'] = JCommentsHTML::selectList($templates, 'cfg_template', 'class="inputbox"', 'value', 'text', $currentTemplate);
     $rows = JCommentsAdmin::getAllGroups();
     $exclude = JCommentsAdmin::getHigherGroups();
     if (count($exclude)) {
         // remove users 'above' me
         $i = 0;
         while ($i < count($rows)) {
             if (in_array($rows[$i]->group_id, $exclude)) {
                 array_splice($rows, $i, 1);
             } else {
                 $i++;
             }
         }
     }
     $captchaError = '';
     $captchaExclude = array();
     if (!extension_loaded('gd') || !function_exists('imagecreatefrompng')) {
         if ($config->get('captcha_engine', 'kcaptcha') != 'recaptcha') {
             foreach ($rows as $row) {
                 $captchaExclude[] = $row->value;
             }
             $captchaError = JText::_('GD library is not installed!');
         }
     }
     $lists['group_names'] = $rows;
     $groups = array();
     // Post
     JCommentsAdmin::loadParam($groups, 'can_comment', $rows, JText::_('A_RIGHTS_POST'), JText::_('AP_CAN_COMMENT'), JText::_('AP_CAN_COMMENT_DESC'));
     JCommentsAdmin::loadParam($groups, 'can_reply', $rows, JText::_('A_RIGHTS_POST'), JText::_('AP_CAN_REPLY'), JText::_('AP_CAN_REPLY_DESC'));
     JCommentsAdmin::loadParam($groups, 'autopublish', $rows, JText::_('A_RIGHTS_POST'), JText::_('AP_AUTOPUBLISH'), JText::_('AP_AUTOPUBLISH_DESC'));
     JCommentsAdmin::loadParam($groups, 'show_policy', $rows, JText::_('A_RIGHTS_POST'), JText::_('AP_SHOW_POLICY'), JText::_('AP_SHOW_POLICY_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_captcha', $rows, JText::_('A_RIGHTS_POST'), JText::_('AP_ENABLE_CAPTCHA'), JText::_('AP_ENABLE_CAPTCHA_DESC'), $captchaExclude, $captchaError);
     JCommentsAdmin::loadParam($groups, 'floodprotection', $rows, JText::_('A_RIGHTS_POST'), JText::_('AP_ENABLE_FLOODPROTECTION'), JText::_('AP_ENABLE_FLOODPROTECTION_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_comment_length_check', $rows, JText::_('A_RIGHTS_POST'), JText::_('AP_ENABLE_COMMENT_LENGTH_CHECK'), JText::_('AP_ENABLE_COMMENT_LENGTH_CHECK_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_autocensor', $rows, JText::_('A_RIGHTS_POST'), JText::_('AP_ENABLE_AUTOCENSOR'), JText::_('AP_ENABLE_AUTOCENSOR_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_subscribe', $rows, JText::_('A_RIGHTS_POST'), JText::_('AP_ENABLE_SUBSCRIBE'), JText::_('AP_ENABLE_SUBSCRIBE_DESC'));
     // BBCodes
     JCommentsAdmin::loadParam($groups, 'enable_bbcode_b', $rows, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_B'), JText::_('AP_ENABLE_BBCODE_B_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_bbcode_i', $rows, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_I'), JText::_('AP_ENABLE_BBCODE_I_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_bbcode_u', $rows, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_U'), JText::_('AP_ENABLE_BBCODE_U_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_bbcode_s', $rows, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_S'), JText::_('AP_ENABLE_BBCODE_S_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_bbcode_url', $rows, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_URL'), JText::_('AP_ENABLE_BBCODE_URL_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_bbcode_img', $rows, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_IMG'), JText::_('AP_ENABLE_BBCODE_IMG_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_bbcode_list', $rows, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_LIST'), JText::_('AP_ENABLE_BBCODE_LIST_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_bbcode_hide', $rows, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_HIDE'), JText::_('AP_ENABLE_BBCODE_HIDE_DESC'), array('Unregistered'));
     JCommentsAdmin::loadParam($groups, 'enable_bbcode_quote', $rows, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_QUOTE'), JText::_('AP_ENABLE_BBCODE_QUOTE_DESC'));
     // View
     JCommentsAdmin::loadParam($groups, 'autolinkurls', $rows, JText::_('A_RIGHTS_VIEW'), JText::_('AP_ENABLE_AUTOLINKURLS'), JText::_('AP_ENABLE_AUTOLINKURLS_DESC'));
     JCommentsAdmin::loadParam($groups, 'emailprotection', $rows, JText::_('A_RIGHTS_VIEW'), JText::_('AP_ENABLE_EMAILPROTECTION'), JText::_('AP_ENABLE_EMAILPROTECTION_DESC'));
     JCommentsAdmin::loadParam($groups, 'enable_gravatar', $rows, JText::_('A_RIGHTS_VIEW'), JText::_('AP_ENABLE_GRAVATAR'), JText::_('AP_ENABLE_GRAVATAR_DESC'));
     JCommentsAdmin::loadParam($groups, 'can_view_email', $rows, JText::_('A_RIGHTS_VIEW'), JText::_('AP_CAN_VIEW_AUTHOR_EMAIL'), JText::_('AP_CAN_VIEW_AUTHOR_EMAIL_DESC'));
     JCommentsAdmin::loadParam($groups, 'can_view_homepage', $rows, JText::_('A_RIGHTS_VIEW'), JText::_('AP_CAN_VIEW_AUTHOR_HOMEPAGE'), JText::_('AP_CAN_VIEW_AUTHOR_HOMEPAGE_DESC'));
     JCommentsAdmin::loadParam($groups, 'can_view_ip', $rows, JText::_('A_RIGHTS_VIEW'), JText::_('AP_CAN_VIEW_AUTHOR_IP'), JText::_('AP_CAN_VIEW_AUTHOR_IP_DESC'), array('Unregistered', 'Registered'));
     // Edit
     JCommentsAdmin::loadParam($groups, 'can_edit_own', $rows, JText::_('A_RIGHTS_EDIT'), JText::_('AP_CAN_EDIT_OWN'), JText::_('AP_CAN_EDIT_OWN_DESC'), array('Unregistered'));
     JCommentsAdmin::loadParam($groups, 'can_delete_own', $rows, JText::_('A_RIGHTS_EDIT'), JText::_('AP_CAN_DELETE_OWN'), JText::_('AP_CAN_DELETE_OWN_DESC'), array('Unregistered'));
     // Administration
     JCommentsAdmin::loadParam($groups, 'can_edit', $rows, JText::_('A_RIGHTS_ADMINISTRATION'), JText::_('AP_CAN_EDIT'), JText::_('AP_CAN_EDIT_DESC'), array('Unregistered', 'Registered'));
     JCommentsAdmin::loadParam($groups, 'can_publish', $rows, JText::_('A_RIGHTS_ADMINISTRATION'), JText::_('AP_CAN_PUBLISH'), JText::_('AP_CAN_PUBLISH_DESC'), array('Unregistered', 'Registered'));
     JCommentsAdmin::loadParam($groups, 'can_delete', $rows, JText::_('A_RIGHTS_ADMINISTRATION'), JText::_('AP_CAN_DELETE'), JText::_('AP_CAN_DELETE_DESC'), array('Unregistered', 'Registered'));
     // Votes
     JCommentsAdmin::loadParam($groups, 'can_vote', $rows, JText::_('A_RIGHTS_MISC'), JText::_('AP_CAN_VOTE'), JText::_('AP_CAN_VOTE_DESC'));
     $reportError = '';
     $reportExclude = array();
     if ($config->getInt('enable_notification') == 0 || $config->check('notification_type', 2) == false) {
         foreach ($rows as $row) {
             $reportExclude[] = $row->value;
         }
         $reportError = JText::_('Notifications are disabled! Please, enable notifications first.');
     }
     JCommentsAdmin::loadParam($groups, 'can_report', $rows, JText::_('A_RIGHTS_MISC'), JText::_('AP_CAN_REPORT'), JText::_('AP_CAN_REPORT_DESC'), $reportExclude, $reportError);
     $lists['groups'] =& $groups;
     if ($config->get('enable_categories') != '') {
         $query = "SELECT c.id AS `value`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE c.id IN ( " . $config->get('enable_categories') . " )" . "\n ORDER BY s.name,c.name";
         $db->setQuery($query);
         $lookup = $db->loadObjectList();
     } else {
         $lookup = '';
     }
     $query = "SELECT c.id AS `value`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n ORDER BY s.name,c.name";
     $db->setQuery($query);
     $categories = $db->loadObjectList();
     if (!is_array($categories)) {
         $categories = array();
     }
     $lists['categories'] = JCommentsHTML::selectList($categories, 'cfg_enable_categories[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup);
     $captcha = array();
     $captcha[] = JCommentsHTML::makeOption('kcaptcha', 'KCAPTCHA');
     require_once JCOMMENTS_HELPERS . DS . 'plugin.php';
     JCommentsPluginHelper::importPlugin('jcomments');
     $enginesList = JCommentsPluginHelper::trigger('onJCommentsCaptchaEngines');
     foreach ($enginesList as $engines) {
         foreach ($engines as $code => $text) {
             $captcha[] = JCommentsHTML::makeOption($code, $text);
         }
     }
     $disabledCAPTCHA = count($captcha) == 1 ? ' disabled="disabled"' : '';
     $lists["captcha"] = JCommentsHTML::selectList($captcha, 'cfg_captcha_engine', 'class="inputbox"' . $disabledCAPTCHA, 'value', 'text', $config->get('captcha_engine'));
     HTML_JComments::showSettings($lists);
 }