Fix: Ajout test si paramètre host invalide
This commit is contained in:
parent
3ab89e5c3a
commit
fff87a117b
@ -84,15 +84,21 @@ class DoliDb
|
|||||||
global $conf;
|
global $conf;
|
||||||
$this->transaction_opened=0;
|
$this->transaction_opened=0;
|
||||||
|
|
||||||
if ($host == '') $host = $conf->db->host;
|
if (! $host) $host = $conf->db->host;
|
||||||
if ($user == '') $user = $conf->db->user;
|
if (! $user) $user = $conf->db->user;
|
||||||
if ($pass == '') $pass = $conf->db->pass;
|
if (! $pass) $pass = $conf->db->pass;
|
||||||
if ($name == '') $name = $conf->db->name;
|
if (! $name) $name = $conf->db->name;
|
||||||
|
|
||||||
//print "Name DB: $host,$user,$pass,$name<br>";
|
//print "Name DB: $host,$user,$pass,$name<br>";
|
||||||
|
if (! $host)
|
||||||
|
{
|
||||||
|
$this->connected = 0;
|
||||||
|
$this->ok = 0;
|
||||||
|
dolibarr_syslog("DoliDB::DoliDB : Erreur Connect, wrong host parameters");
|
||||||
|
return $this->ok;
|
||||||
|
}
|
||||||
|
|
||||||
// Essai connexion serveur
|
// Essai connexion serveur
|
||||||
|
|
||||||
$this->db = $this->connect($host, $user, $pass, $newlink);
|
$this->db = $this->connect($host, $user, $pass, $newlink);
|
||||||
|
|
||||||
if ($this->db)
|
if ($this->db)
|
||||||
@ -108,7 +114,6 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si connexion serveur ok et si connexion base demandée, on essaie connexion base
|
// Si connexion serveur ok et si connexion base demandée, on essaie connexion base
|
||||||
|
|
||||||
if ($this->connected && $name)
|
if ($this->connected && $name)
|
||||||
{
|
{
|
||||||
if ($this->select_db($name) == 1)
|
if ($this->select_db($name) == 1)
|
||||||
|
|||||||
@ -68,15 +68,21 @@ class DoliDb
|
|||||||
global $conf;
|
global $conf;
|
||||||
$this->transaction_opened=0;
|
$this->transaction_opened=0;
|
||||||
|
|
||||||
if ($host == '') $host = $conf->db->host;
|
if (! $host) $host = $conf->db->host;
|
||||||
if ($user == '') $user = $conf->db->user;
|
if (! $user) $user = $conf->db->user;
|
||||||
if ($pass == '') $pass = $conf->db->pass;
|
if (! $pass) $pass = $conf->db->pass;
|
||||||
if ($name == '') $name = $conf->db->name;
|
if (! $name) $name = $conf->db->name;
|
||||||
|
|
||||||
//print "Name DB: $host,$user,$pass,$name<br>";
|
//print "Name DB: $host,$user,$pass,$name<br>";
|
||||||
|
if (! $host)
|
||||||
|
{
|
||||||
|
$this->connected = 0;
|
||||||
|
$this->ok = 0;
|
||||||
|
dolibarr_syslog("DoliDB::DoliDB : Erreur Connect, wrong host parameters");
|
||||||
|
return $this->ok;
|
||||||
|
}
|
||||||
|
|
||||||
// Essai connexion serveur
|
// Essai connexion serveur
|
||||||
|
|
||||||
$this->db = $this->connect($host, $user, $pass, $name);
|
$this->db = $this->connect($host, $user, $pass, $name);
|
||||||
|
|
||||||
if ($this->db)
|
if ($this->db)
|
||||||
@ -91,7 +97,6 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si connexion serveur ok et si connexion base demandée, on essaie connexion base
|
// Si connexion serveur ok et si connexion base demandée, on essaie connexion base
|
||||||
|
|
||||||
if ($this->connected && $name)
|
if ($this->connected && $name)
|
||||||
{
|
{
|
||||||
if ($this->select_db($name) == 1)
|
if ($this->select_db($name) == 1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user