Merge branch '961_Error_al_cambiar_ruta_de_pandora_v7_rev_2' into 'develop'

fixed errors in login page

See merge request !571
This commit is contained in:
vgilc 2017-06-08 12:02:49 +02:00
commit 8e230a4883
3 changed files with 75 additions and 24 deletions

View File

@ -113,29 +113,45 @@ 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')) {
if(!isset($config["homeurl"])){
if(!is_dir($_SERVER['DOCUMENT_ROOT'] . $config["homeurl"]) || !is_dir($_SERVER['DOCUMENT_ROOT'] . $config["homeurl_static"])){
$url = explode('/', $_SERVER['REQUEST_URI']);
$config["homeurl"] = $url[1];
$config["homeurl_static"] = $url[1];
$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]);
}
}
$config["homeurl"] = rtrim(join("/", $url),"/");
$config["homeurl_static"] = $config["homeurl"];
$config["error"] = "homeurl_bad_defined";
return;
}
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;
}
}
}
if (!isset($config["homeurl_static"])) {
$config["homeurl_static"] = $config["homeurl"];
}
else{
if($config["homeurl_static"] != $config["homeurl"]){
$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]);
}
}
$config["homeurl"] = rtrim(join("/", $url),"/");
$config["homeurl_static"] = $config["homeurl"];
$config["error"] = "homeurl_bad_defined";
return;
}

View File

@ -64,8 +64,23 @@ function db_connect($host = null, $db = null, $user = null, $pass = null, $port
// Something went wrong
if ($return === false) {
if ($critical) {
$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]);
}
}
$config["homeurl"] = rtrim(join("/", $url),"/");
$config["homeurl_static"] = $config["homeurl"];
$ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$config['homedir'] = $ownDir;
$login_screen = 'error_authconfig';
require($config['homedir'] . '/general/error_screen.php');
exit;
}

View File

@ -27,14 +27,23 @@ if ($develop_bypass != 1) {
// If no config file, automatically try to install
if (! file_exists ("include/config.php")) {
if (! file_exists ("install.php")) {
$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]);
}
}
$config["homeurl"] = rtrim(join("/", $url),"/");
$config["homeurl_static"] = $config["homeurl"];
$login_screen = 'error_noconfig';
$ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$config['homedir'] = $ownDir;
$config['homeurl'] = $_SERVER['REQUEST_URI'];
$config['homeurl_static'] = $_SERVER['REQUEST_URI'];
require('general/error_screen.php');
exit;
}
@ -67,11 +76,22 @@ if ($develop_bypass != 1) {
if ((substr (sprintf ('%o', fileperms('include/config.php')), -4) != "0600") &&
(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']);
$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]);
}
}
$config["homeurl"] = rtrim(join("/", $url),"/");
$config["homeurl_static"] = $config["homeurl"];
$ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$config['homedir'] = $ownDir;
$config['homeurl'] = "/" . $url[1];
$config['homeurl_static'] = "/" . $url[1];
$login_screen = 'error_perms';
require('general/error_screen.php');
exit;