/** * @param int $messageId * @param string $messageUid * @param Folder $folder * @return WebMailMessage */ function &GetMessage($messageId, $messageUid, &$folder, $mode = null, $_onlyDownloaded = false) { $mailMess = null; $GLOBALS[MailDefaultCharset] = $this->_account->GetDefaultIncCharset(); $GLOBALS[MailOutputCharset] = $this->_account->GetUserCharset(); ConvertUtils::SetLimits(); if ($folder->SyncType == FOLDERSYNC_DirectMode && !$_onlyDownloaded) { if ($this->MailStorage->Connect()) { $mailMess =& $this->MailStorage->LoadMessage($messageUid, true, $folder, $mode); } } else { if (USE_DB && $this->DbStorage->Connect()) { $messageIndexSet = array($messageId); $_preData = $this->DbStorage->PreLoadMessagesFromDB($messageIndexSet, false, $folder); $_firstArr = null; if (count($_preData) > 0) { foreach ($_preData as $_arr) { $_firstArr = $_arr; break; } if (isset($_firstArr[3]) && $_firstArr[3] == 1) { $mailMess =& $this->DbStorage->LoadMessage($messageId, false, $folder, $_preData); } else { if (!$_onlyDownloaded && $this->MailStorage->Connect()) { $mailMess =& $this->MailStorage->LoadMessage($messageUid, true, $folder, $mode); if ($mailMess && isset($_preData[$messageId]) && count($_preData[$messageId]) > 2) { $mailMess->DbPriority = $_preData[$messageId][1]; $mailMess->Flags = $_preData[$messageId][2]; } } } } } } if ($mailMess) { $mailMess->IdMsg = $messageId; $mailMess->Uid = $messageUid; $mailMess->IdFolder = $folder->IdDb; } else { setGlobalError(PROC_MSG_HAS_DELETED); } return $mailMess; }