Exemplo 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);
 }
Exemplo n.º 2
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');
         $this->JsAddFile('static/js/knockout-2.3.0.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.'));
     }
 }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
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);
     }
 }
Exemplo n.º 5
0
CSession::setValue('check_fields_result', check_fields($fields, false));
if (!CSession::keyExists('step')) {
    CSession::setValue('step', 0);
}
// if a guest or a non-super admin user is logged in
if (CWebUser::$data && CWebUser::getType() < USER_TYPE_SUPER_ADMIN) {
    // on the last step of the setup we always have a guest user logged in;
    // when he presses the "Finish" button he must be redirected to the login screen
    if (CWebUser::isGuest() && CSession::getValue('step') == 5 && hasRequest('finish')) {
        CSession::clear();
        redirect('index.php');
    } elseif (!(CWebUser::isGuest() && CSession::getValue('step') == 5)) {
        access_deny(ACCESS_DENY_PAGE);
    }
} elseif (hasRequest('cancel') || hasRequest('finish')) {
    CSession::clear();
    redirect('index.php');
}
$theme = CWebUser::$data ? getUserTheme(CWebUser::$data) : ZBX_DEFAULT_THEME;
DBclose();
/*
 * Setup wizard
 */
$ZBX_SETUP_WIZARD = new CSetupWizard();
// if init fails due to missing configuration, set user as guest with default en_GB language
if (!CWebUser::$data) {
    CWebUser::setDefault();
}
// page title
(new CPageHeader(_('Installation')))->addCssFile('styles/' . CHtml::encode($theme) . '.css')->addJsFile('js/browsers.js')->addJsFile('jsLoader.php?ver=' . ZABBIX_VERSION . '&amp;lang=' . CWebUser::$data['lang'])->display();
/*