private function generateCommentsHTML() { $comments = $this->article->getComments(); $this->commentHTML = ""; if (getStyle()->doCommentHTML()) { try { $this->commentHTML = getStyle()->getCommentsHTML($comments); } catch (Exception $e) { $msgbox = new MessageBox("The style didn't generate the HTML code for the comments, therefore the default generator was used. <br /><br />To hide this message open <br />" . getStyle()->getStylePath() . "info.xml<br /> and set <strong>own_comment_html</strong> to <strong>false</strong>."); $msgbox->bindException($e); getDisplay()->addObject($msgbox); foreach ($comments as $comment) { $this->commentHTML .= $comment->toHTML(); } } } else { foreach ($comments as $comment) { $this->commentHTML .= $comment->toHTML(); } } $LCID = 0; if (count($comments) != 0) { $LCID = $comments[0]->getID(); } $ajaxPC = new CommentPoster($this->article->getID()); $ajaxPC->start(); $ajaxLC = new CommentLoader($this->article->getID(), $LCID, count($comments)); $ajaxLC->start(); }
/** * Handle saving a post if all the data is specified and the * captcha is completed successfully * */ public function doPost() { $req = $this->getRequest(); $commentWasPosted = $this->poster->post($req); if ($commentWasPosted) { $this->getSession()->flash('commentSaved', true); $this->emailer->sendCommentEmails($req); } $this->redirect($_SERVER['HTTP_REFERER'] . '#comments'); }