Esempio n. 1
0
 public function TemplateValues()
 {
     $sFootError = '';
     if (CSession::Has('wm_install_pass_error')) {
         $sFootError = CSession::Get('wm_install_pass_error', '');
         CSession::Clear('wm_install_pass_error');
     }
     return array('Login' => $this->oSettings->GetConf('Common/AdminLogin'), 'Password1' => '', 'Password2' => '', 'FootError' => $sFootError);
 }
Esempio n. 2
0
 /**
  * @param CDomain $oDomain
  * @return bool
  */
 public function UpdateDomain(CDomain $oDomain)
 {
     if (!$this->oDomainsApi->UpdateDomain($oDomain)) {
         $this->lastErrorCode = $this->oDomainsApi->GetLastErrorCode();
         $this->lastErrorMessage = $this->oDomainsApi->GetLastErrorMessage();
         return false;
     }
     if (CSession::Has(AP_SESS_DOMAIN_NEXT_EDIT_ID) && $oDomain->IdDomain === CSession::Get(AP_SESS_DOMAIN_NEXT_EDIT_ID, null)) {
         CSession::Clear(AP_SESS_DOMAIN_NEXT_EDIT_ID);
     }
     return true;
 }
Esempio n. 3
0
 /**
  * @return void
  */
 protected function initAdminPanel()
 {
     $this->RType = (bool) CApi::GetConf('tenant', false);
     $this->AType = !!CApi::Manager('collaboration');
     $this->aTabsSort = array(AP_TAB_COMMON, AP_TAB_DOMAINS, AP_TAB_USERS, AP_TAB_TENANTS, AP_TAB_CHANNELS, AP_TAB_SYSTEM);
     $GLOBALS[AP_START_TIME] = ap_Utils::Microtime();
     $GLOBALS[AP_DB_COUNT] = 0;
     if (isset($_GET['logout'])) {
         CSession::ClearAll();
         CApi::Location(AP_INDEX_FILE . '?login');
     }
     if (isset($_GET['tab']) && strlen($_GET['tab']) > 0) {
         CSession::Set(AP_SESS_TAB, $_GET['tab']);
     } else {
         CSession::Set(AP_SESS_TAB, CSession::Get(AP_SESS_TAB, AP_TAB_DEFAULT));
     }
     $this->sTab = CSession::Get(AP_SESS_TAB, AP_TAB_DEFAULT);
     try {
         $this->CssAddFile('static/styles/style.css');
         $this->JsAddFile('static/js/common.js');
         $this->JsAddFile('static/js/jquery.js');
         if (!CApi::IsValid()) {
             return false;
         }
         $this->initModules();
         $this->initType();
         $this->initAuth();
         $this->sHelpUrl = '';
         $sUrl = $this->IsTenantAuthType() ? (string) CApi::GetConf('labs.custom-tenant-help-url', '') : (string) CApi::GetConf('labs.custom-admin-help-url', '');
         if (0 < strlen($sUrl)) {
             $this->sHelpUrl = $sUrl;
         } else {
             if ($this->AType) {
                 $this->sHelpUrl = 'http://www.afterlogic.com/wiki/Aurora_documentation';
             } else {
                 if ($this->PType) {
                     $this->sHelpUrl = 'http://www.afterlogic.com/wiki/WebMail_Pro_documentation';
                 } else {
                     $this->sHelpUrl = 'http://www.afterlogic.com/wiki/WebMail_Lite_documentation';
                 }
             }
         }
         if (isset($_GET['help'])) {
             if (0 < strlen($this->sHelpUrl)) {
                 CApi::Location($this->sHelpUrl);
             } else {
                 CApi::Location('?root');
             }
         }
         $bResetToDefault = true;
         foreach ($this->aTabs as $aTab) {
             if (isset($aTab[1]) && (string) $aTab[1] === (string) $this->sTab) {
                 $bResetToDefault = false;
                 break;
             }
         }
         if ($bResetToDefault) {
             $this->sTab = $this->IsTenantAuthType() ? AP_TAB_TENANT_DEFAULT : AP_TAB_DEFAULT;
             CSession::Set(AP_SESS_TAB, $this->sTab);
         }
         if (isset($_GET['submit']) && isset($_POST) && 0 < count($_POST)) {
             $this->bShowScreen = false;
             $sReturnRef = $this->initPostActionModules($this->sTab);
             CApi::Location(AP_INDEX_FILE . $sReturnRef);
         } else {
             if (isset($_GET['pop'])) {
                 $this->bShowScreen = false;
                 $this->initPopActionModules($this->sTab);
             } else {
                 if (isset($_GET['blank'])) {
                     $this->bShowScreen = false;
                     $this->initBlankActionModules($this->sTab);
                 } else {
                     if (isset($_GET['ajax'])) {
                         $this->bShowScreen = false;
                         $this->initAjaxActionModules($this->sTab);
                     } else {
                         $this->oCurrentScreen = $this->initScreen($this->sTab);
                         if ($this->oCurrentScreen) {
                             $this->oCurrentScreen->PreModuleInit();
                             $this->initCurrentScreenByModules('first', $this->sTab, $this->oCurrentScreen);
                             $this->oCurrentScreen->MiddleModuleInit();
                             $this->initCurrentScreenByModules('second', $this->sTab, $this->oCurrentScreen);
                             $this->oCurrentScreen->EndModuleInit();
                             $this->initCurrentScreenByModules('third', $this->sTab, $this->oCurrentScreen);
                         }
                         if (CSession::Has(AP_SESS_ERROR)) {
                             $this->JsAddInitText('OnlineMsgError("' . ap_Utils::ReBuildStringToJavaScript(nl2br(CSession::Get(AP_SESS_ERROR, '')), '"') . '");');
                             CSession::Clear(AP_SESS_ERROR);
                         } else {
                             if (CSession::Has(AP_SESS_MESSAGE)) {
                                 $this->JsAddInitText('OnlineMsgInfo("' . ap_Utils::ReBuildStringToJavaScript(nl2br(CSession::Get(AP_SESS_MESSAGE, '')), '"') . '");');
                                 CSession::Clear(AP_SESS_MESSAGE);
                             }
                         }
                     }
                 }
             }
         }
     } catch (Exception $oExeption) {
         $this->oCurrentScreen = new ap_Simple_Screen($this, 'error.php', array('ErrorDesc' => 'Admin Panel internal error.'));
     }
 }
Esempio n. 4
0
 /**
  * @param CDomain $oDomain
  * @return bool
  */
 public function updateDomain(CDomain $oDomain)
 {
     $aTabs = $this->getTabList($oDomain);
     if (is_array($aTabs) && count($aTabs) > 0) {
         $aTabKeys = array_keys($aTabs);
         if (!in_array($oDomain->DefaultTab, $aTabKeys)) {
             $oDomain->DefaultTab = $aTabKeys[0];
         }
     }
     if (!$this->oDomainsApi->updateDomain($oDomain)) {
         $this->lastErrorCode = $this->oDomainsApi->getLastErrorCode();
         $this->lastErrorMessage = $this->oDomainsApi->GetLastErrorMessage();
         return false;
     }
     if (CSession::Has(AP_SESS_DOMAIN_NEXT_EDIT_ID) && $oDomain->IdDomain === CSession::get(AP_SESS_DOMAIN_NEXT_EDIT_ID, null)) {
         CSession::clear(AP_SESS_DOMAIN_NEXT_EDIT_ID);
     }
     return true;
 }
Esempio n. 5
0
 /**
  * @return void
  */
 public function PreModuleInit()
 {
     parent::PreModuleInit();
     $this->AddHeader('Null', 100);
     $sScreenName = $this->GetScreenName();
     if (isset($_GET['search']) && Cpost::Has('searchdesc')) {
         $sSearchDesc = Cpost::get('searchdesc', '');
         if (empty($sSearchDesc)) {
             CSession::clear($sScreenName . self::SESS_SEARCH);
         } else {
             CSession::Set($sScreenName . self::SESS_SEARCH, $sSearchDesc);
         }
         CSession::Set($sScreenName . self::SESS_PAGE, 1);
     } else {
         if (isset($_GET['reset_search'])) {
             CSession::clear($sScreenName . self::SESS_SEARCH);
             CSession::Set($sScreenName . self::SESS_PAGE, 1);
         } else {
             if (isset($_GET['filter']) && (string) $_GET['filter'] !== (string) CSession::get($sScreenName . self::SESS_FILTER)) {
                 CSession::clear($sScreenName . self::SESS_SEARCH);
                 CSession::Set($sScreenName . self::SESS_PAGE, 1);
             }
         }
     }
     if (isset($_GET['page']) && is_numeric($_GET['page'])) {
         CSession::Set($sScreenName . self::SESS_PAGE, (int) $_GET['page']);
     }
     if (CSession::Has($sScreenName . self::SESS_PAGE)) {
         $this->iPage = (int) CSession::get($sScreenName . self::SESS_PAGE, 1);
     }
     if (CSession::Has($sScreenName . self::SESS_SEARCH)) {
         $this->sSearchDesc = CSession::get($sScreenName . self::SESS_SEARCH, '');
     }
     if (isset($_GET['page']) && is_numeric($_GET['page'])) {
         CSession::Set($sScreenName . self::SESS_PAGE, (int) $_GET['page']);
     }
     if (isset($_GET['scolumn']) && 0 < strlen($_GET['scolumn'])) {
         CSession::Set($sScreenName . self::SESS_ORDERBY, $_GET['scolumn']);
     }
     if (isset($_GET['sorder']) && is_numeric($_GET['sorder'])) {
         CSession::Set($sScreenName . self::SESS_ORDERTYPE, (int) $_GET['sorder']);
     }
     if (CSession::Has($sScreenName . self::SESS_ORDERBY)) {
         $this->sOrderField = CSession::get($sScreenName . self::SESS_ORDERBY, '');
     }
     if (CSession::Has($sScreenName . self::SESS_ORDERTYPE)) {
         $this->bOrderType = CSession::get($sScreenName . self::SESS_ORDERTYPE, 0);
     }
 }
Esempio n. 6
0
 public function DomainsMainEdit(ap_Table_Screen &$oScreen)
 {
     $iAutocheckMail = 0;
     $sDomainSkin = $sDomainLang = $sDomainZone = '';
     $iMessagesPerPage = $iContactsPerPage = 20;
     $iContactsGABVisibility = EContactsGABVisibility::Off;
     /* @var $oDomain CDomain */
     $oDomain = $this->oAdminPanel->GetMainObject('domain_edit');
     if ($oDomain) {
         $bHideProtocol = true;
         if ($oDomain->IsDefaultDomain || CSession::Has(AP_SESS_DOMAIN_NEXT_EDIT_ID) && $oDomain->IdDomain === CSession::Get(AP_SESS_DOMAIN_NEXT_EDIT_ID, null)) {
             $oScreen->Data->SetValue('classHideIncomingMailProtocol', '');
         }
         if ($bHideProtocol) {
             $oScreen->Data->SetValue('classHideIncomingMailProtocol', 'wm_hide');
             $oScreen->Data->SetValue('textIncomingMailProtocol', '');
         }
         $oScreen->Data->SetValue('txtFilteHrefAdd', '&filter=' . $oDomain->IdDomain);
         $oScreen->Data->SetValue('radioAuthTypeAuthCurrentUser', true);
         $oScreen->Data->SetValue('classHideSsl', $this->oModule->HasSslSupport() ? '' : 'wm_hide');
         $oScreen->Data->SetValue('txtWebDomain', $oDomain->Url);
         $mLinkWebUrl = $this->oAdminPanel->IsTenantAuthType() ? CApi::GetConf('labs.custom-tenant-link-web-domain-help-url', null) : CApi::GetConf('labs.custom-admin-link-web-domain-help-url', null);
         if (null === $mLinkWebUrl) {
             if ($this->oAdminPanel->AType) {
                 $mLinkWebUrl = 'http://www.afterlogic.com/wiki/Configuring_web_domain_names_(Aurora)';
             } else {
                 $mLinkWebUrl = 'http://www.afterlogic.com/wiki/Configuring_web_domain_names_(WebMail_Pro)';
             }
         }
         if (!empty($mLinkWebUrl)) {
             $oScreen->Data->SetValue('linkWebDomain', $mLinkWebUrl);
         }
         $oScreen->Data->SetValue('classLinkWebDomain', empty($mLinkWebUrl) ? 'wm_hide' : '');
         $oScreen->Data->SetValue('chAllowUsersAccessInterfaveSettings', $oDomain->AllowUsersChangeInterfaceSettings);
         $oScreen->Data->SetValue('chAllowUsersAccessAccountsSettings', $oDomain->AllowUsersChangeEmailSettings);
         $oScreen->Data->SetValue('chEnableWebmail', $oDomain->AllowWebMail);
         $oScreen->Data->SetValue('chEnableAddressBook', $oDomain->AllowContacts);
         $iMessagesPerPage = $oDomain->MailsPerPage;
         $iContactsPerPage = $oDomain->ContactsPerPage;
         $iAutocheckMail = $oDomain->AutoCheckMailInterval;
         $iIncomingMailProtocol = $oDomain->IncomingMailProtocol;
         $oScreen->Data->SetValue('optIncomingProtocolIMAP', EMailProtocol::IMAP4 === $iIncomingMailProtocol);
         $oScreen->Data->SetValue('optIncomingProtocolPOP3', EMailProtocol::POP3 === $iIncomingMailProtocol);
         $oScreen->Data->SetValue('txtIncomingMailHost', $oDomain->IncomingMailServer);
         $oScreen->Data->SetValue('txtIncomingMailPort', $oDomain->IncomingMailPort);
         $oScreen->Data->SetValue('chIncomingUseSSL', $oDomain->IncomingMailUseSSL);
         $oScreen->Data->SetValue('txtOutgoingMailHost', $oDomain->OutgoingMailServer);
         $oScreen->Data->SetValue('txtOutgoingMailPort', $oDomain->OutgoingMailPort);
         $oScreen->Data->SetValue('chOutgoingUseSSL', $oDomain->OutgoingMailUseSSL);
         //			$oScreen->Data->SetValue('txtExternalHostNameOfDAVServer', $oDomain->ExternalHostNameOfDAVServer);
         //			$oScreen->Data->SetValue('txtExternalHostNameOfLocalImap', $oDomain->ExternalHostNameOfLocalImap);
         //			$oScreen->Data->SetValue('txtExternalHostNameOfLocalSmtp', $oDomain->ExternalHostNameOfLocalSmtp);
         $sOutPassword = $oDomain->OutgoingMailPassword;
         $oScreen->Data->SetValue('txtOutgoingMailLogin', $oDomain->OutgoingMailLogin);
         $oScreen->Data->SetValue('txtOutgoingMailPassword', empty($sOutPassword) ? '' : AP_DUMMYPASSWORD);
         $iAuthType = $oDomain->OutgoingMailAuth;
         $oScreen->Data->SetValue('radioAuthTypeNoAuth', $iAuthType === ESMTPAuthType::NoAuth);
         $oScreen->Data->SetValue('radioAuthTypeAuthSpecified', $iAuthType === ESMTPAuthType::AuthSpecified);
         $oScreen->Data->SetValue('radioAuthTypeAuthCurrentUser', $iAuthType === ESMTPAuthType::AuthCurrentUser);
         $oScreen->Data->SetValue('chAllowNewUsersRegister', !$oDomain->AllowNewUsersRegister);
         $oScreen->Data->SetValue('IsDefaultDomain', $oDomain->IsDefaultDomain);
         $oScreen->Data->SetValue('domainIsInternal', $oDomain->IsInternal);
         $iLayout = $oDomain->Layout;
         $oScreen->Data->SetValue('radioLayoutSide', $iLayout === ELayout::Side);
         $oScreen->Data->SetValue('radioLayoutBottom', $iLayout === ELayout::Bottom);
     }
     $sMessagesPerPageOptions = '';
     $aMessagesPerPageList = array(10, 20, 30, 50, 75, 100, 150, 200);
     foreach ($aMessagesPerPageList as $iMessageCount) {
         $sSelected = $iMessageCount === $iMessagesPerPage ? ' selected="selected"' : '';
         $sMessagesPerPageOptions .= '<option value="' . $iMessageCount . '"' . $sSelected . '>' . $iMessageCount . '</option>';
     }
     $oScreen->Data->SetValue('selMessagesPerPageOptions', $sMessagesPerPageOptions);
     $sAutocheckMailOptions = '';
     $aAutocheckMailList = array(0, 1, 3, 5, 10, 15, 20, 30);
     foreach ($aAutocheckMailList as $iAutocheckMailValue) {
         $sSelected = $iAutocheckMail === $iAutocheckMailValue ? ' selected="selected"' : '';
         $sAutocheckMailView = CApi::I18N('ADMIN_PANEL/DOMAINS_WEBMAIL_AUTO_OFF');
         if (0 < $iAutocheckMailValue) {
             $sAutocheckMailView = 1 === $iAutocheckMailValue ? $iAutocheckMailValue . ' ' . CApi::I18N('ADMIN_PANEL/DOMAINS_WEBMAIL_AUTO_MIN') : $iAutocheckMailValue . ' ' . CApi::I18N('ADMIN_PANEL/DOMAINS_WEBMAIL_AUTO_MINS');
         }
         $sAutocheckMailOptions .= '<option value="' . $iAutocheckMailValue . '"' . $sSelected . '>' . $sAutocheckMailView . '</option>';
     }
     $oScreen->Data->SetValue('selAutocheckMailOptions', $sAutocheckMailOptions);
     $sContactsPerPageOptions = '';
     $aContactsPerPageList = array(10, 20, 30, 50, 75, 100, 150, 200);
     foreach ($aContactsPerPageList as $iContactsCount) {
         $sSelected = $iContactsPerPage === $iContactsCount ? ' selected="selected"' : '';
         $sContactsPerPageOptions .= '<option value="' . $iContactsCount . '"' . $sSelected . '>' . $iContactsCount . '</option>';
     }
     $oScreen->Data->SetValue('selContactsPerPageOptions', $sContactsPerPageOptions);
 }