function GetMessageNode(&$_xmlRes, &$_message, &$_folder, &$_processor, &$_account, &$_settings, $_mode, $_charsetNum, $_isFromSave) { $_safety = true; $_messageNode = new XmlDomNode('message'); $_msgId = $_message->IdMsg; $_msgUid = $_message->Uid; $_messageInfo = new CMessageInfo(); $_messageInfo->SetInfo($_msgId, $_msgUid, $_folder->IdDb, $_folder->FullName); $_messageClassType = $_message->TextBodies->ClassType(); $_messageNode->AppendAttribute('id', $_msgId); $_messageNode->AppendAttribute('size', $_message->GetMailSize()); $_messageNode->AppendAttribute('html', (int) (($_messageClassType & 2) == 2)); $_messageNode->AppendAttribute('plain', (int) (($_messageClassType & 1) == 1)); $_messageNode->AppendAttribute('priority', $_message->GetPriorityStatus()); $_messageNode->AppendAttribute('mode', $_mode); $_messageNode->AppendAttribute('charset', $_charsetNum); $_messageNode->AppendAttribute('has_charset', (int) $_message->HasCharset); $_messageNode->AppendAttribute('downloaded', (int) $_message->Downloaded); $_messageNode->AppendAttribute('sensivity', $_message->GetSensitivity()); $maf =& MessageActionFilters::CreateInstance(); $mafNoReply = $maf->GetNoReplyEmails(); $mafNoReplyAll = $maf->GetNoReplyAllEmails(); $mafNoForward = $maf->GetNoForwardEmails(); $fromEmail = $_message->GetFrom(); $fromEmail = $fromEmail->Email; $_textCharset = $_message->GetTextCharset(); $_rtl = 0; if (null !== $_textCharset) { switch (ConvertUtils::GetCodePageNumber($_textCharset)) { case 1255: case 1256: case 28596: case 28598: $_rtl = 1; break; } } $_messageNode->AppendAttribute('rtl', $_rtl); $_messageNode->AppendChild(new XmlDomNode('uid', $_msgUid, true)); $_folderNode = new XmlDomNode('folder', $_folder->FullName, true); $_folderNode->AppendAttribute('id', $_folder->IdDb); $_messageNode->AppendChild($_folderNode); $_signature_html = ''; $_signature_plain = ''; if ($_account->SignatureOptions == SIGNATURE_OPTION_AddToAll) { if ($_account->SignatureType == 1) { $_signature_html = '<br />' . $_account->Signature; require_once WM_ROOTPATH . 'libs/class_converthtml.php'; $_pars = new convertHtml($_account->Signature, false); $_signature_plain = CRLF . $_pars->get_text(); } else { $_signature_plain = CRLF . $_account->Signature; $_signature_html = '<br />' . nl2br($_account->Signature); } $_signature_plain = ConvertUtils::WMHtmlSpecialChars($_signature_plain); } $_accountOffset = $_settings->AllowUsersChangeTimeZone ? $_account->GetDefaultTimeOffset() : $_account->GetDefaultTimeOffset($_settings->DefaultTimeZone); if (($_mode & 1) == 1) { $_headersNode = new XmlDomNode('headers'); $_fromNode = new XmlDomNode('from'); $_id_addr = -1; $_from4search =& $_message->GetFrom(); if ($_from4search && USE_DB) { $_id_addr = $_processor->DbStorage->GetContactIdByEmail($_from4search->Email, $_account->IdUser); } if ($_id_addr > 0) { $_fromNode->AppendAttribute('contact_id', $_id_addr); $_bigContactNode = CXmlProcessing::GetContactNodeFromAddressBookRecord($_account, $_settings, $_id_addr); if (null != $_bigContactNode) { $_xmlRes->XmlRoot->AppendChild($_bigContactNode); } } $_fromNode->AppendChild(new XmlDomNode('short', WebMailMessage::ClearForSend(trim($_from4search->DisplayName)), true)); $_fromNode->AppendChild(new XmlDomNode('full', $_from4search->ToDecodedString(), true)); $_headersNode->AppendChild($_fromNode); $_headersNode->AppendChild(new XmlDomNode('to', $_message->GetToAsString(true), true)); $_headersNode->AppendChild(new XmlDomNode('cc', $_message->GetCcAsString(true), true)); $_headersNode->AppendChild(new XmlDomNode('bcc', $_message->GetBccAsString(true), true)); $_headersNode->AppendChild(new XmlDomNode('reply_to', $_message->GetReplyToAsString(true), true)); $_headersNode->AppendChild(new XmlDomNode('subject', $_message->GetSubject(true), true)); $_mailConfirmation = $_message->GetReadMailConfirmationAsString(); if (strlen($_mailConfirmation) > 0) { $_headersNode->AppendChild(new XmlDomNode('mailconfirmation', $_mailConfirmation, true)); } $_date =& $_message->GetDate(); $_date->FormatString = $_account->DefaultDateFormat; $_date->TimeFormat = $_account->DefaultTimeFormat; $_headersNode->AppendChild(new XmlDomNode('short_date', $_date->GetFormattedShortDate($_accountOffset), true)); $_headersNode->AppendChild(new XmlDomNode('full_date', $_date->GetFormattedFullDate($_accountOffset), true)); $_headersNode->AppendChild(new XmlDomNode('time', $_date->GetFormattedTime($_accountOffset), true)); $_messageNode->AppendChild($_headersNode); } $html_part = ''; if (($_mode & 2) == 2 && ($_messageClassType & 2) == 2) { $html_part = ConvertUtils::ReplaceJSMethod($_message->GetCensoredHtmlWithImageLinks(true, $_messageInfo)); if (($_account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $_account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) && !$_isFromSave) { $html_part = ConvertUtils::HtmlBodyWithoutImages($html_part); if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) { $GLOBALS[GL_WITHIMG] = false; $_safety = false; } } } $modified_plain_text = ''; if (($_mode & 4) == 4 || ($_mode & 2) == 2 && ($_messageClassType & 2) != 2) { $modified_plain_text = $_message->GetCensoredTextBody(true); } if (($_mode & 8) == 8) { if (($_account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $_account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) && !$_isFromSave) { $_messageNode->AppendChild(new XmlDomNode('reply_html', ConvertUtils::AddToLinkMailToCheck(ConvertUtils::HtmlBodyWithoutImages(ConvertUtils::ReplaceJSMethod($_signature_html . $_message->GetRelpyAsHtml(true, $_accountOffset, $_messageInfo)))), true, true)); if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) { $GLOBALS[GL_WITHIMG] = false; $_safety = false; } } else { $_messageNode->AppendChild(new XmlDomNode('reply_html', ConvertUtils::AddToLinkMailToCheck(ConvertUtils::ReplaceJSMethod($_signature_html . $_message->GetRelpyAsHtml(true, $_accountOffset, $_messageInfo))), true, true)); } } if (($_mode & 16) == 16) { $_messageNode->AppendChild(new XmlDomNode('reply_plain', ConvertUtils::AddToLinkMailToCheck($_signature_plain . $_message->GetRelpyAsPlain(true, $_accountOffset)), true, true)); } if (($_mode & 32) == 32) { if (($_account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $_account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) && !$_isFromSave) { $_messageNode->AppendChild(new XmlDomNode('forward_html', ConvertUtils::AddToLinkMailToCheck(ConvertUtils::HtmlBodyWithoutImages(ConvertUtils::ReplaceJSMethod($_signature_html . $_message->GetRelpyAsHtml(true, $_accountOffset, $_messageInfo)))), true, true)); if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) { $GLOBALS[GL_WITHIMG] = false; $_safety = false; } } else { $_messageNode->AppendChild(new XmlDomNode('forward_html', ConvertUtils::AddToLinkMailToCheck(ConvertUtils::ReplaceJSMethod($_signature_html . $_message->GetRelpyAsHtml(true, $_accountOffset, $_messageInfo))), true, true)); } } if (($_mode & 64) == 64) { $_messageNode->AppendChild(new XmlDomNode('forward_plain', ConvertUtils::AddToLinkMailToCheck($_signature_plain . $_message->GetRelpyAsPlain(true, $_accountOffset)), true, true)); } if (($_mode & 128) == 128) { $_messageNode->AppendChild(new XmlDomNode('full_headers', $_message->ClearForSend(ConvertUtils::ConvertEncoding($_message->OriginalHeaders, $GLOBALS[MailInputCharset], $_account->GetUserCharset())), true, true)); } $_messageNode->AppendAttribute('safety', (int) $_safety); $_msqAttachLine = 'msg_id=' . $_msgId . '&msg_uid=' . urlencode($_msgUid) . '&folder_id=' . $_folder->IdDb . '&folder_fname=' . urlencode($_folder->FullName); $addAttachArray = array(); if (($_mode & 256) == 256 || ($_mode & 8) == 8 || ($_mode & 16) == 16 || ($_mode & 32) == 32 || ($_mode & 64) == 64) { $_attachments =& $_message->Attachments; if ($_attachments && $_attachments->Count() > 0) { $tempFiles =& CTempFiles::CreateInstance($_account); $_attachmentsNode = new XmlDomNode('attachments'); $_attachmentsKeys = array_keys($_attachments->Instance()); foreach ($_attachmentsKeys as $_key) { $attachArray = array(); $_attachment =& $_attachments->Get($_key); $_tempname = $_message->IdMsg . '-' . $_key . '_' . ConvertUtils::ClearFileName($_attachment->GetTempName()); $_filename = ConvertUtils::ClearFileName(ConvertUtils::ClearUtf8($_attachment->GetFilenameFromMime(), $GLOBALS[MailInputCharset], $_account->GetUserCharset())); $_size = 0; $_isBodyStructureAttachment = false; if ($_attachment->MimePart && $_attachment->MimePart->BodyStructureIndex !== null && $_attachment->MimePart->BodyStructureSize !== null) { $_isBodyStructureAttachment = true; $_size = $_attachment->MimePart->BodyStructureSize; } else { $_size = $tempFiles->SaveFile($_tempname, $_attachment->GetBinaryBody()); $_size = $_size < 0 ? 0 : $_size; } $attachArray['name'] = $_filename; $attachArray['tempname'] = $_tempname; $attachArray['size'] = $_size; $_bodyStructureUrlAdd = ''; if ($_isBodyStructureAttachment) { $_bodyStructureUrlAdd = 'bsi=' . urlencode($_attachment->MimePart->BodyStructureIndex); if ($_attachment->MimePart->BodyStructureEncode !== null && strlen($_attachment->MimePart->BodyStructureEncode) > 0) { $_bodyStructureUrlAdd .= '&bse=' . urlencode(ConvertUtils::GetBodyStructureEncodeType($_attachment->MimePart->BodyStructureEncode)); } } $_attachNode = new XmlDomNode('attachment'); $_attachNode->AppendAttribute('size', $_size); $_attachNode->AppendAttribute('inline', $_attachment->IsInline ? '1' : '0'); $_attachNode->AppendChild(new XmlDomNode('filename', $_filename, true)); $viewUrl = substr(strtolower($_filename), -4) == '.eml' ? 'message-view.php?type=' . MESSAGE_VIEW_TYPE_ATTACH . '&tn=' . urlencode($_tempname) : 'view-image.php?img&tn=' . urlencode($_tempname) . '&filename=' . urlencode($_filename); if ($_isBodyStructureAttachment) { $viewUrl .= '&' . $_bodyStructureUrlAdd . '&' . $_msqAttachLine; } $_attachNode->AppendChild(new XmlDomNode('view', $viewUrl, true)); $linkUrl = 'attach.php?tn=' . urlencode($_tempname); if ($_isBodyStructureAttachment) { $linkUrl .= '&' . $_bodyStructureUrlAdd . '&' . $_msqAttachLine; } $downloadUrl = $linkUrl . '&filename=' . urlencode($_filename); $attachArray['download'] = $downloadUrl; $attachArray['link'] = $linkUrl; $_attachNode->AppendChild(new XmlDomNode('download', $downloadUrl, true)); $_attachNode->AppendChild(new XmlDomNode('tempname', $_tempname, true)); $mime_type = ConvertUtils::GetContentTypeFromFileName($_filename); $_attachNode->AppendChild(new XmlDomNode('mime_type', $mime_type, true)); $attachArray['mime_type'] = $mime_type; $attachArray['download'] = $downloadUrl; $addAttachArray[] = $attachArray; $_attachmentsNode->AppendChild($_attachNode); unset($_attachment, $_attachNode, $attachArray); } $_messageNode->AppendChild($_attachmentsNode); } } ChangeHtmlTextFromAttachment($html_part, $modified_plain_text, $addAttachArray); if (($_mode & 2) == 2 && ($_messageClassType & 2) == 2) { $_messageNode->AppendChild(new XmlDomNode('html_part', ConvertUtils::AddToLinkMailToCheck($html_part), true, true)); } if (($_mode & 4) == 4 || ($_mode & 2) == 2 && ($_messageClassType & 2) != 2) { $_messageNode->AppendChild(new XmlDomNode('modified_plain_text', ConvertUtils::AddToLinkMailToCheck($modified_plain_text), true, true)); } if (($_mode & 512) == 512) { $_messageNode->AppendChild(new XmlDomNode('unmodified_plain_text', $_message->GetNotCensoredTextBody(true), true, true)); } $_messageNode->AppendChild(new XmlDomNode('save_link', 'attach.php?' . $_msqAttachLine, true)); $_messageNode->AppendChild(new XmlDomNode('print_link', 'message-view.php?type=' . MESSAGE_VIEW_TYPE_PRINT . '&' . $_msqAttachLine . '&charset=' . $_charsetNum, true)); $_messageNode->AppendAttribute('no_reply', count($mafNoReply) > 0 && in_array($fromEmail, $mafNoReply) ? '1' : '0'); $_messageNode->AppendAttribute('no_reply_all', count($mafNoReplyAll) > 0 && in_array($fromEmail, $mafNoReplyAll) ? '1' : '0'); $_messageNode->AppendAttribute('no_forward', count($mafNoForward) > 0 && in_array($fromEmail, $mafNoForward) ? '1' : '0'); $_xmlRes->XmlRoot->AppendChild($_messageNode); }
/** * @param Account $account * @return string */ function UpdateSettings(&$account) { $sql = 'UPDATE %sawm_settings SET msgs_per_page = %s, white_listing = %s, x_spam = %s, def_skin = %s, def_lang = %s, def_charset_inc = %d, def_charset_out = %d, def_timezone = %d, def_date_fmt = %s, hide_folders = %d, mailbox_limit = %d, allow_change_settings = %d, allow_dhtml_editor = %d, allow_direct_mode = %d, hide_contacts = %d, db_charset = %d, horiz_resizer = %d, vert_resizer = %d, mark = %d, reply = %d, contacts_per_page = %d, view_mode = %d WHERE id_user = %d'; return sprintf($sql, $this->_settings->DbPrefix, (int) $account->MailsPerPage > 0 ? (int) $account->MailsPerPage : 20, (int) $account->WhiteListing, (int) $account->XSpam, $this->_escapeString($account->DefaultSkin), $this->_escapeString($account->DefaultLanguage), ConvertUtils::GetCodePageNumber($account->DefaultIncCharset), ConvertUtils::GetCodePageNumber($account->DefaultOutCharset), $account->DefaultTimeZone, $this->_escapeString(CDateTime::GetDbDateFormat($account->DefaultDateFormat, $account->DefaultTimeFormat)), $this->Bool2Bool((int) $account->HideFolders), $account->MailboxLimit, $this->Bool2Bool((int) $account->AllowChangeSettings), $this->Bool2Bool((int) $account->AllowDhtmlEditor), $this->Bool2Bool((int) $account->AllowDirectMode), $this->Bool2Bool((int) $account->HideContacts), ConvertUtils::GetCodePageNumber($account->DbCharset), $account->HorizResizer, $account->VertResizer, $account->Mark, $account->Reply, (int) $account->ContactsPerPage > 0 ? (int) $account->ContactsPerPage : 20, (int) $account->ViewMode, $account->IdUser); }
function PrintMessagePreview($skin, $isRtlOn, $body, $textCharset, $from, $to, $date, $subject, $attachments = null, $cc = null, $usePrint = false) { $CCTr = $AttachTr = ''; $headLink = $isRtlOn ? '<link rel="stylesheet" href="skins/' . $skin . '/styles-rtl.css" type="text/css" id="skin-rtl">' : ''; $dirTextStyle = ' style="text-align: left;"'; if ($textCharset) { if (strtolower($textCharset) == 'iso-8859-8-i') { $dirTextStyle = ' style="text-align: right;"'; } else { switch (ConvertUtils::GetCodePageNumber($textCharset)) { case 1255: case 1256: case 28596: case 28598: $dirTextStyle = ' style="text-align: right;"'; break; case 65001: if ($isRtlOn) { $dirTextStyle = ' style="text-align: right;"'; } break; } } } if ($cc && strlen($cc) > 0) { $CCTr = ' <tr> <td class="wm_print_title" width="60px"> ' . JS_LANG_CC . ' </td> <td class="wm_print_value"> ' . ConvertUtils::WMHtmlSpecialChars($cc) . ' </td> </tr>'; } if ($attachments && strlen($attachments) > 0) { $AttachTr = ' <tr> <td class="wm_print_title" width="60px"> ' . Attachments . ': </td> <td class="wm_print_value"> ' . $attachments . ' </td> </tr>'; } $usePrintStr = $usePrint ? ' onload="window.print();"' : ''; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" /> <html> <head> <link rel="shortcut icon" href="favicon.ico" /> <link rel="stylesheet" href="./skins/<?php echo $skin; ?> /styles.css" type="text/css" /> <?php echo $headLink; ?> </head> <body class="wm_body"<?php echo $usePrintStr; ?> > <div align="center" class="wm_space_before"> <table class="wm_print"> <tr> <td class="wm_print_title" width="60px"> <?php echo JS_LANG_From; ?> : </td> <td class="wm_print_value"> <?php echo ConvertUtils::WMHtmlSpecialChars($from); ?> </td> </tr> <tr> <td class="wm_print_title" width="60px"> <?php echo JS_LANG_To; ?> : </td> <td class="wm_print_value"> <?php echo ConvertUtils::WMHtmlSpecialChars($to); ?> </td> </tr> <?php echo $CCTr; ?> <tr> <td class="wm_print_title" width="60px"> <?php echo JS_LANG_Date; ?> : </td> <td class="wm_print_value"> <?php echo ConvertUtils::WMHtmlSpecialChars($date); ?> </td> </tr> <tr> <td class="wm_print_title" width="60px"> <?php echo JS_LANG_Subject; ?> : </td> <td class="wm_print_value"> <?php echo ConvertUtils::WMHtmlSpecialChars($subject); ?> </td> </tr> <?php echo $AttachTr; ?> <tr> <td colspan="2" class="wm_print_body"> <div class="wm_space_before"<?php echo $dirTextStyle; ?> > <?php echo $body; ?> </div> </td> </tr> </table> </div> </body> </html> <?php }
} else { printErrorAndExit(getGlobalError(), $xmlRes); } break; case 'settings': $account =& Account::LoadFromDb($accountId); if (!$account) { printErrorAndExit('', $xmlRes, 2); } if ($account != null) { $settingsNode =& new XmlDomNode('settings'); $settingsNode->AppendAttribute('msgs_per_page', $account->MailsPerPage); $settingsNode->AppendAttribute('allow_dhtml_editor', (int) $account->AllowDhtmlEditor); if ($settings->AllowUsersChangeCharset) { $settingsNode->AppendAttribute('def_charset_inc', ConvertUtils::GetCodePageNumber($account->DefaultIncCharset)); $settingsNode->AppendAttribute('def_charset_out', ConvertUtils::GetCodePageNumber($account->DefaultOutCharset)); } if ($settings->AllowUsersChangeTimeZone) { $settingsNode->AppendAttribute('def_timezone', (int) $account->DefaultTimeZone); } $settingsNode->AppendAttribute('view_mode', (int) $account->ViewMode); if ($settings->AllowUsersChangeSkin) { $skinsNode =& new XmlDomNode('skins'); $skinsList =& FileSystem::GetSkinsList(); foreach ($skinsList as $skin) { $skinNode =& new XmlDomNode('skin', $skin, true); $skinNode->AppendAttribute('def', (int) (strtolower($account->DefaultSkin) == strtolower($skin))); $skinsNode->AppendChild($skinNode); } $settingsNode->AppendChild($skinsNode); }
function DoGetSettings() { $_dbStorage = $_settings = $_xmlObj = $_xmlRes = $_accountId = null; $this->_initFuncArgs($_dbStorage, $_settings, $_xmlObj, $_xmlRes, $_accountId); $_account =& CXmlProcessing::AccountCheckAndLoad($_xmlRes, $_accountId, false, false); $_settingsNode = new XmlDomNode('settings'); $_settingsNode->AppendAttribute('msgs_per_page', (int) $_account->MailsPerPage); $_settingsNode->AppendAttribute('contacts_per_page', (int) $_account->ContactsPerPage); $_settingsNode->AppendAttribute('allow_dhtml_editor', (int) $_account->AllowDhtmlEditor); $_settingsNode->AppendAttribute('auto_checkmail_interval', (int) $_account->AutoCheckMailInterval); if ($_settings->AllowUsersChangeCharset) { $_settingsNode->AppendAttribute('def_charset_inc', ConvertUtils::GetCodePageNumber($_account->DefaultIncCharset)); $_settingsNode->AppendAttribute('def_charset_out', ConvertUtils::GetCodePageNumber($_account->DefaultOutCharset)); } if ($_settings->AllowUsersChangeTimeZone) { $_settingsNode->AppendAttribute('def_timezone', (int) $_account->DefaultTimeZone); } $_settingsNode->AppendAttribute('view_mode', (int) $_account->ViewMode); if ($_settings->AllowUsersChangeSkin) { $_skinsNode = new XmlDomNode('skins'); $_skinsList =& FileSystem::GetSkinsList(); foreach ($_skinsList as $_skin) { $_skinNode = new XmlDomNode('skin', $_skin, true); $_skinNode->AppendAttribute('def', (int) (strtolower($_account->DefaultSkin) == strtolower($_skin))); $_skinsNode->AppendChild($_skinNode); unset($_skinNode); } $_settingsNode->AppendChild($_skinsNode); } if ($_settings->AllowUsersChangeLanguage) { $_langsNode = new XmlDomNode('langs'); $_langList =& FileSystem::GetLangList(); foreach ($_langList as $_lang) { $_langNode = new XmlDomNode('lang', $_lang, true); $_langNode->AppendAttribute('def', (int) (strtolower($_account->DefaultLanguage) == strtolower($_lang))); $_langsNode->AppendChild($_langNode); unset($_langNode); } $_settingsNode->AppendChild($_langsNode); } $_settingsNode->AppendChild(new XmlDomNode('def_date_fmt', $_account->DefaultDateFormat)); $_settingsNode->AppendAttribute('time_format', $_account->DefaultTimeFormat); $_xmlRes->XmlRoot->AppendChild($_settingsNode); }
/** * @param Account $account; * @param int $messId * @param string $messUid * @param int $folderId * @param string $folderFullName * @return GetMessageBase */ function GetMessageBase(&$account, $messId, $messUid, $folderId, $folderFullName, $charset) { $this->messId = $messId; $this->messUid = $messUid; $this->folderId = $folderId; $this->folderFullName = $folderFullName; $this->charset = $charset; $this->accountId = $account->Id; $this->account =& $account; $this->processor = new MailProcessor($this->account); $this->folder = new Folder($this->accountId, $folderId, $folderFullName); $this->processor->GetFolderInfo($this->folder); $msgIdUid = array(); if (!empty($messId) && !empty($messUid)) { $msgIdUid[$messId] = $messUid; } $charsetNum = -1; if ($charset != -1) { $GLOBALS[MailInputCharset] = $charset; $charsetNum = ConvertUtils::GetCodePageNumber($charset); } $this->msg =& $this->processor->GetMessage($messId, $messUid, $this->folder); if ($this->msg) { if (!(($this->msg->Flags & MESSAGEFLAGS_Seen) == MESSAGEFLAGS_Seen)) { $this->processor->SetFlag($msgIdUid, $this->folder, MESSAGEFLAGS_Seen, ACTION_Set); } if ($this->folder->SyncType != FOLDERSYNC_DirectMode && $this->processor->DbStorage->Connect()) { $this->processor->DbStorage->UpdateMessageCharset($messId, $charsetNum, $this->msg); } } }
/** * @param int $messId * @param string $messUid * @param int $folderId * @param string $folderFullName * @param bool $isFull * @return GetMessageBase */ function GetMessageBase(&$account, $messId, $messUid, $folderId, $folderFullName, $charset, $isFull = false) { $this->messId = $messId; $this->messUid = $messUid; $this->folderId = $folderId; $this->folderFullName = $folderFullName; $this->charset = $charset; if (isset($_SESSION[ACCOUNT_ID])) { $this->accountId = $_SESSION[ACCOUNT_ID]; } if (!isset($_SESSION['attachtempdir'])) { $_SESSION['attachtempdir'] = md5(session_id()); } $this->account =& $account; $this->processor =& new MailProcessor($this->account); $this->folder =& new Folder($this->accountId, $folderId, $folderFullName); $this->processor->GetFolderInfo($this->folder); $msgIdUid = array(); if (!empty($messId) && !empty($messUid)) { $msgIdUid[$messId] = $messUid; } $this->processor->SetFlags($msgIdUid, $this->folder, MESSAGEFLAGS_Seen, ACTION_Set); if ($charset != -1) { $GLOBALS[MailInputCharset] = $charset; $charsetNum = ConvertUtils::GetCodePageNumber($charset); } else { $charsetNum = -1; } $this->msg =& $this->processor->GetMessage($messId, $messUid, $this->folder); if (!$this->msg) { return false; } if ($this->folder->SyncType != FOLDERSYNC_DirectMode && $this->processor->DbStorage->Connect()) { $this->processor->DbStorage->UpdateMessageCharset($messId, $charsetNum, $this->msg); } }
} $_isFromSave = false; if (USE_DB && ($modeForGet === null || ($modeForGet & 1) == 1)) { $_fromObj = new EmailAddress(); $_fromObj->Parse($message->GetFromAsString(true)); if ($_fromObj->Email) { $_isFromSave = $processor->DbStorage->SelectSenderSafetyByEmail($_fromObj->Email, $account->IdUser); } if ($folder->SyncType != FOLDERSYNC_DirectMode && $processor->DbStorage->Connect()) { $processor->DbStorage->UpdateMessageCharset($mes_id, $mes_charset, $message); } } $textCharset = $message->GetTextCharset(); $isRTL = false; if (null !== $textCharset) { switch (ConvertUtils::GetCodePageNumber($textCharset)) { case 1255: case 1256: case 28596: case 28598: $isRTL = true; break; } } $accountOffset = $settings->AllowUsersChangeTimeZone ? $account->GetDefaultTimeOffset() : $account->GetDefaultTimeOffset($settings->DefaultTimeZone); $date =& $message->GetDate(); $date->FormatString = $account->DefaultDateFormat; $date->TimeFormat = $account->DefaultTimeFormat; $from4search =& $message->GetFrom(); // if ($from4search && USE_DB) // {
/** * @return bool */ function SaveToXml() { $xmlDocument =& new XmlDocument(); $xmlDocument->CreateElement('Settings'); $xmlDocument->XmlRoot->AppendAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema'); $xmlDocument->XmlRoot->AppendAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $common = new XmlDomNode('Common'); $common->AppendChild(new XmlDomNode('SiteName', ConvertUtils::WMHtmlSpecialChars($this->WindowTitle))); $common->AppendChild(new XmlDomNode('LicenseKey', ConvertUtils::WMHtmlSpecialChars($this->LicenseKey))); $common->AppendChild(new XmlDomNode('AdminPassword', ConvertUtils::WMHtmlSpecialChars($this->AdminPassword))); $common->AppendChild(new XmlDomNode('DBType', (int) $this->DbType)); $common->AppendChild(new XmlDomNode('DBLogin', ConvertUtils::WMHtmlSpecialChars($this->DbLogin))); $common->AppendChild(new XmlDomNode('DBPassword', ConvertUtils::WMHtmlSpecialChars($this->DbPassword))); $common->AppendChild(new XmlDomNode('DBName', ConvertUtils::WMHtmlSpecialChars($this->DbName))); $common->AppendChild(new XmlDomNode('DBDSN', ConvertUtils::WMHtmlSpecialChars($this->DbDsn))); $common->AppendChild(new XmlDomNode('DBHost', ConvertUtils::WMHtmlSpecialChars($this->DbHost))); $common->AppendChild(new XmlDomNode('UseCustomConnectionString', (int) $this->UseCustomConnectionString)); $common->AppendChild(new XmlDomNode('DBCustomConnectionString', ConvertUtils::WMHtmlSpecialChars($this->DbCustomConnectionString))); $common->AppendChild(new XmlDomNode('DBPrefix', ConvertUtils::WMHtmlSpecialChars($this->DbPrefix))); $common->AppendChild(new XmlDomNode('DefaultSkin', ConvertUtils::WMHtmlSpecialChars($this->DefaultSkin))); $common->AppendChild(new XmlDomNode('AllowUsersChangeSkin', (int) $this->AllowUsersChangeSkin)); $common->AppendChild(new XmlDomNode('DefaultLanguage', ConvertUtils::WMHtmlSpecialChars($this->DefaultLanguage))); $common->AppendChild(new XmlDomNode('AllowUsersChangeLanguage', (int) $this->AllowUsersChangeLanguage)); $xmlDocument->XmlRoot->AppendChild($common); $webmail = new XmlDomNode('WebMail'); $webmail->AppendChild(new XmlDomNode('IncomingMailProtocol', (int) $this->IncomingMailProtocol)); $webmail->AppendChild(new XmlDomNode('IncomingMailServer', ConvertUtils::WMHtmlSpecialChars($this->IncomingMailServer))); $webmail->AppendChild(new XmlDomNode('IncomingMailPort', (int) $this->IncomingMailPort)); $webmail->AppendChild(new XmlDomNode('OutgoingMailServer', ConvertUtils::WMHtmlSpecialChars($this->OutgoingMailServer))); $webmail->AppendChild(new XmlDomNode('OutgoingMailPort', (int) $this->OutgoingMailPort)); $webmail->AppendChild(new XmlDomNode('ReqSmtpAuth', (int) $this->ReqSmtpAuth)); $webmail->AppendChild(new XmlDomNode('AllowAdvancedLogin', (int) $this->AllowAdvancedLogin)); $webmail->AppendChild(new XmlDomNode('HideLoginMode', (int) $this->HideLoginMode)); $webmail->AppendChild(new XmlDomNode('DefaultDomainOptional', ConvertUtils::WMHtmlSpecialChars($this->DefaultDomainOptional))); $webmail->AppendChild(new XmlDomNode('ShowTextLabels', (int) $this->ShowTextLabels)); $webmail->AppendChild(new XmlDomNode('AutomaticCorrectLoginSettings', (int) $this->AutomaticCorrectLoginSettings)); $webmail->AppendChild(new XmlDomNode('EnableLogging', (int) $this->EnableLogging)); $webmail->AppendChild(new XmlDomNode('DisableErrorHandling', (int) $this->DisableErrorHandling)); $webmail->AppendChild(new XmlDomNode('AllowAjax', (int) $this->AllowAjax)); $webmail->AppendChild(new XmlDomNode('MailsPerPage', (int) $this->MailsPerPage)); $webmail->AppendChild(new XmlDomNode('EnableAttachmentSizeLimit', (int) $this->EnableAttachmentSizeLimit)); $webmail->AppendChild(new XmlDomNode('AttachmentSizeLimit', ConvertUtils::WMHtmlSpecialChars($this->AttachmentSizeLimit))); $webmail->AppendChild(new XmlDomNode('EnableMailboxSizeLimit', (int) $this->EnableMailboxSizeLimit)); $webmail->AppendChild(new XmlDomNode('MailboxSizeLimit', ConvertUtils::WMHtmlSpecialChars($this->MailboxSizeLimit))); $webmail->AppendChild(new XmlDomNode('DefaultTimeZone', ConvertUtils::WMHtmlSpecialChars($this->DefaultTimeZone))); $webmail->AppendChild(new XmlDomNode('AllowUsersChangeTimeZone', (int) $this->AllowUsersChangeTimeZone)); $webmail->AppendChild(new XmlDomNode('DefaultUserCharset', ConvertUtils::GetCodePageNumber($this->DefaultUserCharset))); $webmail->AppendChild(new XmlDomNode('AllowUsersChangeCharset', (int) $this->AllowUsersChangeCharset)); $webmail->AppendChild(new XmlDomNode('AllowDHTMLEditor', (int) $this->AllowDhtmlEditor)); $webmail->AppendChild(new XmlDomNode('AllowUsersChangeEmailSettings', (int) $this->AllowUsersChangeEmailSettings)); $webmail->AppendChild(new XmlDomNode('AllowDirectMode', (int) $this->AllowDirectMode)); $webmail->AppendChild(new XmlDomNode('DirectModeIsDefault', (int) $this->DirectModeIsDefault)); $webmail->AppendChild(new XmlDomNode('AllowNewUsersRegister', (int) $this->AllowNewUsersRegister)); $webmail->AppendChild(new XmlDomNode('AllowUsersAddNewAccounts', (int) $this->AllowUsersAddNewAccounts)); $webmail->AppendChild(new XmlDomNode('StoreMailsInDb', (int) $this->StoreMailsInDb)); $webmail->AppendChild(new XmlDomNode('EnableWmServer', (int) $this->EnableWmServer)); $webmail->AppendChild(new XmlDomNode('WmServerRootPath', ConvertUtils::WMHtmlSpecialChars($this->WmServerRootPath))); $webmail->AppendChild(new XmlDomNode('WmServerHost', ConvertUtils::WMHtmlSpecialChars($this->WmServerHost))); $webmail->AppendChild(new XmlDomNode('WmAllowManageXMailAccounts', (int) $this->WmAllowManageXMailAccounts)); $webmail->AppendChild(new XmlDomNode('AllowContacts', (int) $this->AllowContacts)); $webmail->AppendChild(new XmlDomNode('AllowCalendar', (int) $this->AllowCalendar)); $xmlDocument->XmlRoot->AppendChild($webmail); $calendar = new XmlDomNode('Calendar'); $calendar->AppendChild(new XmlDomNode('DefaultTimeFormat', (int) $this->Cal_DefaultTimeFormat)); $calendar->AppendChild(new XmlDomNode('DefaultDateFormat', (int) $this->Cal_DefaultDateFormat)); $calendar->AppendChild(new XmlDomNode('ShowWeekends', (int) $this->Cal_ShowWeekends)); $calendar->AppendChild(new XmlDomNode('WorkdayStarts', (int) $this->Cal_WorkdayStarts)); $calendar->AppendChild(new XmlDomNode('WorkdayEnds', (int) $this->Cal_WorkdayEnds)); $calendar->AppendChild(new XmlDomNode('ShowWorkDay', (int) $this->Cal_ShowWorkDay)); $calendar->AppendChild(new XmlDomNode('WeekStartsOn', (int) $this->Cal_WeekStartsOn)); $calendar->AppendChild(new XmlDomNode('DefaultTab', (int) $this->Cal_DefaultTab)); $calendar->AppendChild(new XmlDomNode('DefaultCountry', ConvertUtils::WMHtmlSpecialChars($this->Cal_DefaultCountry))); $calendar->AppendChild(new XmlDomNode('DefaultTimeZone', (int) $this->Cal_DefaultTimeZone)); $calendar->AppendChild(new XmlDomNode('AllTimeZones', (int) $this->Cal_AllTimeZones)); $xmlDocument->XmlRoot->AppendChild($calendar); return $xmlDocument->SaveToFile(INI_DIR . '/settings/settings.xml'); }