コード例 #1
0
 /**
  * @param WebMailMessage $message
  * @return short
  */
 function GetActionToApply(&$message)
 {
     switch ($this->Field) {
         case FILTERFIELD_From:
             $field = $message->GetFromAsString();
             break;
         case FILTERFIELD_To:
             $field = $message->GetToAsString();
             break;
         case FILTERFIELD_Subject:
             $field = $message->GetSubject();
             break;
         default:
             $field = null;
     }
     if ($field != null) {
         return $this->_processMessage($field);
     }
     return -1;
 }
コード例 #2
0
    /**
     * @param WebMailMessage $message
     * @param Folder $folder
     * @param bool $downloaded
     * @param Account $account
     * @return string
     */
    function SaveMessageHeader(&$message, &$folder, $downloaded, &$account)
    {
        //save message header
        $sql = 'INSERT INTO %sawm_messages (id_msg, id_acct, id_folder_srv, id_folder_db,
								%s, from_msg, to_msg, cc_msg, bcc_msg, subject,
								msg_date, attachments, size, downloaded, x_spam,
								seen, flagged, deleted, replied, grayed, flags, priority, body_text)
					VALUES (%d, %d,	%d, %d, %s, %s, %s, %s, %s, %s, %s, %d, %d, %d,	%d, %d, %d, %d, %d, %d, %d, %d, %s)';
        $date =& $message->GetDate();
        $from =& new I18nString($message->GetFromAsString(), $account->DbCharset);
        $to =& new I18nString($message->GetToAsString(), $account->DbCharset);
        $cc =& new I18nString($message->GetCcAsString(), $account->DbCharset);
        $bcc =& new I18nString($message->GetBccAsString(), $account->DbCharset);
        $subject =& new I18nString($message->GetSubject(), $account->DbCharset);
        $uid = $account->MailProtocol == MAILPROTOCOL_IMAP4 ? (int) $message->Uid : $this->_escapeString($message->Uid);
        return sprintf($sql, $this->_settings->DbPrefix, $this->_getMsgIdUidFieldName(true, $account->MailProtocol), $message->IdMsg, $account->Id, $folder->IdDb, $folder->IdDb, $uid, $this->_escapeString($from->Truncate(255)), $this->_escapeString($to->Truncate(255)), $this->_escapeString($cc->Truncate(255)), $this->_escapeString($bcc->Truncate(255)), $this->_escapeString($subject->Truncate(255)), $this->_escapeString($date->ToANSI()), $this->Bool2Bool((int) $message->HasAttachments()), (int) $message->GetMailSize(), $this->Bool2Bool((int) $downloaded), $this->Bool2Bool((int) $message->GetXSpamStatus()), (int) (($message->Flags & MESSAGEFLAGS_Seen) == MESSAGEFLAGS_Seen), (int) (($message->Flags & MESSAGEFLAGS_Flagged) == MESSAGEFLAGS_Flagged), (int) (($message->Flags & MESSAGEFLAGS_Deleted) == MESSAGEFLAGS_Deleted), (int) (($message->Flags & MESSAGEFLAGS_Answered) == MESSAGEFLAGS_Answered), (int) (($message->Flags & MESSAGEFLAGS_Grayed) == MESSAGEFLAGS_Grayed), $message->Flags, $message->GetPriorityStatus(), $this->_escapeString(ConvertUtils::mainClear(substr($message->GetPlainLowerCaseBodyText(), 0, 500000))));
    }
コード例 #3
0
ファイル: message-view.php プロジェクト: JDevelopers/Mail
     }
     if ($messageBody) {
         $message = new WebMailMessage();
         $message->LoadMessageFromRawBody($messageBody, true);
     }
     if ($message) {
         $isNull = false;
     }
 }
 if ($isNull) {
     exit(PROC_MSG_HAS_DELETED);
 }
 $fromString = $message->GetFromAsString(true);
 $toString = $message->GetToAsString(true);
 $ccString = $message->GetCcAsString(true);
 $subjectString = $message->GetSubject(true);
 $date =& $message->GetDate();
 $date->FormatString = $account->DefaultDateFormat;
 $date->TimeFormat = $account->DefaultTimeFormat;
 $dateString = $date->GetFormattedDate($account->GetDefaultTimeOffset());
 $attachString = '';
 if ($message->Attachments && $message->Attachments->Count() > 0) {
     $attachmentsKeys = array_keys($message->Attachments->Instance());
     foreach ($attachmentsKeys as $key) {
         $attachment =& $message->Attachments->Get($key);
         $tempName = $key . '_' . ConvertUtils::ClearFileName($attachment->GetTempName());
         $fileName = ConvertUtils::ClearFileName(ConvertUtils::ClearUtf8($attachment->GetFilenameFromMime(), $GLOBALS[MailInputCharset], $account->GetUserCharset()));
         $view = $download = null;
         $size = $tempFiles->SaveFile($tempName, $attachment->GetBinaryBody());
         if ($size > -1) {
             $download = 'attach.php?tn=' . urlencode($tempName) . '&filename=' . urlencode($fileName);
コード例 #4
0
ファイル: class_filters.php プロジェクト: JDevelopers/Mail
 /**
  * @param WebMailMessage $message
  * @return short
  */
 function GetActionToApply(&$message)
 {
     if ($this->Applied) {
         $field = null;
         switch ($this->Field) {
             case FILTERFIELD_From:
                 $field = $message->GetFromAsString();
                 break;
             case FILTERFIELD_To:
                 $field = $message->GetAllRecipientsEmailsAsString();
                 break;
             case FILTERFIELD_Subject:
                 $field = $message->GetSubject();
                 break;
             case FILTERFIELD_XSpam:
                 $field = $message->GetSpamHeader();
                 break;
             case FILTERFIELD_XVirus:
                 $field = $message->GetVirusHeader();
                 break;
             case FILTERFIELD_CustomHeader:
                 $field = $message->Headers->GetHeaderValueByName($this->CustomHeaderValue);
                 break;
             default:
                 $field = null;
         }
         if ($field != null) {
             return $this->_processMessage(trim($field));
         }
     }
     return -1;
 }
コード例 #5
0
 /**
  * @param bool $isEncode
  * @return string
  */
 function PrintSubject($isEncode = true)
 {
     return $this->msg->GetSubject($isEncode);
 }
コード例 #6
0
    /**
     * @param WebMailMessage $message
     * @param Folder $folder
     * @param bool $downloaded
     * @param Account $account
     * @return string
     */
    function SaveMessageHeader($message, $folder, $downloaded, $account)
    {
        /* save message header */
        $sql = 'INSERT INTO %sawm_messages (id_msg, id_acct, id_folder_srv, id_folder_db,
								str_uid, int_uid, from_msg, to_msg, cc_msg, bcc_msg, subject,
								msg_date, attachments, size, downloaded, x_spam,
								seen, flagged, rtl, deleted, replied, grayed, flags,
								priority, body_text, forwarded, charset, sensitivity)
					VALUES (%d, %d,	%d, %d, %s, %d, %s, %s, %s, %s, %s, %s, %d, %d, %d,	%d, %d, %d, %d, %d, %d, %d, %d, %d, %s, 0, -1, %d)';
        $date =& $message->GetDate();
        $from = new I18nString($message->GetFromAsString(), $account->DbCharset);
        $to = new I18nString($message->GetToAsString(), $account->DbCharset);
        $cc = new I18nString($message->GetCcAsString(), $account->DbCharset);
        $bcc = new I18nString($message->GetBccAsString(), $account->DbCharset);
        $subject = new I18nString($message->GetSubject(), $account->DbCharset);
        $str_uid = $int_uid = null;
        if ($account->MailProtocol == MAILPROTOCOL_IMAP4) {
            $str_uid = '';
            $int_uid = $message->Uid;
        } else {
            $str_uid = $message->Uid;
            $int_uid = 0;
        }
        return sprintf($sql, $this->_settings->DbPrefix, $message->IdMsg, $account->Id, $folder->IdDb, $folder->IdDb, $this->_escapeString($str_uid), $int_uid, $this->_escapeString($from->Truncate(255)), $this->_escapeString($to->Truncate(255)), $this->_escapeString($cc->Truncate(255)), $this->_escapeString($bcc->Truncate(255)), $this->_escapeString($subject->Truncate(255)), $this->UpdateDateFormat($date->ToANSI()), (int) $message->HasAttachments(), $message->GetMailSize(), (int) $downloaded, (int) $message->GetXSpamStatus(), ($message->Flags & MESSAGEFLAGS_Seen) == MESSAGEFLAGS_Seen, ($message->Flags & MESSAGEFLAGS_Flagged) == MESSAGEFLAGS_Flagged, 0, ($message->Flags & MESSAGEFLAGS_Deleted) == MESSAGEFLAGS_Deleted, ($message->Flags & MESSAGEFLAGS_Answered) == MESSAGEFLAGS_Answered, ($message->Flags & MESSAGEFLAGS_Grayed) == MESSAGEFLAGS_Grayed, $message->Flags, $message->GetPriorityStatus(), $this->_escapeString(substr($message->GetPlainLowerCaseBodyText(), 0, 500000)), $message->GetSensitivity());
    }