Example #1
0
 function _loadMessageHeadersByIndexs($messageIndexSet, &$folder)
 {
     $messageCollection = new WebMailMessageCollection();
     foreach ($messageIndexSet as $idx) {
         $uid = $this->_pop3Mail->uidl($idx);
         $uid = isset($uid[$idx]) ? $uid[$idx] : '';
         $size = $this->_pop3Mail->msglist($idx);
         $size = isset($size[$idx]) ? $size[$idx] : '';
         $response = $this->_pop3Mail->get_top($idx);
         if ($response) {
             $msg = new WebMailMessage();
             $msg->LoadMessageFromRawBody($response);
             $msg->IdMsg = $idx;
             $msg->Uid = $uid;
             $msg->Size = $size;
             $msg->IdFolder = $folder->IdDb;
             if ($folder->SyncType == FOLDERSYNC_DirectMode) {
                 $msg->Flags |= MESSAGEFLAGS_Seen;
             }
             $messageCollection->AddCopy($msg);
             unset($msg);
         }
     }
     if ($messageCollection->Count() > 0) {
         return $messageCollection;
     }
     $messageCollection = null;
     return $messageCollection;
 }
Example #2
0
 /**
  * @param WebMailMessageCollection $messages
  * @param Folder $folder
  * @return bool
  */
 function SaveMessages(&$messages, &$folder)
 {
     $result = true;
     for ($i = 0, $count = $messages->Count(); $i < $count; $i++) {
         $mess =& $messages->Get($i);
         if ($mess) {
             $result &= $this->SaveMessage($mess, $folder);
         } else {
             $result = false;
         }
     }
     return $result;
 }
    /**
     * @return string
     */
    function MessageListTr()
    {
        $out = '';
        if (!$this->messageCollection) {
            return '';
        }
        $c = $this->messageCollection->Count();
        $stylewidth = array(array('', ' style="width: 21px; text-align: center;"'), array('', ' style="width: 20px;"'), array('', ' style="width: 20px;"'), array('', ' style="width: 150px;"'), array('', ' style="width: 140px;"'), array('', ' style="width: 48px;"'), array('', ' style="width: 148px;"'));
        $atemp_1 = $atemp_2 = '';
        if ($this->_proc->account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE || $this->_proc->account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) {
            $atemp_1 = '<a href="#">';
            $atemp_2 = '</a>';
        }
        for ($i = 0; $i < $c; $i++) {
            $msg =& $this->messageCollection->Get($i);
            if (!$msg) {
                continue;
            }
            $isRead = ($msg->Flags & MESSAGEFLAGS_Seen) == MESSAGEFLAGS_Seen ? 'true' : 'false';
            $flaggedImg = '';
            $handclass = $this->_proc->account->MailProtocol != MAILPROTOCOL_IMAP4 && $this->_proc->currentFolder && $this->_proc->currentFolder->SyncType == FOLDERSYNC_DirectMode ? '' : 'wm_control';
            if (($msg->Flags & MESSAGEFLAGS_Flagged) == MESSAGEFLAGS_Flagged) {
                $isFlagged = 'true';
                $flaggedImg = '<img class="' . $handclass . '" src="skins/' . $this->_pagebuilder->SkinName() . '/menu/flag.gif" />';
            } else {
                $isFlagged = 'false';
                $flaggedImg = '<img class="' . $handclass . '" src="skins/' . $this->_pagebuilder->SkinName() . '/menu/unflag.gif" />';
            }
            if ($msg->IdFolder == -1 && $this->folder && $this->folder->SyncType == FOLDERSYNC_DirectMode) {
                $msg->IdFolder = $this->folder->IdDb;
            }
            $isForwarded = ($msg->Flags & MESSAGEFLAGS_Forwarded) == MESSAGEFLAGS_Forwarded ? 'true' : 'false';
            $isDeleted = ($msg->Flags & MESSAGEFLAGS_Deleted) == MESSAGEFLAGS_Deleted ? 'true' : 'false';
            $isGrey = ($msg->Flags & MESSAGEFLAGS_Grayed) == MESSAGEFLAGS_Grayed ? 'true' : 'false';
            $isReplied = 'false';
            $date =& $msg->GetDate();
            $date->FormatString = $this->_proc->account->DefaultDateFormat;
            $date->TimeFormat = $this->_proc->account->DefaultTimeFormat;
            $sep = '-----';
            $char = $msg->Charset > -1 ? ConvertUtils::GetCodePageName($msg->Charset) : -1;
            $idString = $msg->IdMsg . $sep . $msg->Uid . $sep . $msg->IdFolder . $sep . $char . $sep;
            $folderName = $this->folder ? $this->folder->FullName : '';
            $this->_pagebuilder->AddInitText('messObj = {Read: ' . $isRead . ', Replied: ' . $isReplied . ', Forwarded: ' . $isForwarded . ', Flagged: ' . $isFlagged . ', Deleted: ' . $isDeleted . ', Gray: ' . $isGrey . ', Id: ' . (int) $msg->IdMsg . ', Uid: "' . ConvertUtils::ClearJavaScriptString($msg->Uid, '"') . '", FolderId: ' . $msg->IdFolder . ', FolderFullName: "' . ConvertUtils::ClearJavaScriptString($folderName, '"') . '", FromAddr: "", Subject: ""}');
            $this->_pagebuilder->AddInitText('InboxLines.AddLine(new CSelectionPart(document.getElementById("' . ConvertUtils::ClearJavaScriptString($idString, '"') . '"), "' . $this->_pagebuilder->SkinName() . '" , messObj));');
            $from = ConvertUtils::WMHtmlSpecialChars($msg->GetFromAsStringForSend());
            $to = ConvertUtils::WMHtmlSpecialChars($msg->GetAllRecipientsEmailsAsString(true));
            $subject = ConvertUtils::WMHtmlSpecialChars($msg->GetSubject(true));
            if (isset($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) && strlen($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) > 0) {
                $from = preg_replace('/' . preg_quote($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) . '/i', '<font>$0</font>', $from);
                $to = preg_replace('/' . preg_quote($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) . '/i', '<font>$0</font>', $to);
                $subject = preg_replace('/' . preg_quote($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) . '/i', '<font>$0</font>', $subject);
            }
            $subjectId = $i == 0 ? 'id="subject"' : '';
            $out .= '
			<tr onclick="CheckThisLine(event, this);" ondblclick="CheckThisLineDb(event, this);" id="' . ConvertUtils::AttributeQuote($idString) . '">
			<td' . $stylewidth[0][(int) ($i == 0)] . ' id="none"><input type="checkbox" /></td>
			<td' . $stylewidth[1][(int) ($i == 0)] . '>';
            $out .= (int) $msg->HasAttachments() == 1 ? '<img src="skins/' . $this->_pagebuilder->SkinName() . '/menu/attachment.gif" />' : '';
            $out .= '</td><td' . $stylewidth[2][(int) ($i == 0)] . '>' . $flaggedImg;
            $tempFromTo = $this->folder && $this->folder->ToFolder ? $to : $from;
            $out .= '</td><td' . $stylewidth[3][(int) ($i == 0)] . ' class="wm_inbox_from_subject"><nobr>' . $atemp_1 . $tempFromTo . $atemp_2 . '</nobr></td>
			<td' . $stylewidth[4][(int) ($i == 0)] . '><nobr>' . $date->GetFormattedDate($this->_proc->account->GetDefaultTimeOffset()) . '</nobr></td><td' . $stylewidth[5][(int) ($i == 0)] . '><nobr>' . GetFriendlySize($msg->Size) . '</nobr></td>
			<td' . $stylewidth[6][(int) ($i == 0)] . ' class="wm_inbox_from_subject" ' . $subjectId . '><nobr>' . $atemp_1 . $subject . $atemp_2 . '</nobr></td>
			</tr>';
        }
        if (isset($this->_proc->sArray[SEARCH_ARRAY]) && isset($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) && strlen($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) > 0 && $c == 0) {
            $out = '<tr><td colspan="6" style="width: 404px;"></td>';
            $out .= '<td style="width: 150px;" id="subject"></td></tr>
				<tr><td colspan="7"><div class="wm_inbox_info_message">' . InfoNoMessagesFound . '</div></td></tr>
				';
        } else {
            if ($c == 0) {
                $out = '<tr><td colspan="6" style="width: 404px;"></td>';
                $out .= '<td style="width: 150px;" id="subject"></td></tr>
				<tr><td colspan="7"><div class="wm_inbox_info_message">' . JS_LANG_InfoEmptyFolder . '</div></td></tr>
				';
            }
        }
        return $out;
    }
 /**
  * @param WebMailMessageCollection $messages
  * @param Folder $folder
  * @return bool
  */
 function SaveMessages(&$messages, &$folder)
 {
     $result = true;
     for ($i = 0; $i < $messages->Count(); $i++) {
         $result &= $this->SaveMessage($messages->Get($i), $folder);
     }
     return $result;
 }