private function renderAddComment(JournalEntry $oEntry = null)
 {
     if ($oEntry === null) {
         $oEntry = $this->oEntry;
     }
     if (!$oEntry->commentsEnabled()) {
         return null;
     }
     //Disabled comments at this point means moderated
     $oLeaveCommentTemplate = $this->constructTemplate(!$oEntry->getJournal()->getEnableComments() ? 'leave_comment_moderated' : 'leave_comment');
     // Display catcha if enabled and user is not authenticated
     if ($oEntry->getJournal()->getUseCaptcha() && !Session::getSession()->isAuthenticated()) {
         $oLeaveCommentTemplate->replaceIdentifier('captcha', FormFrontendModule::getRecaptchaCode('journal_comment'));
     } elseif (!Manager::isPost()) {
         if ($oUser = Session::user()) {
             $_REQUEST['comment_name'] = $oUser->getFullName();
             $_REQUEST['comment_email'] = $oUser->getEmail();
         }
     }
     $oLeaveCommentTemplate->replaceIdentifier('is_authenticated', Session::getSession()->isAuthenticated() ? true : null);
     $oLeaveCommentTemplate->replaceIdentifier('comment_action', LinkUtil::link($oEntry->getLink($this->oPage, 'add_comment')));
     return $oLeaveCommentTemplate;
 }
예제 #2
0
 protected function getFieldCode($iFormId)
 {
     return FormFrontendModule::getRecaptchaCode('form_frontend_module_' . $iFormId);
 }