Commit 36e81538 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(standAlonePage) Reworked constructor to use init() method as well

issue #5854
Showing with 41 additions and 65 deletions
+41 -65
......@@ -32,77 +32,55 @@ class standAlonePage {
$this->interactive = $interactive;
if ($this->interactive) {
/* Destroy old session if exists.
Else you will get your old session back, if you not logged out correctly. */
session::destroy();
session::start();
/* Reset errors */
reset_errors();
$config = $this->loadConfig();
/* If SSL is forced, just forward to the SSL enabled site */
if (($config->get_cfg_value('forcessl') == 'TRUE') && ($ssl != '')) {
header ("Location: $ssl");
exit;
}
static::securityHeaders();
$this->setupSmarty();
$smarty = get_smarty();
/* Generate server list */
$servers = array();
foreach ($config->data['LOCATIONS'] as $key => $ignored) {
$servers[$key] = $key;
}
/* Destroy old session if exists.
Else you will get your old session back, if you not logged out correctly. */
session::destroy();
session::start();
$smarty->assign('show_directory_chooser', FALSE);
$config = $this->loadConfig();
if (isset($_POST['server'])) {
$this->directory = validate($_POST['server']);
} elseif (isset($_GET['directory']) && isset($servers[$_GET['directory']])) {
$this->directory = validate($_GET['directory']);
} else {
$this->directory = $config->data['MAIN']['DEFAULT'];
/* Generate server list */
$servers = array();
foreach ($config->data['LOCATIONS'] as $key => $ignored) {
$servers[$key] = $key;
}
if (!isset($servers[$this->directory])) {
$this->directory = key($servers);
}
if (isset($_POST['server']) && isset($servers[$_POST['server']])) {
$this->directory = validate($_POST['server']);
} elseif (isset($_GET['directory']) && isset($servers[$_GET['directory']])) {
$this->directory = validate($_GET['directory']);
} else {
$this->directory = $config->data['MAIN']['DEFAULT'];
if (count($servers) > 1) {
$smarty->assign('show_directory_chooser', TRUE);
$smarty->assign('server_options', $servers);
$smarty->assign('server_id', $this->directory);
}
if (!isset($servers[$this->directory])) {
$this->directory = key($servers);
}
/* Set config to selected one */
$config->set_current($this->directory);
session::global_set('config', $config);
}
/* Set config to selected one */
$config->set_current($this->directory);
session::global_set('config', $config);
$this->activated = $this->readLdapConfig();
if (!$this->activated) { /* Password recovery has been disabled */
if (!$this->activated) {
/* This page has been disabled */
return;
}
if ($this->interactive) {
Language::init();
$ui = new userinfoNoAuth(get_class($this));
session::global_set('ui', $ui);
$ui = new userinfoNoAuth(get_class($this));
session::global_set('ui', $ui);
static::init();
if (session::global_is_set('plist')) {
session::global_un_set('plist');
if ($this->interactive) {
$smarty = get_smarty();
if (count($servers) > 1) {
$smarty->assign('show_directory_chooser', TRUE);
$smarty->assign('server_options', $servers);
$smarty->assign('server_id', $this->directory);
} else {
$smarty->assign('show_directory_chooser', FALSE);
}
pluglist::load();
$ssl = $this->checkForSSL();
}
}
......@@ -119,17 +97,15 @@ class standAlonePage {
$ui = session::global_get('ui');
$config = session::global_get('config');
/* If SSL is forced, just forward to the SSL enabled site */
if (($config->get_cfg_value('forcessl') == 'TRUE') && ($ssl != '')) {
header ("Location: $ssl");
exit;
}
if ($this->interactive) {
timezone::setDefaultTimezoneFromConfig();
timezone::setDefaultTimezoneFromConfig();
Language::init();
Language::init();
$this->setupSmarty();
}
$this->setupSmarty();
$ssl = $this->checkForSSL();
/* Prepare plugin list */
pluglist::load();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment