Merge branch '961_Error_al_cambiar_ruta_de_pandora_v7_rev' into 'develop'

fixed errors in login page

See merge request !558
This commit is contained in:
vgilc 2017-06-06 14:31:57 +02:00
commit 6e30b9176a
3 changed files with 113 additions and 23 deletions

View File

@ -37,9 +37,21 @@ else {
//home dir bad defined
if (!is_dir($config['homedir'])) {
$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),"/");
$config["homeurl_static"] = $config["homeurl"];
$ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR;
$config['homedir'] = $ownDir;
$config["error"] = "homedir_bad_defined";
return;
}
@ -114,23 +126,28 @@ require_once ($ownDir . 'functions.php');
// If not we will get ugly warnings. Set Europe/Madrid by default
// Later will be replaced by the good one.
if (!defined('METACONSOLE')) {
if(!isset($config["homeurl"])){
$url = explode('/', $_SERVER['REQUEST_URI']);
$config["homeurl"] = $url[1];
$config["homeurl_static"] = $url[1];
$config["error"] = "homeurl_bad_defined";
return;
$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']);
if($config["homeurl"] != '/'.$url[1]){
$config["homeurl"] = '/'.$url[1];
$config["homeurl_static"] = '/'.$url[1];
$config["error"] = "homeurl_bad_defined";
return;
$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),"/");
}
if (!isset($config["homeurl_static"])) {
$config["homeurl_static"] = $config["homeurl"];
}

View File

@ -64,7 +64,17 @@ 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) {
if (strpos($value, 'index.php?') !== false || $flag_url) {
$flag_url=1;
unset($url[$key]);
}
}
$config["homeurl"] = rtrim(join("/", $url),"/");
require($config['homedir'] . '/general/error_screen.php');
exit;

View File

@ -30,11 +30,29 @@ if ($develop_bypass != 1) {
$login_screen = 'error_noconfig';
$ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$config['homedir'] = $ownDir;
$config['homeurl'] = $_SERVER['REQUEST_URI'];
$config['homeurl_static'] = $_SERVER['REQUEST_URI'];
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_static"] = $config["homeurl"];
require('general/error_screen.php');
exit;
}
@ -58,6 +76,31 @@ if ($develop_bypass != 1) {
// Check for installer presence
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]);
}
}
$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_static"] = $config["homeurl"];
$login_screen = 'error_install';
require('general/error_screen.php');
exit;
@ -68,10 +111,30 @@ if ($develop_bypass != 1) {
(substr (sprintf ('%o', fileperms('include/config.php')), -4) != "0660") &&
(substr (sprintf ('%o', fileperms('include/config.php')), -4) != "0640")) {
$ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$url = explode('/', $_SERVER['REQUEST_URI']);
$config['homedir'] = $ownDir;
$config['homeurl'] = "/" . $url[1];
$config['homeurl_static'] = "/" . $url[1];
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_static"] = $config["homeurl"];
$login_screen = 'error_perms';
require('general/error_screen.php');
exit;