public static function showImport($CommentSystems = array())
    {
        $app = JCommentsFactory::getApplication('administrator');
        $db = JCommentsFactory::getDBO();
        $db->setQuery("SHOW TABLES");
        $tables = $db->loadResultArray();
        foreach ($tables as $tableName) {
            for ($i = 0, $n = count($CommentSystems); $i < $n; $i++) {
                $tableMask = str_replace('#__', $app->getCfg('dbprefix'), $CommentSystems[$i]->table);
                if (preg_match('/' . $tableMask . '$/i', $tableName)) {
                    $CommentSystems[$i]->found = true;
                    $CommentSystems[$i]->UpdateCount();
                }
            }
        }
        $languages = JCommentsMultilingual::getLanguages();
        if (JCOMMENTS_JVERSION == '1.0') {
            $lang = JCommentsMultilingual::getLanguage();
        } else {
            $params = JComponentHelper::getParams('com_languages');
            $lang = $params->get("site", 'en-GB');
        }
        $ajaxUrl = JCommentsFactory::getLink('ajax-backend');
        ?>
<link rel="stylesheet" href="<?php 
        echo $app->getCfg('live_site');
        ?>
/administrator/components/com_jcomments/assets/style.css" type="text/css" />
<script type="text/javascript" src="<?php 
        echo $app->getCfg('live_site');
        ?>
/components/com_jcomments/libraries/joomlatune/ajax.js?v=2"></script>
<script type="text/javascript" src="<?php 
        echo $app->getCfg('live_site');
        ?>
/administrator/components/com_jcomments/assets/jcomments-backend-v2.1.js"></script>
<script type="text/javascript">
<!--
function JCommentsImportCommentsAJAX(source, language, start)
{
	try {
		jtajax.setup({url:'<?php 
        echo $ajaxUrl;
        ?>
'});
		return jtajax.call('JCommentsImportCommentsAjax', arguments, 'post');
	} catch (e) {
		return false;
	}
}

function startCommentsImport(source)
{
	var language = '';
	var e=document.getElementById(source.toLowerCase() + '_lang');
	if (e){for (var i=0;i<e.length;i++) {if (e.options[i].selected){language=e.options[i].value;break;}}}
	var b = document.getElementById('btnImport' + source);
	if (b) {b.disabled = true;}
	JCommentsImportCommentsAJAX(source, language, 0);
}

function finishCommentsImport(source) {
	var b=document.getElementById('btnImport'+source);if(b){b.disabled=false;}
}

<?php 
        if (JCOMMENTS_JVERSION == '1.7') {
            ?>
Joomla.submitbutton = function (task) {
	Joomla.submitform(task, document.getElementById('adminForm'));
};
<?php 
        } else {
            ?>
function submitbutton(task)
{
	submitform(task);
}
<?php 
        }
        ?>
//-->
</script>
<script type="text/javascript">
<!--
var jc_comments = new Array(
<?php 
        $jsArray = array();
        foreach ($CommentSystems as $CommentSystem) {
            if ($CommentSystem->found) {
                $jsArray[] = $CommentSystem->code;
            }
        }
        echo "'" . implode("', '", $jsArray) . "'";
        ?>
			);

function importMode( mode ) {
	if(document.getElementById) {
		for(var i=0;i<jc_comments.length;i++) {
			if (mode == jc_comments[i]) {
				document.getElementById('import' + jc_comments[i]).checked = true;
				document.getElementById('import' + jc_comments[i]+'Info').style.display = '';
			} else {
				document.getElementById('import' + jc_comments[i]).checked = false;
				document.getElementById('import' + jc_comments[i]+'Info').style.display = 'none';
			}
		}
	}
}
//-->
</script>

<style type="text/css">
#jcomments-message {padding: 0 0 0 25px;margin: 0; width: auto; float: right; font-size: 14px; font-weight: bold;}
.jcomments-message-error {background: transparent url(components/com_jcomments/assets/error.gif) no-repeat 4px 50%; color: red;}
.jcomments-message-info {background: transparent url(components/com_jcomments/assets/info.gif) no-repeat 4px 50%; color: green;}
.jcomments-message-wait {background: transparent url(components/com_jcomments/assets/wait.gif) no-repeat 4px 50%; color: green;}
.adminform fieldset { border: 1px #999 solid; }
.adminform fieldset input, fieldset select { float: none; }
.adminform span.note { color: #777; }
table.componentinfo td { color: #777; padding: 0; }
</style>

<div>
<form action="<?php 
        echo JCOMMENTS_INDEX;
        ?>
" method="post" name="adminForm" id="adminForm">
<input type="hidden" name="option" value="com_jcomments" />
<input type="hidden" name="task" value="" />
<?php 
        if (JCOMMENTS_JVERSION == '1.0') {
            ?>
<table class="adminheading">
<tr>
	<th style="background-image: none; padding: 0;"><img src="components/com_jcomments/assets/icon-48-import.png" width="48" height="48" align="middle" alt="<?php 
            echo JText::_('A_IMPORT');
            ?>
">&nbsp;<?php 
            echo JText::_('A_IMPORT');
            ?>
</th>
</tr>
</table>
<?php 
        }
        ?>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
	<tr valign="top">
		<td align="right">&nbsp;</td>
		<td width="50%" align="right"><div id="jcomments-message-holder"></div></td>
	</tr>
</table>

<table width="100%" border="0" cellpadding="4" cellspacing="2" class="adminform">
<tr>
	<td>
		<fieldset>
		<legend><?php 
        echo JText::_('A_IMPORT_SELECT_SOURCE');
        ?>
</legend>
		<table cellpadding="1" cellspacing="1" border="0">
<?php 
        $foundSources = 0;
        foreach ($CommentSystems as $CommentSystem) {
            if ($CommentSystem->found) {
                $foundSources++;
                ?>
		<tr valign="top" align="left">
			<td><input type="radio" id="import<?php 
                echo $CommentSystem->code;
                ?>
" name="vars[import]" value="<?php 
                echo $CommentSystem->code;
                ?>
" onclick="importMode('<?php 
                echo $CommentSystem->code;
                ?>
')" <?php 
                echo $CommentSystem->found ? '' : 'disabled';
                ?>
 /></td>
			<td><label for="import<?php 
                echo $CommentSystem->code;
                ?>
"><?php 
                echo $CommentSystem->name;
                ?>
</label></td>
			<td><div id="jcomments-message-<?php 
                echo strtolower($CommentSystem->code);
                ?>
"></div></td>
		</tr>
		<tr id="import<?php 
                echo $CommentSystem->code;
                ?>
Info" style="display: none;">
			<td>&nbsp;</td>
			<td>
				<table cellpadding="0" cellspacing="0" border="0" class="componentinfo">
				<tr>
					<td width="150px"><?php 
                echo JText::_('A_IMPORT_COMPONENT_AUTHOR');
                ?>
</td>
					<td><?php 
                echo $CommentSystem->author;
                ?>
</td>
				</tr>
				<tr>
					<td><?php 
                echo JText::_('A_IMPORT_COMPONENT_HOMEPAGE');
                ?>
</td>
					<td><a href="<?php 
                echo $CommentSystem->homepage;
                ?>
" target="_blank"><?php 
                echo str_replace('http://', '', $CommentSystem->homepage);
                ?>
</a></td>
				</tr>
				<tr>
					<td><?php 
                echo JText::_('A_IMPORT_COMPONENT_LICENSE');
                ?>
</td>
					<td>
<?php 
                if ($CommentSystem->license_url != '') {
                    ?>
						<a href="<?php 
                    echo $CommentSystem->license_url;
                    ?>
" target="_blank"><?php 
                    echo $CommentSystem->license;
                    ?>
</a>
<?php 
                } else {
                    ?>
					
						<?php 
                    echo $CommentSystem->license;
                }
                ?>
					</td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
				<tr valign="top" align="left">
					<td>
						<?php 
                echo JText::_('A_IMPORT_COMPONENT_COMMENTS_COUNT');
                ?>
					</td>
					<td>
						<label for="import<?php 
                echo $CommentSystem->code;
                ?>
"><?php 
                echo $CommentSystem->count;
                ?>
</label>
					</td>
				</tr>

				<tr valign="top" align="left">
					<td>
					</td>
					<td>
<?php 
                if (count($languages)) {
                    echo JCommentsHTML::selectList($languages, strtolower($CommentSystem->code) . '_lang', 'class="inputbox" size="1"', 'value', 'name', $lang) . '&nbsp;';
                }
                ?>
						<input type="button" id="btnImport<?php 
                echo $CommentSystem->code;
                ?>
" name="btnImport<?php 
                echo $CommentSystem->code;
                ?>
" value="<?php 
                echo JText::_('A_IMPORT_BUTTON_IMPORT');
                ?>
" onclick="startCommentsImport('<?php 
                echo $CommentSystem->code;
                ?>
')" <?php 
                echo $CommentSystem->count ? '' : 'disabled';
                ?>
 />
					</td>
				</tr>

				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
				</table>
			</td>
		</tr>
<?php 
            }
        }
        if ($foundSources == 0) {
            ?>
		<tr>
			<td><?php 
            echo JText::_('A_IMPORT_NO_SOURCES');
            ?>
</td>
		</tr>
<?php 
        }
        ?>
		</table>
	</fieldset>
	</td>
</tr>
</table>
<?php 
        echo JCommentsSecurity::formToken();
        ?>
</form>
</div>
<?php 
    }
예제 #2
0
 public static 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 . '/templates/' . $template . '/html/com_content/article/default.php';
         if (is_file($articleTemplate)) {
             $tmpl = implode('', file($articleTemplate));
             if (strpos($tmpl, 'afterDisplayContent') === false && !(strpos($tmpl, 'include') !== false || strpos($tmpl, 'require') !== false)) {
                 JError::raiseWarning(500, JText::_('A_WARNINGS_TEMPLATE_EVENT'));
             }
         }
     }
     $joomfish = JOOMLATUNE_JPATH_SITE . '/components/com_joomfish/joomfish.php';
     if (is_file($joomfish) || JCommentsMultilingual::isEnabled()) {
         $languages = JCommentsMultilingual::getLanguages();
         if (count($languages)) {
             $lang = trim(JCommentsInput::getVar('lang', ''));
             if ($lang == '') {
                 if (JCOMMENTS_JVERSION != '1.0') {
                     $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 . '/joomlatune/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);
     require_once JCOMMENTS_HELPERS . '/user.php';
     $groups = JCommentsUserHelper::getUserGroups();
     $captchaError = '';
     $captchaExclude = array();
     if (!extension_loaded('gd') || !function_exists('imagecreatefrompng')) {
         if ($config->get('captcha_engine', 'kcaptcha') != 'recaptcha') {
             foreach ($groups as $group) {
                 $captchaExclude[] = $group->id;
             }
             $captchaError = JText::_('A_WARNINGS_PHP_GD');
         }
     }
     $reportError = '';
     $reportExclude = array();
     if ($config->getInt('enable_notification') == 0 || $config->check('notification_type', 2) == false) {
         foreach ($groups as $group) {
             $reportExclude[] = $group->id;
         }
         $reportError = JText::_('A_REPORTS_WARNING_NOTIFICATIONS_DISABLED');
     }
     $lists['group_names'] = $groups;
     $permissions = array();
     // Post
     JCommentsAdmin::loadParam($permissions, 'can_comment', $groups, JText::_('A_RIGHTS_POST'), JText::_('AP_CAN_COMMENT'), JText::_('AP_CAN_COMMENT_DESC'));
     JCommentsAdmin::loadParam($permissions, 'can_reply', $groups, JText::_('A_RIGHTS_POST'), JText::_('AP_CAN_REPLY'), JText::_('AP_CAN_REPLY_DESC'));
     JCommentsAdmin::loadParam($permissions, 'autopublish', $groups, JText::_('A_RIGHTS_POST'), JText::_('AP_AUTOPUBLISH'), JText::_('AP_AUTOPUBLISH_DESC'));
     JCommentsAdmin::loadParam($permissions, 'show_policy', $groups, JText::_('A_RIGHTS_POST'), JText::_('AP_SHOW_POLICY'), JText::_('AP_SHOW_POLICY_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_captcha', $groups, JText::_('A_RIGHTS_POST'), JText::_('AP_ENABLE_CAPTCHA'), JText::_('AP_ENABLE_CAPTCHA_DESC'), $captchaExclude, $captchaError);
     JCommentsAdmin::loadParam($permissions, 'floodprotection', $groups, JText::_('A_RIGHTS_POST'), JText::_('AP_ENABLE_FLOODPROTECTION'), JText::_('AP_ENABLE_FLOODPROTECTION_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_comment_length_check', $groups, JText::_('A_RIGHTS_POST'), JText::_('AP_ENABLE_COMMENT_LENGTH_CHECK'), JText::_('AP_ENABLE_COMMENT_LENGTH_CHECK_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_autocensor', $groups, JText::_('A_RIGHTS_POST'), JText::_('AP_ENABLE_AUTOCENSOR'), JText::_('AP_ENABLE_AUTOCENSOR_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_subscribe', $groups, JText::_('A_RIGHTS_POST'), JText::_('AP_ENABLE_SUBSCRIBE'), JText::_('AP_ENABLE_SUBSCRIBE_DESC'));
     // BBCodes
     JCommentsAdmin::loadParam($permissions, 'enable_bbcode_b', $groups, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_B'), JText::_('AP_ENABLE_BBCODE_B_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_bbcode_i', $groups, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_I'), JText::_('AP_ENABLE_BBCODE_I_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_bbcode_u', $groups, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_U'), JText::_('AP_ENABLE_BBCODE_U_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_bbcode_s', $groups, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_S'), JText::_('AP_ENABLE_BBCODE_S_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_bbcode_url', $groups, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_URL'), JText::_('AP_ENABLE_BBCODE_URL_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_bbcode_img', $groups, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_IMG'), JText::_('AP_ENABLE_BBCODE_IMG_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_bbcode_list', $groups, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_LIST'), JText::_('AP_ENABLE_BBCODE_LIST_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_bbcode_hide', $groups, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_HIDE'), JText::_('AP_ENABLE_BBCODE_HIDE_DESC'), array('Public'));
     JCommentsAdmin::loadParam($permissions, 'enable_bbcode_quote', $groups, JText::_('A_RIGHTS_BBCODE'), JText::_('AP_ENABLE_BBCODE_QUOTE'), JText::_('AP_ENABLE_BBCODE_QUOTE_DESC'));
     // View
     JCommentsAdmin::loadParam($permissions, 'autolinkurls', $groups, JText::_('A_RIGHTS_VIEW'), JText::_('AP_ENABLE_AUTOLINKURLS'), JText::_('AP_ENABLE_AUTOLINKURLS_DESC'));
     JCommentsAdmin::loadParam($permissions, 'emailprotection', $groups, JText::_('A_RIGHTS_VIEW'), JText::_('AP_ENABLE_EMAILPROTECTION'), JText::_('AP_ENABLE_EMAILPROTECTION_DESC'));
     JCommentsAdmin::loadParam($permissions, 'enable_gravatar', $groups, JText::_('A_RIGHTS_VIEW'), JText::_('AP_ENABLE_GRAVATAR'), JText::_('AP_ENABLE_GRAVATAR_DESC'));
     JCommentsAdmin::loadParam($permissions, 'can_view_email', $groups, JText::_('A_RIGHTS_VIEW'), JText::_('AP_CAN_VIEW_AUTHOR_EMAIL'), JText::_('AP_CAN_VIEW_AUTHOR_EMAIL_DESC'));
     JCommentsAdmin::loadParam($permissions, 'can_view_homepage', $groups, JText::_('A_RIGHTS_VIEW'), JText::_('AP_CAN_VIEW_AUTHOR_HOMEPAGE'), JText::_('AP_CAN_VIEW_AUTHOR_HOMEPAGE_DESC'));
     JCommentsAdmin::loadParam($permissions, 'can_view_ip', $groups, JText::_('A_RIGHTS_VIEW'), JText::_('AP_CAN_VIEW_AUTHOR_IP'), JText::_('AP_CAN_VIEW_AUTHOR_IP_DESC'), array('Public', 'Registered'));
     // Edit
     JCommentsAdmin::loadParam($permissions, 'can_edit_own', $groups, JText::_('A_RIGHTS_EDIT'), JText::_('AP_CAN_EDIT_OWN'), JText::_('AP_CAN_EDIT_OWN_DESC'), array('Public'));
     JCommentsAdmin::loadParam($permissions, 'can_delete_own', $groups, JText::_('A_RIGHTS_EDIT'), JText::_('AP_CAN_DELETE_OWN'), JText::_('AP_CAN_DELETE_OWN_DESC'), array('Public'));
     // Administration
     JCommentsAdmin::loadParam($permissions, 'can_edit', $groups, JText::_('A_RIGHTS_ADMINISTRATION'), JText::_('AP_CAN_EDIT'), JText::_('AP_CAN_EDIT_DESC'), array('Public', 'Registered'));
     JCommentsAdmin::loadParam($permissions, 'can_edit_for_my_object', $groups, JText::_('A_RIGHTS_ADMINISTRATION'), JText::_('AP_CAN_EDIT_FOR_MY_OBJECT'), JText::_('AP_CAN_EDIT_FOR_MY_OBJECT_DESC'), array('Public'));
     JCommentsAdmin::loadParam($permissions, 'can_publish', $groups, JText::_('A_RIGHTS_ADMINISTRATION'), JText::_('AP_CAN_PUBLISH'), JText::_('AP_CAN_PUBLISH_DESC'), array('Public', 'Registered'));
     JCommentsAdmin::loadParam($permissions, 'can_publish_for_my_object', $groups, JText::_('A_RIGHTS_ADMINISTRATION'), JText::_('AP_CAN_PUBLISH_FOR_MY_OBJECT'), JText::_('AP_CAN_PUBLISH_FOR_MY_OBJECT_DESC'), array('Public'));
     JCommentsAdmin::loadParam($permissions, 'can_delete', $groups, JText::_('A_RIGHTS_ADMINISTRATION'), JText::_('AP_CAN_DELETE'), JText::_('AP_CAN_DELETE_DESC'), array('Public', 'Registered'));
     JCommentsAdmin::loadParam($permissions, 'can_delete_for_my_object', $groups, JText::_('A_RIGHTS_ADMINISTRATION'), JText::_('AP_CAN_DELETE_FOR_MY_OBJECT'), JText::_('AP_CAN_DELETE_FOR_MY_OBJECT_DESC'), array('Public'));
     // Votes
     JCommentsAdmin::loadParam($permissions, 'can_vote', $groups, JText::_('A_RIGHTS_MISC'), JText::_('AP_CAN_VOTE'), JText::_('AP_CAN_VOTE_DESC'));
     JCommentsAdmin::loadParam($permissions, 'can_report', $groups, JText::_('A_RIGHTS_MISC'), JText::_('AP_CAN_REPORT'), JText::_('AP_CAN_REPORT_DESC'), $reportExclude, $reportError);
     JCommentsAdmin::loadParam($permissions, 'can_ban', $groups, JText::_('A_RIGHTS_MISC'), JText::_('AP_CAN_BAN'), JText::_('AP_CAN_BAN_DESC'), array('Public', 'Registered'));
     $lists['groups'] =& $permissions;
     if (JCOMMENTS_JVERSION == '1.0') {
         $lookupQuery = "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.title,c.title";
         $categoriesQuery = "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.title,c.title";
     } elseif (JCOMMENTS_JVERSION == '1.5') {
         $lookupQuery = "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.title,c.title";
         $categoriesQuery = "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.title,c.title";
     } else {
         $lookupQuery = "SELECT c.id AS `value`, c.title AS `text`" . "\n FROM #__categories AS c" . "\n WHERE c.extension = 'com_content'" . "\n AND c.id IN ( " . $config->get('enable_categories') . " )" . "\n ORDER BY c.title";
         $categoriesQuery = "SELECT c.id AS `value`, c.title AS `text`, c.level" . "\n FROM #__categories AS c" . "\n WHERE c.extension = 'com_content'" . "\n ORDER BY c.lft, c.title";
     }
     $db->setQuery($categoriesQuery);
     $categories = $db->loadObjectList();
     if (!is_array($categories)) {
         $categories = array();
     } else {
         if (JCOMMENTS_JVERSION == '1.7') {
             for ($i = 0, $n = count($categories); $i < $n; $i++) {
                 $repeat = $categories[$i]->level - 1 >= 0 ? $categories[$i]->level - 1 : 0;
                 $categories[$i]->text = str_repeat('- ', $repeat) . $categories[$i]->text;
             }
         }
     }
     if ($config->get('enable_categories') != '') {
         $db->setQuery($lookupQuery);
         $lookup = $db->loadObjectList();
     } else {
         $lookup = '';
     }
     $lists['categories'] = JCommentsHTML::selectList($categories, 'cfg_enable_categories[]', 'class="inputbox categories" size="10" multiple="multiple"', 'value', 'text', $lookup);
     $captcha = array();
     $captcha[] = JCommentsHTML::makeOption('kcaptcha', 'KCAPTCHA');
     $config->set('enable_mambots', 1);
     $enginesList = JCommentsEvent::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', 'kcaptcha'));
     HTML_JComments::showSettings($lists);
 }