diff --git a/htdocs/core/conf.class.php b/htdocs/core/conf.class.php index 5945c772ce9..9307ae0d26f 100644 --- a/htdocs/core/conf.class.php +++ b/htdocs/core/conf.class.php @@ -180,10 +180,10 @@ class Conf foreach($this->modules as $module) { if (empty($this->$module->dir_output)) $this->$module->dir_output=$rootfordata."/".$module; - //else $this->$module->dir_output=$rootfordata.$this->$module->dir_output; + else $this->$module->dir_output=$rootfordata.$this->$module->dir_output; //print 'this->'.$module.'->dir_output='.$this->$module->dir_output.'
'; if (empty($this->$module->dir_temp)) $this->$module->dir_temp=$rootfordata."/".$module."/temp"; - //else $this->$module->dir_temp=$rootfordata.$this->$module->dir_temp; + else $this->$module->dir_temp=$rootfordata.$this->$module->dir_temp; //print 'this->'.$module.'->dir_temp='.$this->$module->dir_temp.'
'; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index c078910f8bc..ce9ea2bc9a2 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -112,6 +112,11 @@ analyse_sql_injection($_POST); // This is to make Dolibarr working with Plesk set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); +// Retrieve the entity in login form, and after in the cookie +$entityCookieName = "DOLENTITYID_dolibarr"; +if (isset($_POST["entity"])) $_SESSION["dol_entity"] = $_POST["entity"]; +if (isset($_COOKIE[$entityCookieName])) $_SESSION["dol_entity"] = $_COOKIE[$entityCookieName]; + // Set and init common variables // This include will set $conf, $langs and $mysoc objects require_once("master.inc.php"); @@ -161,7 +166,7 @@ if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) ini_set('session.gc_maxlifetim session_name($sessionname); session_start(); dol_syslog("Start session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".(isset($_SESSION["dol_login"])?$_SESSION["dol_login"]:'').", ".ini_get("session.gc_maxlifetime")); - +/* // Retrieve the entity in login form and in the cookie. // This must be after the init of session (session_start) or this create serious pb of corrupted session. $entityCookieName = "DOLENTITYID_dolibarr"; @@ -181,7 +186,7 @@ elseif (isset($_COOKIE[$entityCookieName])) // Now we need to reload the conf with the choosed entity $conf->setValues($db); } - +*/ // Disable modules (this must be after session_start and after conf has been reloaded) if (! empty($_REQUEST["disablemodules"])) $_SESSION["disablemodules"]=$_REQUEST["disablemodules"]; if (! empty($_SESSION["disablemodules"])) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index a926b5d720f..b4459bb5c24 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -114,6 +114,10 @@ require_once(DOL_DOCUMENT_ROOT."/core/conf.class.php"); $conf = new Conf(); +// Retrieve the entity +// Removed: The session has not been initialized yet so using SESSION is forbidden here +if (isset($_SESSION["dol_entity"])) $conf->entity = $_SESSION["dol_entity"]; + // Identifiant propres au serveur base de donnee $conf->db->host = $dolibarr_main_db_host; if (empty($dolibarr_main_db_port)) $dolibarr_main_db_port=0; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'