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,12 +57,12 @@ class Conf
/** /**
* \brief Positionne toutes les variables de configuration * \brief Load setup values into conf object
* \param $db Handler d'acces base * \param $db Handler d'acces base
* \param $entity Id of company * \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"); dol_syslog("Conf::setValues");
@ -77,7 +77,7 @@ class Conf
* - En $this->global->key=value * - En $this->global->key=value
*/ */
$sql = "SELECT name, value, entity FROM ".MAIN_DB_PREFIX."const "; $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); $result = $db->query($sql);
if ($result) if ($result)
{ {
@ -88,7 +88,7 @@ class Conf
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$key=$objp->name; $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 ($key)
{ {
if (! defined("$key")) define ("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_FILE during install) if (! defined("$key")) define ("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_FILE during install)

View File

@ -262,7 +262,11 @@ if (! isset($_SESSION["dol_login"]))
if ($login) if ($login)
{ {
$test=false; $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 // Call function to check entity
if ($conf->multicompany->enabled && isset($_POST["entity"])) if ($conf->multicompany->enabled && isset($_POST["entity"]))
{ {
@ -274,6 +278,7 @@ if (! isset($_SESSION["dol_login"]))
{ {
setcookie($entityCookieName, $entitytotest, 0, "/", "", 0); setcookie($entityCookieName, $entitytotest, 0, "/", "", 0);
} }
// Reload index.php // Reload index.php
$url=DOL_URL_ROOT."/index.php"; $url=DOL_URL_ROOT."/index.php";
header("Location: ".$url); header("Location: ".$url);
@ -394,12 +399,12 @@ else
} }
} }
// Est-ce une nouvelle session // Is it a new session ?
if (! isset($_SESSION["dol_login"])) if (! isset($_SESSION["dol_login"]))
{ {
$error=0; $error=0;
// Nouvelle session pour ce login // New session for this login
$_SESSION["dol_login"]=$user->login; $_SESSION["dol_login"]=$user->login;
$_SESSION["dol_authmode"]=$conf->authmode; $_SESSION["dol_authmode"]=$conf->authmode;