From c25c5acfeb51bf6aa820eba574cf0b8affb251db Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 6 Jun 2017 15:22:58 +0200 Subject: [PATCH] fixed errors instalation --- pandora_console/include/config_process.php | 35 ++++---- pandora_console/include/functions_db.php | 12 ++- pandora_console/index.php | 99 +++++++++------------- 3 files changed, 66 insertions(+), 80 deletions(-) diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index abda262e03..8e81ffce31 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -125,28 +125,24 @@ 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. -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]); - } + +$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]); - } + 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),"/"); } +$config["homeurl"] = rtrim(join("/", $url),"/"); if (!isset($config["homeurl_static"])) { $config["homeurl_static"] = $config["homeurl"]; @@ -172,7 +168,6 @@ 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 cb505f6563..fe7b2d30e6 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -64,8 +64,6 @@ 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) { @@ -73,9 +71,17 @@ 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 51387e4a36..aeae1d40c6 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -30,28 +30,23 @@ if ($develop_bypass != 1) { $login_screen = 'error_noconfig'; $ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $config['homedir'] = $ownDir; - 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]); - } + $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]); - } + 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),"/"); } + $config["homeurl"] = rtrim(join("/", $url),"/"); $config["homeurl_static"] = $config["homeurl"]; require('general/error_screen.php'); exit; @@ -78,28 +73,23 @@ if ($develop_bypass != 1) { if (file_exists ("install.php")) { $ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $config['homedir'] = $ownDir; - 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]); - } + $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]); - } + 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),"/"); } + $config["homeurl"] = rtrim(join("/", $url),"/"); $config["homeurl_static"] = $config["homeurl"]; $login_screen = 'error_install'; require('general/error_screen.php'); @@ -112,28 +102,23 @@ if ($develop_bypass != 1) { (substr (sprintf ('%o', fileperms('include/config.php')), -4) != "0640")) { $ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $config['homedir'] = $ownDir; - 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]); - } + $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]); - } + 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),"/"); } + $config["homeurl"] = rtrim(join("/", $url),"/"); $config["homeurl_static"] = $config["homeurl"]; $login_screen = 'error_perms'; require('general/error_screen.php');