Fix: On rend obligatoire les paramtre de DoliDb afin de permettre l'utilisation d'un mot de passe vide.

This commit is contained in:
Laurent Destailleur 2005-03-23 23:06:18 +00:00
parent f424c9550a
commit 82579a6958
11 changed files with 51 additions and 37 deletions

View File

@ -71,33 +71,19 @@ class DoliDb
);
/**
\brief Ouverture d'une connection vers le serveur et éventuellement une database.
\param type type de base de données (mysql ou pgsql)
\brief Ouverture d'une connection vers le serveur et éventuellement une database.
\param type type de base de données (mysql ou pgsql)
\param host addresse de la base de données
\param user nom de l'utilisateur autorisé
\param pass mot de passe
\param name nom de la database
\return int 1 en cas de succès, 0 sinon
\return int 1 en cas de succès, 0 sinon
*/
function DoliDb($type = 'mysql', $host = '', $user = '', $pass = '', $name = '', $newlink=0)
function DoliDb($type='mysql', $host, $user, $pass, $name='', $newlink=0)
{
global $conf;
$this->transaction_opened=0;
if (! $host) $host = $conf->db->host;
if (! $user) $user = $conf->db->user;
if (! $pass) $pass = $conf->db->pass;
if (! $name) $name = $conf->db->name;
//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
$this->db = $this->connect($host, $user, $pass, $newlink);

View File

@ -63,16 +63,11 @@ class DoliDb
\param name nom de la database
\return int 1 en cas de succès, 0 sinon
*/
function DoliDb($type = 'pgsql', $host = '', $user = '', $pass = '', $name = '')
function DoliDb($type='pgsql', $host, $user, $pass, $name='')
{
global $conf;
$this->transaction_opened=0;
if (! $host) $host = $conf->db->host;
if (! $user) $user = $conf->db->user;
if (! $pass) $pass = $conf->db->pass;
if (! $name) $name = $conf->db->name;
//print "Name DB: $host,$user,$pass,$name<br>";
if (! $host)
{

View File

@ -107,7 +107,7 @@ require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
require_once(DOL_DOCUMENT_ROOT ."/address.class.php");
$db = new DoliDb();
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
$user = new User($db);

View File

@ -32,8 +32,11 @@ require("../../retourbplc.class.php");
require("../../don.class.php");
$conf = new Conf();
conf->db->type = $dolibarr_main_db_type;
$conf->db->type = $dolibarr_main_db_type;
$conf->db->host = $dolibarr_main_db_host;
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
// Si type non défini (pour compatibilité avec ancienne install), on
// travail avec mysql
@ -41,7 +44,7 @@ if (! $conf->db->type) { $conf->db->type = 'mysql'; }
require (DOL_DOCUMENT_ROOT ."/lib/".$dolibarr_main_db_type.".lib.php");
$db = new DoliDb();
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
$retbplc = new Retourbplc($db);

View File

@ -24,7 +24,13 @@
$conf = new Conf();
$db = new DoliDb();
$conf->db->type = $dolibarr_main_db_type;
$conf->db->host = $dolibarr_main_db_host;
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
$a = setlocale(LC_TIME, "fr_FR");
$sql = "SELECT ".$db->pdate("f.datef")." as datef, s.nom, f.total, f.note, f.paye";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";

View File

@ -22,7 +22,14 @@
$conf = new Conf();
$db = new DoliDb();
$conf->db->type = $dolibarr_main_db_type;
$conf->db->host = $dolibarr_main_db_host;
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
$a = setlocale(LC_TIME, "fr_FR");
$sql = "SELECT ".$db->pdate("d.datedon")." as datedon, d.nom, d.prenom, d.amount, d.public, d.societe";
$sql .= " FROM ".MAIN_DB_PREFIX."don as d";

View File

@ -24,8 +24,11 @@ require("../../don.class.php");
require("../../conf/conf.class.php");
$conf = new Conf();
conf->db->type = $dolibarr_main_db_type;
$conf->db->type = $dolibarr_main_db_type;
$conf->db->host = $dolibarr_main_db_host;
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
// Si type non défini (pour compatibilité avec ancienne install), on
// travail avec mysql
@ -36,7 +39,8 @@ require("../../lib/.$dolibarr_main_db_type.lib.php");
if ($conf->don->enabled)
{
$db = new DoliDb();
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
$don = new Don($db);
$don->projetid = $_POST["projetid"];

View File

@ -62,7 +62,14 @@ if (file_exists ($thermlib))
*/
$conf = new Conf();
$dbt = new DoliDb();
$conf->db->type = $dolibarr_main_db_type;
$conf->db->host = $dolibarr_main_db_host;
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
$dbt = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
$dontherm = new Don($dbt);
$actualValue = $dontherm->sum_actual();

View File

@ -51,9 +51,11 @@ class ProcessGraphClients
function ProcessGraphClients( $ident , $cpc)
{
global $conf;
$this->ident = $ident;
$this->cpc = $cpc;
$this->db = new DoliDb('','','','','',1);
$this->db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,1);
}
function go()

View File

@ -50,9 +50,11 @@ class ProcessGraphContrats
function ProcessGraphContrats( $ident , $cpc)
{
global $conf;
$this->ident = $ident;
$this->cpc = $cpc;
$this->db = new DoliDb('','','','','',1);
$this->db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,1);
}
function go($contrat_id = 0)

View File

@ -50,9 +50,11 @@ class ProcessGraphLignes
function ProcessGraphLignes( $ident , $cpc)
{
global $conf;
$this->ident = $ident;
$this->cpc = $cpc;
$this->db = new DoliDb('','','','','',1);
$this->db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,1);
}
function go()