Exemple #1
0
 /**
  * @param int $pageNumber
  * @param string $condition
  * @param FolderCollection $folders
  * @param bool $inHeadersOnly
  * @return WebMailMessageCollection
  */
 function &SearchMessages($pageNumber, $condition, &$folders, $inHeadersOnly)
 {
     $mailCollection = null;
     if ($this->_dbConnection->Execute($this->_commandCreator->SearchMessages($pageNumber, $condition, $folders->CreateFolderListFromTree(), $inHeadersOnly, $this->Account))) {
         $mailCollection = new WebMailMessageCollection();
         while (false !== ($row = $this->_dbConnection->GetNextRecord())) {
             $msg =& $this->_rowToWebMailMessage($row);
             $mailCollection->Add($msg);
             unset($msg);
         }
     }
     return $mailCollection;
 }
 /**
  * @param int $pageNumber
  * @param string $condition
  * @param FolderCollection $folders
  * @param bool $inHeadersOnly
  * @return WebMailMessageCollection
  */
 function &SearchMessages($pageNumber, $condition, &$folders, $inHeadersOnly, $countMessages = 0)
 {
     $mailCollection = null;
     if ($this->_dbConnection->Execute($this->_commandCreator->SearchMessages($pageNumber, $condition, $folders->CreateFolderListFromTree(), $inHeadersOnly, $this->Account))) {
         $mailCollection =& new WebMailMessageCollection();
         while ($row = $this->_dbConnection->GetNextRecord()) {
             $msg =& new WebMailMessage();
             $msg->SetFromAsString($row->from_msg);
             $msg->SetToAsString($row->to_msg);
             $msg->SetCcAsString($row->cc_msg);
             $msg->SetBccAsString($row->bcc_msg);
             $date =& new CDateTime();
             $date->SetFromANSI($row->nmsg_date);
             $msg->SetDate($date);
             $msg->SetSubject($row->subject);
             $msg->IdMsg = $row->id_msg;
             $msg->IdFolder = $row->id_folder_db;
             $msg->Uid = $row->uid;
             $msg->Size = $row->size;
             $msg->DbPriority = $row->priority;
             $msg->DbXSpam = (bool) abs($row->x_spam);
             $msg->DbHasAttachments = $row->attachments;
             $msg->Flags = 0;
             if ($row->seen) {
                 $msg->Flags |= MESSAGEFLAGS_Seen;
             }
             if ($row->flagged) {
                 $msg->Flags |= MESSAGEFLAGS_Flagged;
             }
             if ($row->deleted) {
                 $msg->Flags |= MESSAGEFLAGS_Deleted;
             }
             if ($row->replied) {
                 $msg->Flags |= MESSAGEFLAGS_Answered;
             }
             if ($row->forwarded) {
                 $msg->Flags |= MESSAGEFLAGS_Forwarded;
             }
             if ($row->grayed) {
                 $msg->Flags |= MESSAGEFLAGS_Grayed;
             }
             $mailCollection->Add($msg);
         }
     }
     return $mailCollection;
 }