Fix hash for gol_getprefix must not contains special char.

This commit is contained in:
Laurent Destailleur 2019-01-19 16:14:45 +01:00
parent 691deeb2c3
commit f311deb405

View File

@ -616,7 +616,7 @@ if (! function_exists('dol_getprefix'))
/**
* Return a prefix to use for this Dolibarr instance, for session/cookie names or email id.
* The prefix for session is unique in a web context only and is unique for instance and avoid conflict
* between multi-instances, even when having two instances with one root dir or two instances in virtual servers.
* between multi-instances, even when having two instances with same root dir or two instances in same virtual server.
* The prefix for email is unique if MAIL_PREFIX_FOR_EMAIL_ID is set to a value, otherwise value may be same than other instance.
*
* @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
@ -634,16 +634,16 @@ if (! function_exists('dol_getprefix'))
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
else if (isset($_SERVER["SERVER_NAME"])) return $_SERVER["SERVER_NAME"];
}
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
}
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"]))
{
return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
// Use this for a "readable" cookie name
return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
// Use this for a "readable" key
//return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
}
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
}
}