load(JRequest::getInt('commentID'));
if (!$row->published)
{
JError::raiseError(404, JText::_('K2_NOT_FOUND'));
}
$this->assignRef('row', $row);
$user = JFactory::getUser();
$this->assignRef('user', $user);
$params = &K2HelperUtilities::getParams('com_k2');
if (!$params->get('comments') || !$params->get('commentsReporting') || ($params->get('commentsReporting') == '2' && $user->guest))
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
// Pass the old parameter to the view in order to avoid layout changes
if ($params->get('antispam') == 'recaptcha' || $params->get('antispam') == 'both')
{
$params->set('recaptcha', true);
}
else
{
$params->set('recaptcha', false);
}
$this->assignRef('params', $params);
if ($params->get('recaptcha') && $user->guest)
{
$document = JFactory::getDocument();
$document->addScript('https://www.google.com/recaptcha/api/js/recaptcha_ajax.js');
$js = '
function showRecaptcha(){
Recaptcha.create("'.$params->get('recaptcha_public_key').'", "recaptcha", {
theme: "'.$params->get('recaptcha_theme', 'clean').'"
});
}
$K2(window).load(function() {
showRecaptcha();
});
';
$document->addScriptDeclaration($js);
}
parent::display($tpl);
}
}