Esempio n. 1
0
 function HeadersFullImapSearchMessages($pageNumber, $condition, $folder, &$refMsgCount)
 {
     $webMailMessageCollection = null;
     if ($this->_account->MailProtocol == MAILPROTOCOL_IMAP4 && ($folder->SyncType == FOLDERSYNC_AllHeadersOnly || $folder->SyncType == FOLDERSYNC_NewHeadersOnly)) {
         ConvertUtils::SetLimits();
         if ($this->MailStorage->Connect()) {
             $imapUids = $this->MailStorage->HeadersBodyImapSearchMessagesUids($folder, $condition);
             if ($imapUids !== false) {
                 if (count($imapUids) > 0) {
                     if (USE_DB && $this->DbStorage->Connect()) {
                         $dbUids = $this->DbStorage->SearchMessagesUids($condition, $folder);
                         if ($dbUids !== false) {
                             if (count($dbUids) > 0) {
                                 $resultUids = array_intersect($dbUids, $imapUids);
                                 $refMsgCount = count($resultUids);
                                 $start = ($pageNumber - 1) * $this->_account->MailsPerPage;
                                 $messageUidSet = array_slice($resultUids, $start, $this->_account->MailsPerPage);
                                 $webMailMessageCollection =& $this->DbStorage->LoadMessageHeadersByIntUids($messageUidSet, $folder);
                                 $webMailMessageCollection->SetAllMessageFolderId($folder->IdDb);
                             } else {
                                 $webMailMessageCollection = new WebMailMessageCollection();
                             }
                         }
                     }
                 } else {
                     $webMailMessageCollection = new WebMailMessageCollection();
                 }
                 //$GLOBALS[MailDefaultCharset] = $this->_account->GetDefaultIncCharset();
                 //$GLOBALS[MailOutputCharset] = $this->_account->GetUserCharset();
                 //$webMailMessageCollection =& $this->MailStorage->DmImapSearchMessages($pageNumber, $folder, $condition, $inHeadersOnly, $refMsgCount);
             }
         }
     }
     return $webMailMessageCollection;
 }