Example #1
0
 public function SystemLogging()
 {
     if (isset($_POST['btnClearLog']) || isset($_POST['btnUserActivityClearLog'])) {
         /* @var $oApiLoggerManager CApiLoggerManager */
         $oApiLoggerManager = CApi::Manager('logger');
         $bResult = false;
         if (isset($_POST['btnClearLog'])) {
             $bResult = $oApiLoggerManager->DeleteCurrentLog();
         } else {
             $bResult = $oApiLoggerManager->DeleteCurrentUserActivityLog();
         }
         if ($bResult) {
             $this->LastMessage = WM_INFO_LOGCLEARSUCCESSFUL;
         } else {
             $this->LastError = AP_LANG_ERROR;
         }
     } else {
         if ($this->isStandartSubmit()) {
             $this->oSettings->SetConf('Common/EnableLogging', CPost::GetCheckBox('ch_EnableDebugLogging'));
             $this->oSettings->SetConf('Common/EnableEventLogging', CPost::GetCheckBox('ch_EnableUserActivityLogging'));
             $this->oSettings->SetConf('Common/LoggingLevel', EnumConvert::FromPost(CPost::Get('selVerbosity', ''), 'ELogLevel'));
             $this->checkBolleanWithMessage($this->oSettings->SaveToXml());
         }
     }
 }
Example #2
0
 protected function initUpdateDomainByPost(CDomain &$oDomain)
 {
     $oDomain->OverrideSettings = CPost::GetCheckBox('chOverrideSettings');
     if (CPost::Has('txtIncomingMailHost') && CPost::Has('txtOutgoingMailHost') && CPost::Has('txtIncomingMailPort') && CPost::Has('txtOutgoingMailPort')) {
         $oDomain->IncomingMailServer = CPost::get('txtIncomingMailHost');
         $oDomain->IncomingMailPort = CPost::get('txtIncomingMailPort');
         $oDomain->IncomingMailUseSSL = CPost::GetCheckBox('chIncomingUseSSL');
         $oDomain->OutgoingMailServer = CPost::get('txtOutgoingMailHost');
         $oDomain->OutgoingMailPort = CPost::get('txtOutgoingMailPort');
         $oDomain->OutgoingMailUseSSL = CPost::GetCheckBox('chOutgoingUseSSL');
     }
     if (CPost::Has('radioAuthType')) {
         $oDomain->OutgoingMailAuth = EnumConvert::FromPost(CPost::get('radioAuthType'), 'ESMTPAuthType');
     }
     if (CPost::Has('txtOutgoingMailLogin') && CPost::Has('txtOutgoingMailPassword')) {
         $oDomain->OutgoingMailLogin = CPost::get('txtOutgoingMailLogin');
         if ((string) AP_DUMMYPASSWORD !== (string) CPost::get('txtOutgoingMailPassword')) {
             $oDomain->OutgoingMailPassword = CPost::get('txtOutgoingMailPassword', '');
         }
     }
     if (CPost::Has('selIncomingMailProtocol')) {
         $oDomain->IncomingMailProtocol = EnumConvert::FromPost(CPost::get('selIncomingMailProtocol'), 'EMailProtocol');
     }
     //		if ($oDomain->OverrideSettings || $oDomain->IsDefaultDomain)
     //		{
     //			$oDomain->ExternalHostNameOfDAVServer = CPost::Get('txtExternalHostNameOfDAVServer', $oDomain->ExternalHostNameOfDAVServer);
     //			$oDomain->ExternalHostNameOfLocalImap = CPost::Get('txtExternalHostNameOfLocalImap', $oDomain->ExternalHostNameOfLocalImap);
     //			$oDomain->ExternalHostNameOfLocalSmtp = CPost::Get('txtExternalHostNameOfLocalSmtp', $oDomain->ExternalHostNameOfLocalSmtp);
     //		}
     if ($oDomain->OverrideSettings) {
         // General
         $oDomain->Url = (string) CPost::get('txtWebDomain', $oDomain->Url);
         $oDomain->AllowUsersChangeEmailSettings = CPost::GetCheckBox('chAllowUsersAccessAccountsSettings');
         $oDomain->AllowNewUsersRegister = !CPost::GetCheckBox('chAllowNewUsersRegister');
         // Webmail
         $oDomain->AllowWebMail = CPost::GetCheckBox('chEnableWebmail');
         $oDomain->MailsPerPage = CPost::get('selMessagesPerPage', $oDomain->MailsPerPage);
         $oDomain->AutoCheckMailInterval = CPost::get('selAutocheckMail', $oDomain->AutoCheckMailInterval);
         if (CPost::Has('radioLayout')) {
             $oDomain->Layout = EnumConvert::FromPost(CPost::get('radioLayout'), 'ELayout');
         }
         // Address Book
         $oDomain->AllowContacts = CPost::GetCheckBox('chEnableAddressBook');
         $oDomain->ContactsPerPage = CPost::get('selContactsPerPage', $oDomain->ContactsPerPage);
     }
 }
Example #3
0
 protected function initUpdateDomainByPost(CDomain &$oDomain)
 {
     $oDomain->OverrideSettings = 0 < $oDomain->IdTenant ? true : CPost::GetCheckBox('chOverrideSettings');
     if ($oDomain->OverrideSettings) {
         // Regional settings and domain branding (moved from "webmail" module)
         $oDomain->SiteName = CPost::get('txtSiteName', $oDomain->SiteName);
         $oDomain->AllowUsersChangeInterfaceSettings = CPost::GetCheckBox('chAllowUsersAccessInterfaveSettings');
         $sSelSkin = CPost::get('selSkin', '');
         if (!empty($sSelSkin)) {
             $aSkins = $this->oModule->GetSkinList();
             if (is_array($aSkins) && in_array($sSelSkin, $aSkins)) {
                 $oDomain->DefaultSkin = $sSelSkin;
             }
         }
         $sSelTab = CPost::get('selTab', '');
         if (!empty($sSelTab)) {
             $aTabs = $this->oModule->getTabList($oDomain);
             if (is_array($aTabs) && in_array($sSelTab, array_keys($aTabs))) {
                 $oDomain->DefaultTab = $sSelTab;
             }
         }
         $sSelLanguage = CPost::get('selLanguage', '');
         if (!empty($sSelLanguage)) {
             $aLangs = $this->oModule->GetLangsList();
             if (is_array($aLangs) && in_array($sSelLanguage, $aLangs)) {
                 $oDomain->DefaultLanguage = $sSelLanguage;
             }
         }
         $sSelTimeZone = CPost::get('selTimeZone', null);
         if (null !== $sSelTimeZone) {
             $aTimeZones = $this->oModule->GetTimeZoneList();
             if (is_array($aTimeZones) && isset($aTimeZones[(int) $sSelTimeZone])) {
                 $oDomain->DefaultTimeZone = $sSelTimeZone;
             }
         }
         if (CPost::Has('radioTimeFormat')) {
             $oDomain->DefaultTimeFormat = EnumConvert::FromPost(CPost::get('radioTimeFormat'), 'ETimeFormat');
         }
         if (CPost::Has('selDateformat')) {
             $oDomain->DefaultDateFormat = CPost::get('selDateformat');
         }
     }
 }
Example #4
0
 public function SystemDb()
 {
     if (CApi::GetConf('mailsuite', false)) {
         $this->oSettings->SetConf('Common/DBType', EDbType::MySQL);
     } else {
         $this->oSettings->SetConf('Common/DBType', EnumConvert::FromPost(CPost::Get('radioSqlType'), 'EDbType'));
     }
     if (CPost::Has('txtSqlLogin')) {
         $this->oSettings->SetConf('Common/DBLogin', CPost::Get('txtSqlLogin'));
     }
     if (CPost::Has('txtSqlPassword') && AP_DUMMYPASSWORD !== (string) CPost::Get('txtSqlPassword')) {
         $this->oSettings->SetConf('Common/DBPassword', CPost::Get('txtSqlPassword'));
     }
     if (CPost::Has('txtSqlName')) {
         $this->oSettings->SetConf('Common/DBName', CPost::Get('txtSqlName'));
     }
     if (CPost::Has('txtSqlSrc')) {
         $this->oSettings->SetConf('Common/DBHost', CPost::Get('txtSqlSrc'));
     }
     if (CPost::GetCheckBox('isTestConnection')) {
         CDbCreator::ClearStatic();
         $aConnections =& CDbCreator::CreateConnector($this->oSettings);
         $oConnect = $aConnections[0];
         if ($oConnect) {
             $this->LastError = AP_LANG_CONNECTUNSUCCESSFUL;
             try {
                 if ($oConnect->Connect()) {
                     $this->LastMessage = AP_LANG_CONNECTSUCCESSFUL;
                     $this->LastError = '';
                 }
             } catch (CApiDbException $oException) {
                 $this->LastError .= "\r\n" . $oException->getMessage() . ' (' . (int) $oException->getCode() . ')';
             }
         } else {
             $this->LastError = AP_LANG_CONNECTUNSUCCESSFUL;
         }
         $this->oSettings->SaveToXml();
     } else {
         $this->saveSettingsXmlWithMessage();
     }
     return '';
 }
Example #5
0
 public function CommonSocial()
 {
     $oApiCapa = CApi::Manager('capability');
     /* @var $oApiCapa CApiCapabilityManager */
     if ($oApiCapa) {
         $oTenant = $this->oModule->GetTenantAdminObject();
         if ($oTenant) {
             $aTenentSocials = array();
             foreach ($oTenant->getSocials() as $sKey => $oSocial) {
                 $oTenentSocial = new CTenantSocials();
                 $oTenentSocial->IdTenant = $oTenant->IdTenant;
                 $oTenentSocial->SocialAllow = CPost::GetCheckBox($sKey . '_chSocialAllow');
                 $oTenentSocial->SocialName = ucfirst($sKey);
                 $oTenentSocial->SocialId = CPost::get($sKey . '_txtSocialId');
                 $oTenentSocial->SocialSecret = CPost::get($sKey . '_txtSocialSecret');
                 $oTenentSocial->SocialApiKey = CPost::get($sKey . '_txtSocialApiKey');
                 $aScopes = CPost::get($sKey . '_chSocialScopes', array());
                 $oTenentSocial->SocialScopes = implode(' ', array_keys($aScopes));
                 $aTenentSocials[$sKey] = $oTenentSocial;
             }
             $oTenant->setSocials($aTenentSocials);
         }
         if ($oTenant && $this->oModule->UpdateTenantAdminObject($oTenant)) {
             $this->LastMessage = AP_LANG_SAVESUCCESSFUL;
             $this->LastError = '';
         } else {
             $this->LastMessage = '';
             $this->LastError = AP_LANG_SAVEUNSUCCESSFUL;
         }
     }
 }