mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 19:41:26 +01:00
Fix: Bad init of conf->entity
This commit is contained in:
@@ -39,19 +39,17 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
|||||||
|
|
||||||
// Include Dolibarr environment
|
// Include Dolibarr environment
|
||||||
require_once($path."../../htdocs/master.inc.php");
|
require_once($path."../../htdocs/master.inc.php");
|
||||||
// After this $db is an opened handler to database. We close it at end of file.
|
// After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file.
|
||||||
require_once(DOL_DOCUMENT_ROOT."/cron/functions_cron.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/cron/functions_cron.lib.php");
|
||||||
|
|
||||||
|
|
||||||
// Load main language strings
|
|
||||||
$langs->load("main");
|
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
$version='$Revision$';
|
$version='$Revision$';
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
|
||||||
// -------------------- START OF YOUR CODE HERE --------------------
|
// -------------------- START OF YOUR CODE HERE --------------------
|
||||||
|
//$langs->setDefaultLang('en_US'); // To change default language of $langs
|
||||||
|
$langs->load("main"); // To load language file for default language
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
print "***** ".$script_file." (".$version.") *****\n";
|
print "***** ".$script_file." (".$version.") *****\n";
|
||||||
|
|
||||||
|
|||||||
@@ -225,22 +225,23 @@ if (! defined('NOREQUIREUSER'))
|
|||||||
*/
|
*/
|
||||||
if (! defined('NOREQUIREDB'))
|
if (! defined('NOREQUIREDB'))
|
||||||
{
|
{
|
||||||
if (session_id() && isset($_SESSION["dol_entity"])) // Entity inside an opened session
|
// By default conf->entity is 1, but we change this if we ask another value.
|
||||||
|
if (session_id() && ! empty($_SESSION["dol_entity"])) // Entity inside an opened session
|
||||||
{
|
{
|
||||||
$conf->entity = $_SESSION["dol_entity"];
|
$conf->entity = $_SESSION["dol_entity"];
|
||||||
}
|
}
|
||||||
elseif (isset($_ENV["dol_entity"])) // Entity inside a CLI script
|
elseif (! empty($_ENV["dol_entity"])) // Entity inside a CLI script
|
||||||
{
|
{
|
||||||
$conf->entity = $_ENV["dol_entity"];
|
$conf->entity = $_ENV["dol_entity"];
|
||||||
}
|
}
|
||||||
elseif (isset($_POST["loginfunction"]) && isset($_POST["entity"])) // Just after a login page
|
elseif (isset($_POST["loginfunction"]) && ! empty($_POST["entity"])) // Just after a login page
|
||||||
{
|
{
|
||||||
$conf->entity = $_POST["entity"];
|
$conf->entity = $_POST["entity"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
|
$entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
|
||||||
if (isset($_COOKIE[$entityCookieName]) && ! empty($conf->file->cookie_cryptkey)) // Just for view specific login page
|
if (! empty($_COOKIE[$entityCookieName]) && ! empty($conf->file->cookie_cryptkey)) // Just for view specific login page
|
||||||
{
|
{
|
||||||
include_once(DOL_DOCUMENT_ROOT."/core/cookie.class.php");
|
include_once(DOL_DOCUMENT_ROOT."/core/cookie.class.php");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user