function voteComment($id, $value)
 {
     $acl =& JCommentsFactory::getACL();
     $db =& JCommentsFactory::getDBO();
     $config =& JCommentsFactory::getConfig();
     $response =& JCommentsFactory::getAjaxResponse();
     $id = (int) $id;
     $value = (int) $value;
     $value = $value > 0 ? 1 : -1;
     $ip = $acl->getUserIP();
     $query = 'SELECT COUNT(*) FROM `#__jcomments_votes` WHERE commentid = ' . $id;
     if ($acl->getUserId()) {
         $query .= ' AND userid = ' . $acl->getUserId();
     } else {
         $query .= ' AND userid = 0 AND ip = "' . $ip . '"';
     }
     $db->setQuery($query);
     $voted = $db->loadResult();
     if ($voted == 0) {
         $comment = new JCommentsDB($db);
         if ($comment->load($id)) {
             if ($acl->canVote($comment)) {
                 $allowed = true;
                 if ($config->getInt('enable_mambots') == 1) {
                     require_once JCOMMENTS_HELPERS . DS . 'plugin.php';
                     JCommentsPluginHelper::importPlugin('jcomments');
                     JCommentsPluginHelper::trigger('onCommentVote', array(&$comment, &$response, &$allowed, &$value));
                 }
                 if ($allowed !== false) {
                     if ($value > 0) {
                         $comment->isgood++;
                     } else {
                         $comment->ispoor++;
                     }
                     $comment->store();
                     $query = "INSERT INTO `#__jcomments_votes`(`commentid`,`userid`,`ip`,`date`,`value`)" . "VALUES('" . $comment->id . "', '" . $acl->getUserId() . "','" . $db->getEscaped($ip) . "', now(), " . $value . ")";
                     $db->setQuery($query);
                     $db->query();
                 }
                 $tmpl =& JCommentsFactory::getTemplate();
                 $tmpl->load('tpl_comment');
                 $tmpl->addVar('tpl_comment', 'get_comment_vote', 1);
                 $tmpl->addObject('tpl_comment', 'comment', $comment);
                 $html = $tmpl->renderTemplate('tpl_comment');
                 $html = JCommentsText::jsEscape($html);
                 $response->addScript("jcomments.updateVote('" . $comment->id . "','{$html}');");
             } else {
                 $response->addAlert(JText::_('ERROR_CANT_VOTE'));
             }
         } else {
             $response->addAlert(JText::_('ERROR_NOT_FOUND'));
         }
         unset($comment);
     } else {
         $response->addAlert(JText::_('ERROR_ALREADY_VOTED'));
     }
     return $response;
 }
Exemple #2
0
function plgContentJCommentsLinksJ10($published, &$row, &$params, $page = 0)
{
    global $task, $option, $my;
    // disable comments link in 3rd party components (except Events and AlphaContent)
    if ($option != 'com_content' && $option != 'com_frontpage' && $option != 'com_alphacontent' && $option != 'com_events') {
        return;
    }
    require_once JCOMMENTS_HELPERS . '/content.php';
    require_once JCOMMENTS_LIBRARIES . '/joomlatune/language.tools.php';
    if (!isset($params) || $params == null) {
        $params = new mosParameters('');
    }
    $pvars = array_keys(get_object_vars($params->_params));
    if (!$published || $params->get('popup') || in_array('moduleclass_sfx', $pvars)) {
        JCommentsContentPluginHelper::processForeignTags($row, true);
        JCommentsContentPluginHelper::clear($row, true);
        return;
    }
    /*
    if ($option == 'com_frontpage') {
    	$pluginParams = JCommentsPluginHelper::getParams('jcomments', 'content');
    	if ((int) $pluginParams->get('show_frontpage', 1) == 0) {
    		return;
    	}
    }
    */
    require_once JCOMMENTS_BASE . '/jcomments.config.php';
    require_once JCOMMENTS_BASE . '/jcomments.class.php';
    if ($task != 'view') {
        // replace other comment systems tags to JComments equivalents like {jcomments on}
        JCommentsContentPluginHelper::processForeignTags($row, false);
        // show link to comments only
        if ($row->access <= $my->gid) {
            $readmore_link = JCommentsObjectHelper::getLink($row->id, 'com_content');
            $readmore_register = 0;
        } else {
            $readmore_link = sefRelToAbs('index.php?option=com_registration&amp;task=register');
            $readmore_register = 1;
        }
        $tmpl = JCommentsFactory::getTemplate($row->id, 'com_content', false);
        $tmpl->load('tpl_links');
        $tmpl->addVar('tpl_links', 'comments_link_style', $readmore_register ? -1 : 1);
        $tmpl->addVar('tpl_links', 'link-readmore', $readmore_link);
        $tmpl->addVar('tpl_links', 'content-item', $row);
        if ($params->get('readmore') == 0 || @$row->readmore == 0) {
            $tmpl->addVar('tpl_links', 'readmore_link_hidden', 1);
        } else {
            if (@$row->readmore > 0) {
                $tmpl->addVar('tpl_links', 'readmore_link_hidden', 0);
            }
        }
        $config = JCommentsFactory::getConfig();
        $commentsDisabled = false;
        if (!JCommentsContentPluginHelper::checkCategory($row->catid)) {
            $commentsDisabled = true;
        }
        if ($config->getInt('comments_off', 0) == 1) {
            $commentsDisabled = true;
        } else {
            if ($config->getInt('comments_on', 0) == 1) {
                $commentsDisabled = false;
            }
        }
        $tmpl->addVar('tpl_links', 'comments_link_hidden', intval($commentsDisabled));
        $count = 0;
        // do not query comments count if comments disabled and link hidden
        if (!$commentsDisabled) {
            require_once JCOMMENTS_MODELS . '/jcomments.php';
            require_once JCOMMENTS_LIBRARIES . '/joomlatune/language.tools.php';
            $acl = JCommentsFactory::getACL();
            $options = array();
            $options['object_id'] = (int) $row->id;
            $options['object_group'] = 'com_content';
            $options['published'] = $acl->canPublish() || $acl->canPublishForObject($row->id, 'com_content') ? null : 1;
            $count = JCommentsModel::getCommentsCount($options);
            $anchor = $count == 0 ? '#addcomments' : '#comments';
            $link_text = $count == 0 ? JText::_('LINK_ADD_COMMENT') : JText::plural('LINK_READ_COMMENTS', $count);
            $tmpl->addVar('tpl_links', 'link-comment', $readmore_link . $anchor);
            $tmpl->addVar('tpl_links', 'link-comment-text', $link_text);
            $tmpl->addVar('tpl_links', 'link-comments-class', 'comments-link');
            $tmpl->addVar('tpl_links', 'comments-count', $count);
        }
        if ($readmore_register == 1 && $count == 0) {
            $tmpl->addVar('tpl_links', 'comments_link_hidden', 1);
        }
        if ($readmore_register == 1) {
            $readmore_text = JText::_('LINK_REGISTER_TO_READ_MORE');
        } else {
            $readmore_text = JText::_('LINK_READ_MORE');
        }
        $tmpl->addVar('tpl_links', 'link-readmore-text', $readmore_text);
        $tmpl->addVar('tpl_links', 'link-readmore-title', $row->title);
        $tmpl->addVar('tpl_links', 'link-readmore-class', 'readmore-link');
        JCommentsContentPluginHelper::clear($row, true);
        $row->text .= $tmpl->renderTemplate('tpl_links');
        $GLOBALS['jcomments_params_readmore'] = $params->get('readmore');
        $GLOBALS['jcomments_row_readmore'] = $row->readmore;
        $params->set('readmore', 0);
        $row->readmore = 0;
    } else {
        JCommentsContentPluginHelper::processForeignTags($row, true);
        JCommentsContentPluginHelper::clear($row, true);
    }
    return;
}
Exemple #3
0
	function onPrepareContent(&$article, &$params, $limitstart = 0)
	{
		require_once (JCOMMENTS_HELPERS . '/content.php');

		// check whether plugin has been unpublished
		if (!JPluginHelper::isEnabled('content', 'jcomments')) {
			JCommentsContentPluginHelper::clear($article, true);
			return '';
		}

		$app = JFactory::getApplication('site');
		$option = JRequest::getCmd('option');
		$view = JRequest::getCmd('view');

		if (!isset($article->id) || ($option != 'com_content' && $option != 'com_alphacontent' && $option != 'com_multicategories')) {
			return '';
		}

		if (!isset($params) || $params == null) {
			jimport('joomla.html.parameter');
			$params = new JParameter('');
		} else if (isset($params->_raw) && strpos($params->_raw, 'moduleclass_sfx') !== false) {
			return '';
		}

		if ($view == 'frontpage' || $view == 'featured') {
			if ($this->params->get('show_frontpage', 1) == 0) {
				return '';
			}
		}

		require_once (JCOMMENTS_BASE . '/jcomments.config.php');
		require_once (JCOMMENTS_BASE . '/jcomments.class.php');

		JCommentsContentPluginHelper::processForeignTags($article);

		$config = JCommentsFactory::getConfig();

		$categoryEnabled = JCommentsContentPluginHelper::checkCategory($article->catid);
		$commentsEnabled = JCommentsContentPluginHelper::isEnabled($article) || $categoryEnabled;
		$commentsDisabled = JCommentsContentPluginHelper::isDisabled($article) || !$commentsEnabled;
		$commentsLocked = JCommentsContentPluginHelper::isLocked($article);

		if ($article->state == -1 && $this->params->get('enable_for_archived', 0) == 0) {
			$commentsLocked = true;
		}

		$config->set('comments_on', intval($commentsEnabled));
		$config->set('comments_off', intval($commentsDisabled));
		$config->set('comments_locked', intval($commentsLocked));

		if ($view != 'article') {
			$user = JFactory::getUser();

			if (JCOMMENTS_JVERSION == '1.5') {
				$checkAccess = $article->access <= $user->get('aid', 0);
			} else {
				$authorised = JAccess::getAuthorisedViewLevels($user->get('id'));
				$checkAccess = in_array($article->access, $authorised);
			}

			if ($checkAccess) {
				require_once(JPATH_ROOT . '/components/com_content/helpers/route.php');
				if (JCOMMENTS_JVERSION == '1.5') {
					$readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid));
				} else {
					$readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid));
				}
				$readmore_register = 0;
			} else {
				if (JCOMMENTS_JVERSION == '1.5') {
					$readmore_link = JRoute::_('index.php?option=com_user&task=register');
				} else {
					$returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug));

					$menu = JFactory::getApplication()->getMenu();
					$active = $menu->getActive();
					$itemId = $active->id;
					$link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
					$link = new JURI($link1);
					$link->setVar('return', base64_encode($returnURL));
					$readmore_link = $link;
				}
				$readmore_register = 1;
			}

			// load template for comments & readmore links
			$tmpl = JCommentsFactory::getTemplate($article->id, 'com_content', false);
			$tmpl->load('tpl_links');

			$tmpl->addVar('tpl_links', 'comments_link_style', ($readmore_register ? -1 : 1));
			$tmpl->addVar('tpl_links', 'content-item', $article);
			$tmpl->addVar('tpl_links', 'show_hits', intval($this->params->get('show_hits', 0) && $params->get('show_hits', 0)));

			$readmoreDisabled = false;

			if (($params->get('show_readmore') == 0) || (@$article->readmore == 0)) {
				$readmoreDisabled = true;
			} else if (@$article->readmore > 0) {
				$readmoreDisabled = false;
			}

			if ($this->params->get('readmore_link', 1) == 0) {
				$readmoreDisabled = true;
			}

			$tmpl->addVar('tpl_links', 'readmore_link_hidden', intval($readmoreDisabled));

			// don't fill any readmore variable if it disabled
			if (!$readmoreDisabled) {
				if ($readmore_register == 1) {
					$readmore_text = JText::_('LINK_REGISTER_TO_READ_MORE');
				} else if (isset($params) && $readmore = $params->get('readmore')) {
					$readmore_text = $readmore;
				} else {
					$readmore_text = JText::_('LINK_READ_MORE');
				}
				$tmpl->addVar('tpl_links', 'link-readmore', $readmore_link);
				$tmpl->addVar('tpl_links', 'link-readmore-text', $readmore_text);
				$tmpl->addVar('tpl_links', 'link-readmore-title', $article->title);
				$tmpl->addVar('tpl_links', 'link-readmore-class', $this->params->get('readmore_css_class', 'readmore-link'));
			}

			$commentsDisabled = false;

			if ($config->getInt('comments_off', 0) == 1) {
				$commentsDisabled = true;
			} else if ($config->getInt('comments_on', 0) == 1) {
				$commentsDisabled = false;
			}

			$tmpl->addVar('tpl_links', 'comments_link_hidden', intval($commentsDisabled));

			$count = 0;

			// do not query comments count if comments disabled and link hidden
			if (!$commentsDisabled) {
				require_once (JCOMMENTS_MODELS . '/jcomments.php');

				$anchor = "";

				if ($this->params->get('comments_count', 1) != 0) {

					$acl = JCommentsFactory::getACL();

					$options = array();
					$options['object_id'] = (int) $article->id;
					$options['object_group'] = 'com_content';
					$options['published'] = $acl->canPublish() || $acl->canPublishForObject($article->id, 'com_content') ? null : 1;

					$count = JCommentsModel::getCommentsCount($options);

					$tmpl->addVar('tpl_links', 'comments-count', $count);
					$anchor = $count == 0 ? '#addcomment' : '#comments';

					if ($count == 0) {
						$link_text = JText::_('LINK_ADD_COMMENT');
					} else {
						if (JCOMMENTS_JVERSION == '1.5') {
							require_once (JCOMMENTS_LIBRARIES.'/joomlatune/language.tools.php');
							$lang = JFactory::getLanguage();
							$suffix = JoomlaTuneLanguageTools::getPluralSuffix($lang->getTag(), $count);
							$string = 'LINK_READ_COMMENTS';
							$key = $string . '_' . $suffix;
							if (!$lang->hasKey($key)) {
								$key = $string;
							}
							$link_text = JText::sprintf($key, $count);

						} else {
							$link_text = JText::plural('LINK_READ_COMMENTS', $count);
						}
					}
				} else {
					$link_text = JText::_('LINK_ADD_COMMENT');
				}

				$tmpl->addVar('tpl_links', 'link-comment', $readmore_link . $anchor);
				$tmpl->addVar('tpl_links', 'link-comment-text', $link_text);
				$tmpl->addVar('tpl_links', 'link-comments-class', $this->params->get('comments_css_class', 'comments-link'));
			}

			JCommentsContentPluginHelper::clear($article, true);

			// hide comments link if comments enabled but link disabled in plugin params
			if ((($this->params->get('comments_count', 1) == 0)
					|| ($count == 0 && $this->params->get('add_comments', 1) == 0)
					|| ($count == 0 && $readmore_register == 1))
					&& !$commentsDisabled) {
				$tmpl->addVar('tpl_links', 'comments_link_hidden', 1);
			}

			//links_position
			if ($this->params->get('links_position', 1) == 1) {
				$article->text .= $tmpl->renderTemplate('tpl_links');
			} else {
				$article->text = $tmpl->renderTemplate('tpl_links') . $article->text;
			}

			$tmpl->freeTemplate('tpl_links');

			if ($this->params->get('readmore_link', 1) == 1) {
				$article->readmore = 0;
				$article->readmore_link = '';
				$article->readmore_register = false;
			}
		} else {
			if ($this->params->get('show_comments_event') == 'onPrepareContent') {
				$isEnabled = ($config->getInt('comments_on', 0) == 1) && ($config->getInt('comments_off', 0) == 0);
				if ($isEnabled && $view == 'article') {
					require_once (JCOMMENTS_BASE . '/jcomments.php');

					$comments = JComments::show($article->id, 'com_content', $article->title);

					if (strpos($article->text, '{jcomments}') !== false) {
						$article->text = str_replace('{jcomments}', $comments, $article->text);
					} else {
						$article->text .= $comments;
					}
				}
			}
			JCommentsContentPluginHelper::clear($article, true);
		}
		return '';
	}
Exemple #4
0
 public static function getCommentListItem(&$comment)
 {
     $total = JComments::getCommentsCount($comment->object_id, $comment->object_group, 'parent = ' . $comment->parent);
     $tmpl = JCommentsFactory::getTemplate($comment->object_id, $comment->object_group);
     $tmpl->load('tpl_list');
     $tmpl->addVar('tpl_list', 'comment-id', $comment->id);
     $tmpl->addVar('tpl_list', 'comment-item', JComments::getCommentItem($comment));
     $tmpl->addVar('tpl_list', 'comment-modulo', $total % 2 ? 1 : 0);
     return $tmpl->renderTemplate('tpl_list');
 }
Exemple #5
0
 /**
  * @param  $comment JCommentsTableComment
  * @param boolean $isNew
  * @return
  */
 public static function sendToSubscribers(&$comment, $isNew = true)
 {
     if (!$comment->published) {
         return;
     }
     $app = JCommentsFactory::getApplication('site');
     $dbo = JCommentsFactory::getDBO();
     $config = JCommentsFactory::getConfig();
     $query = "SELECT DISTINCTROW js.`name`, js.`email`, js.`hash` " . "\n , jo.title AS object_title, jo.link AS object_link, jo.access AS object_access" . "\nFROM #__jcomments_subscriptions AS js" . "\nJOIN #__jcomments_objects AS jo ON js.object_id = jo.object_id AND js.object_group = jo.object_group" . "\nWHERE js.`object_group` = " . $dbo->Quote($comment->object_group) . "\nAND js.`object_id` = " . intval($comment->object_id) . "\nAND js.`published` = 1 " . (JCommentsMultilingual::isEnabled() ? "\nAND js.`lang` = " . $dbo->Quote($comment->lang) : '') . (JCommentsMultilingual::isEnabled() ? "\nAND jo.`lang` = " . $dbo->Quote($comment->lang) : '') . "\nAND js.`email` <> '" . $dbo->getEscaped($comment->email) . "'" . ($comment->userid ? "\nAND js.`userid` <> " . $comment->userid : '');
     $dbo->setQuery($query);
     $rows = $dbo->loadObjectList();
     if (count($rows)) {
         // getting object's information (title and link)
         $object_title = empty($rows[0]->object_title) ? JCommentsObjectHelper::getTitle($comment->object_id, $comment->object_group, $comment->lang) : $rows[0]->object_title;
         $object_link = empty($rows[0]->object_link) ? JCommentsObjectHelper::getLink($comment->object_id, $comment->object_group, $comment->lang) : $rows[0]->object_link;
         $object_link = JCommentsFactory::getAbsLink($object_link);
         if ($comment->title != '') {
             $comment->title = JCommentsText::censor($comment->title);
         }
         $commentText = $comment->comment;
         $bbcode = JCommentsFactory::getBBCode();
         $txt = JCommentsText::censor($comment->comment);
         $txt = $bbcode->replace($txt);
         if ($config->getInt('enable_custom_bbcode')) {
             $customBBCode = JCommentsFactory::getCustomBBCode();
             // TODO: add control for replacement mode from CustomBBCode parameters
             $txt = $customBBCode->replace($txt, true);
         }
         $comment->comment = trim(preg_replace('/(\\s){2,}/i', '\\1', $txt));
         $comment->author = JComments::getCommentAuthorName($comment);
         $tmpl = JCommentsFactory::getTemplate($comment->object_id, $comment->object_group);
         $tmpl->load('tpl_email');
         $tmpl->addVar('tpl_email', 'notification-type', 'subscription');
         $tmpl->addVar('tpl_email', 'comment-isnew', $isNew ? 1 : 0);
         $tmpl->addVar('tpl_email', 'comment-object_title', $object_title);
         $tmpl->addVar('tpl_email', 'comment-object_link', $object_link);
         $tmpl->addObject('tpl_email', 'comment', $comment);
         if ($isNew) {
             $subject = JText::sprintf('NOTIFICATION_SUBJECT_NEW', $object_title);
         } else {
             $subject = JText::sprintf('NOTIFICATION_SUBJECT_UPDATED', $object_title);
         }
         if (isset($subject)) {
             $mailFrom = $app->getCfg('mailfrom');
             $fromName = $app->getCfg('fromname');
             foreach ($rows as $row) {
                 $tmpl->addVar('tpl_email', 'hash', $row->hash);
                 $message = $tmpl->renderTemplate('tpl_email');
                 JCommentsMail::send($mailFrom, $fromName, $row->email, $subject, $message, true);
             }
         }
         $tmpl->freeTemplate('tpl_email');
         unset($rows);
         $comment->comment = $commentText;
     }
 }
 function getCommentsTree($object_id, $object_group = 'com_content', $search_text = '')
 {
     global $my;
     $object_id = (int) $object_id;
     $object_group = trim($object_group);
     $acl =& JCommentsFactory::getACL();
     $dbo =& JCommentsFactory::getDBO();
     $config =& JCommentsFactory::getConfig();
     $canPublish = $acl->canPublish();
     $canComment = $acl->canComment();
     $where = '';
     if ($search_text) {
         $words = explode(' ', $search_text);
         $wheres = array();
         foreach ($words as $word) {
             $wheres2 = array();
             $wheres2[] = "LOWER(name) LIKE '%{$word}%'";
             $wheres2[] = "LOWER(comment) LIKE '%{$word}%'";
         }
         if (isset($wheres2) && count($wheres2)) {
             $where .= ' AND (';
             $where .= implode(' OR ', $wheres2);
             $where .= ' )';
         }
     }
     if ($canComment == 0) {
         $total = JLMS_JComments::getCommentsCount($object_id, $object_group, $where);
         if ($total == 0) {
             return '';
         }
     }
     $query = "SELECT c.id, c.parent, c.object_id, c.object_group, c.userid, c.name, c.username, c.title, c.comment" . "\n , c.email, c.homepage, c.date as datetime, c.ip, c.published, c.checked_out, c.checked_out_time" . "\n , c.isgood, c.ispoor" . "\n , v.value as voted" . "\n FROM #__jcomments AS c" . "\n LEFT JOIN #__jcomments_votes AS v ON c.id = v.commentid " . ($my->id ? " AND  v.userid = " . $my->id : " AND  v.ip = '" . $acl->getUserIP() . "'") . "\n WHERE c.object_id = " . $object_id . "\n AND c.object_group = '" . $object_group . "'" . (JCommentsMultilingual::isEnabled() ? "\nAND c.lang = '" . JCommentsMultilingual::getLanguage() . "'" : "") . ($canPublish == 0 ? "\nAND c.published = 1" : "") . $where . "\n ORDER BY c.parent, c.date ASC";
     $dbo->setQuery($query);
     $rows = $dbo->loadObjectList();
     $tmpl =& JCommentsFactory::getTemplate($object_id, $object_group);
     $tmpl->load('tpl_tree');
     $tmpl->load('tpl_comment');
     if (count($rows)) {
         $isLocked = $config->getInt('object_locked', 0) == 1;
         $tmpl->addVar('tpl_tree', 'comments-refresh', intval(!$isLocked));
         $tmpl->addVar('tpl_tree', 'comments-rss', intval($config->getInt('enable_rss') && !$isLocked));
         $tmpl->addVar('tpl_tree', 'comments-can-subscribe', intval($my->id && $acl->check('enable_subscribe') && !$isLocked));
         if ($my->id && $acl->check('enable_subscribe')) {
             require_once JCOMMENTS_BASE . DS . 'jcomments.subscription.php';
             $manager =& JCommentsSubscriptionManager::getInstance();
             $isSubscribed = $manager->isSubscribed($object_id, $object_group, $my->id);
             $tmpl->addVar('tpl_tree', 'comments-user-subscribed', $isSubscribed);
         }
         $i = 1;
         if ($config->getInt('enable_mambots') == 1) {
             require_once JCOMMENTS_HELPERS . DS . 'plugin.php';
             JCommentsPluginHelper::importPlugin('jcomments');
             JCommentsPluginHelper::trigger('onBeforeDisplayCommentsList', array(&$rows));
             if ($acl->check('enable_gravatar')) {
                 JCommentsPluginHelper::trigger('onPrepareAvatars', array(&$rows));
             }
         }
         require_once JCOMMENTS_LIBRARIES . DS . 'joomlatune' . DS . 'tree.php';
         $tree = new JoomlaTuneTree($rows);
         $items = $tree->get();
         foreach ($rows as $row) {
             if ($config->getInt('enable_mambots') == 1) {
                 JCommentsPluginHelper::trigger('onBeforeDisplayComment', array(&$row));
             }
             // run autocensor, replace quotes, smiles and other pre-view processing
             JComments::prepareComment($row);
             // setup toolbar
             if (!$acl->canModerate($row)) {
                 $tmpl->addVar('tpl_comment', 'comments-panel-visible', 0);
             } else {
                 $tmpl->addVar('tpl_comment', 'comments-panel-visible', 1);
                 $tmpl->addVar('tpl_comment', 'button-edit', $acl->canEdit($row));
                 $tmpl->addVar('tpl_comment', 'button-delete', $acl->canDelete($row));
                 $tmpl->addVar('tpl_comment', 'button-publish', $acl->canPublish($row));
                 $tmpl->addVar('tpl_comment', 'button-ip', $acl->canViewIP($row));
             }
             $tmpl->addVar('tpl_comment', 'comment-show-vote', $config->getInt('enable_voting'));
             $tmpl->addVar('tpl_comment', 'comment-show-email', $acl->canViewEmail($row));
             $tmpl->addVar('tpl_comment', 'comment-show-homepage', $acl->canViewHomepage($row));
             $tmpl->addVar('tpl_comment', 'comment-show-title', $config->getInt('comment_title'));
             $tmpl->addVar('tpl_comment', 'button-vote', $acl->canVote($row));
             $tmpl->addVar('tpl_comment', 'button-quote', $acl->canQuote($row));
             $tmpl->addVar('tpl_comment', 'button-reply', $acl->canReply($row));
             $tmpl->addVar('tpl_comment', 'avatar', $acl->check('enable_gravatar'));
             if (isset($items[$row->id])) {
                 $tmpl->addVar('tpl_comment', 'comment-number', '');
                 $tmpl->addObject('tpl_comment', 'comment', $row);
                 $items[$row->id]->html = $tmpl->renderTemplate('tpl_comment');
                 $i++;
             }
         }
         $tmpl->addObject('tpl_tree', 'comments-items', $items);
         unset($rows);
     }
     return $tmpl->renderTemplate('tpl_tree');
 }
Exemple #7
0
 public static function voteComment($id, $value)
 {
     $acl = JCommentsFactory::getACL();
     $db = JCommentsFactory::getDBO();
     $response = JCommentsFactory::getAjaxResponse();
     $id = (int) $id;
     $value = (int) $value;
     $value = $value > 0 ? 1 : -1;
     $ip = $acl->getUserIP();
     $query = 'SELECT COUNT(*) FROM `#__jcomments_votes` WHERE commentid = ' . $id;
     if ($acl->getUserId()) {
         $query .= ' AND userid = ' . $acl->getUserId();
     } else {
         $query .= ' AND userid = 0 AND ip = "' . $ip . '"';
     }
     $db->setQuery($query);
     $voted = $db->loadResult();
     if ($voted == 0) {
         $comment = new JCommentsTableComment($db);
         if ($comment->load($id)) {
             if ($acl->canVote($comment)) {
                 $result = JCommentsEvent::trigger('onJCommentsCommentBeforeVote', array(&$comment, &$value));
                 if (!in_array(false, $result, true)) {
                     if ($value > 0) {
                         $comment->isgood++;
                     } else {
                         $comment->ispoor++;
                     }
                     $comment->store();
                     $query = "INSERT INTO `#__jcomments_votes`(`commentid`,`userid`,`ip`,`date`,`value`)" . "VALUES('" . $comment->id . "', '" . $acl->getUserId() . "','" . $db->getEscaped($ip) . "', now(), " . $value . ")";
                     $db->setQuery($query);
                     $db->query();
                     JCommentsEvent::trigger('onJCommentsCommentAfterVote', array(&$comment, $value));
                 }
                 $tmpl = JCommentsFactory::getTemplate();
                 $tmpl->load('tpl_comment');
                 $tmpl->addVar('tpl_comment', 'get_comment_vote', 1);
                 $tmpl->addObject('tpl_comment', 'comment', $comment);
                 $html = $tmpl->renderTemplate('tpl_comment');
                 $html = JCommentsText::jsEscape($html);
                 $response->addScript("jcomments.updateVote('" . $comment->id . "','{$html}');");
             } else {
                 $response->addAlert(JText::_('ERROR_CANT_VOTE'));
             }
         } else {
             $response->addAlert(JText::_('ERROR_NOT_FOUND'));
         }
     } else {
         $response->addAlert(JText::_('ERROR_ALREADY_VOTED'));
     }
     return $response;
 }
Exemple #8
0
 /**
  * @param  $comment JCommentsDB
  * @param boolean $isNew
  * @return
  */
 function sendToSubscribers(&$comment, $isNew = true)
 {
     global $mainframe;
     if (!$comment->published) {
         return;
     }
     $dbo =& JCommentsFactory::getDBO();
     $config =& JCommentsFactory::getConfig();
     $query = "SELECT DISTINCTROW `name`, `email`, `hash` " . "\nFROM #__jcomments_subscriptions " . "\nWHERE `object_group` = '" . $dbo->getEscaped($comment->object_group) . "'" . "\nAND `object_id`='" . intval($comment->object_id) . "'" . "\nAND `published`='1' " . (JCommentsMultilingual::isEnabled() ? "\nAND `lang` = '" . $dbo->getEscaped($comment->lang) . "'" : '') . "\nAND `email` <> '" . $dbo->getEscaped($comment->email) . "'" . ($comment->userid ? "\nAND `userid` <> '" . $comment->userid . "'" : '');
     $dbo->setQuery($query);
     $rows = $dbo->loadObjectList();
     if (count($rows)) {
         $object_title = JCommentsObjectHelper::getTitle($comment->object_id, $comment->object_group, $comment->lang);
         $object_link = JCommentsObjectHelper::getLink($comment->object_id, $comment->object_group);
         $object_link = JCommentsFactory::getAbsLink($object_link);
         $commentText = $comment->comment;
         $bbcode =& JCommentsFactory::getBBCode();
         $txt = JCommentsText::censor($comment->comment);
         $txt = $bbcode->replace($txt);
         if ($config->getInt('enable_custom_bbcode')) {
             $customBBCode =& JCommentsFactory::getCustomBBCode();
             // TODO: add control for replacement mode from CustomBBCode parameters
             $txt = $customBBCode->replace($txt, true);
         }
         $txt = trim(preg_replace('/(\\s){2,}/i', '\\1', $txt));
         $txt = str_replace('class="quotebody"', 'style="margin: 5px 0 0 0;padding: 8px; border: 1px dashed #aaa;"', $txt);
         $comment->comment = $txt;
         unset($bbcode);
         $comment->author = JComments::getCommentAuthorName($comment);
         $tmpl =& JCommentsFactory::getTemplate($comment->object_id, $comment->object_group);
         $tmpl->load('tpl_email');
         $tmpl->addVar('tpl_email', 'notification-type', 'subscription');
         $tmpl->addVar('tpl_email', 'comment-isnew', $isNew ? 1 : 0);
         $tmpl->addVar('tpl_email', 'comment-object_title', $object_title);
         $tmpl->addVar('tpl_email', 'comment-object_link', $object_link);
         $tmpl->addObject('tpl_email', 'comment', $comment);
         if ($isNew) {
             $subject = JText::sprintf('NOTIFICATION_SUBJECT_NEW', $object_title);
         } else {
             $subject = JText::sprintf('NOTIFICATION_SUBJECT_UPDATED', $object_title);
         }
         if (isset($subject)) {
             $mailFrom = $mainframe->getCfg('mailfrom');
             $fromName = $mainframe->getCfg('fromname');
             foreach ($rows as $row) {
                 $tmpl->addVar('tpl_email', 'hash', $row->hash);
                 $message = $tmpl->renderTemplate('tpl_email');
                 JCommentsMail::send($mailFrom, $fromName, $row->email, $subject, $message, true);
             }
         }
         $tmpl->freeTemplate('tpl_email');
         unset($rows);
         $comment->comment = $commentText;
     }
 }
Exemple #9
0
 function onPrepareContent(&$article, &$params, $limitstart = 0)
 {
     require_once JPATH_ROOT . '/components/com_jcomments/helpers/content.php';
     // check whether plugin has been unpublished
     if (!JPluginHelper::isEnabled('content', 'jcomments')) {
         JCommentsContentPluginHelper::clear($article, true);
         return '';
     }
     $app = JFactory::getApplication('site');
     $option = $app->input->get('option');
     $view = $app->input->get('view');
     if (!isset($article->id) || $option != 'com_content' && $option != 'com_alphacontent' && $option != 'com_multicategories') {
         return '';
     }
     if (!isset($params) || $params == null) {
         $params = new JRegistry('');
     } else {
         if (isset($params->_raw) && strpos($params->_raw, 'moduleclass_sfx') !== false) {
             return '';
         }
     }
     if ($view == 'frontpage' || $view == 'featured') {
         if ($this->params->get('show_frontpage', 1) == 0) {
             return '';
         }
     }
     require_once JPATH_ROOT . '/components/com_jcomments/jcomments.class.php';
     JCommentsContentPluginHelper::processForeignTags($article);
     $config = JCommentsFactory::getConfig();
     $categoryEnabled = JCommentsContentPluginHelper::checkCategory($article->catid);
     $commentsEnabled = JCommentsContentPluginHelper::isEnabled($article) || $categoryEnabled;
     $commentsDisabled = JCommentsContentPluginHelper::isDisabled($article) || !$commentsEnabled;
     $commentsLocked = JCommentsContentPluginHelper::isLocked($article);
     $archivesState = 2;
     if (isset($article->state) && $article->state == $archivesState && $this->params->get('enable_for_archived', 0) == 0) {
         $commentsLocked = true;
     }
     $config->set('comments_on', intval($commentsEnabled));
     $config->set('comments_off', intval($commentsDisabled));
     $config->set('comments_locked', intval($commentsLocked));
     if ($view != 'article') {
         $user = JFactory::getUser();
         $authorised = JAccess::getAuthorisedViewLevels($user->get('id'));
         $checkAccess = in_array($article->access, $authorised);
         $slug = isset($article->slug) ? $article->slug : $article->id;
         $language = isset($article->language) ? $article->language : 0;
         require_once JPATH_ROOT . '/components/com_content/helpers/route.php';
         if ($checkAccess) {
             $readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($slug, $article->catid, $language));
             $readmore_register = 0;
         } else {
             $returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($slug, $article->catid, $language));
             $menu = JFactory::getApplication()->getMenu();
             $active = $menu->getActive();
             $itemId = $active->id;
             $link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
             $link = new JURI($link1);
             $link->setVar('return', base64_encode($returnURL));
             $readmore_link = $link;
             $readmore_register = 1;
         }
         // load template for comments & readmore links
         $tmpl = JCommentsFactory::getTemplate($article->id, 'com_content', false);
         $tmpl->load('tpl_links');
         $tmpl->addVar('tpl_links', 'comments_link_style', $readmore_register ? -1 : 1);
         $tmpl->addVar('tpl_links', 'content-item', $article);
         $tmpl->addVar('tpl_links', 'show_hits', intval($this->params->get('show_hits', 0) && $params->get('show_hits', 0)));
         $readmoreDisabled = false;
         if ($params->get('show_readmore') == 0 || @$article->readmore == 0) {
             $readmoreDisabled = true;
         } else {
             if (@$article->readmore > 0) {
                 $readmoreDisabled = false;
             }
         }
         if ($this->params->get('readmore_link', 1) == 0) {
             $readmoreDisabled = true;
         }
         $tmpl->addVar('tpl_links', 'readmore_link_hidden', intval($readmoreDisabled));
         // don't fill any readmore variable if it disabled
         if (!$readmoreDisabled) {
             if ($readmore_register == 1) {
                 $readmore_text = JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
             } else {
                 if (isset($params) && ($readmore = $params->get('readmore'))) {
                     $readmore_text = $readmore;
                 } else {
                     if ($alternative_readmore = $article->alternative_readmore) {
                         $readmore_text = trim($alternative_readmore);
                         if ($params->get('show_readmore_title', 0) != 0) {
                             $readmore_text .= ' ' . JHtml::_('string.truncate', $article->title, $params->get('readmore_limit'));
                         }
                     } else {
                         $readmore_text = JText::_('COM_CONTENT_READ_MORE_TITLE');
                         if ($params->get('show_readmore_title', 0) == 1) {
                             $readmore_text = JText::_('COM_CONTENT_READ_MORE') . JHtml::_('string.truncate', $article->title, $params->get('readmore_limit'));
                         }
                     }
                 }
             }
             $tmpl->addVar('tpl_links', 'link-readmore', $readmore_link);
             $tmpl->addVar('tpl_links', 'link-readmore-text', $readmore_text);
             $tmpl->addVar('tpl_links', 'link-readmore-title', $article->title);
             $tmpl->addVar('tpl_links', 'link-readmore-class', $this->params->get('readmore_css_class', 'readmore-link'));
         }
         $commentsDisabled = false;
         if ($config->getInt('comments_off', 0) == 1) {
             $commentsDisabled = true;
         } else {
             if ($config->getInt('comments_on', 0) == 1) {
                 $commentsDisabled = false;
             }
         }
         $tmpl->addVar('tpl_links', 'comments_link_hidden', intval($commentsDisabled));
         $count = 0;
         // do not query comments count if comments disabled and link hidden
         if (!$commentsDisabled) {
             require_once JPATH_ROOT . '/components/com_jcomments/models/jcomments.php';
             $anchor = "";
             if ($this->params->get('comments_count', 1) != 0) {
                 $acl = JCommentsFactory::getACL();
                 $options = array();
                 $options['object_id'] = (int) $article->id;
                 $options['object_group'] = 'com_content';
                 $options['published'] = $acl->canPublish() || $acl->canPublishForObject($article->id, 'com_content') ? null : 1;
                 $count = JCommentsModel::getCommentsCount($options);
                 $tmpl->addVar('tpl_links', 'comments-count', $count);
                 $anchor = $count == 0 ? '#addcomments' : '#comments';
                 if ($count == 0) {
                     $link_text = JText::_('LINK_ADD_COMMENT');
                 } else {
                     $link_text = JText::plural('LINK_READ_COMMENTS', $count);
                 }
             } else {
                 $link_text = JText::_('LINK_ADD_COMMENT');
             }
             $tmpl->addVar('tpl_links', 'link-comment', $readmore_link . $anchor);
             $tmpl->addVar('tpl_links', 'link-comment-text', $link_text);
             $tmpl->addVar('tpl_links', 'link-comments-class', $this->params->get('comments_css_class', 'comments-link'));
         }
         JCommentsContentPluginHelper::clear($article, true);
         // hide comments link if comments enabled but link disabled in plugin params
         if (($this->params->get('comments_count', 1) == 0 || $count == 0 && $this->params->get('add_comments', 1) == 0 || $count == 0 && $readmore_register == 1) && !$commentsDisabled) {
             $tmpl->addVar('tpl_links', 'comments_link_hidden', 1);
         }
         //links_position
         if ($this->params->get('links_position', 1) == 1) {
             $article->text .= $tmpl->renderTemplate('tpl_links');
         } else {
             $article->text = $tmpl->renderTemplate('tpl_links') . $article->text;
         }
         $tmpl->freeTemplate('tpl_links');
         if ($this->params->get('readmore_link', 1) == 1) {
             $article->readmore = 0;
             $article->readmore_link = '';
             $article->readmore_register = false;
         }
     } else {
         if ($this->params->get('show_comments_event') == 'onPrepareContent') {
             $isEnabled = $config->getInt('comments_on', 0) == 1 && $config->getInt('comments_off', 0) == 0;
             if ($isEnabled && $view == 'article') {
                 require_once JPATH_ROOT . '/components/com_jcomments/jcomments.php';
                 $comments = JComments::show($article->id, 'com_content', $article->title);
                 if (strpos($article->text, '{jcomments}') !== false) {
                     $article->text = str_replace('{jcomments}', $comments, $article->text);
                 } else {
                     $article->text .= $comments;
                 }
             }
         }
         JCommentsContentPluginHelper::clear($article, true);
     }
     return '';
 }
Exemple #10
0
 /**
  * Returns message body
  *
  * @param array $data An associative array of notification data
  * @param object $subscriber An object with information about subscriber
  *
  * @return string
  */
 private static function getMessageBody($data, $subscriber)
 {
     switch ($data['notification-type']) {
         case 'moderate-new':
         case 'moderate-update':
             $templateName = 'tpl_email_administrator';
             break;
         case 'report':
             $templateName = 'tpl_email_report';
             break;
         case 'comment-new':
         case 'comment-reply':
         case 'comment-update':
         default:
             $templateName = 'tpl_email';
             break;
     }
     $tmpl = JCommentsFactory::getTemplate($data['comment']->object_id, $data['comment']->object_group);
     if ($tmpl->load($templateName)) {
         $config = JCommentsFactory::getConfig();
         foreach ($data as $key => $value) {
             if (is_scalar($value)) {
                 $tmpl->addVar($templateName, $key, $value);
             } else {
                 $tmpl->addObject($templateName, $key, $value);
             }
         }
         $tmpl->addVar($templateName, 'notification-unsubscribe-link', self::getUnsubscribeLink($subscriber->hash));
         $tmpl->addVar($templateName, 'comment-object_title', $data['object_title']);
         $tmpl->addVar($templateName, 'comment-object_link', $data['object_link']);
         if ($data['notification-type'] == 'report' || $data['notification-type'] == 'moderate-new' || $data['notification-type'] == 'moderate-update') {
             $tmpl->addVar($templateName, 'quick-moderation', $config->getInt('enable_quick_moderation'));
             $tmpl->addVar($templateName, 'enable-blacklist', $config->getInt('enable_blacklist'));
         }
         // backward compatibility only
         $tmpl->addVar($templateName, 'hash', $subscriber->hash);
         $tmpl->addVar($templateName, 'comment-isnew', $data['notification-type'] == 'new' ? 1 : 0);
         return $tmpl->renderTemplate($templateName);
     }
     return false;
 }
Exemple #11
0
 function onPrepareContent(&$article, &$params, $limitstart = 0)
 {
     require_once JCOMMENTS_HELPERS . DS . 'content.php';
     // check whether plugin has been unpublished
     if (!JPluginHelper::isEnabled('content', 'jcomments')) {
         JCommentsContentPluginHelper::clear($article, true);
         return;
     }
     $application =& JFactory::getApplication('site');
     $option = JRequest::getCmd('option');
     $view = JRequest::getCmd('view');
     if (!isset($article->id) || $option != 'com_content' && $option != 'com_alphacontent' && $option != 'com_customproperties') {
         return;
     }
     if (!isset($params) || $params == null) {
         $params = new JParameter('');
     } else {
         if (strpos($params->_raw, 'moduleclass_sfx') !== false) {
             return '';
         }
     }
     if ($view == 'frontpage') {
         if ($this->params->get('show_frontpage', 1) == 0) {
             return;
         }
     }
     require_once JCOMMENTS_BASE . DS . 'jcomments.config.php';
     require_once JCOMMENTS_BASE . DS . 'jcomments.class.php';
     JCommentsContentPluginHelper::processForeignTags($article);
     $config =& JCommentsFactory::getConfig();
     $categoryEnabled = JCommentsContentPluginHelper::checkCategory($article->catid);
     $commentsEnabled = JCommentsContentPluginHelper::isEnabled($article) || $categoryEnabled;
     $commentsDisabled = JCommentsContentPluginHelper::isDisabled($article) || !$commentsEnabled;
     $commentsLocked = JCommentsContentPluginHelper::isLocked($article);
     if ($article->state == -1 && $config->getInt('enable_for_archived') == 0) {
         $commentsLocked = true;
     }
     $config->set('comments_on', intval($commentsEnabled));
     $config->set('comments_off', intval($commentsDisabled));
     $config->set('comments_locked', intval($commentsLocked));
     if ($view != 'article') {
         $user =& JFactory::getUser();
         if ($article->access <= $user->get('aid', 0)) {
             $readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid));
             $readmore_register = 0;
         } else {
             $readmore_link = JRoute::_('index.php?option=com_user&task=register');
             $readmore_register = 1;
         }
         // load template for comments & readmore links
         $tmpl =& JCommentsFactory::getTemplate($article->id, 'com_content', false);
         $tmpl->load('tpl_links');
         $tmpl->addVar('tpl_links', 'comments_link_style', $readmore_register ? -1 : 1);
         $tmpl->addVar('tpl_links', 'content-item', $article);
         $tmpl->addVar('tpl_links', 'show_hits', intval($this->params->get('show_hits', 0) && $params->get('show_hits', 0)));
         $tmpl->addVar('tpl_links', 'link-comment', $readmore_link);
         $tmpl->addVar('tpl_links', 'link-comments-class', $this->params->get('comments_css_class', 'comments-link'));
         $readmoreDisabled = false;
         if ($params->get('show_readmore') == 0 || @$article->readmore == 0) {
             $readmoreDisabled = true;
         } else {
             if (@$article->readmore > 0) {
                 $readmoreDisabled = false;
             }
         }
         if ($this->params->get('readmore_link', 1) == 0) {
             $readmoreDisabled = true;
         }
         $tmpl->addVar('tpl_links', 'readmore_link_hidden', intval($readmoreDisabled));
         // don't fill any readmore variable if it disabled
         if (!$readmoreDisabled) {
             if ($readmore_register == 1) {
                 $readmore_text = JText::_('Register to read more...');
             } else {
                 if (isset($params) && ($readmore = $params->get('readmore'))) {
                     $readmore_text = $readmore;
                 } else {
                     $readmore_text = JText::_('Read more...');
                 }
             }
             $tmpl->addVar('tpl_links', 'link-readmore', $readmore_link);
             $tmpl->addVar('tpl_links', 'link-readmore-text', $readmore_text);
             $tmpl->addVar('tpl_links', 'link-readmore-title', $article->title);
             $tmpl->addVar('tpl_links', 'link-readmore-class', $this->params->get('readmore_css_class', 'readmore-link'));
         }
         $commentsDisabled = false;
         if ($config->getInt('comments_off', 0) == 1) {
             $commentsDisabled = true;
         } else {
             if ($config->getInt('comments_on', 0) == 1) {
                 $commentsDisabled = false;
             }
         }
         $tmpl->addVar('tpl_links', 'comments_link_hidden', intval($commentsDisabled));
         $count = 0;
         // do not query comments count if comments disabled and link hidden
         if (!$commentsDisabled && $this->params->get('comments_count', 1) != 0) {
             require_once JCOMMENTS_BASE . DS . 'model' . DS . 'jcomments.php';
             $count = JCommentsModel::getCommentsCount($article->id, 'com_content');
             $tmpl->addVar('tpl_links', 'comments-count', $count);
             if ($config->getInt('use_plural_forms', 0)) {
                 require_once JCOMMENTS_LIBRARIES . DS . 'joomlatune' . DS . 'language.tools.php';
                 $tmpl->addVar('tpl_links', 'use-plural-forms', $config->getInt('use_plural_forms', 0));
             }
         }
         JCommentsContentPluginHelper::clear($article, true);
         // hide comments link if comments enabled but link disabled in plugin params
         if (($this->params->get('comments_count', 1) == 0 || $count == 0 && $this->params->get('add_comments', 1) == 0 || $count == 0 && $readmore_register == 1) && !$commentsDisabled) {
             $tmpl->addVar('tpl_links', 'comments_link_hidden', 1);
         }
         //links_position
         if ($this->params->get('links_position', 1) == 1) {
             $article->text .= $tmpl->renderTemplate('tpl_links');
         } else {
             $article->text = $tmpl->renderTemplate('tpl_links') . $article->text;
         }
         $tmpl->freeTemplate('tpl_links');
         if ($this->params->get('readmore_link', 1) == 1) {
             $article->readmore = 0;
             if (isset($params)) {
                 $params->set('show_readmore', 0);
             }
             $article->readmore_link = '';
             $article->readmore_register = false;
         }
     } else {
         if ($this->params->get('show_comments_event') == 'onPrepareContent') {
             $isEnabled = $config->getInt('comments_on', 0) == 1 && $config->getInt('comments_off', 0) == 0;
             if ($isEnabled && $view == 'article') {
                 require_once JCOMMENTS_BASE . DS . 'jcomments.php';
                 $article->text .= JComments::show($article->id, 'com_content', $article->title);
             }
         } else {
             $user = JFactory::getUser();
             if ($user->usertype == 'Super Administrator') {
                 $application =& JFactory::getApplication('site');
                 $template = $application->getTemplate();
                 $articleTemplate = DS . 'templates' . DS . $template . DS . 'html' . DS . 'com_content' . DS . 'article' . DS . 'default.php';
                 if (is_file(JPATH_SITE . $articleTemplate)) {
                     $tmpl = implode('', file(JPATH_SITE . $articleTemplate));
                     if (strpos($tmpl, 'afterDisplayContent') === false) {
                         JError::raiseWarning(500, JText::sprintf('The article template (%s) doesn\'t have afterDisplayContent event!', $articleTemplate));
                     }
                 }
             }
         }
         JCommentsContentPluginHelper::clear($article, true);
     }
     return;
 }