/** * Gets document comments. */ public function executeComment() { $timer = new sfTimer('executeComment'); $id = $this->getRequestParameter('id'); $lang = $this->getRequestParameter('lang'); // one cannot comment a document which does not exist. if (!($document = DocumentI18n::findName($id, $lang, $this->model_class))) { c2cActions::statsdTiming('document.executeComment.redirect', $timer->getElapsedTime('executeComment')); $this->setNotFoundAndRedirect(); } // redirect to true document module if $model_class == Document if ($this->model_class == 'Document') { $document = Document::find('Document', $id, array('module')); c2cActions::statsdTiming('document.executeComment.redirect', $timer->getElapsedTime('executeComment')); $this->redirect('@document_comment?module=' . $document->get('module') . "&id={$id}&lang={$lang}", 301); } $this->document_name = $document->get('name'); $this->search_name = $document->get('search_name'); $this->comments = PunbbComm::retrieveComments($id . '_' . $lang); // mark topic as read if user connected if ($this->getUser()->isConnected()) { $row = $this->comments->getLast(); $topic_id = $row->get('topic_id'); $last_post_time = $row->get('posted'); Punbb::MarkTopicAsRead($topic_id, $last_post_time); } $this->exists_in_lang = 1; $this->setTemplate('../../documents/templates/comment'); $this->setPageTitle($this->document_name . ' :: ' . $this->__('Comments')); $this->getResponse()->addMeta('robots', 'index, follow'); c2cActions::statsdTiming('document.executeComment', $timer->getElapsedTime('executeComment')); }