diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 7d464ce614..1a675c73aa 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -125,24 +125,28 @@ require_once ($ownDir . 'functions.php'); // We need a timezone BEFORE calling config_process_config. // If not we will get ugly warnings. Set Europe/Madrid by default // Later will be replaced by the good one. - -$url = explode('/', $_SERVER['REQUEST_URI']); -$flag_url =0; -foreach ($url as $key => $value) { - if (strpos($value, 'index.php') !== false || $flag_url) { - $flag_url=1; - unset($url[$key]); - } - else if(strpos($value, 'enterprise') !== false || $flag_url){ - $flag_url=1; - unset($url[$key]); - } - else if(strpos($value, '?login') !== false || $flag_url){ - $flag_url=1; - unset($url[$key]); +if (!defined('METACONSOLE')) { + $url = explode('/', $_SERVER['REQUEST_URI']); + $flag_url =0; + foreach ($url as $key => $value) { + if (strpos($value, 'index.php?') !== false || $flag_url) { + $flag_url=1; + unset($url[$key]); + } } + $config["homeurl"] = rtrim(join("/", $url),"/"); +} +else{ + $url = explode('/', $_SERVER['REQUEST_URI']); + $flag_url =0; + foreach ($url as $key => $value) { + if (strpos($value, 'enterprise') !== false || $flag_url) { + $flag_url=1; + unset($url[$key]); + } + } + $config["homeurl"] = rtrim(join("/", $url),"/"); } -$config["homeurl"] = rtrim(join("/", $url),"/"); if (!isset($config["homeurl_static"])) { $config["homeurl_static"] = $config["homeurl"]; @@ -168,6 +172,7 @@ require_once ($ownDir. 'functions_config.php'); date_default_timezone_set("Europe/Madrid"); + config_process_config(); config_prepare_session(); diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index fe7b2d30e6..cb505f6563 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -64,6 +64,8 @@ function db_connect($host = null, $db = null, $user = null, $pass = null, $port // Something went wrong if ($return === false) { if ($critical) { + + $login_screen = 'error_authconfig'; $url = explode('/', $_SERVER['REQUEST_URI']); $flag_url =0; foreach ($url as $key => $value) { @@ -71,17 +73,9 @@ function db_connect($host = null, $db = null, $user = null, $pass = null, $port $flag_url=1; unset($url[$key]); } - else if(strpos($value, 'enterprise') !== false || $flag_url){ - $flag_url=1; - unset($url[$key]); - } - else if(strpos($value, '?login') !== false || $flag_url){ - $flag_url=1; - unset($url[$key]); - } } $config["homeurl"] = rtrim(join("/", $url),"/"); - $login_screen = 'error_authconfig'; + require($config['homedir'] . '/general/error_screen.php'); exit; } diff --git a/pandora_console/index.php b/pandora_console/index.php index aeae1d40c6..51387e4a36 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -30,23 +30,28 @@ if ($develop_bypass != 1) { $login_screen = 'error_noconfig'; $ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $config['homedir'] = $ownDir; - $url = explode('/', $_SERVER['REQUEST_URI']); - $flag_url =0; - foreach ($url as $key => $value) { - if (strpos($value, 'index.php?') !== false || $flag_url) { - $flag_url=1; - unset($url[$key]); - } - else if(strpos($value, 'enterprise') !== false || $flag_url){ - $flag_url=1; - unset($url[$key]); - } - else if(strpos($value, '?login') !== false || $flag_url){ - $flag_url=1; - unset($url[$key]); + if (!defined('METACONSOLE')) { + $url = explode('/', $_SERVER['REQUEST_URI']); + $flag_url =0; + foreach ($url as $key => $value) { + if (strpos($value, 'index.php?') !== false || $flag_url) { + $flag_url=1; + unset($url[$key]); + } } + $config["homeurl"] = rtrim(join("/", $url),"/"); + } + else{ + $url = explode('/', $_SERVER['REQUEST_URI']); + $flag_url =0; + foreach ($url as $key => $value) { + if (strpos($value, 'enterprise') !== false || $flag_url) { + $flag_url=1; + unset($url[$key]); + } + } + $config["homeurl"] = rtrim(join("/", $url),"/"); } - $config["homeurl"] = rtrim(join("/", $url),"/"); $config["homeurl_static"] = $config["homeurl"]; require('general/error_screen.php'); exit; @@ -73,23 +78,28 @@ if ($develop_bypass != 1) { if (file_exists ("install.php")) { $ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $config['homedir'] = $ownDir; - $url = explode('/', $_SERVER['REQUEST_URI']); - $flag_url =0; - foreach ($url as $key => $value) { - if (strpos($value, 'index.php?') !== false || $flag_url) { - $flag_url=1; - unset($url[$key]); - } - else if(strpos($value, 'enterprise') !== false || $flag_url){ - $flag_url=1; - unset($url[$key]); - } - else if(strpos($value, '?login') !== false || $flag_url){ - $flag_url=1; - unset($url[$key]); + if (!defined('METACONSOLE')) { + $url = explode('/', $_SERVER['REQUEST_URI']); + $flag_url =0; + foreach ($url as $key => $value) { + if (strpos($value, 'index.php?') !== false || $flag_url) { + $flag_url=1; + unset($url[$key]); + } } + $config["homeurl"] = rtrim(join("/", $url),"/"); + } + else{ + $url = explode('/', $_SERVER['REQUEST_URI']); + $flag_url =0; + foreach ($url as $key => $value) { + if (strpos($value, 'enterprise') !== false || $flag_url) { + $flag_url=1; + unset($url[$key]); + } + } + $config["homeurl"] = rtrim(join("/", $url),"/"); } - $config["homeurl"] = rtrim(join("/", $url),"/"); $config["homeurl_static"] = $config["homeurl"]; $login_screen = 'error_install'; require('general/error_screen.php'); @@ -102,23 +112,28 @@ if ($develop_bypass != 1) { (substr (sprintf ('%o', fileperms('include/config.php')), -4) != "0640")) { $ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $config['homedir'] = $ownDir; - $url = explode('/', $_SERVER['REQUEST_URI']); - $flag_url =0; - foreach ($url as $key => $value) { - if (strpos($value, 'index.php?') !== false || $flag_url) { - $flag_url=1; - unset($url[$key]); - } - else if(strpos($value, 'enterprise') !== false || $flag_url){ - $flag_url=1; - unset($url[$key]); - } - else if(strpos($value, '?login') !== false || $flag_url){ - $flag_url=1; - unset($url[$key]); + if (!defined('METACONSOLE')) { + $url = explode('/', $_SERVER['REQUEST_URI']); + $flag_url =0; + foreach ($url as $key => $value) { + if (strpos($value, 'index.php?') !== false || $flag_url) { + $flag_url=1; + unset($url[$key]); + } } + $config["homeurl"] = rtrim(join("/", $url),"/"); + } + else{ + $url = explode('/', $_SERVER['REQUEST_URI']); + $flag_url =0; + foreach ($url as $key => $value) { + if (strpos($value, 'enterprise') !== false || $flag_url) { + $flag_url=1; + unset($url[$key]); + } + } + $config["homeurl"] = rtrim(join("/", $url),"/"); } - $config["homeurl"] = rtrim(join("/", $url),"/"); $config["homeurl_static"] = $config["homeurl"]; $login_screen = 'error_perms'; require('general/error_screen.php');