Ejemplo n.º 1
0
function plgSystemJComments()
{
    global $mosConfig_absolute_path, $mainframe;
    include_once $mosConfig_absolute_path . '/components/com_jcomments/jcomments.legacy.php';
    if (!defined('JCOMMENTS_JVERSION')) {
        return;
    }
    include_once JCOMMENTS_BASE . '/jcomments.class.php';
    include_once JCOMMENTS_BASE . '/jcomments.config.php';
    include_once JCOMMENTS_HELPERS . '/system.php';
    $document = JCommentsFactory::getDocument();
    if (!defined('JCOMMENTS_CSS')) {
        $document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
        define('JCOMMENTS_CSS', 1);
    }
    if (!$mainframe->isAdmin()) {
        if (!defined('JCOMMENTS_JS')) {
            $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
            define('JCOMMENTS_JS', 1);
        }
        if (!defined('JOOMLATUNE_AJAX_JS')) {
            $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
            define('JOOMLATUNE_AJAX_JS', 1);
        }
    }
}
Ejemplo n.º 2
0
 public static function getCSS($isRTL = false, $template = '')
 {
     if (empty($template)) {
         $config = JCommentsCfg::getInstance();
         $template = $config->get('template');
     }
     $cssName = $isRTL ? 'style_rtl.css' : 'style.css';
     $cssFile = $cssName . '?v=21';
     if (JCOMMENTS_JVERSION == '1.0') {
         $cssUrl = JCommentsSystemPluginHelper::getBaseUrl() . '/components/com_jcomments/tpl/' . $template . '/' . $cssFile;
     } else {
         $app = JCommentsFactory::getApplication('site');
         $cssPath = JPATH_SITE . '/templates/' . $app->getTemplate() . '/html/com_jcomments/' . $template . '/' . $cssName;
         $cssUrl = JURI::root(true) . '/templates/' . $app->getTemplate() . '/html/com_jcomments/' . $template . '/' . $cssFile;
         if (!is_file($cssPath)) {
             $cssPath = JPATH_SITE . '/components/com_jcomments/tpl/' . $template . '/' . $cssName;
             $cssUrl = JURI::root(true) . '/components/com_jcomments/tpl/' . $template . '/' . $cssFile;
             if ($isRTL && !is_file($cssPath)) {
                 $cssUrl = '';
             }
         }
     }
     return $cssUrl;
 }
Ejemplo n.º 3
0
    function render()
    {
        $object_id = $this->getVar('comment-object_id');
        $object_group = $this->getVar('comment-object_group');
        // comments data is prepared in tpl_list and tpl_comments templates
        $comments = $this->getVar('comments-list', '');
        // form data is prepared in tpl_form template.
        $form = $this->getVar('comments-form');
        if ($comments != '' || $form != '' || $this->getVar('comments-anticache')) {
            // include comments css (only if we are in administor's panel)
            if ($this->getVar('comments-css', 0) == 1) {
                include_once JCOMMENTS_HELPERS . DS . 'system.php';
                ?>
<link href="<?php 
                echo JCommentsSystemPluginHelper::getCSS();
                ?>
" rel="stylesheet" type="text/css" />
<?php 
                if ($this->getVar('direction') == 'rtl') {
                    $rtlCSS = JCommentsSystemPluginHelper::getCSS(true);
                    if ($rtlCSS != '') {
                        ?>
<link href="<?php 
                        echo $rtlCSS;
                        ?>
" rel="stylesheet" type="text/css" />
<?php 
                    }
                }
            }
            // include JComments JavaScript initialization
            ?>
<script type="text/javascript">
<!--
var jcomments=new JComments(<?php 
            echo $object_id;
            ?>
, '<?php 
            echo $object_group;
            ?>
','<?php 
            echo $this->getVar('ajaxurl');
            ?>
');
jcomments.setList('comments-list');
//-->
</script>
<?php 
            // IMPORTANT: Do not rename this div's id! Some JavaScript functions references to it!
            ?>
<div id="jc">
<?php 
            if ($this->getVar('comments-form-position', 0) == 1) {
                // Display comments form (or link to show form)
                if (isset($form)) {
                    echo $form;
                }
            }
            ?>
<div id="comments"><?php 
            echo $comments;
            ?>
</div>
<?php 
            if ($this->getVar('comments-form-position', 0) == 0) {
                // Display comments form (or link to show form)
                if (isset($form)) {
                    echo $form;
                }
            }
            ?>
<div id="comments-footer" align="center"><?php 
            echo $this->getVar('support');
            ?>
</div>
<?php 
            // Some magic like dynamic comments list loader (anticache) and auto go to anchor script
            $aca = (int) ($this->getVar('comments-gotocomment') == 1);
            $acp = (int) ($this->getVar('comments-anticache') == 1);
            $acf = (int) ($this->getVar('comments-form-link') == 1 && $this->getVar('comments-form-locked', 0) == 0);
            if ($aca || $acp || $acf) {
                ?>
<script type="text/javascript">
<!--
jcomments.setAntiCache(<?php 
                echo $aca;
                ?>
,<?php 
                echo $acp;
                ?>
,<?php 
                echo $acf;
                ?>
);
//-->
</script> 
<?php 
            }
            ?>
</div>
<?php 
        }
    }
Ejemplo n.º 4
0
 public static function show($object_id, $object_group = 'com_content', $object_title = '')
 {
     // only one copy of JComments per page is allowed
     if (defined('JCOMMENTS_SHOW')) {
         return '';
     }
     $app = JFactory::getApplication('site');
     $object_group = JCommentsSecurity::clearObjectGroup($object_group);
     if ($object_group == '' || !isset($object_id) || $object_id == '') {
         return '';
     }
     $object_id = (int) $object_id;
     $object_title = trim($object_title);
     $acl = JCommentsFactory::getACL();
     $config = JCommentsFactory::getConfig();
     $document = JFactory::getDocument();
     $tmpl = JCommentsFactory::getTemplate($object_id, $object_group);
     $tmpl->load('tpl_index');
     if (!defined('JCOMMENTS_CSS')) {
         include_once JCOMMENTS_HELPERS . '/system.php';
         if ($app->isAdmin()) {
             $tmpl->addVar('tpl_index', 'comments-css', 1);
         } else {
             $document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
             $language = JFactory::getLanguage();
             if ($language->isRTL()) {
                 $rtlCSS = JCommentsSystemPluginHelper::getCSS(true);
                 if ($rtlCSS != '') {
                     $document->addStyleSheet($rtlCSS);
                 }
             }
         }
     }
     if (!defined('JCOMMENTS_JS')) {
         include_once JCOMMENTS_HELPERS . '/system.php';
         $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
         define('JCOMMENTS_JS', 1);
         if (!defined('JOOMLATUNE_AJAX_JS')) {
             $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
             define('JOOMLATUNE_AJAX_JS', 1);
         }
     }
     $commentsCount = JComments::getCommentsCount($object_id, $object_group);
     $commentsPerObject = $config->getInt('max_comments_per_object');
     $showForm = $config->getInt('form_show') == 1 || $config->getInt('form_show') == 2 && $commentsCount == 0;
     if ($commentsPerObject != 0 && $commentsCount >= $commentsPerObject) {
         $config->set('comments_locked', 1);
     }
     if ($config->getInt('comments_locked', 0) == 1) {
         $config->set('enable_rss', 0);
         $tmpl->addVar('tpl_index', 'comments-form-locked', 1);
         $acl->setCommentsLocked(true);
     }
     $tmpl->addVar('tpl_index', 'comments-form-captcha', $acl->check('enable_captcha'));
     $tmpl->addVar('tpl_index', 'comments-form-link', $showForm ? 0 : 1);
     if ($config->getInt('enable_rss') == 1) {
         if ($document->getType() == 'html') {
             $link = JCommentsFactory::getLink('rss', $object_id, $object_group);
             $title = htmlspecialchars($object_title, ENT_COMPAT, 'UTF-8');
             $attribs = array('type' => 'application/rss+xml', 'title' => $title);
             $document->addHeadLink($link, 'alternate', 'rel', $attribs);
         }
     }
     $cacheEnabled = intval($app->getCfg('caching')) != 0;
     if ($cacheEnabled == 0) {
         $jrecache = JPATH_ROOT . '/components/com_jrecache/jrecache.config.php';
         if (is_file($jrecache)) {
             $cfg = new _JRECache_Config();
             $cacheEnabled = $cacheEnabled && $cfg->enable_cache;
         }
     }
     $load_cached_comments = intval($config->getInt('load_cached_comments', 0) && $commentsCount > 0);
     if ($cacheEnabled) {
         $tmpl->addVar('tpl_index', 'comments-anticache', 1);
     }
     if (!$cacheEnabled || $load_cached_comments === 1) {
         if ($config->get('template_view') == 'tree') {
             $tmpl->addVar('tpl_index', 'comments-list', $commentsCount > 0 ? JComments::getCommentsTree($object_id, $object_group) : '');
         } else {
             $tmpl->addVar('tpl_index', 'comments-list', $commentsCount > 0 ? JComments::getCommentsList($object_id, $object_group) : '');
         }
     }
     $needScrollToComment = ($cacheEnabled || $config->getInt('comments_per_page') > 0) && $commentsCount > 0;
     $tmpl->addVar('tpl_index', 'comments-gotocomment', (int) $needScrollToComment);
     $tmpl->addVar('tpl_index', 'comments-form', JComments::getCommentsForm($object_id, $object_group, $showForm));
     $tmpl->addVar('tpl_index', 'comments-form-position', $config->getInt('form_position'));
     $result = $tmpl->renderTemplate('tpl_index');
     $tmpl->freeAllTemplates();
     // send notifications
     srand((double) microtime() * 10000000);
     $randValue = intval(rand(0, 100));
     if ($randValue <= 30) {
         JCommentsNotificationHelper::send();
     }
     define('JCOMMENTS_SHOW', 1);
     return $result;
 }
Ejemplo n.º 5
0
 function show($object_id, $object_group = 'com_content', $object_title = '', $search_text = '')
 {
     $object_id = (int) $object_id;
     $object_group = trim($object_group);
     $object_title = trim($object_title);
     $acl =& JCommentsFactory::getACL();
     $config =& JCommentsFactory::getConfig();
     $JLMS_CONFIG =& JLMSFactory::getConfig();
     $app =& JFactory::getApplication();
     $tmpl =& JCommentsFactory::getTemplate($object_id, $object_group);
     $tmpl->load('tpl_index');
     if ($config->getInt('object_locked', 0) == 1) {
         $config->set('enable_rss', 0);
         $tmpl->addVar('tpl_index', 'comments-form-locked', 1);
     }
     if (JCOMMENTS_JVERSION == '1.5') {
         $document =& JFactory::getDocument();
     }
     if (!defined('JCOMMENTS_CSS')) {
         include_once JCOMMENTS_HELPERS . DS . 'system.php';
         if ($app->isAdmin()) {
             $tmpl->addVar('tpl_index', 'comments-css', 1);
         } else {
             $link = JCommentsSystemPluginHelper::getCSS();
             $document->addStyleSheet($link);
         }
     }
     if (!defined('JCOMMENTS_JS')) {
         include_once JCOMMENTS_HELPERS . DS . 'system.php';
         if ($config->getInt('gzip_js') == 1) {
             $document->addScript(JCommentsSystemPluginHelper::getCompressedJS());
         } else {
             $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
             if (!defined('JOOMLATUNE_AJAX_JS')) {
                 $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
                 define('JOOMLATUNE_AJAX_JS', 1);
             }
         }
     }
     $tmpl->addVar('tpl_index', 'comments-form-captcha', $acl->check('enable_captcha'));
     $tmpl->addVar('tpl_index', 'comments-form-link', $config->getInt('form_show') ? 0 : 1);
     if ($config->getInt('enable_rss') == 1) {
         $link = JCommentsFactory::getLink('rss', $object_id, $object_group);
         $attribs = array('type' => 'application/rss+xml', 'title' => strip_tags($object_title));
         $document->addHeadLink($link, 'alternate', 'rel', $attribs);
     }
     $cacheEnabled = intval($JLMS_CONFIG->get('caching')) == 1;
     if ($cacheEnabled == 0) {
         $jrecache = $JLMS_CONFIG->get('absolute_path') . DS . 'components' . DS . 'com_jrecache' . DS . 'jrecache.config.php';
         if (is_file($jrecache)) {
             $cfg = new _JRECache_Config();
             $cacheEnabled = $cacheEnabled && $cfg->enable_cache;
         }
     }
     $load_cached_comments = $config->getInt('load_cached_comments', 0);
     if ($cacheEnabled) {
         $tmpl->addVar('tpl_index', 'comments-anticache', 1);
     }
     if (!$cacheEnabled || $load_cached_comments === 1) {
         if ($config->get('template_view') == 'tree' && !strlen($search_text)) {
             $tmpl->addVar('tpl_index', 'comments-list', JLMS_JComments::getCommentsTree($object_id, $object_group, $search_text));
         } else {
             $tmpl->addVar('tpl_index', 'comments-list', JLMS_JComments::getCommentsList($object_id, $object_group, $search_text));
         }
     }
     $needScrollToComment = $cacheEnabled || $config->getInt('comments_per_page') > 0;
     $tmpl->addVar('tpl_index', 'comments-gotocomment', (int) $needScrollToComment);
     $tmpl->addVar('tpl_index', 'comments-form', JComments::getCommentsForm($object_id, $object_group, $config->getInt('form_show') == 1));
     $result = $tmpl->renderTemplate('tpl_index');
     $tmpl->freeAllTemplates();
     return $result;
 }
Ejemplo n.º 6
0
 function onAfterRoute()
 {
     include_once JPATH_ROOT . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.legacy.php';
     $mainframe =& JFactory::getApplication('site');
     $mainframe->getRouter();
     $document =& JFactory::getDocument();
     if ($document->getType() == 'pdf') {
         return;
     }
     if ($mainframe->isAdmin()) {
         $document->addStyleSheet(JURI::base() . 'components/com_jcomments/assets/icon.css?v=2');
         $option = JAdministratorHelper::findOption();
         $task = JRequest::getCmd('task');
         $type = JRequest::getCmd('type', '', 'post');
         // remove comments if content item deleted from trash
         if ($option == 'com_trash' && $task == 'delete' && $type == 'content') {
             $cid = JRequest::getVar('cid', array(0), 'post', 'array');
             JArrayHelper::toInteger($cid, array(0));
             include_once JPATH_ROOT . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
             JComments::deleteComments($cid, 'com_content');
         }
     } else {
         $option = JRequest::getCmd('option');
         if ($option == 'com_content' || $option == 'com_alphacontent') {
             include_once JCOMMENTS_BASE . DS . 'jcomments.class.php';
             include_once JCOMMENTS_BASE . DS . 'jcomments.config.php';
             include_once JCOMMENTS_HELPERS . DS . 'system.php';
             // include JComments CSS
             if ($this->params->get('disable_template_css', 0) == 0) {
                 $document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
                 $language =& JFactory::getLanguage();
                 if ($language->isRTL()) {
                     $rtlCSS = JCommentsSystemPluginHelper::getCSS(true);
                     if ($rtlCSS != '') {
                         $document->addStyleSheet($rtlCSS);
                     }
                 }
             }
             if (!defined('JCOMMENTS_CSS')) {
                 define('JCOMMENTS_CSS', 1);
             }
             $config =& JCommentsCfg::getInstance();
             // include JComments JavaScript library
             $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
             if (!defined('JOOMLATUNE_AJAX_JS')) {
                 $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
                 define('JOOMLATUNE_AJAX_JS', 1);
             }
             if (!defined('JCOMMENTS_JS')) {
                 define('JCOMMENTS_JS', 1);
             }
         }
     }
 }
Ejemplo n.º 7
0
 function show($object_id, $object_group = 'com_content', $object_title = '')
 {
     global $mainframe;
     // only one copy of JComments per page is allowed
     if (defined('JCOMMENTS_SHOW')) {
         return;
     }
     $object_id = (int) $object_id;
     $object_group = trim(strip_tags($object_group));
     $object_group = preg_replace('#[^0-9A-Za-z\\-\\_\\,\\.]#is', '', $object_group);
     $object_title = trim($object_title);
     $acl =& JCommentsFactory::getACL();
     $config =& JCommentsFactory::getConfig();
     $tmpl =& JCommentsFactory::getTemplate($object_id, $object_group);
     $tmpl->load('tpl_index');
     if ($config->getInt('comments_locked', 0) == 1) {
         $config->set('enable_rss', 0);
         $tmpl->addVar('tpl_index', 'comments-form-locked', 1);
     }
     if (JCOMMENTS_JVERSION == '1.5') {
         $document =& JFactory::getDocument();
     }
     if (!defined('JCOMMENTS_CSS')) {
         include_once JCOMMENTS_HELPERS . DS . 'system.php';
         if ($mainframe->isAdmin()) {
             $tmpl->addVar('tpl_index', 'comments-css', 1);
         } else {
             $link = JCommentsSystemPluginHelper::getCSS();
             if (JCOMMENTS_JVERSION == '1.5') {
                 $document->addStyleSheet($link);
                 $language =& JFactory::getLanguage();
                 if ($language->isRTL()) {
                     $rtlCSS = JCommentsSystemPluginHelper::getCSS(true);
                     if ($rtlCSS != '') {
                         $document->addStyleSheet($rtlCSS);
                     }
                 }
             } else {
                 $mainframe->addCustomHeadTag('<link href="' . $link . '" rel="stylesheet" type="text/css" />');
             }
         }
     }
     if (!defined('JCOMMENTS_JS')) {
         include_once JCOMMENTS_HELPERS . DS . 'system.php';
         if (JCOMMENTS_JVERSION == '1.5') {
             $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
         } else {
             $mainframe->addCustomHeadTag(JCommentsSystemPluginHelper::getCoreJS(true));
         }
         if (!defined('JOOMLATUNE_AJAX_JS')) {
             if (JCOMMENTS_JVERSION == '1.5') {
                 $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
             } else {
                 $mainframe->addCustomHeadTag(JCommentsSystemPluginHelper::getAjaxJS(true));
             }
             define('JOOMLATUNE_AJAX_JS', 1);
         }
     }
     $commentsCount = JCommentsModel::getCommentsCount($object_id, $object_group);
     $showForm = $config->getInt('form_show') == 1 || $config->getInt('form_show') == 2 && $commentsCount == 0;
     $tmpl->addVar('tpl_index', 'comments-form-captcha', $acl->check('enable_captcha'));
     $tmpl->addVar('tpl_index', 'comments-form-link', $showForm ? 0 : 1);
     if ($config->getInt('enable_rss') == 1) {
         $link = JCommentsFactory::getLink('rss', $object_id, $object_group);
         if (JCOMMENTS_JVERSION == '1.5') {
             $attribs = array('type' => 'application/rss+xml', 'title' => strip_tags($object_title));
             $document->addHeadLink($link, 'alternate', 'rel', $attribs);
         } else {
             $html = '<link rel="alternate" type="application/rss+xml" title="' . strip_tags($object_title) . '" href="' . $link . '" />';
             $mainframe->addCustomHeadTag($html);
         }
     }
     $cacheEnabled = intval($mainframe->getCfg('caching')) == 1;
     if ($cacheEnabled == 0) {
         $jrecache = $mainframe->getCfg('absolute_path') . DS . 'components' . DS . 'com_jrecache' . DS . 'jrecache.config.php';
         if (is_file($jrecache)) {
             $cfg = new _JRECache_Config();
             $cacheEnabled = $cacheEnabled && $cfg->enable_cache;
         }
     }
     $load_cached_comments = intval($config->getInt('load_cached_comments', 0) && $commentsCount > 0);
     if ($cacheEnabled && $commentsCount > 0) {
         $tmpl->addVar('tpl_index', 'comments-anticache', 1);
     }
     if (!$cacheEnabled || $load_cached_comments === 1) {
         if ($config->get('template_view') == 'tree') {
             $tmpl->addVar('tpl_index', 'comments-list', $commentsCount > 0 ? JComments::getCommentsTree($object_id, $object_group) : '');
         } else {
             $tmpl->addVar('tpl_index', 'comments-list', $commentsCount > 0 ? JComments::getCommentsList($object_id, $object_group) : '');
         }
     }
     $needScrollToComment = ($cacheEnabled || $config->getInt('comments_per_page') > 0) && $commentsCount > 0;
     $tmpl->addVar('tpl_index', 'comments-gotocomment', (int) $needScrollToComment);
     $tmpl->addVar('tpl_index', 'comments-form', JComments::getCommentsForm($object_id, $object_group, $showForm));
     $result = $tmpl->renderTemplate('tpl_index');
     $tmpl->freeAllTemplates();
     define('JCOMMENTS_SHOW', 1);
     return $result;
 }
Ejemplo n.º 8
0
 function onAfterRoute()
 {
     $legacyFile = JPATH_ROOT . '/components/com_jcomments/jcomments.legacy.php';
     if (!is_file($legacyFile)) {
         return;
     }
     include_once $legacyFile;
     $app = JFactory::getApplication('site');
     $app->getRouter();
     $document = JFactory::getDocument();
     if ($document->getType() == 'html') {
         if ($app->isAdmin()) {
             $document->addStyleSheet(JURI::root(true) . '/administrator/components/com_jcomments/assets/css/icon.css?v=2');
             JFactory::getLanguage()->load('com_jcomments.sys', JPATH_ROOT . '/administrator', 'en-GB', true);
             $option = JAdministratorHelper::findOption();
             $task = $app->input->get('task');
             $type = $app->input->post('type', '', 'post');
             // remove comments if content item deleted from trash
             if ($option == 'com_trash' && $task == 'delete' && $type == 'content') {
                 $cid = JRequest::getVar('cid', array(0), 'post', 'array');
                 JArrayHelper::toInteger($cid, array(0));
                 include_once JPATH_ROOT . '/components/com_jcomments/jcomments.php';
                 JCommentsModel::deleteComments($cid, 'com_content');
             }
         } else {
             $option = $app->input->get('option');
             if ($option == 'com_content' || $option == 'com_alphacontent' || $option == 'com_multicategories') {
                 include_once JPATH_ROOT . '/components/com_jcomments/jcomments.class.php';
                 include_once JPATH_ROOT . '/components/com_jcomments/helpers/system.php';
                 // include JComments CSS
                 if ($this->params->get('disable_template_css', 0) == 0) {
                     $document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
                     $language = JFactory::getLanguage();
                     if ($language->isRTL()) {
                         $rtlCSS = JCommentsSystemPluginHelper::getCSS(true);
                         if ($rtlCSS != '') {
                             $document->addStyleSheet($rtlCSS);
                         }
                     }
                 }
                 if (!defined('JCOMMENTS_CSS')) {
                     define('JCOMMENTS_CSS', 1);
                 }
                 // include JComments JavaScript library
                 $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
                 if (!defined('JOOMLATUNE_AJAX_JS')) {
                     $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
                     define('JOOMLATUNE_AJAX_JS', 1);
                 }
                 if (!defined('JCOMMENTS_JS')) {
                     define('JCOMMENTS_JS', 1);
                 }
             }
         }
     }
 }
    function show($lists)
    {
        global $mainframe;
        include_once JCOMMENTS_HELPERS . DS . 'system.php';
        $link = JCommentsSystemPluginHelper::getCSS();
        if (JCOMMENTS_JVERSION == '1.5') {
            $document =& JFactory::getDocument();
            $document->addStyleSheet($link);
        } else {
            if (JCOMMENTS_JVERSION == '1.0') {
                $mainframe->addCustomHeadTag('<link href="' . $link . '" rel="stylesheet" type="text/css" />');
            }
        }
        ?>
<form action="<?php 
        echo JCOMMENTS_INDEX;
        ?>
" method="post" name="adminForm">
<table class="adminheading">
	<tr>
<?php 
        if (JCOMMENTS_JVERSION == '1.0') {
            ?>
	<th style="background-image: none; padding: 0;"><img src="./components/com_jcomments/assets/custombbcode48x48.png" width="48" height="48" align="middle" />&nbsp;<?php 
            echo JText::_('Custom BBCode');
            ?>
</th>
<?php 
        }
        ?>
	<td nowrap="nowrap" align="right"></td>
	</tr>
</table>
<table id="jc" class="adminlist" cellspacing="1">
	<thead>
		<tr>
			<th width="2%" class="title">#</th>
			<th width="20"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($lists['rows']);
        ?>
);" /></th>
			<th width="30%" align="left" nowrap="nowrap"><?php 
        echo JText::_('Name');
        ?>
</th>
			<th width="50%" class="title"><?php 
        echo JText::_('Pattern');
        ?>
</th>
			<th width="16" align="center"><?php 
        echo JText::_('Icon');
        ?>
</th>
			<th width="10%" colspan="2"><?php 
        echo JText::_('Ordering');
        ?>
</th>
			<th width="5%"><?php 
        echo JText::_('Button');
        ?>
</th>
			<th width="5%"><?php 
        echo JText::_('A_PUBLISHING');
        ?>
</th>
		</tr>
	</thead>
	<tbody>
<?php 
        for ($i = 0, $k = 0, $n = count($lists['rows']); $i < $n; $i++) {
            $row =& $lists['rows'][$i];
            $task = $row->published ? 'custombbcode.unpublish' : 'custombbcode.publish';
            $img = $row->published ? 'tick.png' : 'publish_x.png';
            $button_task = $row->button_enabled ? 'custombbcode.disable_button' : 'custombbcode.enable_button';
            $button_img = $row->button_enabled ? 'tick.png' : 'publish_x.png';
            $icon = '';
            if ($row->button_image != '') {
                $icon = '<img src="' . $mainframe->getCfg('live_site') . '/' . $row->button_image . '" alt="" />';
            } else {
                if ($row->button_css != '') {
                    $icon = '<span class="bbcode" style="width: 23px;"><a href="#" onclick="return false;" class="' . $row->button_css . '"></a></span>';
                }
            }
            $link = JCOMMENTS_INDEX . '?option=com_jcomments&task=custombbcode.edit&hidemainmenu=1&cid=' . $row->id;
            $link_title = JCOMMENTS_JVERSION == '1.5' ? JText::_('Edit') : _E_EDIT;
            ?>
<tr valign="middle" class="<?php 
            echo "row{$k}";
            ?>
">
	<td><label for="cb<?php 
            echo $i;
            ?>
"><?php 
            echo $i + 1 + $lists['pageNav']->limitstart;
            ?>
</label></td>
	<td width="20"><input type="checkbox" id="cb<?php 
            echo $i;
            ?>
" name="cid[]" value="<?php 
            echo $row->id;
            ?>
" onclick="isChecked(this.checked);" /></td>
	<td align="left"><a href="<?php 
            echo $link;
            ?>
" title="<?php 
            echo $link_title;
            ?>
"><?php 
            echo $row->name;
            ?>
</a></td>
	<td align="left"><?php 
            echo $row->simple_pattern;
            ?>
</td>
	<td align="center"><?php 
            echo $icon;
            ?>
</td>
	<td align="right"><?php 
            echo $lists['pageNav']->orderUpIcon($i, true, 'custombbcode.orderup');
            ?>
</td>
	<td align="left"><?php 
            echo $lists['pageNav']->orderDownIcon($i, $n, true, 'custombbcode.orderup');
            ?>
</td>
	<td align="center"><a href="javascript: void(0);" onclick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $button_task;
            ?>
')"><img src="images/<?php 
            echo $button_img;
            ?>
" border="0" alt="<?php 
            echo $row->button_enabled ? JText::_('A_DISABLE') : JText::_('A_ENABLE');
            ?>
" /></a></td>
	<td align="center"><a href="javascript: void(0);" onclick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $task;
            ?>
')"><img src="images/<?php 
            echo $img;
            ?>
" border="0" alt="<?php 
            echo $row->published ? JText::_('Unpublish') : JText::_('Publish');
            ?>
" /></a></td>
</tr>
<?php 
            $k = 1 - $k;
        }
        ?>
</tbody>
	<tfoot>
		<tr>
			<td colspan="15"><?php 
        echo $lists['pageNav']->getListFooter();
        ?>
</td>
		</tr>
	</tfoot>
</table>
<input type="hidden" name="option" value="com_jcomments" />
<input type="hidden" name="task" value="custombbcode" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="hidemainmenu" value="0" /></form>
<?php 
    }
    public static function show($lists)
    {
        $app = JCommentsFactory::getApplication('administrator');
        include_once JCOMMENTS_HELPERS . DS . 'system.php';
        $link = JCommentsSystemPluginHelper::getCSS();
        if (JCOMMENTS_JVERSION == '1.0') {
            $app->addCustomHeadTag('<link href="' . $link . '" rel="stylesheet" type="text/css" />');
        } else {
            $document = JFactory::getDocument();
            $document->addStyleSheet($link);
        }
        ?>
<form action="<?php 
        echo JCOMMENTS_INDEX;
        ?>
" method="post" name="adminForm" id="adminForm">
<table class="adminheading">
	<tr>
<?php 
        if (JCOMMENTS_JVERSION == '1.0') {
            ?>
	<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');
            ?>
" />&nbsp;<?php 
            echo JText::_('A_CUSTOM_BBCODE');
            ?>
</th>
<?php 
        }
        ?>
	<td nowrap="nowrap" align="right"></td>
	</tr>
</table>
<table id="jc" class="adminlist" cellspacing="1">
	<thead>
		<tr>
			<th width="1%"><input type="checkbox" id="toggle" name="toggle" value="" onclick="checkAll(<?php 
        echo count($lists['rows']);
        ?>
);" /></th>
			<th width="30%" align="left" nowrap="nowrap"><?php 
        echo JText::_('A_CUSTOM_BBCODE_NAME');
        ?>
</th>
			<th width="50%" class="title"><?php 
        echo JText::_('A_CUSTOM_BBCODE_PATTERN');
        ?>
</th>
			<th width="16" align="center"><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON_ICON');
        ?>
</th>
			<th width="4%"><?php 
        echo JText::_('A_ORDERING');
        ?>
</th>
			<th width="5%"><?php 
        echo JText::_('A_CUSTOM_BBCODE_BUTTON');
        ?>
</th>
			<th width="5%"><?php 
        echo JText::_('A_PUBLISHING');
        ?>
</th>
		</tr>
	</thead>
	<tbody>
<?php 
        for ($i = 0, $k = 0, $n = count($lists['rows']); $i < $n; $i++) {
            $row =& $lists['rows'][$i];
            $buttonStateTask = $row->button_enabled ? 'custombbcodes.disable_button' : 'custombbcodes.enable_button';
            if (JCOMMENTS_JVERSION == '1.7') {
                $buttonStateClass = $row->button_enabled ? 'publish' : 'unpublish';
                $buttonStateText = $row->button_enabled ? JText::_('JENABLED') : JText::_('JDISABLED');
                $buttonStateTitle = addslashes(htmlspecialchars($buttonStateText, ENT_COMPAT, 'UTF-8'));
                $buttonState = '<span class="state ' . $buttonStateClass . '"><span class="text">' . $buttonStateText . '</span></span>';
            } else {
                $buttonStateTitle = $row->button_enabled ? JText::_('A_DISABLE') : JText::_('A_ENABLE');
                $buttonState = '<img src="images/' . ($row->button_enabled ? 'tick.png' : 'publish_x.png') . '" border="0" alt="' . $buttonStateTitle . '" />';
            }
            $icon = '';
            if ($row->button_image != '') {
                $icon = '<img src="' . $app->getCfg('live_site') . '/' . $row->button_image . '" alt="' . $row->name . '" />';
            } else {
                if ($row->button_css != '') {
                    $icon = '<span class="bbcode" style="width: 23px;"><a href="#" onclick="return false;" class="' . $row->button_css . '"></a></span>';
                }
            }
            $link = JCOMMENTS_INDEX . '?option=com_jcomments&task=custombbcodes.edit&hidemainmenu=1&cid=' . $row->id;
            ?>
<tr valign="middle" class="<?php 
            echo "row{$k}";
            ?>
">
	<td align="center"><?php 
            echo JCommentsHTML::_('grid.id', $row, $i);
            ?>
</td>
	<td align="left"><a href="<?php 
            echo $link;
            ?>
" title="<?php 
            echo JText::_('A_EDIT');
            ?>
"><?php 
            echo $row->name;
            ?>
</a></td>
	<td align="left"><?php 
            echo $row->simple_pattern;
            ?>
</td>
	<td align="center"><?php 
            echo $icon;
            ?>
</td>
	<td class="order" align="center">
		<span><?php 
            echo $lists['pageNav']->orderUpIcon($i, true, 'custombbcodes.orderup');
            ?>
</span>			
		<span><?php 
            echo $lists['pageNav']->orderDownIcon($i, $n, true, 'custombbcodes.orderdown');
            ?>
</span>
	</td>
	<td align="center"><a class="jgrid" href="javascript: void(0);" onclick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $buttonStateTask;
            ?>
')" title="<?php 
            echo $buttonStateTitle;
            ?>
"><?php 
            echo $buttonState;
            ?>
</a></td>
	<td align="center"><?php 
            echo JCommentsHTML::_('grid.published', $row, $i, 'custombbcodes.');
            ?>
</td>
</tr>
<?php 
            $k = 1 - $k;
        }
        ?>
</tbody>
	<tfoot>
		<tr>
			<td colspan="15"><?php 
        echo $lists['pageNav']->getListFooter();
        ?>
</td>
		</tr>
	</tfoot>
</table>
<input type="hidden" name="option" value="com_jcomments" />
<input type="hidden" name="task" value="custombbcodes" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="hidemainmenu" value="0" />
<?php 
        echo JCommentsSecurity::formToken();
        ?>
</form>
<?php 
    }