Renamed conf->cookie_cryptkey into conf->file->cookie_cryptkey. The goal is to have all parameters defined inside file conf.php to be in $conf->file->xxx. Excep for database that are stored in $conf->db (historic reasons). This make code easier to understand and to know origine of a value (file or database).

This commit is contained in:
Laurent Destailleur 2009-05-24 00:19:06 +00:00
parent 29b707d380
commit e86917a148
3 changed files with 22 additions and 23 deletions

View File

@ -141,7 +141,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
{ {
include_once(DOL_DOCUMENT_ROOT . "/core/cookie.class.php"); include_once(DOL_DOCUMENT_ROOT . "/core/cookie.class.php");
$cryptkey = ( isset($conf->cookie->cryptkey) ? $conf->cookie->cryptkey : '' ); $cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
$entityCookie = new DolCookie($cryptkey); $entityCookie = new DolCookie($cryptkey);
$cookieValue = $entityCookie->_getCookie($entityCookieName); $cookieValue = $entityCookie->_getCookie($entityCookieName);

View File

@ -450,7 +450,7 @@ if (! isset($_SESSION["dol_login"]))
// TTL : sera defini dans la page de config multicompany // TTL : sera defini dans la page de config multicompany
$ttl = (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE_TTL) ? $conf->global->MAIN_MULTICOMPANY_COOKIE_TTL : time()+60*60*8 ); $ttl = (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE_TTL) ? $conf->global->MAIN_MULTICOMPANY_COOKIE_TTL : time()+60*60*8 );
// Cryptkey : sera cree aleatoirement dans la page de config multicompany // Cryptkey : sera cree aleatoirement dans la page de config multicompany
$cryptkey = ( isset($conf->cookie->cryptkey) ? $conf->cookie->cryptkey : '' ); $cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
$entityCookie = new DolCookie($cryptkey); $entityCookie = new DolCookie($cryptkey);
$entityCookie->_setCookie($entityCookieName, $entity, $ttl); $entityCookie->_setCookie($entityCookieName, $entity, $ttl);

View File

@ -137,10 +137,7 @@ $conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_m
if (empty($force_charset_do_notuse)) $force_charset_do_notuse='UTF-8'; if (empty($force_charset_do_notuse)) $force_charset_do_notuse='UTF-8';
$conf->file->character_set_client=strtoupper($force_charset_do_notuse); $conf->file->character_set_client=strtoupper($force_charset_do_notuse);
// Cookie cryptkey // Cookie cryptkey
if (isset($dolibarr_main_cookie_cryptkey)) $conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey;
{
$conf->cookie->cryptkey = $dolibarr_main_cookie_cryptkey;
}
// Define array of document root directories // Define array of document root directories
$conf->file->dol_document_root=array(DOL_DOCUMENT_ROOT); $conf->file->dol_document_root=array(DOL_DOCUMENT_ROOT);
@ -210,8 +207,6 @@ if (! defined('NOREQUIREUSER'))
*/ */
if (! defined('NOREQUIREDB')) if (! defined('NOREQUIREDB'))
{ {
$entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
if (session_id() && isset($_SESSION["dol_entity"])) // Entity inside an opened session if (session_id() && isset($_SESSION["dol_entity"])) // Entity inside an opened session
{ {
$conf->entity = $_SESSION["dol_entity"]; $conf->entity = $_SESSION["dol_entity"];
@ -224,18 +219,22 @@ if (! defined('NOREQUIREDB'))
{ {
$conf->entity = $_POST["entity"]; $conf->entity = $_POST["entity"];
} }
elseif (isset($_COOKIE[$entityCookieName])) // Just for view specific login page else
{ {
include_once(DOL_DOCUMENT_ROOT."/core/cookie.class.php"); $entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
if (isset($_COOKIE[$entityCookieName])) // Just for view specific login page
{
include_once(DOL_DOCUMENT_ROOT."/core/cookie.class.php");
$lastuser = ''; $lastuser = '';
$lastentity = ''; $lastentity = '';
$cryptkey = ( isset($conf->cookie->cryptkey) ? $conf->cookie->cryptkey : '' ); $cryptkey = ( ! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
$entityCookie = new DolCookie($conf->cookie->cryptkey); $entityCookie = new DolCookie($conf->file->cookie_cryptkey);
$cookieValue = $entityCookie->_getCookie($entityCookieName); $cookieValue = $entityCookie->_getCookie($entityCookieName);
list($lastuser, $lastentity) = split('\|', $cookieValue); list($lastuser, $lastentity) = split('\|', $cookieValue);
$conf->entity = $lastentity; $conf->entity = $lastentity;
}
} }
$conf->setValues($db); $conf->setValues($db);