Exemple #1
0
 function JCommentsACL()
 {
     $user = JFactory::getUser();
     $config = JCommentsFactory::getConfig();
     $this->canDelete = $this->check('can_delete');
     $this->canDeleteOwn = $this->check('can_delete_own');
     $this->canDeleteForMyObject = $this->check('can_delete_for_my_object');
     $this->canEdit = $this->check('can_edit');
     $this->canEditOwn = $this->check('can_edit_own');
     $this->canEditForMyObject = $this->check('can_edit_for_my_object');
     $this->canPublish = $this->check('can_publish');
     $this->canPublishForMyObject = $this->check('can_publish_for_my_object');
     $this->canViewIP = $this->check('can_view_ip');
     $this->canViewEmail = $this->check('can_view_email');
     $this->canViewHomepage = $this->check('can_view_homepage');
     $this->canComment = $this->check('can_comment');
     $this->canVote = $this->check('can_vote');
     $this->canReport = intval($this->check('can_report') && $config->getInt('enable_reports'));
     $this->canBan = 0;
     $this->canQuote = intval($this->canComment && $this->check('enable_bbcode_quote'));
     $this->canReply = intval($this->canComment && $this->check('can_reply') && $config->get('template_view') == 'tree');
     $this->userID = (int) $user->id;
     $this->userIP = $_SERVER['REMOTE_ADDR'];
     $this->userBlocked = 0;
     $this->deleteMode = $config->getInt('delete_mode');
     $this->commentsLocked = false;
     if ($config->getInt('enable_blacklist', 0) == 1) {
         $options = array();
         $options['ip'] = $this->getUserIP();
         $options['userid'] = $this->getUserID();
         if (!JCommentsSecurity::checkBlacklist($options)) {
             $this->userBlocked = 1;
             $this->canComment = 0;
             $this->canQuote = 0;
             $this->canReply = 0;
             $this->canVote = 0;
             $this->canBan = 0;
         } else {
             $this->canBan = $this->check('can_ban');
         }
     }
 }
    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 
    }
 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;
 }
Exemple #4
0
 public static function executeCmd()
 {
     $app = JFactory::getApplication('site');
     $cmd = strtolower($app->input->get('cmd', ''));
     $hash = $app->input->get('hash', '');
     $id = $app->input->getInt('id', 0);
     $message = '';
     $link = str_replace('/administrator', '', JURI::root()) . 'index.php';
     $checkHash = JCommentsFactory::getCmdHash($cmd, $id);
     if ($hash == $checkHash) {
         $config = JCommentsFactory::getConfig();
         if ($config->getInt('enable_quick_moderation') == 1) {
             JTable::addIncludePath(JCOMMENTS_TABLES);
             $comment = JTable::getInstance('Comment', 'JCommentsTable');
             if ($comment->load($id)) {
                 $link = JCommentsObjectHelper::getLink($comment->object_id, $comment->object_group, $comment->lang);
                 $link = str_replace('&amp;', '&', $link);
                 switch ($cmd) {
                     case 'publish':
                         $comment->published = 1;
                         $comment->store();
                         // send notification to comment subscribers
                         JComments::sendToSubscribers($comment, true);
                         $link .= '#comment-' . $comment->id;
                         break;
                     case 'unpublish':
                         $comment->published = 0;
                         $comment->store();
                         $acl = JCommentsFactory::getACL();
                         if ($acl->canPublish()) {
                             $link .= '#comment-' . $comment->id;
                         } else {
                             $link .= '#comments';
                         }
                         break;
                     case 'delete':
                         if ($config->getInt('delete_mode') == 0) {
                             $comment->delete();
                             $link .= '#comments';
                         } else {
                             $comment->markAsDeleted();
                             $link .= '#comment-' . $comment->id;
                         }
                         break;
                     case 'ban':
                         if ($config->getInt('enable_blacklist') == 1) {
                             $acl = JCommentsFactory::getACL();
                             // we will not ban own IP ;)
                             if ($comment->ip != $acl->getUserIP()) {
                                 $options = array();
                                 $options['ip'] = $comment->ip;
                                 // check if this IP already banned
                                 if (JCommentsSecurity::checkBlacklist($options)) {
                                     $blacklist = JTable::getInstance('Blacklist', 'JCommentsTable');
                                     $blacklist->ip = $comment->ip;
                                     $blacklist->store();
                                     $message = JText::_('SUCCESSFULLY_BANNED');
                                 } else {
                                     $message = JText::_('ERROR_IP_ALREADY_BANNED');
                                 }
                             } else {
                                 $message = JText::_('ERROR_YOU_CAN_NOT_BAN_YOUR_IP');
                             }
                         }
                         break;
                 }
                 JCommentsNotificationHelper::send();
             } else {
                 $message = JText::_('ERROR_NOT_FOUND');
             }
         } else {
             $message = JText::_('ERROR_QUICK_MODERATION_DISABLED');
         }
     } else {
         $message = JText::_('ERROR_QUICK_MODERATION_INCORRECT_HASH');
     }
     $app->redirect($link, $message);
 }
    public static function edit($row)
    {
        ?>
<style type="text/css">
.editbox {border: 1px solid #ccc;padding: 2px;}
.short {width: 40px;}
.long {width: 450px;}
</style>
<script type="text/javascript">
<!--
<?php 
        if (JCOMMENTS_JVERSION == '1.7') {
            ?>
Joomla.submitbutton = function (task) {
	if (task == 'subscription.cancel') {
		Joomla.submitform(task, document.getElementById('adminForm'));
		return;
	}
	if (document.adminForm.object_group.value == "") {
		alert("<?php 
            echo addslashes(JText::sprintf('A_FORM_VALIDATE_FIELD_REQUIRED', JText::_('A_COMPONENT')));
            ?>
");
	} else if (document.adminForm.object_id.value == "") {
		alert("<?php 
            echo addslashes(JText::sprintf('A_FORM_VALIDATE_FIELD_REQUIRED', JText::_('A_SUBSCRIPTION_OBJECT_ID')));
            ?>
");
	} else if (document.adminForm.name.value == "") {
		alert("<?php 
            echo addslashes(JText::sprintf('A_FORM_VALIDATE_FIELD_REQUIRED', JText::_('A_SUBSCRIPTION_NAME')));
            ?>
");
	} else if (document.adminForm.email.value == "") {
		alert("<?php 
            echo addslashes(JText::sprintf('A_FORM_VALIDATE_FIELD_REQUIRED', JText::_('A_SUBSCRIPTION_EMAIL')));
            ?>
");
	} else {
		Joomla.submitform(task, document.getElementById('adminForm'));
	}
};
<?php 
        } else {
            ?>
function submitbutton(task)
{
	if (task == 'subscription.cancel') {
		submitform(task);
		return;
	}
	if (document.adminForm.object_group.value == "") {
		alert("<?php 
            echo addslashes(JText::sprintf('A_FORM_VALIDATE_FIELD_REQUIRED', JText::_('A_COMPONENT')));
            ?>
");
	} else if (document.adminForm.object_id.value == "") {
		alert("<?php 
            echo addslashes(JText::sprintf('A_FORM_VALIDATE_FIELD_REQUIRED', JText::_('A_SUBSCRIPTION_OBJECT_ID')));
            ?>
");
	} else if (document.adminForm.name.value == "") {
		alert("<?php 
            echo addslashes(JText::sprintf('A_FORM_VALIDATE_FIELD_REQUIRED', JText::_('A_SUBSCRIPTION_NAME')));
            ?>
");
	} else if (document.adminForm.email.value == "") {
		alert("<?php 
            echo addslashes(JText::sprintf('A_FORM_VALIDATE_FIELD_REQUIRED', JText::_('A_SUBSCRIPTION_EMAIL')));
            ?>
");
	} else {
		submitform(task);
	}
}
<?php 
        }
        ?>
//-->
</script>
<form action="<?php 
        echo JCOMMENTS_INDEX;
        ?>
" method="post" name="adminForm" id="adminForm">
<?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-subscriptions.png" width="48" height="48" align="middle" alt="<?php 
            echo JText::_('A_SUBSCRIPTION_EDIT');
            ?>
">&nbsp;<?php 
            echo JText::_('A_SUBSCRIPTION_EDIT');
            ?>
</th>
	</tr>
</table>
<?php 
        }
        ?>
<table class="adminform" width="100%" cellpadding="4" cellspacing="1" border="0">
<tr valign="top" align="left">
	<td><label for="object_group"><?php 
        echo JText::_('A_COMPONENT');
        ?>
</label></td>
	<td><input type="text" class="editbox long" size="35" id="object_group" name="object_group" value="<?php 
        echo $row->object_group;
        ?>
"></td>
</tr>
<tr valign="top" align="left">
	<td><label for="object_id"><?php 
        echo JText::_('A_SUBSCRIPTION_OBJECT_ID');
        ?>
</label></td>
	<td><input type="text" class="editbox short" size="35" id="object_id" name="object_id" value="<?php 
        echo $row->object_id;
        ?>
"></td>
</tr>
<tr valign="top" align="left">
	<td><label for="name"><?php 
        echo JText::_('A_SUBSCRIPTION_NAME');
        ?>
</label></td>
	<td><input type="text" class="editbox long" size="35" id="name" name="name" value="<?php 
        echo $row->name;
        ?>
"></td>
</tr>
<tr valign="top" align="left">
	<td><label for="email"><?php 
        echo JText::_('A_SUBSCRIPTION_EMAIL');
        ?>
</label></td>
	<td><input type="text" class="editbox long" size="35" id="email" name="email" value="<?php 
        echo $row->email;
        ?>
"></td>
</tr>
<tr valign="top" align="left">
	<td><?php 
        echo JText::_('A_PUBLISHING');
        ?>
</td>
	<td><?php 
        echo JCommentsHTML::yesnoRadioList('published', 'class="inputbox"', $row->published, JText::_('A_YES'), JText::_('A_NO'));
        ?>
</td>
</tr>
</table>
<input type="hidden" name="option" value="com_jcomments" />
<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
<input type="hidden" name="task" value="" />
<?php 
        echo JCommentsSecurity::formToken();
        ?>
</form>
<?php 
    }
 public static function getLink($type = 'ajax', $object_id = 0, $object_group = '', $lang = '')
 {
     global $iso_client_lang;
     $app = JCommentsFactory::getApplication();
     $config = JCommentsFactory::getConfig();
     switch ($type) {
         case 'rss':
             if (JCOMMENTS_JVERSION == '1.0') {
                 return $app->getCfg('live_site') . '/index2.php?option=com_jcomments&amp;task=rss&amp;object_id=' . $object_id . '&amp;object_group=' . $object_group . '&amp;no_html=1';
             } else {
                 $link = 'index.php?option=com_jcomments&amp;task=rss&amp;object_id=' . $object_id . '&amp;object_group=' . $object_group . '&amp;format=raw';
                 if ($app->isAdmin()) {
                     $link = JURI::root(true) . '/' . $link;
                 } else {
                     $link = JRoute::_($link);
                 }
                 return $link;
             }
             break;
         case 'noavatar':
             return $app->getCfg('live_site') . '/components/com_jcomments/images/no_avatar.png';
             break;
         case 'smiles':
             $smilesPath = str_replace(DS, '/', $config->get('smiles_path', '/components/com_jcomments/images/smiles/'));
             $smilesPath = $smilesPath[strlen($smilesPath) - 1] == '/' ? substr($smilesPath, 0, strlen($smilesPath) - 1) : $smilesPath;
             return $app->getCfg('live_site') . $smilesPath;
             // '/components/com_jcomments/images/smiles';
             break;
         case 'captcha':
             mt_srand((double) microtime() * 1000000);
             $random = mt_rand(10000, 99999);
             if (JCOMMENTS_JVERSION == '1.0') {
                 return $app->getCfg('live_site') . '/index2.php?option=com_jcomments&amp;task=captcha&amp;no_html=1&amp;ac=' . $random;
             } else {
                 if (JCOMMENTS_JVERSION == '1.7') {
                     return JRoute::_('index.php?option=com_jcomments&amp;task=captcha&amp;format=raw&amp;ac=' . $random);
                 } else {
                     return JURI::root(true) . '/index.php?option=com_jcomments&amp;task=captcha&amp;tmpl=component&amp;ac=' . $random;
                 }
             }
             break;
         case 'ajax':
             $config = JCommentsFactory::getConfig();
             // support alternate language files
             $lsfx = $config->get('lsfx') != '' ? '&amp;lsfx=' . $config->get('lsfx') : '';
             // support additional param for multilingual sites
             if (!empty($lang)) {
                 $lang = '&amp;lang=' . $lang;
             } else {
                 $lang = $app->getCfg('multilingual_support') == 1 ? '&amp;lang=' . $iso_client_lang : '';
             }
             if (JCOMMENTS_JVERSION == '1.0') {
                 $_Itemid = '&amp;Itemid=' . (!empty($_REQUEST['Itemid']) ? $_REQUEST['Itemid'] : 1);
                 $link = $app->getCfg('live_site') . '/index2.php?option=com_jcomments&amp;no_html=1' . $lang . $lsfx . $_Itemid;
             } else {
                 if (JCOMMENTS_JVERSION == '1.5') {
                     $link = JURI::root(true) . '/index.php?option=com_jcomments&amp;tmpl=component' . $lang . $lsfx;
                 } else {
                     $link = JRoute::_('index.php?option=com_jcomments&amp;tmpl=component' . $lang . $lsfx);
                 }
             }
             return JCommentsSecurity::fixAJAX($link);
             break;
         case 'ajax-backend':
             if (JCOMMENTS_JVERSION == '1.0') {
                 $link = $app->getCfg('live_site') . '/administrator/index3.php?option=com_jcomments&amp;no_html=1';
             } else {
                 $link = $app->getCfg('live_site') . '/administrator/index.php?option=com_jcomments&amp;tmpl=component&amp;' . JCommentsSecurity::getToken() . '=1';
             }
             return JCommentsSecurity::fixAJAX($link);
             break;
         default:
             return '';
             break;
     }
 }
    public static function edit($row)
    {
        ?>
<style type="text/css">
.editbox {border: 1px solid #ccc;padding: 2px;}
.ip {width: 100px;}
.middle {width: 250px;}
</style>
<script type="text/javascript">
<!--
<?php 
        if (JCOMMENTS_JVERSION == '1.7') {
            ?>
Joomla.submitbutton = function (task) {
	if (task == 'blacklist.cancel') {
		Joomla.submitform(task, document.getElementById('adminForm'));
		return;
	}
	if (document.adminForm.email.value == "") {
		alert("<?php 
            echo addslashes(JText::sprintf('A_FORM_VALIDATE_FIELD_REQUIRED', JText::_('A_BLACKLIST_IP')));
            ?>
");
	} else {
		Joomla.submitform(task, document.getElementById('adminForm'));
	}
};
<?php 
        } else {
            ?>
function submitbutton(task)
{
	if (task == 'blacklist.cancel') {
		submitform(task);
		return;
	}
	if (document.adminForm.ip.value == "") {
		alert("<?php 
            echo JText::sprintf('A_FORM_VALIDATE_FIELD_REQUIRED', JText::_('A_BLACKLIST_IP'));
            ?>
");
	} else {
		submitform(task);
	}
}
<?php 
        }
        ?>
//-->
</script>
<form action="<?php 
        echo JCOMMENTS_INDEX;
        ?>
" method="post" name="adminForm" id="adminForm">
<?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-blacklist.png" width="48" height="48" align="middle" alt="<?php 
            echo JText::_('A_BLACKLIST_EDIT');
            ?>
">&nbsp;<?php 
            echo JText::_('A_BLACKLIST_EDIT');
            ?>
</th>
	</tr>
</table>
<?php 
        }
        ?>
<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
<tr valign="top" align="left">
	<td width="15%"><label for="ip"><?php 
        echo JText::_('A_BLACKLIST_IP');
        ?>
</label></td>
	<td width="25%"><input type="text" class="editbox ip" size="35" id="ip" name="ip" value="<?php 
        echo $row->ip;
        ?>
"></td>
	<td width="60%"></td>
</tr>
<tr valign="top" align="left">
	<td><label for="reason"><?php 
        echo JText::_('A_BLACKLIST_REASON');
        ?>
</label></td>
	<td><input type="text" class="editbox middle" size="35" id="reason" name="reason" value="<?php 
        echo $row->reason;
        ?>
"></td>
	<td><?php 
        echo JText::_('A_BLACKLIST_REASON_DESC');
        ?>
</td>
</tr>
<tr valign="top" align="left">
	<td><label for="notes"><?php 
        echo JText::_('A_BLACKLIST_NOTES');
        ?>
</label></td>
	<td><input type="text" class="editbox middle" size="35" id="notes" name="notes" value="<?php 
        echo $row->notes;
        ?>
"></td>
	<td><?php 
        echo JText::_('A_BLACKLIST_NOTES_DESC');
        ?>
</td>
</tr>
</table>
<input type="hidden" name="option" value="com_jcomments" />
<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
<input type="hidden" name="task" value="" />
<?php 
        echo JCommentsSecurity::formToken();
        ?>
</form>
<?php 
    }
 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);
 }
Exemple #9
0
 public static function showObjectComments()
 {
     $config = JCommentsFactory::getConfig();
     if ($config->get('enable_rss') == '1') {
         $app = JFactory::getApplication('site');
         $object_id = $app->input->getInt('object_id', 0);
         $object_group = JCommentsSecurity::clearObjectGroup($app->input->get('object_group', 'com_content'));
         $limit = $app->input->getInt('limit', $config->getInt('feed_limit', 100));
         // if no group or id specified - return 404
         if ($object_id == 0 || $object_group == '') {
             self::showNotFound();
             return;
         }
         $lm = $limit != $config->getInt('feed_limit') ? '&amp;limit=' . $limit : '';
         if (JCommentsMultilingual::isEnabled()) {
             $language = JCommentsMultilingual::getLanguage();
             $lp = '&amp;lang=' . $language;
         } else {
             $language = null;
             $lp = '';
         }
         $liveSite = trim(str_replace(JURI::root(true), '', str_replace('/administrator', '', JURI::root())), '/');
         $syndicationURL = $liveSite . JRoute::_('index.php?option=com_jcomments&amp;task=rss&amp;object_id=' . $object_id . '&amp;object_group=' . $object_group . $lm . $lp . '&amp;format=raw');
         $object_title = JCommentsObjectHelper::getTitle($object_id, $object_group, $language);
         $object_link = JCommentsObjectHelper::getLink($object_id, $object_group, $language);
         $object_link = str_replace('amp;', '', JCommentsFactory::getAbsLink($object_link));
         $rss = new JoomlaTuneFeed();
         $rss->title = $object_title;
         $rss->link = $object_link;
         $rss->syndicationURL = $syndicationURL;
         $rss->description = JText::sprintf('OBJECT_FEED_DESCRIPTION', $rss->title);
         $options = array();
         $options['object_id'] = $object_id;
         $options['object_group'] = $object_group;
         $options['lang'] = $language;
         $options['published'] = 1;
         $options['filter'] = 'c.deleted = 0';
         $options['orderBy'] = 'c.date DESC';
         $options['limit'] = $limit;
         $options['limitStart'] = 0;
         $options['objectinfo'] = true;
         $rows = JCommentsModel::getCommentsList($options);
         $word_maxlength = $config->getInt('word_maxlength');
         foreach ($rows as $row) {
             $comment = JCommentsText::cleanText($row->comment);
             $title = $row->title;
             $author = JComments::getCommentAuthorName($row);
             if ($comment != '') {
                 // apply censor filter
                 $title = JCommentsText::censor($title);
                 $comment = JCommentsText::censor($comment);
                 // fix long words problem
                 if ($word_maxlength > 0) {
                     $comment = JCommentsText::fixLongWords($comment, $word_maxlength, ' ');
                     if ($title != '') {
                         $title = JCommentsText::fixLongWords($title, $word_maxlength, ' ');
                     }
                 }
                 $item = new JoomlaTuneFeedItem();
                 $item->title = $title != '' ? $title : JText::sprintf('OBJECT_FEED_ITEM_TITLE', $author);
                 $item->link = $object_link . '#comment-' . $row->id;
                 $item->description = $comment;
                 $item->source = $object_link;
                 $item->pubDate = $row->date;
                 $item->author = $author;
                 $rss->addItem($item);
             }
         }
         $rss->display();
         unset($rows, $rss);
         exit;
     }
 }
Exemple #10
0
 public static function RefreshObjects($hash, $step = 0, $object_group = '', $lang = '')
 {
     if (JCommentsSecurity::badRequest() == 1) {
         JCommentsSecurity::notAuth();
     }
     $response = JCommentsFactory::getAjaxResponse();
     $app = JCommentsFactory::getApplication();
     $count = 50;
     if ($hash === md5($app->getCfg('secret'))) {
         $db = JCommentsFactory::getDBO();
         if ($step == 0) {
             $db->setQuery('DELETE FROM #__jcomments_objects WHERE 1=1');
             $db->query();
         }
         $where = array();
         $where[] = 'IFNULL(c.lang, "") <> ""';
         if (!empty($object_group)) {
             $where[] = 'c.object_group = ' . $db->Quote($object_group);
         }
         // count objects without information
         $query = "SELECT COUNT(DISTINCT c.object_id, c.object_group, c.lang)" . " FROM #__jcomments AS c" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "");
         $db->setQuery($query);
         $objectsCount = (int) $db->loadResult();
         $where[] = 'NOT EXISTS (SELECT o.id FROM #__jcomments_objects AS o WHERE o.object_id = c.object_id AND o.object_group = c.object_group AND o.lang = c.lang)';
         // get list of first objects without information
         $query = "SELECT DISTINCT c.object_id, c.object_group, c.lang" . " FROM #__jcomments AS c" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . " ORDER BY c.object_group, c.lang";
         $db->setQuery($query, 0, $count);
         $rows = $db->loadObjectList();
         $i = 0;
         $multilanguage = JCommentsMultilingual::isEnabled();
         $nextLanguage = $lang;
         if (count($rows)) {
             foreach ($rows as $row) {
                 if ($nextLanguage != $row->lang && $multilanguage) {
                     $nextLanguage = $row->lang;
                     break;
                 }
                 // retrieve and store object information
                 JCommentsObjectHelper::storeObjectInfo($row->object_id, $row->object_group, $row->lang, false, true);
                 $i++;
             }
         }
         $objectsRefreshed = 0;
         if ($i > 0) {
             $db->setQuery("SELECT COUNT(*) FROM #__jcomments_objects");
             $objectsRefreshed = (int) $db->loadResult();
             $response->addScript("JCommentsRefreshObjectsProgress({$objectsRefreshed}, {$objectsCount});");
         }
         if ($objectsCount > $objectsRefreshed && ($i > 0 || $lang != $nextLanguage)) {
             // we need continue refresh
             $step++;
             $response->addScript("JCommentsRefreshObjectsAJAX('{$hash}', '{$step}', '', '{$nextLanguage}');");
         } else {
             $response->addScript("JCommentsRefreshObjectsProgress({$objectsCount}, {$objectsCount});");
             if ($app->getCfg('caching')) {
                 // clean cache for all object groups
                 $db->setQuery('SELECT DISTINCT object_group FROM #__jcomments_objects');
                 $rows = $db->loadResultArray();
                 foreach ($rows as $row) {
                     $cache = JCommentsFactory::getCache('com_jcomments_objects_' . strtolower($row));
                     $cache->clean();
                 }
             }
         }
     }
     return $response;
 }
 public static function BanIP($id)
 {
     if (JCommentsSecurity::badRequest() == 1) {
         JCommentsSecurity::notAuth();
     }
     $acl = JCommentsFactory::getACL();
     $response = JCommentsFactory::getAjaxResponse();
     if ($acl->canBan()) {
         $config = JCommentsFactory::getConfig();
         if ($config->getInt('enable_blacklist') == 1) {
             $id = (int) $id;
             $comment = JTable::getInstance('Comment', 'JCommentsTable');
             if ($comment->load($id)) {
                 // we will not ban own IP ;)
                 if ($comment->ip != $acl->getUserIP()) {
                     $options = array();
                     $options['ip'] = $comment->ip;
                     // check if this IP already banned
                     if (JCommentsSecurity::checkBlacklist($options)) {
                         $result = JCommentsEventHelper::trigger('onJCommentsUserBeforeBan', array(&$comment, &$options));
                         if (!in_array(false, $result, true)) {
                             $blacklist = JTable::getInstance('Blacklist', 'JCommentsTable');
                             $blacklist->ip = $comment->ip;
                             $blacklist->created = JFactory::getDate()->toSql();
                             $blacklist->created_by = $acl->getUserId();
                             if ($blacklist->store()) {
                                 JCommentsEventHelper::trigger('onJCommentsUserAfterBan', array(&$comment, $options));
                                 self::showInfoMessage(JText::_('SUCCESSFULLY_BANNED'), 'comment-item-' . $id);
                             }
                         }
                     } else {
                         self::showErrorMessage(JText::_('ERROR_IP_ALREADY_BANNED'), '', 'comment-item-' . $id);
                     }
                 } else {
                     self::showErrorMessage(JText::_('ERROR_YOU_CAN_NOT_BAN_YOUR_IP'), '', 'comment-item-' . $id);
                 }
             }
         }
     }
     return $response;
 }
    public static function edit($row, $lists)
    {
        $pcreText = JText::_('A_CUSTOM_BBCODE_ADVANCED_PATTERN_PCRE');
        $pcreLink = JText::_('A_CUSTOM_BBCODE_ADVANCED_PATTERN_PCRE_LINK');
        $patternLink = '<a href="' . $pcreLink . '">' . $pcreText . '</a>';
        $patternDescription = JText::sprintf('A_CUSTOM_BBCODE_ADVANCED_PATTERN_DESC', $patternLink);
        ?>
<style type="text/css">
.editbox {border: 1px solid #ccc;padding: 2px;}
.short {width: 100px;}
.middle {width: 250px;}
.long {width: 450px;}
.adminform fieldset label {display: inline; clear: none; float: none; font-size: 1em;}
.adminform fieldset input {float: none}
.adminform fieldset p {margin: 5px 0; }
</style>
<script language="javascript" type="text/javascript">
<!--
function jc_insertText(id,text) {
	var ta=document.getElementById(id);
	if(typeof(ta.caretPos)!="undefined"&&ta.createTextRange){ta.focus();var sel=document.selection.createRange();sel.text=sel.text+text;ta.focus();}
	else if(typeof(ta.selectionStart)!="undefined"){
		var ss=ta.value.substr(0, ta.selectionStart);
		var se=ta.value.substr(ta.selectionEnd),sp=ta.scrollTop;
		ta.value=ss+text+se;
		if(ta.setSelectionRange){ta.focus();ta.setSelectionRange(ss.length+text.length,ss.length+text.length);}
		ta.scrollTop=sp;
	} else {ta.value+=text;ta.focus(ta.value.length-1);}
}

<?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>
<form action="<?php 
        echo JCOMMENTS_INDEX;
        ?>
" method="post" name="adminForm" id="adminForm">
<?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-custombbcodes.png" width="48" height="48" align="middle" alt="<?php 
            echo JText::_('A_CUSTOM_BBCODE_EDIT');
            ?>
">&nbsp;<?php 
            echo JText::_('A_CUSTOM_BBCODE_EDIT');
            ?>
</th>
	</tr>
</table>
<?php 
        }
        ?>
<table class="adminform" width="100%" cellpadding="4" cellspacing="1" border="0">
	<tr valign="top" align="left">
		<td>
			<fieldset>
				<legend><?php 
        echo JText::_('A_COMMON');
        ?>
</legend>
				<table width="100%">
				<tr valign="top" align="left">
					<td width="10%"><label for="name"><?php 
        echo JText::_('A_CUSTOM_BBCODE_NAME');
        ?>
</label></td>
					<td><input type="text" class="editbox middle" size="35" id="name" name="name" onChange="return generate_tag();" value="<?php 
        echo $row->name;
        ?>
"></td>
				</tr>
				<tr valign="top" align="left">
					<td><?php 
        echo JText::_('A_PUBLISHING');
        ?>
</td>
					<td><?php 
        echo JCommentsHTML::yesnoRadioList('published', 'class="inputbox"', $row->published, JText::_('A_YES'), JText::_('A_NO'));
        ?>
</td>
					<td></td>
				</tr>
				</table>
			</fieldset>
		</td>
	</tr>
	<tr valign="top" align="left">
		<td>
			<fieldset>
				<legend><?php 
        echo JText::_('A_CUSTOM_BBCODE_PATTERN');
        ?>
</legend>
<?php 
        $tabs = new JCommentsTabs(1);
        $tabs->startPane('com_jcomments_custom_bbcode_pattern');
        $tabs->startTab(JText::_('A_CUSTOM_BBCODE_SIMPLE'), "simple_pattern_tab");
        ?>
				<table width="100%">
				<tr valign="top" align="left">
					<td width="30%">
						<textarea class="editbox long" rows="4" cols="50" id="simple_pattern" name="simple_pattern"><?php 
        echo $row->simple_pattern;
        ?>
</textarea>
						<p><?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKENS');
        ?>
</p>
						<p>
						<abbr onclick="jc_insertText('simple_pattern', '{SIMPLETEXT}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_SIMPLETEXT');
        ?>
">{SIMPLETEXT}</abbr>,
						<abbr onclick="jc_insertText('simple_pattern', '{TEXT}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_TEXT');
        ?>
">{TEXT}</abbr>,
						<abbr onclick="jc_insertText('simple_pattern', '{IDENTIFIER}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_IDENTIFIER');
        ?>
">{IDENTIFIER}</abbr>
						<abbr onclick="jc_insertText('simple_pattern', '{ALPHA}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_ALPHA');
        ?>
">{ALPHA}</abbr>
						<abbr onclick="jc_insertText('simple_pattern', '{NUMBER}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_NUMBER');
        ?>
">{NUMBER}</abbr>
						</p>
					</td>
					<td align="left">
						<label for="simple_pattern"><?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_PATTERN_DESC');
        ?>
</label><br />
						<br /><?php 
        echo JText::_('A_CUSTOM_BBCODE_EXAMPLE');
        ?>
 [highlight={SIMPLETEXT1}]{SIMPLETEXT2}[/highlight]
					</td>
				</tr>
				</table>
<?php 
        $tabs->endTab();
        $tabs->startTab(JText::_('A_CUSTOM_BBCODE_ADVANCED'), "regexp_pattern_tab");
        ?>
				<table width="100%">
				<tr valign="top" align="left">
					<td width="30%">
						<textarea class="editbox long" rows="4" cols="50" id="pattern" name="pattern"><?php 
        echo $row->pattern;
        ?>
</textarea>
					</td>
					<td align="left">
						<label for="pattern"><?php 
        echo $patternDescription;
        ?>
</label><br />
						<br /><?php 
        echo JText::_('A_CUSTOM_BBCODE_EXAMPLE');
        ?>
 \[highlight\=([a-zA-Z0-9].?)\](*.?)\[\/highlight\]
					</td>
				</tr>
				</table>
<?php 
        $tabs->endTab();
        $tabs->endPane();
        ?>
			</fieldset>
		</td>
	</tr>
	<tr valign="top" align="left">
		<td>
			<fieldset>
				<legend><?php 
        echo JText::_('A_CUSTOM_BBCODE_REPLACEMENT');
        ?>
 (<?php 
        echo JText::_('A_CUSTOM_BBCODE_HTML');
        ?>
)</legend>
<?php 
        $tabs2 = new JCommentsTabs(1);
        $tabs2->startPane('com_jcomments_custom_bbcode_replacement_html');
        $tabs2->startTab(JText::_('A_CUSTOM_BBCODE_SIMPLE'), "simple_replacement_html_tab");
        ?>
				<table width="100%">
				<tr valign="top" align="left">
					<td width="30%">
						<textarea class="editbox long" rows="4" cols="50" id="simple_replacement_html" name="simple_replacement_html"><?php 
        echo $row->simple_replacement_html;
        ?>
</textarea>
						<p><?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKENS');
        ?>
</p>
						<p>
						<abbr onclick="jc_insertText('simple_replacement_html', '{SIMPLETEXT}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_SIMPLETEXT');
        ?>
">{SIMPLETEXT}</abbr>,
						<abbr onclick="jc_insertText('simple_replacement_html', '{TEXT}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_TEXT');
        ?>
">{TEXT}</abbr>,
						<abbr onclick="jc_insertText('simple_replacement_html', '{IDENTIFIER}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_IDENTIFIER');
        ?>
">{IDENTIFIER}</abbr>
						<abbr onclick="jc_insertText('simple_replacement_html', '{ALPHA}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_ALPHA');
        ?>
">{ALPHA}</abbr>
						<abbr onclick="jc_insertText('simple_replacement_html', '{NUMBER}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_NUMBER');
        ?>
">{NUMBER}</abbr>
						</p>
					</td>
					<td align="left">
						<label for="simple_replacement_html"><?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_REPLACEMENT_HTML_DESC');
        ?>
</label><br />
						<br /><?php 
        echo JText::_('A_CUSTOM_BBCODE_EXAMPLE');
        ?>
 &lt;span style="background-color: {SIMPLETEXT1};"&gt;{SIMPLETEXT2}&lt;/span&gt;
					</td>
				</tr>
				</table>
<?php 
        $tabs2->endTab();
        $tabs2->startTab(JText::_('A_CUSTOM_BBCODE_ADVANCED'), "regexp_replacement_html_tab");
        ?>
				<table width="100%">
				<tr valign="top" align="left">
					<td width="30%">
						<textarea class="editbox long" rows="4" cols="50" id="replacement_html" name="replacement_html"><?php 
        echo $row->replacement_html;
        ?>
</textarea>
					</td>
					<td align="left">
						<label for="replacement_html"><?php 
        echo $patternDescription;
        ?>
</label><br />
						<br /><?php 
        echo JText::_('A_CUSTOM_BBCODE_EXAMPLE');
        ?>
 &lt;span style="background-color: ${1};"&gt;${2}&lt;/span&gt;
					</td>
				</tr>
				</table>
<?php 
        $tabs2->endTab();
        $tabs2->endPane();
        ?>
			</fieldset>
		</td>
	</tr>

	<tr valign="top" align="left">
		<td>
			<fieldset>
				<legend><?php 
        echo JText::_('A_CUSTOM_BBCODE_REPLACEMENT');
        ?>
 (<?php 
        echo JText::_('A_CUSTOM_BBCODE_PLAIN_TEXT');
        ?>
)</legend>
<?php 
        $tabs2 = new JCommentsTabs(1);
        $tabs2->startPane('com_jcomments_custom_bbcode_replacement_text');
        $tabs2->startTab(JText::_('A_CUSTOM_BBCODE_SIMPLE'), "simple_replacement_text_tab");
        ?>
				<table width="100%">
				<tr valign="top" align="left">
					<td width="30%">
						<textarea class="editbox long" rows="3" cols="50" id="simple_replacement_text" name="simple_replacement_text"><?php 
        echo $row->simple_replacement_text;
        ?>
</textarea>
						<p><?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKENS');
        ?>
</p>
						<p>
						<abbr onclick="jc_insertText('simple_replacement_text', '{SIMPLETEXT}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_SIMPLETEXT');
        ?>
">{SIMPLETEXT}</abbr>,
						<abbr onclick="jc_insertText('simple_replacement_text', '{TEXT}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_TEXT');
        ?>
">{TEXT}</abbr>,
						<abbr onclick="jc_insertText('simple_replacement_text', '{IDENTIFIER}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_IDENTIFIER');
        ?>
">{IDENTIFIER}</abbr>
						<abbr onclick="jc_insertText('simple_replacement_text', '{ALPHA}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_ALPHA');
        ?>
">{ALPHA}</abbr>
						<abbr onclick="jc_insertText('simple_replacement_text', '{NUMBER}');" title="<?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_TOKEN_NUMBER');
        ?>
">{NUMBER}</abbr>
						</p>
					</td>
					<td align="left">
						<label for="simple_replacement_text"><?php 
        echo JText::_('A_CUSTOM_BBCODE_SIMPLE_REPLACEMENT_TEXT_DESC');
        ?>
</label><br />
						<br /><?php 
        echo JText::_('A_CUSTOM_BBCODE_EXAMPLE');
        ?>
 {SIMPLETEXT2}
					</td>
				</tr>
				</table>
<?php 
        $tabs2->endTab();
        $tabs2->startTab(JText::_('A_CUSTOM_BBCODE_ADVANCED'), "regexp_replacement_text_tab");
        ?>
				<table width="100%">
				<tr valign="top" align="left">
					<td width="30%">
						<textarea class="editbox long" rows="3" cols="50" id="replacement_text" name="replacement_text"><?php 
        echo $row->replacement_text;
        ?>
</textarea>
					</td>
					<td align="left">
						<label for="replacement_text"><?php 
        echo $patternDescription;
        ?>
</label><br />
						<br /><?php 
        echo JText::_('A_CUSTOM_BBCODE_EXAMPLE');
        ?>
 ${2}
					</td>
				</tr>
				</table>
<?php 
        $tabs2->endTab();
        $tabs2->endPane();
        ?>
			</fieldset>
		</td>
	</tr>

	<tr valign="top" align="left">
		<td>
			<fieldset>
				<legend><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON');
        ?>
</legend>

				<table class="adminform" width="100%">
				<tr valign="top" align="left">
					<td width="20%"><label for="button_title"><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_TITLE');
        ?>
</label></td>
					<td width="30%"><input type="text" class="editbox middle" size="35" id="button_title" name="button_title" value="<?php 
        echo $row->button_title;
        ?>
"></td>
					<td><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_TITLE_DESC');
        ?>
</td>
				</tr>
				<tr valign="top" align="left">
					<td><label for="button_prompt"><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_HELP_LINE');
        ?>
</label></td>
					<td><input type="text" class="editbox middle" size="35" id="button_prompt" name="button_prompt" value="<?php 
        echo $row->button_prompt;
        ?>
"></td>
					<td><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_HELP_LINE_DESC');
        ?>
</td>
				</tr>
				<tr valign="top" align="left">
					<td><label for="button_image"><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_ICON');
        ?>
</label></td>
					<td><input type="text" class="editbox middle" size="35" id="button_image" name="button_image" value="<?php 
        echo $row->button_image;
        ?>
"></td>
					<td><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_ICON_DESC');
        ?>
</td>
				</tr>
				<tr valign="top" align="left">
					<td><label for="button_css"><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_CSS_CLASS');
        ?>
</label></td>
					<td><input type="text" class="editbox short" size="35" id="button_css" name="button_css" value="<?php 
        echo $row->button_css;
        ?>
"></td>
					<td><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_CSS_CLASS_DESC');
        ?>
</td>
				</tr>
				<tr valign="top" align="left">
					<td><label for="button_open_tag"><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_OPEN_TAG');
        ?>
</label></td>
					<td><input type="text" class="editbox short" size="35" id="button_open_tag" name="button_open_tag" value="<?php 
        echo $row->button_open_tag;
        ?>
"></td>
					<td><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_OPEN_TAG_DESC');
        ?>
</td>
				</tr>
				<tr valign="top" align="left">
					<td><label for="button_close_tag"><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_CLOSE_TAG');
        ?>
</label></td>
					<td><input type="text" class="editbox short" size="35" id="button_close_tag" name="button_close_tag" value="<?php 
        echo $row->button_close_tag;
        ?>
"></td>
					<td><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_CLOSE_TAG_DESC');
        ?>
</td>
				</tr>
				<tr valign="top" align="left">
					<td><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_ENABLE');
        ?>
</td>
					<td><?php 
        echo JCommentsHTML::yesnoRadioList('button_enabled', 'class="inputbox"', $row->button_enabled, JText::_('A_YES'), JText::_('A_NO'));
        ?>
</td>
					<td></td>
				</tr>
				</table>
			</fieldset>
		</td>
	</tr>

	<tr valign="top" align="left">
		<td>
			<fieldset>
				<legend><?php 
        echo JText::_('A_CUSTOM_BBCODE_PERMISSIONS');
        ?>
</legend>

				<table class="adminform" width="100%">
				<tr valign="top" align="left">
					<td>
<?php 
        foreach ($lists['groups'] as $group) {
            $inputId = 'button_' . $row->id . '_acl_' . $group->id;
            $inputValue = $group->id;
            $prefix = trim(str_repeat('|&mdash; ', $group->level) . ' ');
            $text = ($prefix != '' ? '<span style="color: #ccc;">' . $prefix . '</span>&nbsp;' : '') . $group->text;
            ?>
						<input type="checkbox" id="<?php 
            echo $inputId;
            ?>
" name="button_acl[]" value="<?php 
            echo $inputValue;
            ?>
" <?php 
            echo $group->enabled == '1' ? 'checked="checked"' : '';
            ?>
 />
						<label for="<?php 
            echo $inputId;
            ?>
"><?php 
            echo $text;
            ?>
</label>
						<br />
<?php 
        }
        ?>
					</td>
				</tr>
				</table>
			</fieldset>
		</td>
	</tr>
</table>
<input type="hidden" name="option" value="com_jcomments" />
<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
<input type="hidden" name="task" value="" />
<?php 
        echo JCommentsSecurity::formToken();
        ?>
</form>
<?php 
    }
 function getLink($type = 'ajax', $object_id = 0, $object_group = '')
 {
     global $mainframe, $iso_client_lang;
     switch ($type) {
         case 'rss':
             if (JCOMMENTS_JVERSION == '1.5') {
                 $link = 'index.php?option=com_jcomments&amp;task=rss&amp;object_id=' . $object_id . '&amp;object_group=' . $object_group . '&amp;format=raw';
                 if ($mainframe->isAdmin()) {
                     $link = JURI::root(true) . '/' . $link;
                 } else {
                     $link = JRoute::_($link);
                 }
                 return $link;
             }
             return $mainframe->getCfg('live_site') . '/index2.php?option=com_jcomments&amp;task=rss&amp;object_id=' . $object_id . '&amp;object_group=' . $object_group . '&amp;no_html=1';
             break;
         case 'noavatar':
             return $mainframe->getCfg('live_site') . '/components/com_jcomments/images/no_avatar.png';
             break;
         case 'smiles':
             return $mainframe->getCfg('live_site') . '/components/com_jcomments/images/smiles';
             break;
         case 'captcha':
             mt_srand((double) microtime() * 1000000);
             $random = mt_rand(10000, 99999);
             if (JCOMMENTS_JVERSION == '1.5') {
                 return JURI::root(true) . '/index.php?option=com_jcomments&amp;task=captcha&amp;tmpl=component&amp;ac=' . $random;
             }
             return $mainframe->getCfg('live_site') . '/index2.php?option=com_jcomments&amp;task=captcha&amp;no_html=1&amp;ac=' . $random;
             break;
         case 'ajax':
             $config =& JCommentsFactory::getConfig();
             // support alternate language files
             $lsfx = $config->get('lsfx') != '' ? '&amp;lsfx=' . $config->get('lsfx') : '';
             // support additional param for multilingual sites
             $lang = $mainframe->getCfg('multilingual_support') == 1 ? '&amp;lang=' . $iso_client_lang : '';
             if (JCOMMENTS_JVERSION == '1.5') {
                 $link = JURI::root(true) . '/index.php?option=com_jcomments&amp;tmpl=component' . $lang . $lsfx;
             } else {
                 $_Itemid = '&amp;Itemid=' . (!empty($_REQUEST['Itemid']) ? $_REQUEST['Itemid'] : 1);
                 $link = $mainframe->getCfg('live_site') . '/index2.php?option=com_jcomments&amp;no_html=1' . $lang . $lsfx . $_Itemid;
             }
             return JCommentsSecurity::fixAJAX($link);
             break;
         case 'ajax-backend':
             if (JCOMMENTS_JVERSION == '1.5') {
                 $link = $mainframe->getCfg('live_site') . '/administrator/index.php?option=com_jcomments&amp;tmpl=component';
             } else {
                 $link = $mainframe->getCfg('live_site') . '/administrator/index3.php?option=com_jcomments&amp;no_html=1';
             }
             return JCommentsSecurity::fixAJAX($link);
             break;
         default:
             return '';
             break;
     }
 }