]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/baculum/protected/Pages/ConfigurationWizard.php
Update ReleaseNotes + ChangeLog
[bacula/bacula] / gui / baculum / protected / Pages / ConfigurationWizard.php
index bcf84ca28794f98ba47ae16fe340f1308f1fd2e9..3c1beb1059b893317acf71659a51d4bd37a2867c 100644 (file)
@@ -1,20 +1,23 @@
 <?php
-/**
- * Bacula® - The Network Backup Solution
- * Baculum - Bacula web interface
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2014 Marcin Haba
+ * Copyright (C) 2013-2016 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
- * The main author of Bacula is Kern Sibbald, with contributions from many
- * others, a complete list can be found in the file AUTHORS.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
  *
  * You may use this file and others of this release according to the
  * license defined in the LICENSE file, which includes the Affero General
  * Public License, v3.0 ("AGPLv3") and some additional permissions and
  * terms pursuant to its AGPLv3 Section 7.
  *
- * Bacula® is a registered trademark of Kern Sibbald.
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
  */
  
 Prado::using('System.Web.UI.ActiveControls.TActiveDropDownList');
@@ -29,6 +32,7 @@ class ConfigurationWizard extends BaculumPage
 {
        public $firstRun;
        public $applicationConfig;
+       public $userPattern;
 
        const DEFAULT_DB_NAME = 'bacula';
        const DEFAULT_DB_LOGIN = 'bacula';
@@ -38,9 +42,11 @@ class ConfigurationWizard extends BaculumPage
 
        public function onInit($param) {
                parent::onInit($param);
-               $this->Lang->SelectedValue = $this->Session['language'];
-               $this->firstRun = !$this->getModule('configuration')->isApplicationConfig();
-               $this->applicationConfig = $this->getModule('configuration')->getApplicationConfig();
+               $this->Lang->SelectedValue = $_SESSION['language'];
+               $config = $this->getModule('configuration');
+               $this->firstRun = !$config->isApplicationConfig();
+               $this->applicationConfig = $config->getApplicationConfig();
+               $this->userPattern = $config->getUserPattern();
                if($this->firstRun === false && $this->User->getIsAdmin() === false) {
                        die('Access denied.');
                }
@@ -103,15 +109,17 @@ class ConfigurationWizard extends BaculumPage
                $cfgData['baculum']['login'] = $this->PanelLogin->Text;
                $cfgData['baculum']['password'] = $this->PanelPassword->Text;
                $cfgData['baculum']['debug'] = isset($this->applicationConfig['baculum']['debug']) ? $this->applicationConfig['baculum']['debug'] : "0";
+               $cfgData['baculum']['lang'] = $_SESSION['language'];
                $ret = $this->getModule('configuration')->setApplicationConfig($cfgData);
                if($ret === true) {
                        if($this->getModule('configuration')->isUsersConfig() === true) { // version with users config file, so next is try to auto-login
                                $previousUser = ($this->firstRun === false) ? $this->applicationConfig['baculum']['login'] : null;
                                $this->getModule('configuration')->setUsersConfig($cfgData['baculum']['login'], $cfgData['baculum']['password'], $this->firstRun, $previousUser);
+
                                // Automatic login after finish wizard.
                                $http_protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) ? 'https' : 'http';
-                               $location = sprintf("%s://%s:%s@%s:%d/", $http_protocol, $cfgData['baculum']['login'], $cfgData['baculum']['password'], $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']);
-                               header("Location: $location");
+                               $this->getModule('configuration')->switchToUser($http_protocol, $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $cfgData['baculum']['login'], $cfgData['baculum']['password']);
+                               exit();
                        } else { // standard version (user defined auth method)
                                $this->goToDefaultPage();
                        }
@@ -173,7 +181,7 @@ class ConfigurationWizard extends BaculumPage
        }
 
        public function setLang($sender, $param) {
-               $this->Session['language'] = $sender->SelectedValue;
+               $_SESSION['language'] = $sender->SelectedValue;
                $this->goToPage('ConfigurationWizard');
        }
 
@@ -221,7 +229,6 @@ class ConfigurationWizard extends BaculumPage
                $isValidate = ($result === 0);
                $this->BconsoleTestResultOk->Display = ($isValidate === true) ? 'Dynamic' : 'None';
                $this->BconsoleTestResultErr->Display = ($isValidate === false) ? 'Dynamic' : 'None';
-               $this->Step4Content->render($param->NewWriter);
        }
 }
-?>
\ No newline at end of file
+?>