Fix: Correct broken install

This commit is contained in:
Laurent Destailleur 2009-04-17 18:26:21 +00:00
parent dfa14dc04f
commit 47f255ea15
2 changed files with 16 additions and 11 deletions

View File

@ -57,18 +57,18 @@ class Conf
/**
* \brief Positionne toutes les variables de configuration
* \brief Load setup values into conf object
* \param $db Handler d'acces base
* \param $entity Id of company
* \return int < 0 si erreur, >= 0 si succes
* \return int < 0 if KO, >= 0 if OK
*/
function setValues($db,$entity)
function setValues($db,$entity=1)
{
dol_syslog("Conf::setValues");
// Par defaut, a oui
$this->global->PRODUIT_CONFIRM_DELETE_LINE=1;
$this->entity = $entity;
/*
@ -77,7 +77,7 @@ class Conf
* - En $this->global->key=value
*/
$sql = "SELECT name, value, entity FROM ".MAIN_DB_PREFIX."const ";
$sql.= " WHERE entity = 0 OR entity = ".$entity;
$sql.= " WHERE entity = 0 OR entity = ".$this->entity;
$result = $db->query($sql);
if ($result)
{
@ -88,7 +88,7 @@ class Conf
{
$objp = $db->fetch_object($result);
$key=$objp->name;
$value=$objp->value; // Pas de stripslashes (ne s'applique pas sur lecture en base mais apres POST quand get_magic_quotes_gpc()==1)
$value=$objp->value;
if ($key)
{
if (! defined("$key")) define ("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_FILE during install)

View File

@ -262,18 +262,23 @@ if (! isset($_SESSION["dol_login"]))
if ($login)
{
$test=false;
$conf->authmode=$mode; // This properties is defined only when login
$conf->authmode=$mode; // This properties is defined only when logged
// TODO Should not have setting and redirection header here.
// Cookie add must be set at same place than "New session for this login"
// and header call must be removed. Also entity must be set in session.
// Call function to check entity
if ($conf->multicompany->enabled && isset($_POST["entity"]))
{
$entitytotest=$_POST["entity"];
// Create entity cookie
$entityCookieName = "DOLENTITYID_dolibarr";
if (!isset($HTTP_COOKIE_VARS[$entityCookieName]))
{
setcookie($entityCookieName, $entitytotest, 0, "/", "", 0);
}
// Reload index.php
$url=DOL_URL_ROOT."/index.php";
header("Location: ".$url);
@ -394,14 +399,14 @@ else
}
}
// Est-ce une nouvelle session
// Is it a new session ?
if (! isset($_SESSION["dol_login"]))
{
$error=0;
// Nouvelle session pour ce login
// New session for this login
$_SESSION["dol_login"]=$user->login;
$_SESSION["dol_authmode"]=$conf->authmode;
dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id());