/** * Process a submitted post. */ public function submitFormAction() { // STAGE 3: Choose, create, and optionally update models using business logic. $topicId = $this->getTopicId(); require_once 'Zend/Filter/StripTags.php'; $filter = new Zend_Filter_StripTags(); // only permit digits using ctype_digit() $subject = $filter->filter($_POST['subject']); $body = $filter->filter($_POST['body']); ZFDemoModel_Posts::submit(ZFModule_Forum::getAuthorizationId(), $topicId, $subject, $body); // STAGE 4: Apply business logic to create a presentation model for the view. // STAGE 5: Choose view and submit presentation model to view. $this->setRedirectCode(303); // PRG pattern via http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html $this->_redirect("/forum/index/index/topic/{$topicId}"); }