function showComment($id) { $response =& JCommentsFactory::getAjaxResponse(); $acl =& JCommentsFactory::getACL(); $db =& JCommentsFactory::getDBO(); $config =& JCommentsFactory::getConfig(); $comment = new JCommentsDB($db); if ($comment->load((int) $id) && ($acl->canPublish() || $comment->published)) { if ($config->get('template_view') == 'tree') { $page = 0; } else { $page = JComments::getCommentPage($comment->object_id, $comment->object_group, $comment->id); } JCommentsAJAX::updateCommentsList($response, $comment->object_id, $comment->object_group, $page); $response->addScript("jcomments.scrollToComment('{$id}');"); } else { $response->addAlert(JText::_('ERROR_NOT_FOUND')); } unset($comment); return $response; }
public static function showComment($id) { $response = JCommentsFactory::getAjaxResponse(); $acl = JCommentsFactory::getACL(); $config = JCommentsFactory::getConfig(); $comment = JTable::getInstance('Comment', 'JCommentsTable'); if ($comment->load((int) $id) && ($acl->canPublish($comment) || $comment->published)) { if ($config->get('template_view') == 'tree') { $page = 0; } else { $page = JComments::getCommentPage($comment->object_id, $comment->object_group, $comment->id); } self::updateCommentsList($response, $comment->object_id, $comment->object_group, $page); $response->addScript("jcomments.scrollToComment('{$id}');"); } else { $response->addAlert(JText::_('ERROR_NOT_FOUND')); } return $response; }