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 //home dir bad defined
if (!is_dir($config['homedir'])) { 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; $ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR;
$config['homedir'] = $ownDir; $config['homedir'] = $ownDir;
$config["error"] = "homedir_bad_defined"; $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 // If not we will get ugly warnings. Set Europe/Madrid by default
// Later will be replaced by the good one. // Later will be replaced by the good one.
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
if(!isset($config["homeurl"])){ $url = explode('/', $_SERVER['REQUEST_URI']);
$url = explode('/', $_SERVER['REQUEST_URI']); $flag_url =0;
$config["homeurl"] = $url[1]; foreach ($url as $key => $value) {
$config["homeurl_static"] = $url[1]; if (strpos($value, 'index.php?') !== false || $flag_url) {
$config["error"] = "homeurl_bad_defined"; $flag_url=1;
return; unset($url[$key]);
}
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;
} }
} }
$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),"/");
}
if (!isset($config["homeurl_static"])) { if (!isset($config["homeurl_static"])) {
$config["homeurl_static"] = $config["homeurl"]; $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 // Something went wrong
if ($return === false) { if ($return === false) {
if ($critical) { if ($critical) {
$login_screen = 'error_authconfig'; $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'); require($config['homedir'] . '/general/error_screen.php');
exit; exit;

View File

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