/** * Show a conversation */ public function showAction() { $request = $this->getRequest(); $id = $request->getParam('id'); $lang = $this->lang; /* First check wheter the user should be looking here */ $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { /* Information for the view */ $this->view->me = $me = $auth->getIdentity()->id; $this->view->my_name = $auth->getIdentity()->username; /* Grab thread from database */ $m_message = new Model_Message(); $thread = $m_message->getThreadFromId($id); /* Check if user is allowed to see the conversation */ if ($thread->user_to != $me && $thread->user_from != $me || $thread->user_to == $me && $thread->deleted_to || $thread->user_from == $me && $thread->deleted_from) { $this->_helper->_flashMessenger->addMessage($this->view->translate('You are not allowed to view this page')); $this->_redirect('/' . $lang . '/woeid/' . $this->location . '/give'); } /* Grab the whole conversation from database */ $this->view->thread = $m_message->getMessagesFromThread($id); if (!$this->view->thread) { $this->_helper->_flashMessenger->addMessage($this->view->translate('This thread does not exist!')); $this->_redirect('/' . $lang . '/woeid/' . $this->location . '/give'); } /* Mark conversation as read */ $m_message = new Model_Message(); $m_message->markAsRead($id, $me); $reply_to = $me == $thread->user_to ? $thread->user_from : $thread->user_to; $this->view->subject = $thread->subject; $this->view->page_title .= $thread->subject; $f_message_reply = new Form_MessageReply(); $f_message_reply->setAction('/' . $lang . '/message/reply/' . $id . '/to/' . $reply_to); $this->view->createreply = $f_message_reply; } }