Ejemplo n.º 1
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 = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'WindowTitle':
                 $this->WindowTitle = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'LicenseKey':
                 $this->LicenseKey = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'AdminPassword':
                 $this->AdminPassword = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'DBType':
                 $this->DbType = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'DBLogin':
                 $this->DbLogin = trim(ap_Utils::DecodeSpecialXmlChars($node->Value));
                 break;
             case 'DBPassword':
                 $this->DbPassword = trim(ap_Utils::DecodeSpecialXmlChars($node->Value));
                 break;
             case 'DBName':
                 $this->DbName = trim(ap_Utils::DecodeSpecialXmlChars($node->Value));
                 break;
             case 'UseDsn':
                 $this->UseDsn = (bool) $node->Value;
                 break;
             case 'DBDSN':
                 $this->DbDsn = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'DBHost':
                 $this->DbHost = trim(ap_Utils::DecodeSpecialXmlChars($node->Value));
                 break;
             case 'UseCustomConnectionString':
                 $this->UseCustomConnectionString = (bool) $node->Value;
                 break;
             case 'DBCustomConnectionString':
                 $this->DbCustomConnectionString = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'DBPrefix':
                 $this->DbPrefix = ap_Utils::ClearPrefix(ap_Utils::DecodeSpecialXmlChars($node->Value));
                 break;
             case 'IncomingMailProtocol':
                 $this->IncomingMailProtocol = (int) $node->Value;
                 break;
             case 'IncomingMailServer':
                 $this->IncomingMailServer = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'IncomingMailPort':
                 $this->IncomingMailPort = (int) $node->Value;
                 break;
             case 'OutgoingMailServer':
                 $this->OutgoingMailServer = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'OutgoingMailPort':
                 $this->OutgoingMailPort = (int) $node->Value;
                 break;
             case 'ReqSmtpAuth':
                 $this->ReqSmtpAuth = (bool) $node->Value;
                 break;
             case 'AllowAdvancedLogin':
                 $this->AllowAdvancedLogin = (bool) $node->Value;
                 break;
             case 'HideLoginMode':
                 $this->HideLoginMode = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'DefaultDomainOptional':
                 $this->DefaultDomainOptional = ap_Utils::DecodeSpecialXmlChars($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 = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'EnableAttachmentSizeLimit':
                 $this->EnableAttachmentSizeLimit = (bool) $node->Value;
                 break;
             case 'AttachmentSizeLimit':
                 $this->AttachmentSizeLimit = GetGoodBigInt(ap_Utils::DecodeSpecialXmlChars($node->Value));
                 break;
             case 'EnableMailboxSizeLimit':
                 $this->EnableMailboxSizeLimit = (bool) $node->Value;
                 break;
             case 'MailboxSizeLimit':
                 $this->MailboxSizeLimit = GetGoodBigInt(ap_Utils::DecodeSpecialXmlChars($node->Value));
                 break;
             case 'TakeImapQuota':
                 $this->TakeImapQuota = (bool) $node->Value;
                 break;
             case 'AllowUsersChangeTimeZone':
                 $this->AllowUsersChangeTimeZone = (bool) $node->Value;
                 break;
             case 'DefaultUserCharset':
                 $this->DefaultUserCharset = CWebMail_Plugin::GetCodePageName($node->Value);
                 break;
             case 'AllowUsersChangeCharset':
                 $this->AllowUsersChangeCharset = (bool) $node->Value;
                 break;
             case 'DefaultSkin':
                 $this->DefaultSkin = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'AllowUsersChangeSkin':
                 $this->AllowUsersChangeSkin = (bool) $node->Value;
                 break;
             case 'DefaultLanguage':
                 $this->DefaultLanguage = ap_Utils::DecodeSpecialXmlChars($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 '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(ap_Utils::DecodeSpecialXmlChars($node->Value), '\\/');
                 break;
             case 'WmServerHost':
                 $this->WmServerHost = ap_Utils::DecodeSpecialXmlChars($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 = ap_Utils::DecodeSpecialXmlChars($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 = $node->Value;
                 break;
             case 'EnableMobileSync':
                 $this->EnableMobileSync = (bool) $node->Value;
                 break;
             case 'MobileSyncUrl':
                 $this->MobileSyncUrl = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'MobileSyncContactDataBase':
                 $this->MobileSyncContactDataBase = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
             case 'MobileSyncCalendarDataBase':
                 $this->MobileSyncCalendarDataBase = ap_Utils::DecodeSpecialXmlChars($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 = ap_Utils::DecodeSpecialXmlChars($node->Value);
                 break;
         }
     }
 }
Ejemplo n.º 2
0
 function UpdateSettings(&$settings)
 {
     if (!$settings) {
         return false;
     }
     $settings->WindowTitle = $this->GetSettingsValue('site_name');
     $settings->IncomingMailProtocol = (int) $this->GetSettingsValue('settings_mail_protocol');
     $settings->IncomingMailServer = $this->GetSettingsValue('settings_mail_inc_host');
     $settings->IncomingMailPort = (int) $this->GetSettingsValue('settings_mail_inc_port');
     $settings->OutgoingMailServer = $this->GetSettingsValue('settings_mail_out_host');
     $settings->OutgoingMailPort = (int) $this->GetSettingsValue('settings_mail_out_port');
     $settings->ReqSmtpAuth = (bool) $this->GetSettingsValue('settings_mail_out_auth');
     $settings->AllowDirectMode = (bool) $this->GetSettingsValue('allow_direct_mode');
     $settings->DirectModeIsDefault = (bool) $this->GetSettingsValue('direct_mode_id_def');
     $settings->AttachmentSizeLimit = (int) $this->GetSettingsValue('attachment_size_limit');
     $settings->EnableAttachmentSizeLimit = (bool) $this->GetSettingsValue('allow_attachment_limit');
     $settings->MailboxSizeLimit = (int) $this->GetSettingsValue('mailbox_size_limit');
     $settings->EnableMailboxSizeLimit = (bool) $this->GetSettingsValue('allow_mailbox_limit');
     $settings->TakeImapQuota = (bool) $this->GetSettingsValue('take_quota');
     $settings->AllowUsersChangeEmailSettings = (bool) $this->GetSettingsValue('allow_new_users_change_set');
     $settings->AllowNewUsersRegister = (bool) $this->GetSettingsValue('allow_auto_reg_on_login');
     $settings->AllowUsersAddNewAccounts = (bool) $this->GetSettingsValue('allow_users_add_accounts');
     $settings->AllowUsersChangeAccountsDef = (bool) $this->GetSettingsValue('allow_users_change_account_def');
     $settings->DefaultUserCharset = CWebMail_Plugin::GetCodePageName((int) $this->GetSettingsValue('def_user_charset'));
     $settings->AllowUsersChangeCharset = (bool) $this->GetSettingsValue('allow_users_change_charset');
     $settings->DefaultTimeZone = (int) $this->GetSettingsValue('def_user_timezone');
     $settings->AllowUsersChangeTimeZone = (bool) $this->GetSettingsValue('allow_users_change_timezone');
     $settings->MailsPerPage = (int) $this->GetSettingsValue('msgs_per_page');
     $settings->DefaultSkin = $this->GetSettingsValue('skin');
     $settings->AllowUsersChangeSkin = (bool) $this->GetSettingsValue('allow_users_change_skin');
     $settings->DefaultLanguage = $this->GetSettingsValue('lang');
     $settings->AllowUsersChangeLanguage = (bool) $this->GetSettingsValue('allow_users_change_lang');
     $settings->ShowTextLabels = (bool) $this->GetSettingsValue('show_text_labels');
     $settings->AllowAjax = true;
     $settings->AllowDhtmlEditor = (bool) $this->GetSettingsValue('allow_editor');
     $settings->AllowContacts = (bool) $this->GetSettingsValue('allow_contacts');
     $settings->AllowCalendar = (bool) $this->GetSettingsValue('allow_calendar');
     $settings->HideLoginMode = (int) $this->GetSettingsValue('hide_login_mode');
     $settings->DefaultDomainOptional = $this->GetSettingsValue('domain_to_use');
     $settings->AllowLanguageOnLogin = (bool) $this->GetSettingsValue('allow_choosing_lang');
     $settings->AllowAdvancedLogin = (bool) $this->GetSettingsValue('allow_advanced_login');
     $settings->AutomaticCorrectLoginSettings = (bool) $this->GetSettingsValue('allow_auto_detect_and_correct');
     $settings->UseCaptcha = (bool) $this->GetSettingsValue('use_captcha');
     $settings->UseMultipleDomainsSelection = (bool) $this->GetSettingsValue('use_domain_selection');
     $settings->ViewMode = (int) $this->GetSettingsValue('view_mode');
     $settings->SaveInSent = (int) $this->GetSettingsValue('save_mail');
 }