forked from Wavyzz/dolibarr
FIX master must be after session_start but dol_getprefix must be before
and after filefunc.inc.php.
This commit is contained in:
@@ -711,11 +711,11 @@ if (!function_exists('dol_getprefix'))
|
||||
*/
|
||||
function dol_getprefix($mode = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// If prefix is for email
|
||||
// If prefix is for email (we need to have $conf alreayd loaded for this case)
|
||||
if ($mode == 'email')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended)
|
||||
{
|
||||
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
|
||||
@@ -729,12 +729,17 @@ if (!function_exists('dol_getprefix'))
|
||||
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
|
||||
}
|
||||
|
||||
// If prefix is for session (no need to have $conf loaded)
|
||||
global $dolibarr_main_instance_unique_id, $dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php
|
||||
$tmp_instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance
|
||||
|
||||
// The recommended value (may be not defined for old versions)
|
||||
if (!empty($conf->file->instance_unique_id)) return $conf->file->instance_unique_id;
|
||||
if (!empty($tmp_instance_unique_id)) {
|
||||
return $tmp_instance_unique_id;
|
||||
}
|
||||
|
||||
// For backward compatibility
|
||||
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"]))
|
||||
{
|
||||
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) {
|
||||
return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user