コード例 #1
0
 function perform()
 {
     // try to load the message
     $messageId = $this->_request->getValue("messageId");
     $mailMessages = new MailMessages();
     $message = $mailMessages->getMessage($messageId);
     if (!$message) {
         // if something went wrong loading the message, quit
         $view = new MailCentreMessageListView($this->_blogInfo);
         $view->setErrorMessage($this->_locale->tr("mailcentre_incorrect_message_id"));
         $this->setValidationErrorView($view);
         $this->setCommonData();
         return false;
     }
     // pass the data to the template if everything's ok
     $this->_view = new MailCentreSendMessageView($this->_blogInfo, false);
     $this->_view->setValue("messageRecipient", $message->getTo());
     $this->_view->setValue("messageBcc", $message->getBcc());
     $this->_view->setValue("messageCc", $message->getCc());
     $this->_view->setValue("messageText", $message->getText());
     $this->_view->setValue("messageSubject", $message->getSubject());
     $this->_view->setValue("messageSentDate", $message->getSentTimestamp());
     $this->setCommonData();
     return true;
 }
 /**
  * deletes comments
  * @private
  */
 function _deleteMessages()
 {
     $messages = new MailMessages();
     $errorMessage = "";
     $successMessage = "";
     $totalOk = 0;
     // loop through the messages and remove them
     foreach ($this->_messageIds as $messageId) {
         $message = $messages->getMessage($messageId);
         if (!$message) {
             $errorMessage .= $this->_locale->pr("mailcentre_error_deleting_message2", $messageId);
         } else {
             if (!$messages->deleteMessage($messageId)) {
                 $errorMessage .= $this->_locale->pr("mailcentre_error_deleting_message", $message->getSubject()) . "<br/>";
             } else {
                 $totalOk++;
                 if ($totalOk < 2) {
                     $successMessage .= $this->_locale->pr("mailcentre_message_deleted_ok", $message->getSubject()) . "<br/>";
                 } else {
                     $successMessage = $this->_locale->pr("mailcentre_messages_deleted_ok", $totalOk);
                 }
             }
         }
     }
     // if everything fine, then display the same view again with the feedback
     $this->_view = new MailCentreMessageListView($this->_blogInfo);
     if ($successMessage != "") {
         $this->_view->setSuccessMessage($successMessage);
     }
     if ($errorMessage != "") {
         $this->_view->setErrorMessage($errorMessage);
     }
     $this->setCommonData();
     // better to return true if everything fine
     return true;
 }