/**
  * @see ExpressoLite\Backend\Request\LiteRequest::execute
  */
 public function execute($params)
 {
     $liteRequestProcessor = new LiteRequestProcessor();
     $message = $liteRequestProcessor->executeRequest('MoveMessages', (object) array('folder' => $params->folderId, 'messages' => $params->messageIds));
     $outMsg = count(explode(',', $params->messageIds)) > 1 ? count(explode(',', $params->messageIds)) . ' mensagens movidas para a pasta ' . $params->folderName . ' com sucesso.' : count(explode(',', $params->messageIds)) . ' mensagem movida para a pasta ' . $params->folderName . ' com sucesso.';
     Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => ShowFeedback::MSG_SUCCESS, 'message' => $outMsg, 'destinationText' => 'Voltar para ' . $params->currentFolderName, 'destinationUrl' => (object) array('action' => 'Mail.Main', 'params' => array('folderId' => $params->currentFolderId))));
 }
 /**
  * @see Accessible\Handler::execute
  */
 public function execute($params)
 {
     if (TineSessionRepository::getTineSession()->isLoggedIn()) {
         $liteRequestProcessor = new LiteRequestProcessor();
         $liteRequestProcessor->executeRequest('Logoff', (object) array());
     }
     Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => ShowFeedback::MSG_SUCCESS, 'message' => 'Saída realizada com sucesso.', 'destinationText' => 'Acessar a página de login', 'destinationUrl' => (object) array('action' => 'Login.Main')));
 }
 /**
  * @see Accessible\Handler::execute
  */
 public function execute($params)
 {
     $user = $params->user;
     $password = $params->pwd;
     $liteRequestProcessor = new LiteRequestProcessor();
     $response = $liteRequestProcessor->executeRequest('Login', (object) array('user' => $user, 'pwd' => $password));
     if ($response->success === true) {
         Dispatcher::processRequest('Mail.Main', $params);
     } else {
         Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => ShowFeedback::MSG_ERROR, 'message' => 'Login falhou! Usuário ou senha inválidos.', 'destinationText' => 'Voltar para página de login', 'destinationUrl' => (object) array('action' => 'Login.Main')));
     }
 }
 /**
  * @see Accessible\Handler::execute
  */
 public function execute($params)
 {
     if (!$this->hasAtLeastOneMessageChecked($params)) {
         $messageIds = '';
         $typeFeedbackMsg = ShowFeedback::MSG_ALERT;
     } else {
         $typeFeedbackMsg = ShowFeedback::MSG_CONFIRM;
         $messageIds = MessageIds::paramsToString($params);
     }
     $messageFeedback = $this->prepareConfirmMessageAction($params);
     Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => $typeFeedbackMsg, 'message' => $messageFeedback, 'destinationText' => 'Voltar para ' . $params->folderName, 'destinationUrl' => (object) array('action' => 'Mail.Main', 'params' => array('folderId' => $params->folderId, 'folderName' => $params->folderName, 'page' => $params->page)), 'buttons' => $this->prepareConfirmationButtons($messageIds, $params)));
 }
 /**
  * @see Accessible\Handler::execute
  */
 public function execute($params)
 {
     $liteRequestProcessor = new LiteRequestProcessor();
     $message = $liteRequestProcessor->executeRequest('setEventConfirmation', (object) array('id' => $params->idEvent, 'confirmation' => $params->confirmation));
     if (isset($message->eventId) && isset($message->confirmation)) {
         $outMsg = 'Confirmação de evento realizada com sucesso.';
         $feedbackType = ShowFeedback::MSG_SUCCESS;
     } else {
         $outMsg = 'Não foi possível realizar a confirmação do evento.';
         $feedbackType = ShowFeedback::MSG_SUCCESS;
     }
     Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => $feedbackType, 'message' => $outMsg, 'destinationText' => 'Voltar para o evento', 'destinationUrl' => (object) array('action' => 'Calendar.OpenEvent', 'params' => array('from' => $params->from, 'until' => $params->until, 'idEvent' => $params->idEvent, 'calendarId' => $params->calendarId, 'monthVal' => $params->month, 'yearVal' => $params->year))));
 }
 /**
  * @see Accessible\Handler::execute
  */
 public function execute($params)
 {
     $liteRequestProcessor = new LiteRequestProcessor();
     $response = $liteRequestProcessor->executeRequest('EmptyTrash', (object) array('trashId' => $params->folderId));
     if ($response->status) {
         $typeMsg = ShowFeedback::MSG_SUCCESS;
         $feedbackMsg = self::EMPTY_TRASH_SUCCESS;
     } else {
         $typeMsg = ShowFeedback::MSG_ERROR;
         $feedbackMsg = $response->message;
     }
     Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => $typeMsg, 'message' => $feedbackMsg, 'destinationText' => 'Voltar para ' . $params->folderName, 'destinationUrl' => (object) array('action' => 'Mail.Main', 'params' => array('folderId' => $params->folderId, 'page' => 1))));
 }
 public function execute($params)
 {
     $folders = TineSessionRepository::getTineSession()->getAttribute('folders');
     $isTrashFolder = FALSE;
     foreach ($folders as $fol) {
         if ($fol->id === $params->folderId) {
             $isTrashFolder = $fol->globalName === self::TRASH_FOLDER;
             break;
         }
     }
     $liteRequestProcessor = new LiteRequestProcessor();
     $message = $liteRequestProcessor->executeRequest('DeleteMessages', (object) array('messages' => $params->messageIds, 'forever' => $isTrashFolder ? '1' : '0'));
     $outMsg = $this->getFormattedFeedbackMsg($params->messageIds, $isTrashFolder);
     Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => ShowFeedback::MSG_SUCCESS, 'message' => $outMsg, 'destinationText' => 'Voltar para ' . $params->folderName, 'destinationUrl' => (object) array('action' => 'Mail.Main', 'params' => array('folderId' => $params->folderId))));
 }
 /**
  * @see Accessible\Handler::execute
  */
 public function execute($params)
 {
     $isParamsOkToOpenEvent = $this->validateParamsToOpenEvent($params);
     $event = $isParamsOkToOpenEvent ? $this->retrieveCalendarEvent($params) : null;
     if ($isParamsOkToOpenEvent && !is_null($event)) {
         $formtEvInfo = $this->formatEventInformation($event);
         $currentEmailUser = TineSessionRepository::getTineSession()->getAttribute('Expressomail.email');
         $eventHasNotOccurred = EventUtils::checkEventHasNotOccurred($event->from);
         $userAllowedToConfirm = EventUtils::isUserAllowedToConfirmEvent((object) array('currentEmailUser' => $currentEmailUser, 'attendees' => (object) $event->attendees));
         $this->showTemplate('OpenEventTemplate', (object) array('lnkBackToCalendar' => $this->makeUrl('Calendar.Main', array('month' => $params->monthVal, 'year' => $params->yearVal, 'calendarId' => $params->calendarId)), 'date' => $formtEvInfo->date, 'summary' => $formtEvInfo->summary, 'schedule' => $formtEvInfo->schedule, 'location' => $formtEvInfo->location, 'description' => $formtEvInfo->description, 'organizerName' => $formtEvInfo->organizerName, 'organizerOrgUnitRegion' => $formtEvInfo->organizerOrgUnitRegion, 'countAttendees' => count($formtEvInfo->attendees), 'attendeesInformation' => $this->formatAttendeesInformation($formtEvInfo->attendees), 'lnkAccepted' => $this->makeUrl('Calendar.EventConfirmation', array('idEvent' => $params->idEvent, 'confirmation' => EventUtils::EVENTS_CONFIRM_ACCEPTED, 'month' => $params->monthVal, 'year' => $params->yearVal, 'calendarId' => $params->calendarId, 'from' => $params->from, 'until' => $params->until)), 'lnkDeclined' => $this->makeUrl('Calendar.EventConfirmation', array('idEvent' => $params->idEvent, 'confirmation' => EventUtils::EVENTS_CONFIRM_DECLINED, 'month' => $params->monthVal, 'year' => $params->yearVal, 'calendarId' => $params->calendarId, 'from' => $params->from, 'until' => $params->until)), 'lnkTentative' => $this->makeUrl('Calendar.EventConfirmation', array('idEvent' => $params->idEvent, 'confirmation' => EventUtils::EVENTS_CONFIRM_TENTATIVE, 'month' => $params->monthVal, 'year' => $params->yearVal, 'calendarId' => $params->calendarId, 'from' => $params->from, 'until' => $params->until)), 'lnkNeedsAction' => $this->makeUrl('Calendar.EventConfirmation', array('idEvent' => $params->idEvent, 'confirmation' => EventUtils::EVENTS_CONFIRM_NEEDS_ACTION, 'month' => $params->monthVal, 'year' => $params->yearVal, 'calendarId' => $params->calendarId, 'from' => $params->from, 'until' => $params->until)), 'isUserAllowedToConfirm' => $eventHasNotOccurred && $userAllowedToConfirm));
     } else {
         // At this point something was not properly correct to open the event
         Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => ShowFeedback::MSG_ERROR, 'message' => 'Não foi possível acessar as informações desse evento!', 'destinationText' => 'Voltar para o calendário', 'destinationUrl' => (object) array('action' => 'Calendar.Main', 'params' => array('calendarId' => $params->calendarId, 'month' => $params->monthVal, 'year' => $params->yearVal))));
     }
 }
 /**
  * @see Accessible\Handler::execute
  */
 public function execute($params)
 {
     if ($params->messageIds === '') {
         // No message id was specified
         $typeMsg = ShowFeedback::MSG_ERROR;
         $outMsg = 'Não foi possível marcar mensagem como não lida';
     } else {
         $liteRequestProcessor = new LiteRequestProcessor();
         $message = $liteRequestProcessor->executeRequest('MarkAsRead', (object) array('ids' => $params->messageIds, 'asRead' => '0'));
         $typeMsg = ShowFeedback::MSG_SUCCESS;
         $msgCount = MessageIds::messageCount($params->messageIds);
         $outMsg = $msgCount == 1 ? '1 mensagem marcada como não lida com sucesso.' : "{$msgCount} mensagens marcadas como não lida com sucesso.";
     }
     Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => $typeMsg, 'message' => $outMsg, 'destinationText' => 'Voltar para ' . $params->folderName, 'destinationUrl' => (object) array('action' => 'Mail.Main', 'params' => array('folderId' => $params->folderId))));
 }
 /**
  * @see Accessible\Handler::execute
  */
 public function execute($params)
 {
     //check if the action can be executed
     if (!ConfirmMessageAction::isActionConfirmOk($params)) {
         // Message action will not be complete
         Dispatcher::processRequest('Mail.Main', $params);
         return;
     }
     // check wich action to be executed
     if ($params->actionProcess === self::ACTION_MARK_UNREAD) {
         Dispatcher::processRequest('Mail.MarkMessageAsUnread', $params);
     } else {
         // action does not exist
         Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => ShowFeedback::MSG_ERROR, 'message' => 'Ação requisitada não existe', 'destinationText' => 'Voltar para ' . $params->folderName, 'destinationUrl' => (object) array('action' => 'Mail.Main', 'params' => array('folderId' => $params->folderId, 'page' => $params->page))));
     }
 }
 /**
  * @see Accessible\Handler::execute
  */
 public function execute($params)
 {
     // Treat uploaded files, if any.
     $upFiles = array();
     foreach ($_FILES as $upf) {
         $processed = $this->uploadFile($upf);
         if ($processed !== null) {
             $upFiles[] = $processed;
         }
     }
     // Retrieve original message, if replying or forwarding.
     $lrp = new LiteRequestProcessor();
     if (!empty($params->replyToId) || !empty($params->forwardFromId)) {
         $msg = $lrp->executeRequest('GetMessage', (object) array('id' => !empty($params->replyToId) ? $params->replyToId : $params->forwardFromId));
     } else {
         $msg = null;
         // compose new mail, not reply/forward
     }
     $lrp->executeRequest('SaveMessage', (object) array('subject' => $params->subject, 'body' => $this->prepareMessageBody($params, $msg), 'to' => $params->addrTo, 'cc' => $params->addrCc, 'bcc' => $params->addrBcc, 'isImportant' => isset($params->important) ? '1' : '0', 'attachs' => empty($upFiles) && (!is_null($msg) && !$msg->has_attachment) ? '' : $this->formatAllAttachs($params, $msg, $upFiles), 'replyToId' => $params->replyToId, 'forwardFromId' => $params->forwardFromId, 'origDraftId' => ''));
     Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => ShowFeedback::MSG_SUCCESS, 'message' => 'Mensagem enviada com sucesso.', 'destinationText' => 'Voltar para ' . $params->folderName, 'destinationUrl' => (object) array('action' => 'Mail.Main', 'params' => array('folderId' => $params->folderId, 'page' => $params->page))));
 }
 /**
  * @see Accessible\Handler::execute
  */
 public function execute($params)
 {
     Dispatcher::processRequest('Core.ShowFeedback', (object) array('typeMsg' => ShowFeedback::MSG_CONFIRM, 'message' => self::EMPTY_TRASH_PROMPT_CONFIRMATION, 'destinationText' => 'Voltar para ' . $params->folderName, 'destinationUrl' => (object) array('action' => 'Mail.Main', 'params' => array('folderId' => $params->folderId, 'folderName' => $params->folderName, 'page' => 1)), 'buttons' => $this->prepareConfirmationButtons($params)));
 }
<?php

/**
 * Expresso Lite Accessible
 * Instantiates the dispatcher.
 *
 * @package   Lite
 * @license   http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author    Charles Wust <*****@*****.**>
 * @copyright Copyright (c) 2015 Serpro (http://www.serpro.gov.br)
 */
require_once dirname(__FILE__) . '/bootstrap.php';
use Accessible\Dispatcher;
Dispatcher::processRawHttpRequest($_REQUEST);