Beispiel #1
0
 /**
  * @param	string	$tagName
  * @return	string
  */
 function GetChildValueByTagName($tagName)
 {
     $node =& $this->GetChildNodeByTagName($tagName);
     if ($node != null) {
         return ap_Utils::DecodeSpecialXmlChars($node->Value);
     }
     return '';
 }
Beispiel #2
0
 function _initSettings()
 {
     $_path = $this->GetCfg('adminpanel_data_path');
     $_xml = new XmlDocument();
     if ($_path === false || !@file_exists($_path . '/settings/' . AP_XML_CFG_FILE)) {
         $this->_ge(ap_Utils::TakePhrase('AP_LANG_FILE_ERROR_OCCURRED'));
         exit;
     }
     if ($_xml->LoadFromFile($_path . '/settings/' . AP_XML_CFG_FILE)) {
         $_advanced_options =& $_xml->XmlRoot->GetChildNodeByTagName('advancedoptions');
         if ($_advanced_options) {
             $this->_cfg['advancedoptions'] = (bool) $_advanced_options->Value;
         }
         $_license_node =& $_xml->XmlRoot->GetChildNodeByTagName('licensekey');
         if ($_license_node) {
             $this->_cfg[AP_TEST_P] = trim(ap_Utils::DecodeSpecialXmlChars($_license_node->Value));
         }
         $_plugins =& $_xml->XmlRoot->GetChildNodeByTagName('plugins');
         if ($_plugins) {
             $this->_cfg['plugins'] = array();
             if (!$_plugins->Children) {
                 $_plugins->Children = array();
             }
             foreach ($_plugins->Children as $_node) {
                 if ($_node->TagName == 'plugin') {
                     $_ipath = CAdminPanel::RootPath() . '/plugins/' . trim($_node->Value) . '/index.php';
                     if (@file_exists($_ipath)) {
                         $this->_cfg['plugins'][] = trim(ap_Utils::DecodeSpecialXmlChars($_node->Value));
                     }
                 }
             }
             if (@file_exists(CAdminPanel::RootPath() . '/plugins/common/index.php')) {
                 $this->_cfg['plugins'][] = 'common';
             }
         }
         $_login_node =& $_xml->XmlRoot->GetChildNodeByTagName('login');
         if ($_login_node && $_login_node->Children && is_array($_login_node->Children)) {
             foreach ($_login_node->Children as $_node) {
                 $this->_cfg['login'][trim($_node->TagName)] = trim(ap_Utils::DecodeSpecialXmlChars($_node->Value));
             }
         }
         $_resp = $this->ValidateCfg($this->_cfg);
         if ($_resp !== true) {
             $this->_ge($_resp);
         }
     }
 }
Beispiel #3
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;
         }
     }
 }