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. // We need a timezone BEFORE calling config_process_config.
// 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(!is_dir($_SERVER['DOCUMENT_ROOT'] . $config["homeurl"]) || !is_dir($_SERVER['DOCUMENT_ROOT'] . $config["homeurl_static"])){
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{ else if(strpos($value, 'enterprise') !== false || $flag_url){
$url = explode('/', $_SERVER['REQUEST_URI']); $flag_url=1;
if($config["homeurl"] != '/'.$url[1]){ unset($url[$key]);
$config["homeurl"] = '/'.$url[1];
$config["homeurl_static"] = '/'.$url[1];
$config["error"] = "homeurl_bad_defined";
return;
} }
} }
$config["homeurl"] = rtrim(join("/", $url),"/");
$config["homeurl_static"] = $config["homeurl"];
$config["error"] = "homeurl_bad_defined";
return;
} }
if (!isset($config["homeurl_static"])) { if (!isset($config["homeurl_static"])) {
$config["homeurl_static"] = $config["homeurl"]; $config["homeurl_static"] = $config["homeurl"];
} }
else{ else{
if($config["homeurl_static"] != $config["homeurl"]){ 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"; $config["error"] = "homeurl_bad_defined";
return; return;
} }

View File

@ -64,8 +64,23 @@ 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) {
$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'; $login_screen = 'error_authconfig';
require($config['homedir'] . '/general/error_screen.php'); require($config['homedir'] . '/general/error_screen.php');
exit; exit;
} }

View File

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