Exemple #1
0
             $msgsNode->AppendChild($msgNode);
         }
         $xmlRes->XmlRoot->AppendChild($msgsNode);
     } else {
         printErrorAndExit(PROC_CANT_GET_MSG_LIST, $xmlRes);
     }
     break;
 case 'message':
     $safety = true;
     $account =& Account::LoadFromDb($accountId);
     if (!$account) {
         printErrorAndExit('', $xmlRes, 2);
     }
     $charsetNum = $xmlObj->GetParamValueByName('charset');
     if ($charsetNum > 0) {
         $account->DefaultIncCharset = ConvertUtils::GetCodePageName($charsetNum);
         $GLOBALS[MailInputCharset] = $account->DefaultIncCharset;
         $account->Update();
     }
     $processor =& new MailProcessor($account);
     $folderNodeRequest =& $xmlObj->XmlRoot->GetChildNodeByTagName('folder');
     $folder =& new Folder($accountId, $folderNodeRequest->Attributes['id'], $folderNodeRequest->GetChildValueByTagName('full_name'));
     $processor->GetFolderInfo($folder);
     $msgId = $xmlObj->GetParamValueByName('id');
     $msgUid = $xmlObj->GetParamTagValueByName('uid');
     $msgIdUid = array();
     $msgIdUid[$msgId] = $msgUid;
     $processor->SetFlags($msgIdUid, $folder, MESSAGEFLAGS_Seen, ACTION_Set);
     $message =& $processor->GetMessage($msgId, $msgUid, $folder);
     if ($message != null) {
         $fromObj = new EmailAddress();
Exemple #2
0
 /**
  * @param string $email
  * @param string $login
  * @return Account
  */
 function &SelectAccountFullDataByLogin($email, $login)
 {
     $null = null;
     if (!$this->_dbConnection->Execute($this->_commandCreator->SelectAccountFullDataByLogin($email, $login))) {
         return $null;
     }
     $account = new Account();
     $row = $this->_dbConnection->GetNextRecord();
     if ($row) {
         $account->Id = (int) $row->id_acct;
         $account->IdUser = (int) $row->id_user;
         $account->IdDomain = (int) $row->id_domain;
         $account->DefaultAccount = (bool) $row->def_acct;
         $account->Deleted = (bool) $row->deleted;
         $account->Email = $row->email;
         $account->MailProtocol = (int) $row->mail_protocol;
         $account->MailIncHost = $row->mail_inc_host;
         $account->MailIncLogin = $row->mail_inc_login;
         $account->MailIncPort = (int) $row->mail_inc_port;
         $account->MailOutHost = $row->mail_out_host;
         $account->MailOutLogin = $row->mail_out_login;
         $account->MailOutPort = (int) $row->mail_out_port;
         $account->MailOutAuthentication = (int) $row->mail_out_auth;
         $account->FriendlyName = $row->friendly_nm;
         $account->UseFriendlyName = (bool) $row->use_friendly_nm;
         $account->DefaultOrder = (int) $row->def_order;
         $account->GetMailAtLogin = (bool) $row->getmail_at_login;
         $account->MailMode = (int) $row->mail_mode;
         $account->MailsOnServerDays = (int) $row->mails_on_server_days;
         $account->SignatureType = (int) $row->signature_type;
         $account->SignatureOptions = (int) $row->signature_opt;
         $account->HideContacts = (bool) $row->hide_contacts;
         $account->MailsPerPage = (int) $row->msgs_per_page;
         $account->Delimiter = $row->delimiter;
         $account->NameSpace = $row->personal_namespace;
         $account->WhiteListing = (bool) $row->white_listing;
         $account->XSpam = (bool) $row->x_spam;
         $account->LastLogin = (int) $row->last_login;
         $account->LoginsCount = (int) $row->logins_count;
         $account->DefaultSkin = $row->def_skin;
         $account->DefaultLanguage = $row->def_lang;
         $account->DefaultIncCharset = ConvertUtils::GetCodePageName((int) $row->def_charset_inc);
         $account->DefaultOutCharset = ConvertUtils::GetCodePageName((int) $row->def_charset_out);
         $account->DefaultTimeZone = (int) $row->def_timezone;
         $account->DefaultDateFormat = $row->def_date_fmt;
         $account->HideFolders = (bool) $row->hide_folders;
         $account->MailboxLimit = GetGoodBigInt($row->mailbox_limit);
         $account->MailboxSize = GetGoodBigInt($row->mailbox_size);
         $account->AllowChangeSettings = (bool) $row->allow_change_settings;
         $account->AllowDhtmlEditor = (bool) $row->allow_dhtml_editor;
         $account->AllowDirectMode = (bool) $row->allow_direct_mode;
         $account->DbCharset = ConvertUtils::GetCodePageName((int) $row->db_charset);
         $account->HorizResizer = (int) $row->horiz_resizer;
         $account->VertResizer = (int) $row->vert_resizer;
         $account->Mark = (int) $row->mark;
         $account->Reply = (int) $row->reply;
         $account->ContactsPerPage = (int) $row->contacts_per_page;
         $account->ViewMode = (int) $row->view_mode;
         $account->ImapQuota = (int) $row->imap_quota;
         $account->MailIncPassword = ConvertUtils::DecodePassword($row->mail_inc_pass, $account);
         $account->MailOutPassword = ConvertUtils::DecodePassword($row->mail_out_pass, $account);
         $this->_dbConnection->FreeResult();
     } else {
         $account = $null;
     }
     if (!is_object($account) || !$this->_dbConnection->Execute($this->_commandCreator->SelectSignature($account->Id))) {
         return $null;
     }
     $row = $this->_dbConnection->GetNextRecord();
     if ($row) {
         $account->Signature = $row->signature;
         $this->_dbConnection->FreeResult();
     }
     return $account;
 }
    /**
     * @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;
    }
Exemple #4
0
 /**
  * @access private
  * @param XmlDomNode $xmlTree
  */
 function _loadFromXML(&$xmlTree)
 {
     foreach ($xmlTree->Children as $node) {
         switch ($node->TagName) {
             case 'Common':
             case 'WebMail':
             case 'Calendar':
                 if (count($node->Children) > 0) {
                     $this->_loadFromXML($node);
                 }
                 break;
             case 'SiteName':
                 $this->WindowTitle = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'WindowTitle':
                 $this->WindowTitle = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'LicenseKey':
                 $this->LicenseKey = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'AdminPassword':
                 $this->AdminPassword = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DBType':
                 $this->DbType = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DBLogin':
                 $this->DbLogin = trim(ConvertUtils::WMBackHtmlSpecialChars($node->Value));
                 break;
             case 'DBPassword':
                 $this->DbPassword = trim(ConvertUtils::WMBackHtmlSpecialChars($node->Value));
                 break;
             case 'DBName':
                 $this->DbName = trim(ConvertUtils::WMBackHtmlSpecialChars($node->Value));
                 break;
             case 'UseDsn':
                 $this->UseDsn = (bool) $node->Value;
             case 'DBDSN':
                 $this->DbDsn = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DBHost':
                 $this->DbHost = trim(ConvertUtils::WMBackHtmlSpecialChars($node->Value));
                 break;
             case 'UseCustomConnectionString':
                 $this->UseCustomConnectionString = (bool) $node->Value;
                 break;
             case 'DBCustomConnectionString':
                 $this->DbCustomConnectionString = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DBPrefix':
                 $this->DbPrefix = ConvertUtils::ClearPrefix(ConvertUtils::WMBackHtmlSpecialChars($node->Value));
                 break;
             case 'IncomingMailProtocol':
                 $this->IncomingMailProtocol = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'IncomingMailServer':
                 $this->IncomingMailServer = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'IncomingMailPort':
                 $this->IncomingMailPort = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'OutgoingMailServer':
                 $this->OutgoingMailServer = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'OutgoingMailPort':
                 $this->OutgoingMailPort = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'ReqSmtpAuth':
                 $this->ReqSmtpAuth = (bool) $node->Value;
                 break;
             case 'AllowAdvancedLogin':
                 $this->AllowAdvancedLogin = (bool) $node->Value;
                 break;
             case 'HideLoginMode':
                 $this->HideLoginMode = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DefaultDomainOptional':
                 $this->DefaultDomainOptional = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'UseMultipleDomainsSelection':
                 $this->UseMultipleDomainsSelection = (bool) $node->Value;
                 break;
             case 'UseCaptcha':
                 $this->UseCaptcha = (bool) $node->Value;
                 break;
             case 'ShowTextLabels':
                 $this->ShowTextLabels = (bool) $node->Value;
                 break;
             case 'AutomaticCorrectLoginSettings':
                 $this->AutomaticCorrectLoginSettings = (bool) $node->Value;
                 break;
             case 'EnableLogging':
                 $this->EnableLogging = (bool) (0 < (int) $node->Value);
                 $this->LoggingSpecialUsers = (bool) (2 === (int) $node->Value);
                 break;
             case 'LogLevel':
                 $this->LogLevel = (int) $node->Value;
                 break;
             case 'EnableEventsLogging':
                 $this->EnableEventsLogging = (bool) $node->Value;
                 break;
             case 'DisableErrorHandling':
                 $this->DisableErrorHandling = (bool) $node->Value;
                 break;
             case 'AllowAjax':
                 $this->AllowAjax = true;
                 break;
             case 'MailsPerPage':
                 $this->MailsPerPage = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'EnableAttachmentSizeLimit':
                 $this->EnableAttachmentSizeLimit = (bool) $node->Value;
                 break;
             case 'AttachmentSizeLimit':
                 $this->AttachmentSizeLimit = GetGoodBigInt(ConvertUtils::WMBackHtmlSpecialChars($node->Value));
                 break;
             case 'EnableMailboxSizeLimit':
                 $this->EnableMailboxSizeLimit = (bool) $node->Value;
                 break;
             case 'MailboxSizeLimit':
                 $this->MailboxSizeLimit = GetGoodBigInt(ConvertUtils::WMBackHtmlSpecialChars($node->Value));
                 break;
             case 'TakeImapQuota':
                 $this->TakeImapQuota = (bool) $node->Value;
                 break;
             case 'AllowUsersChangeTimeZone':
                 $this->AllowUsersChangeTimeZone = (bool) $node->Value;
                 break;
             case 'DefaultUserCharset':
                 $this->DefaultUserCharset = ConvertUtils::GetCodePageName($node->Value);
                 break;
             case 'AllowUsersChangeCharset':
                 $this->AllowUsersChangeCharset = (bool) ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DefaultSkin':
                 $this->DefaultSkin = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'AllowUsersChangeSkin':
                 $this->AllowUsersChangeSkin = (bool) $node->Value;
                 break;
             case 'DefaultLanguage':
                 $this->DefaultLanguage = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'AllowUsersChangeLanguage':
                 $this->AllowUsersChangeLanguage = (bool) $node->Value;
                 break;
             case 'AllowDHTMLEditor':
                 $this->AllowDhtmlEditor = (bool) $node->Value;
                 break;
             case 'AllowUsersChangeEmailSettings':
                 $this->AllowUsersChangeEmailSettings = (bool) $node->Value;
                 break;
             case 'AllowDirectMode':
                 $this->AllowDirectMode = (bool) $node->Value;
                 break;
             case 'DirectModeIsDefault':
                 $this->DirectModeIsDefault = (bool) $node->Value;
                 break;
             case 'AllowNewUsersRegister':
                 $this->AllowNewUsersRegister = true;
                 break;
             case 'AllowUsersAddNewAccounts':
                 $this->AllowUsersAddNewAccounts = false;
                 break;
             case 'AllowUsersChangeAccountsDef':
                 $this->AllowUsersChangeAccountsDef = (bool) $node->Value;
                 break;
             case 'StoreMailsInDb':
                 $this->StoreMailsInDb = (bool) $node->Value;
                 break;
             case 'Imap4DeleteLikePop3':
                 $this->Imap4DeleteLikePop3 = (bool) $node->Value;
                 break;
             case 'EnableWmServer':
                 $this->EnableWmServer = (bool) $node->Value;
                 break;
             case 'WmServerRootPath':
                 $this->WmServerRootPath = rtrim(ConvertUtils::WMBackHtmlSpecialChars($node->Value), '\\/');
                 break;
             case 'WmServerHost':
                 $this->WmServerHost = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'WmAllowManageXMailAccounts':
                 $this->WmAllowManageXMailAccounts = (bool) $node->Value;
                 break;
             case 'AllowContacts':
                 $this->AllowContacts = (bool) $node->Value;
                 break;
             case 'AllowCalendar':
                 $this->AllowCalendar = false;
                 break;
             case 'DefaultTimeZone':
                 if ($xmlTree->TagName == 'Calendar') {
                     $this->Cal_DefaultTimeZone = (int) $node->Value;
                 } else {
                     $this->DefaultTimeZone = (int) $node->Value;
                 }
                 break;
             case 'DefaultTimeFormat':
                 $this->Cal_DefaultTimeFormat = (int) $node->Value;
                 break;
             case 'DefaultDateFormat':
                 $this->Cal_DefaultDateFormat = (int) $node->Value;
                 break;
             case 'ShowWeekends':
                 $this->Cal_ShowWeekends = (int) $node->Value;
                 break;
             case 'WorkdayStarts':
                 $this->Cal_WorkdayStarts = (int) $node->Value;
                 break;
             case 'WorkdayEnds':
                 $this->Cal_WorkdayEnds = (int) $node->Value;
                 break;
             case 'ShowWorkDay':
                 $this->Cal_ShowWorkDay = (int) $node->Value;
                 break;
             case 'WeekStartsOn':
                 $this->Cal_WeekStartsOn = (int) $node->Value;
                 break;
             case 'DefaultTab':
                 $this->Cal_DefaultTab = (int) $node->Value;
                 break;
             case 'DefaultCountry':
                 $this->Cal_DefaultCountry = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'AllTimeZones':
                 $this->Cal_AllTimeZones = (int) $node->Value;
                 break;
             case 'AllowReminders':
                 $this->Cal_AllowReminders = (bool) $node->Value;
                 break;
             case 'AutoAddInvitation':
                 $this->Cal_AutoAddInvitation = (int) $node->Value;
                 break;
             case 'AllowLanguageOnLogin':
                 $this->AllowLanguageOnLogin = (bool) $node->Value;
                 break;
             case 'IdleSessionTimeout':
                 $this->IdleSessionTimeout = (int) $node->Value;
                 break;
             case 'AllowInsertImage':
                 $this->AllowInsertImage = (bool) $node->Value;
                 break;
             case 'AllowBodySize':
                 $this->AllowBodySize = (bool) $node->Value;
                 break;
             case 'MaxBodySize':
                 $this->MaxBodySize = (int) $node->Value;
                 break;
             case 'MaxSubjectSize':
                 $this->MaxSubjectSize = (int) $node->Value;
                 break;
             case 'AllowRegistration':
                 $this->AllowRegistration = (int) $node->Value;
                 break;
             case 'AllowPasswordReset':
                 $this->AllowPasswordReset = (int) $node->Value;
                 break;
             case 'GlobalAddressBook':
                 $this->GlobalAddressBook = GLOBAL_ADDRESS_BOOK_OFF;
                 break;
             case 'EnableMobileSync':
                 $this->EnableMobileSync = (bool) $node->Value;
                 break;
             case 'MobileSyncUrl':
                 $this->MobileSyncUrl = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'MobileSyncContactDataBase':
                 $this->MobileSyncContactDataBase = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'MobileSyncCalendarDataBase':
                 $this->MobileSyncCalendarDataBase = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'FlagsLangSelect':
                 $this->FlagsLangSelect = (bool) $node->Value;
                 break;
             case 'ViewMode':
                 $this->ViewMode = (int) $node->Value;
                 break;
             case 'SaveInSent':
                 $this->SaveInSent = (int) $node->Value;
                 break;
             case 'Dev':
                 $this->Dev = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
         }
     }
 }
 /**
  * @param Account $account
  * @param int $userId
  * @return bool
  */
 function SelectSetings(&$account, $userId)
 {
     if (!$this->_dbConnection->Execute($this->_commandCreator->SelectSetings($userId))) {
         return false;
     }
     while ($row = $this->_dbConnection->GetNextRecord()) {
         $account->IdUser = $row->id_user;
         $account->HideContacts = $row->hide_contacts;
         $account->MailsPerPage = $row->msgs_per_page;
         $account->Delimiter = $row->delimiter;
         $account->WhiteListing = $row->white_listing;
         $account->XSpam = $row->x_spam;
         $account->LastLogin = $row->last_login;
         $account->LoginsCount = $row->logins_count;
         $account->DefaultSkin = $row->def_skin;
         $account->DefaultLanguage = $row->def_lang;
         $account->DefaultIncCharset = ConvertUtils::GetCodePageName($row->def_charset_inc);
         $account->DefaultOutCharset = ConvertUtils::GetCodePageName($row->def_charset_out);
         $account->DefaultTimeZone = $row->def_timezone;
         $account->DefaultDateFormat = $row->def_date_fmt;
         $account->HideFolders = $row->hide_folders;
         $account->MailboxLimit = $row->mailbox_limit;
         $account->MailboxSize = $row->mailbox_size;
         $account->AllowChangeSettings = $row->allow_change_settings;
         $account->AllowDhtmlEditor = $row->allow_dhtml_editor;
         $account->AllowDirectMode = $row->allow_direct_mode;
         $account->DbCharset = ConvertUtils::GetCodePageName($row->db_charset);
         $account->HorizResizer = $row->horiz_resizer;
         $account->VertResizer = $row->vert_resizer;
         $account->Mark = $row->mark;
         $account->Reply = $row->reply;
         $account->ContactsPerPage = $row->contacts_per_page;
         $account->ViewMode = $row->view_mode;
     }
     return true;
 }
 function DoGetMessage()
 {
     $_dbStorage = $_settings = $_xmlObj = $_xmlRes = $_accountId = null;
     $this->_initFuncArgs($_dbStorage, $_settings, $_xmlObj, $_xmlRes, $_accountId);
     $_account =& CXmlProcessing::AccountCheckAndLoad($_xmlRes, $_accountId, true, false);
     $_charsetNum = $_xmlObj->GetParamValueByName('charset');
     if ($_charsetNum > 0) {
         $_account->DefaultIncCharset = ConvertUtils::GetCodePageName($_charsetNum);
         $GLOBALS[MailInputCharset] = $_account->DefaultIncCharset;
         $_account->UpdateDefaultIncCharset();
     }
     $_processor = new MailProcessor($_account);
     $_folderNodeRequest =& $_xmlObj->XmlRoot->GetChildNodeByTagName('folder');
     $_folder = null;
     if (isset($_folderNodeRequest->Attributes['id'])) {
         $_folder = new Folder($_accountId, $_folderNodeRequest->Attributes['id'], $_folderNodeRequest->GetChildValueByTagName('full_name'));
         $_processor->GetFolderInfo($_folder);
         if (!$_folder || $_folder->IdDb < 1) {
             CXmlProcessing::PrintErrorAndExit(WebMailException, $_xmlRes);
         }
     } else {
         CXmlProcessing::PrintErrorAndExit(WebMailException, $_xmlRes);
     }
     $_msgId = $_xmlObj->GetParamValueByName('id');
     $_msgUid = $_xmlObj->GetParamTagValueByName('uid');
     $_msgSize = $_xmlObj->GetParamValueByName('size');
     $_msgIdUid = array($_msgId => $_msgUid);
     $_mode = (int) $_xmlObj->GetParamValueByName('mode');
     $_modeForGet = $_mode;
     if (empty($_msgSize) || (int) $_msgSize < BODYSTRUCTURE_MGSSIZE_LIMIT || $_folder && FOLDERTYPE_Drafts == $_folder->Type || (($_mode & 8) == 8 || ($_mode & 16) == 16 || ($_mode & 32) == 32 || ($_mode & 64) == 64)) {
         $_modeForGet = null;
     }
     $_message = null;
     $_message =& $_processor->GetMessage($_msgId, $_msgUid, $_folder, $_modeForGet);
     if (null != $_message) {
         if (($_message->Flags & MESSAGEFLAGS_Seen) != MESSAGEFLAGS_Seen) {
             $_processor->SetFlag($_msgIdUid, $_folder, MESSAGEFLAGS_Seen, ACTION_Set);
         }
         $_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($_msgId, $_charsetNum, $_message);
             }
         }
         CXmlProcessing::GetMessageNode($_xmlRes, $_message, $_folder, $_processor, $_account, $_settings, $_mode, $_charsetNum, $_isFromSave);
     } else {
         CXmlProcessing::PrintErrorAndExit(getGlobalError(), $_xmlRes);
     }
 }
Exemple #7
0
 define('JS_VERS', ConvertUtils::GetJsVersion());
 header('Content-type: text/html; charset=utf-8');
 header('Content-script-type: text/javascript');
 header('Pragma: cache');
 header('Cache-control: public');
 if ($openMode == 'view') {
     require_once WM_ROOTPATH . 'common/class_mailprocessor.php';
     $mes_id = isset($_GET['msg_id']) ? (int) $_GET['msg_id'] : -1;
     $mes_uid = isset($_GET['msg_uid']) ? $_GET['msg_uid'] : '';
     $folder_id = isset($_GET['folder_id']) ? (int) $_GET['folder_id'] : -1;
     $folder_name = isset($_GET['folder_full_name']) ? $_GET['folder_full_name'] : '';
     $mes_charset = isset($_GET['charset']) ? (int) $_GET['charset'] : -1;
     $msgSize = isset($_GET['size']) ? (int) $_GET['size'] : 0;
     $mode = isset($_GET['mode']) ? (int) $_GET['mode'] : 0;
     if ($mes_charset > 0) {
         $account->DefaultIncCharset = ConvertUtils::GetCodePageName($mes_charset);
         $GLOBALS[MailInputCharset] = $_account->DefaultIncCharset;
         $account->UpdateDefaultIncCharset();
     }
     $processor = new MailProcessor($account);
     $folder = null;
     if (!empty($folder_id) && !empty($folder_name)) {
         $folder = new Folder($account->Id, $folder_id, $folder_name);
         $processor->GetFolderInfo($folder);
         if (!$folder || $folder->IdDb < 1) {
             ///!!!!
         }
     } else {
         ///!!!!
     }
     $msgIdUid = array($mes_id => $mes_uid);
 /**
  * @access private
  * @param XmlDomNode $xmlTree
  */
 function _loadFromXML(&$xmlTree)
 {
     foreach ($xmlTree->Children as $node) {
         switch ($node->TagName) {
             case 'Common':
             case 'WebMail':
             case 'Calendar':
                 if (count($node->Children) > 0) {
                     $this->_loadFromXML($node);
                 }
                 break;
             case 'SiteName':
                 $this->WindowTitle = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'WindowTitle':
                 $this->WindowTitle = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'AdminPassword':
                 $this->AdminPassword = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DBType':
                 $this->DbType = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DBLogin':
                 $this->DbLogin = trim(ConvertUtils::WMBackHtmlSpecialChars($node->Value));
                 break;
             case 'DBPassword':
                 $this->DbPassword = trim(ConvertUtils::WMBackHtmlSpecialChars($node->Value));
                 break;
             case 'DBName':
                 $this->DbName = trim(ConvertUtils::WMBackHtmlSpecialChars($node->Value));
                 break;
             case 'DBDSN':
                 $this->DbDsn = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DBHost':
                 $this->DbHost = trim(ConvertUtils::WMBackHtmlSpecialChars($node->Value));
                 break;
             case 'UseCustomConnectionString':
                 $this->UseCustomConnectionString = (bool) $node->Value;
                 break;
             case 'DBCustomConnectionString':
                 $this->DbCustomConnectionString = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DBPrefix':
                 $this->DbPrefix = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'IncomingMailProtocol':
                 $this->IncomingMailProtocol = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'IncomingMailServer':
                 $this->IncomingMailServer = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'IncomingMailPort':
                 $this->IncomingMailPort = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'OutgoingMailServer':
                 $this->OutgoingMailServer = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'OutgoingMailPort':
                 $this->OutgoingMailPort = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'ReqSmtpAuth':
                 $this->ReqSmtpAuth = (bool) $node->Value;
                 break;
             case 'AllowAdvancedLogin':
                 $this->AllowAdvancedLogin = (bool) $node->Value;
                 break;
             case 'HideLoginMode':
                 $this->HideLoginMode = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DefaultDomainOptional':
                 $this->DefaultDomainOptional = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'ShowTextLabels':
                 $this->ShowTextLabels = (bool) $node->Value;
                 break;
             case 'AutomaticCorrectLoginSettings':
                 $this->AutomaticCorrectLoginSettings = (bool) $node->Value;
                 break;
             case 'EnableLogging':
                 $this->EnableLogging = (bool) $node->Value;
                 break;
             case 'DisableErrorHandling':
                 $this->DisableErrorHandling = (bool) $node->Value;
                 break;
             case 'AllowAjax':
                 $this->AllowAjax = (bool) $node->Value;
                 break;
             case 'MailsPerPage':
                 $this->MailsPerPage = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'EnableAttachmentSizeLimit':
                 $this->EnableAttachmentSizeLimit = (bool) $node->Value;
                 break;
             case 'AttachmentSizeLimit':
                 $this->AttachmentSizeLimit = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'EnableMailboxSizeLimit':
                 $this->EnableMailboxSizeLimit = (bool) $node->Value;
                 break;
             case 'MailboxSizeLimit':
                 $this->MailboxSizeLimit = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'AllowUsersChangeTimeZone':
                 $this->AllowUsersChangeTimeZone = (bool) $node->Value;
                 break;
             case 'DefaultUserCharset':
                 $this->DefaultUserCharset = ConvertUtils::GetCodePageName($node->Value);
                 break;
             case 'AllowUsersChangeCharset':
                 $this->AllowUsersChangeCharset = (bool) ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'DefaultSkin':
                 $this->DefaultSkin = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'AllowUsersChangeSkin':
                 $this->AllowUsersChangeSkin = (bool) $node->Value;
                 break;
             case 'DefaultLanguage':
                 $this->DefaultLanguage = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'AllowUsersChangeLanguage':
                 $this->AllowUsersChangeLanguage = (bool) $node->Value;
                 break;
             case 'AllowDHTMLEditor':
                 $this->AllowDhtmlEditor = (bool) $node->Value;
                 break;
             case 'AllowUsersChangeEmailSettings':
                 $this->AllowUsersChangeEmailSettings = (bool) $node->Value;
                 break;
             case 'AllowDirectMode':
                 $this->AllowDirectMode = (bool) $node->Value;
                 break;
             case 'DirectModeIsDefault':
                 $this->DirectModeIsDefault = (bool) $node->Value;
                 break;
             case 'AllowNewUsersRegister':
                 $this->AllowNewUsersRegister = (bool) $node->Value;
                 break;
             case 'AllowUsersAddNewAccounts':
                 $this->AllowUsersAddNewAccounts = (bool) $node->Value;
                 break;
             case 'StoreMailsInDb':
                 $this->StoreMailsInDb = (bool) $node->Value;
                 break;
             case 'EnableWmServer':
                 $this->EnableWmServer = (bool) $node->Value;
                 break;
             case 'WmServerRootPath':
                 $this->WmServerRootPath = rtrim(ConvertUtils::WMBackHtmlSpecialChars($node->Value), '\\/');
                 break;
             case 'WmServerHost':
                 $this->WmServerHost = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'WmAllowManageXMailAccounts':
                 $this->WmAllowManageXMailAccounts = (bool) $node->Value;
                 break;
             case 'AllowContacts':
                 $this->AllowContacts = (bool) $node->Value;
                 break;
             case 'AllowCalendar':
                 $this->AllowCalendar = (bool) $node->Value;
                 break;
             case 'DefaultTimeZone':
                 if ($xmlTree->TagName == 'Calendar') {
                     $this->Cal_DefaultTimeZone = (int) $node->Value;
                 } else {
                     $this->DefaultTimeZone = (int) $node->Value;
                 }
                 break;
             case 'DefaultTimeFormat':
                 $this->Cal_DefaultTimeFormat = (int) $node->Value;
                 break;
             case 'DefaultDateFormat':
                 $this->Cal_DefaultDateFormat = (int) $node->Value;
                 break;
             case 'ShowWeekends':
                 $this->Cal_ShowWeekends = (int) $node->Value;
                 break;
             case 'WorkdayStarts':
                 $this->Cal_WorkdayStarts = (int) $node->Value;
                 break;
             case 'WorkdayEnds':
                 $this->Cal_WorkdayEnds = (int) $node->Value;
                 break;
             case 'ShowWorkDay':
                 $this->Cal_ShowWorkDay = (int) $node->Value;
                 break;
             case 'WeekStartsOn':
                 $this->Cal_WeekStartsOn = (int) $node->Value;
                 break;
             case 'DefaultTab':
                 $this->Cal_DefaultTab = (int) $node->Value;
                 break;
             case 'DefaultCountry':
                 $this->Cal_DefaultCountry = ConvertUtils::WMBackHtmlSpecialChars($node->Value);
                 break;
             case 'AllTimeZones':
                 $this->Cal_AllTimeZones = (int) $node->Value;
                 break;
         }
     }
 }