/**
  * @see Accessible\Handler::execute
  */
 public function execute($params)
 {
     $liteRequestProcessor = new LiteRequestProcessor();
     $message = $liteRequestProcessor->executeRequest('GetMessage', (object) array('id' => $params->messageId));
     $markAsRead = $liteRequestProcessor->executeRequest('MarkAsRead', (object) array('ids' => $params->messageId, 'asRead' => '1'));
     if ($message->subject == '') {
         $message->subject = '(sem assunto)';
     }
     $attachments = $this->formatAttachments($message->attachments, $params->messageId);
     $this->showTemplate('OpenMessageTemplate', (object) array('folderName' => $params->folderName, 'message' => $message, 'bodyMessage' => MessageUtils::getSanitizedBodyContent($message->body->message), 'quotedMessage' => MessageUtils::getSanitizedBodyContent($message->body->quoted), 'formattedDate' => DateUtils::getFormattedDate(strtotime($message->received), true), 'page' => $params->page, 'lnkBack' => $this->makeUrl('Mail.Main', array('folderId' => $params->folderId, 'page' => $params->page)), 'lnkDelete' => $this->makeUrl('Mail.DeleteMessage', array('folderName' => $params->folderName, 'messageIds' => $params->messageId, 'folderId' => $params->folderId)), 'lnkMark' => $this->makeUrl('Mail.MarkMessageAsUnread', array('folderName' => $params->folderName, 'messageIds' => $params->messageId, 'folderId' => $params->folderId)), 'lnkReply' => $this->makeUrl('Mail.ComposeMessage', array('folderId' => $params->folderId, 'folderName' => $params->folderName, 'page' => $params->page, 'messageId' => $params->messageId, 'reply' => 'yes', 'attachments' => urlencode(json_encode($attachments)))), 'lnkReplyAll' => $this->makeUrl('Mail.ComposeMessage', array('folderId' => $params->folderId, 'folderName' => $params->folderName, 'page' => $params->page, 'messageId' => $params->messageId, 'replyAll' => 'yes', 'attachments' => urlencode(json_encode($attachments)))), 'lnkForward' => $this->makeUrl('Mail.ComposeMessage', array('folderId' => $params->folderId, 'folderName' => $params->folderName, 'page' => $params->page, 'messageId' => $params->messageId, 'forward' => 'yes', 'attachments' => urlencode(json_encode($attachments)))), 'attachmentsForExhibition' => $attachments, 'lnkMoveMsgToFolder' => $this->makeUrl('Mail.OpenFolder', array('folderId' => $params->folderId, 'folderName' => $params->folderName, 'page' => $params->page, 'messageIds' => $params->messageId, 'isMsgBeingMoved' => true))));
 }
 /**
  * Formats replied/forwarded message body texts.
  *
  * @param  stdClass $params Request parameters.
  * @param  stdClass $msg    Message object, if replied or forwarded.
  * @return string           Formatted body text.
  */
 private function prepareQuotedMessage($params, $msg = null)
 {
     if (is_null($msg)) {
         return '';
     }
     $formatedDate = date('d/m/Y H:i', strtotime($msg->received));
     $bodyMessage = MessageUtils::getSanitizedBodyContent($msg->body->message);
     $quotedMessage = MessageUtils::getSanitizedBodyContent($msg->body->quoted);
     if ((isset($params->reply) || isset($params->replyAll)) && $msg !== null) {
         return '<br />Em ' . $formatedDate . ', ' . $msg->from_name . ' escreveu:' . '<blockquote>' . $bodyMessage . '<br />' . $quotedMessage . '</blockquote>';
     } else {
         if (isset($params->forward) && $msg !== null) {
             return '<br />-----Mensagem original-----<br />' . '<b>Assunto:</b> ' . $msg->subject . '<br />' . '<b>Remetente:</b> "' . $msg->from_name . '" &lt;' . $msg->from_email . '&gt;<br />' . '<b>Para:</b> ' . implode(', ', $msg->to) . '<br />' . (!empty($msg->cc) ? '<b>Cc:</b> ' . implode(', ', $msg->cc) . '<br />' : '') . '<b>Data:</b> ' . $formatedDate . '<br /><br />' . $bodyMessage . '<br />' . $quotedMessage;
         }
     }
     return '';
 }