Qual: Meilleure gestion erreur en cas de paramètres saisis incorrects
Suppression warning en mode safe_mode
This commit is contained in:
parent
cb9aacc2e8
commit
3fc7fbce57
@ -38,10 +38,25 @@ $langs->load("install");
|
|||||||
|
|
||||||
pHeader($langs->trans("ConfigurationFile"),"etape2");
|
pHeader($langs->trans("ConfigurationFile"),"etape2");
|
||||||
|
|
||||||
|
|
||||||
|
$ok=0;
|
||||||
|
$error = 0;
|
||||||
$etape = 1;
|
$etape = 1;
|
||||||
|
|
||||||
// Répertoire des pages dolibarr
|
// Répertoire des pages dolibarr
|
||||||
$main_dir=isset($_POST["main_dir"])?$_POST["main_dir"]:'';
|
$main_dir=isset($_POST["main_dir"])?trim($_POST["main_dir"]):'';
|
||||||
|
|
||||||
|
// On supprime / de fin dans main_dir
|
||||||
|
if (substr($main_dir, strlen($main_dir) -1) == "/")
|
||||||
|
{
|
||||||
|
$main_dir = substr($main_dir, 0, strlen($main_dir)-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// On supprime / de fin dans main_url
|
||||||
|
if (substr($_POST["main_url"], strlen($_POST["main_url"]) -1) == "/")
|
||||||
|
{
|
||||||
|
$_POST["main_url"] = substr($_POST["main_url"], 0, strlen($_POST["main_url"])-1);
|
||||||
|
}
|
||||||
|
|
||||||
// Répertoire des documents générés (factures, etc...)
|
// Répertoire des documents générés (factures, etc...)
|
||||||
$main_data_dir=isset($_POST["main_data_dir"])?$_POST["main_data_dir"]:'';
|
$main_data_dir=isset($_POST["main_data_dir"])?$_POST["main_data_dir"]:'';
|
||||||
@ -49,153 +64,159 @@ if (! $main_data_dir) { $main_data_dir="$main_dir/documents"; }
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
if ($_POST["action"] == "set")
|
if ($_POST["action"] == "set")
|
||||||
{
|
{
|
||||||
umask(0);
|
umask(0);
|
||||||
print '<h2>'.$langs->trans("SaveConfigurationFile").'</h2>';
|
|
||||||
|
|
||||||
print '<table cellspacing="0" width="100%" cellpadding="1" border="0">';
|
print '<h2>'.$langs->trans("SaveConfigurationFile").'</h2>';
|
||||||
$error=0;
|
|
||||||
$fp = fopen("$conffile", "w");
|
|
||||||
|
|
||||||
if($fp)
|
print '<table cellspacing="0" width="100%" cellpadding="1" border="0">';
|
||||||
{
|
|
||||||
if (substr($main_dir, strlen($main_dir) -1) == "/")
|
|
||||||
{
|
|
||||||
$main_dir = substr($main_dir, 0, strlen($main_dir)-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (substr($_POST["main_url"], strlen($_POST["main_url"]) -1) == "/")
|
|
||||||
{
|
|
||||||
$_POST["main_url"] = substr($_POST["main_url"], 0, strlen($_POST["main_url"])-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearstatcache();
|
|
||||||
|
|
||||||
fwrite($fp, '<?php');
|
|
||||||
fputs($fp,"\n");
|
|
||||||
|
|
||||||
fputs($fp, '$dolibarr_main_url_root="'.$_POST["main_url"].'";');
|
|
||||||
fputs($fp,"\n");
|
|
||||||
|
|
||||||
fputs($fp, '$dolibarr_main_document_root="'.$main_dir.'";');
|
|
||||||
fputs($fp,"\n");
|
|
||||||
|
|
||||||
fputs($fp, '$dolibarr_main_data_root="'.$main_data_dir.'";');
|
|
||||||
fputs($fp,"\n");
|
|
||||||
|
|
||||||
fputs($fp, '$dolibarr_main_db_host="'.$_POST["db_host"].'";');
|
|
||||||
fputs($fp,"\n");
|
|
||||||
|
|
||||||
fputs($fp, '$dolibarr_main_db_name="'.$_POST["db_name"].'";');
|
|
||||||
fputs($fp,"\n");
|
|
||||||
|
|
||||||
fputs($fp, '$dolibarr_main_db_user="'.$_POST["db_user"].'";');
|
|
||||||
fputs($fp,"\n");
|
|
||||||
|
|
||||||
fputs($fp, '$dolibarr_main_db_pass="'.$_POST["db_pass"].'";');
|
|
||||||
fputs($fp,"\n");
|
|
||||||
|
|
||||||
fputs($fp, '$dolibarr_main_db_type="'.$_POST["db_type"].'";');
|
|
||||||
fputs($fp,"\n");
|
|
||||||
|
|
||||||
fputs($fp, '?>');
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
if (file_exists("$conffile"))
|
|
||||||
{
|
|
||||||
include ("$conffile");
|
|
||||||
print "<tr><td>".$langs->trans("ConfigurationSaving")."</td><td>".$langs->trans("OK")."</td>";
|
|
||||||
$error = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$error = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($dolibarr_main_db_type == "mysql")
|
|
||||||
{
|
|
||||||
include_once("../lib/mysql.lib.php");
|
|
||||||
$choix=1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
include_once("../lib/pgsql.lib.php");
|
|
||||||
$choix=2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* Creation des répertoires
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
|
// Verification validite parametre main_dir
|
||||||
if ($error == 0)
|
if ($error == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Les documents sont en dehors de htdocs car ne doivent pas pouvoir etre téléchargés en passant outre l'authentification
|
|
||||||
$dir[0] = "$main_data_dir/facture";
|
|
||||||
$dir[1] = "$main_data_dir/users";
|
|
||||||
$dir[2] = "$main_data_dir/propale";
|
|
||||||
$dir[3] = "$main_data_dir/societe";
|
|
||||||
$dir[4] = "$main_data_dir/ficheinter";
|
|
||||||
$dir[5] = "$main_data_dir/produit";
|
|
||||||
$dir[6] = "$main_data_dir/rapport";
|
|
||||||
$dir[7] = "$main_data_dir/rsscache";
|
|
||||||
$dir[8] = "$main_data_dir/logo";
|
|
||||||
|
|
||||||
if (! is_dir($main_dir))
|
if (! is_dir($main_dir))
|
||||||
{
|
{
|
||||||
|
dolibarr_syslog ("Le dossier '".$main_dir."' n'existe pas");
|
||||||
|
|
||||||
print "<tr><td>";
|
print "<tr><td>";
|
||||||
print $langs->trans("DirDoesNotExists",$main_dir);
|
print $langs->trans("ErrorDirDoesNotExists",$main_dir).'<br>';;
|
||||||
print "</td><td>";
|
print "Vous avez saisie une mauvaise valeur pour le paramètre '".$langs->trans("WebPagesDirectory")."'.<br>";
|
||||||
|
print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
||||||
|
print '</td><td>';
|
||||||
|
print $langs->trans("Error");
|
||||||
|
print "</td></tr>";
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sauvegarde fichier configuration
|
||||||
|
if ($error == 0)
|
||||||
|
{
|
||||||
|
$fp = fopen("$conffile", "w");
|
||||||
|
|
||||||
|
if($fp)
|
||||||
|
{
|
||||||
|
clearstatcache();
|
||||||
|
|
||||||
|
fwrite($fp, '<?php');
|
||||||
|
fputs($fp,"\n");
|
||||||
|
|
||||||
|
fputs($fp, '$dolibarr_main_url_root="'.$_POST["main_url"].'";');
|
||||||
|
fputs($fp,"\n");
|
||||||
|
|
||||||
|
fputs($fp, '$dolibarr_main_document_root="'.$main_dir.'";');
|
||||||
|
fputs($fp,"\n");
|
||||||
|
|
||||||
|
fputs($fp, '$dolibarr_main_data_root="'.$main_data_dir.'";');
|
||||||
|
fputs($fp,"\n");
|
||||||
|
|
||||||
|
fputs($fp, '$dolibarr_main_db_host="'.$_POST["db_host"].'";');
|
||||||
|
fputs($fp,"\n");
|
||||||
|
|
||||||
|
fputs($fp, '$dolibarr_main_db_name="'.$_POST["db_name"].'";');
|
||||||
|
fputs($fp,"\n");
|
||||||
|
|
||||||
|
fputs($fp, '$dolibarr_main_db_user="'.$_POST["db_user"].'";');
|
||||||
|
fputs($fp,"\n");
|
||||||
|
|
||||||
|
fputs($fp, '$dolibarr_main_db_pass="'.$_POST["db_pass"].'";');
|
||||||
|
fputs($fp,"\n");
|
||||||
|
|
||||||
|
fputs($fp, '$dolibarr_main_db_type="'.$_POST["db_type"].'";');
|
||||||
|
fputs($fp,"\n");
|
||||||
|
|
||||||
|
fputs($fp, '?>');
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
if (file_exists("$conffile"))
|
||||||
|
{
|
||||||
|
include ("$conffile");
|
||||||
|
print "<tr><td>".$langs->trans("ConfigurationSaving")."</td><td>".$langs->trans("OK")."</td>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($dolibarr_main_db_type == "mysql")
|
||||||
|
{
|
||||||
|
$choix=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$choix=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chargement driver acces bases
|
||||||
|
include_once("../lib/".$dolibarr_main_db_type.".lib.php");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
*
|
||||||
|
* Creation des répertoires
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
// Creation des sous-répertoires main_data_dir
|
||||||
|
if ($error == 0)
|
||||||
|
{
|
||||||
|
dolibarr_syslog ("Le dossier '".$main_dir."' existe");
|
||||||
|
|
||||||
|
// Répertoire des documents
|
||||||
|
if (! is_dir($main_data_dir))
|
||||||
|
{
|
||||||
|
@mkdir($main_data_dir, 0755);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! is_dir($main_data_dir))
|
||||||
|
{
|
||||||
|
print "<tr><td>Le dossier '$main_data_dir' n'existe pas ! ";
|
||||||
|
print "Vous devez créer ce dossier et permettre au serveur web d'écrire dans celui-ci";
|
||||||
|
print '</td><td>';
|
||||||
print $langs->trans("Error");
|
print $langs->trans("Error");
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_syslog ("Le dossier '".$main_dir."' existe");
|
// Les documents sont en dehors de htdocs car ne doivent pas pouvoir etre téléchargés en passant outre l'authentification
|
||||||
|
$dir[0] = "$main_data_dir/facture";
|
||||||
// Répertoire des documents
|
$dir[1] = "$main_data_dir/users";
|
||||||
if (! is_dir($main_data_dir))
|
$dir[2] = "$main_data_dir/propale";
|
||||||
|
$dir[3] = "$main_data_dir/societe";
|
||||||
|
$dir[4] = "$main_data_dir/ficheinter";
|
||||||
|
$dir[5] = "$main_data_dir/produit";
|
||||||
|
$dir[6] = "$main_data_dir/rapport";
|
||||||
|
$dir[7] = "$main_data_dir/rsscache";
|
||||||
|
$dir[8] = "$main_data_dir/logo";
|
||||||
|
|
||||||
|
// Boucle sur chaque répertoire de dir[] pour les créer s'ils nexistent pas
|
||||||
|
for ($i = 0 ; $i < sizeof($dir) ; $i++)
|
||||||
{
|
{
|
||||||
@mkdir($main_data_dir, 0755);
|
if (is_dir($dir[$i]))
|
||||||
}
|
|
||||||
|
|
||||||
if (! is_dir($main_data_dir))
|
|
||||||
{
|
|
||||||
print "<tr><td>Le dossier '$main_data_dir' n'existe pas ! ";
|
|
||||||
print "Vous devez créer ce dossier et permettre au serveur web d'écrire dans celui-ci";
|
|
||||||
print '</td><td bgcolor="red">Erreur</td></tr>';
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Boucle sur chaque répertoire de dir[] pour les créer s'ils nexistent pas
|
|
||||||
for ($i = 0 ; $i < sizeof($dir) ; $i++)
|
|
||||||
{
|
{
|
||||||
if (is_dir($dir[$i]))
|
dolibarr_syslog ("Le dossier '".$dir[$i]."' existe");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! @mkdir($dir[$i], 0755))
|
||||||
{
|
{
|
||||||
dolibarr_syslog ("Le dossier '".$dir[$i]."' existe");
|
print "<tr><td>";
|
||||||
|
print "Impossible de créer : ".$dir[$i];
|
||||||
|
print '</td><td>';
|
||||||
|
print $langs->trans("Error");
|
||||||
|
print "</td></tr>";
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (! @mkdir($dir[$i], 0755))
|
dolibarr_syslog ("Le dossier '".$dir[$i]."' a ete cree");
|
||||||
{
|
|
||||||
print "<tr><td>";
|
|
||||||
print "Impossible de créer : ".$dir[$i];
|
|
||||||
print "</td><td bgcolor=\"red\">";
|
|
||||||
print $langs->trans("Error");
|
|
||||||
print "</td></tr>";
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_syslog ("Le dossier '".$dir[$i]."' a ete cree");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,62 +224,60 @@ if ($_POST["action"] == "set")
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Base de données
|
* Base de données
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ($error == 0)
|
if ($error == 0)
|
||||||
{
|
{
|
||||||
include_once($dolibarr_main_document_root . "/conf/conf.class.php");
|
include_once($dolibarr_main_document_root . "/conf/conf.class.php");
|
||||||
|
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
$conf->db->type = trim($dolibarr_main_db_type);
|
$conf->db->type = trim($dolibarr_main_db_type);
|
||||||
$conf->db->host = trim($dolibarr_main_db_host);
|
$conf->db->host = trim($dolibarr_main_db_host);
|
||||||
$conf->db->name = trim($dolibarr_main_db_name);
|
$conf->db->name = trim($dolibarr_main_db_name);
|
||||||
$conf->db->user = trim($dolibarr_main_db_user);
|
$conf->db->user = trim($dolibarr_main_db_user);
|
||||||
$conf->db->pass = trim($dolibarr_main_db_pass);
|
$conf->db->pass = trim($dolibarr_main_db_pass);
|
||||||
|
|
||||||
$userroot=isset($_POST["db_user_root"])?$_POST["db_user_root"]:"";
|
$userroot=isset($_POST["db_user_root"])?$_POST["db_user_root"]:"";
|
||||||
$passroot=isset($_POST["db_pass_root"])?$_POST["db_pass_root"]:"";
|
$passroot=isset($_POST["db_pass_root"])?$_POST["db_pass_root"]:"";
|
||||||
|
|
||||||
$ok=0;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Si creation utilisateur admin demandée, on le crée
|
* Si creation utilisateur admin demandée, on le crée
|
||||||
*/
|
*/
|
||||||
if (isset($_POST["db_create_user"]) && $_POST["db_create_user"] == "on")
|
if (isset($_POST["db_create_user"]) && $_POST["db_create_user"] == "on")
|
||||||
{
|
{
|
||||||
dolibarr_syslog ("Creation de l'utilisateur: ".$dolibarr_main_db_user." choix base: ".$choix);
|
dolibarr_syslog("Creation de l'utilisateur: ".$dolibarr_main_db_user." choix base: ".$choix);
|
||||||
|
|
||||||
if ($choix == 1) //choix 1=mysql
|
if ($choix == 1) //choix 1=mysql
|
||||||
{
|
{
|
||||||
//print $conf->db->host." , ".$conf->db->name." , ".$conf->db->user." , ".$conf->db->pass;
|
//print $conf->db->host." , ".$conf->db->name." , ".$conf->db->user." , ".$conf->db->pass;
|
||||||
$db = new DoliDb($conf->db->type,$conf->db->host,$userroot,$passroot,'mysql');
|
$db = new DoliDb($conf->db->type,$conf->db->host,$userroot,$passroot,'mysql');
|
||||||
|
|
||||||
if ($db->connected)
|
if ($db->connected)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO user ";
|
$sql = "INSERT INTO user ";
|
||||||
$sql.= "(Host,User,password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Index_Priv,Alter_priv)";
|
$sql.= "(Host,User,password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Index_Priv,Alter_priv)";
|
||||||
$sql.= " VALUES ('$dolibarr_main_db_host','$dolibarr_main_db_user',password('$dolibarr_main_db_pass')";
|
$sql.= " VALUES ('$dolibarr_main_db_host','$dolibarr_main_db_user',password('$dolibarr_main_db_pass')";
|
||||||
$sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y');";
|
$sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y');";
|
||||||
|
|
||||||
//print "$sql<br>\n";
|
//print "$sql<br>\n";
|
||||||
|
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
|
|
||||||
$sql = "INSERT INTO db ";
|
$sql = "INSERT INTO db ";
|
||||||
$sql.= "(Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Index_Priv,Alter_priv)";
|
$sql.= "(Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Index_Priv,Alter_priv)";
|
||||||
$sql.= " VALUES ('$dolibarr_main_db_host','$dolibarr_main_db_name','$dolibarr_main_db_user'";
|
$sql.= " VALUES ('$dolibarr_main_db_host','$dolibarr_main_db_name','$dolibarr_main_db_user'";
|
||||||
$sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y');";
|
$sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y');";
|
||||||
|
|
||||||
//print "$sql<br>\n";
|
//print "$sql<br>\n";
|
||||||
|
|
||||||
if ($db->query($sql))
|
if ($db->query($sql))
|
||||||
{
|
{
|
||||||
dolibarr_syslog("flush privileges");
|
dolibarr_syslog("flush privileges");
|
||||||
$db->query("FLUSH Privileges;");
|
$db->query("FLUSH Privileges;");
|
||||||
|
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $langs->trans("UserCreation").' : ';
|
print $langs->trans("UserCreation").' : ';
|
||||||
print $dolibarr_main_db_user;
|
print $dolibarr_main_db_user;
|
||||||
@ -283,10 +302,10 @@ if ($_POST["action"] == "set")
|
|||||||
print $langs->trans("UserCreation").' : ';
|
print $langs->trans("UserCreation").' : ';
|
||||||
print $dolibarr_main_db_user;
|
print $dolibarr_main_db_user;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>".$langs->trans("Error").' '.$db->error()."</td></tr>";
|
print '<td>'.$langs->trans("Error").' '.$db->error()."</td></tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -296,14 +315,14 @@ if ($_POST["action"] == "set")
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans("Error").'</td>';
|
print '<td>'.$langs->trans("Error").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Affiche aide diagnostique
|
// Affiche aide diagnostique
|
||||||
print '<tr><td colspan="2"><br>Vous avez demandé la création du login Dolibarr "<b>'.$dolibarr_main_db_user.'</b>", mais pour cela, ';
|
print '<tr><td colspan="2"><br>Vous avez demandé la création du login Dolibarr "<b>'.$dolibarr_main_db_user.'</b>", mais pour cela, ';
|
||||||
print 'Dolibarr doit se connecter sur le serveur "<b>'.$dolibarr_main_db_host.'</b>" via le super utilisateur "<b>'.$userroot.'</b>", mot de passe "<b>'.$passroot.'</b>".<br>';
|
print 'Dolibarr doit se connecter sur le serveur "<b>'.$dolibarr_main_db_host.'</b>" via le super utilisateur "<b>'.$userroot.'</b>", mot de passe "<b>'.$passroot.'</b>".<br>';
|
||||||
print 'La connexion ayant échoué, les paramètres du serveur ou du super utilisateur sont peut-etre incorrects. ';
|
print 'La connexion ayant échoué, les paramètres du serveur ou du super utilisateur sont peut-etre incorrects. ';
|
||||||
print 'Revenez en arrière pour corriger les paramètres.<br><br>';
|
print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$ok=-1;
|
$ok=-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,15 +332,15 @@ if ($_POST["action"] == "set")
|
|||||||
print $langs->trans("ThisPHPDoesNotSupportTypeBase",'pgsql');
|
print $langs->trans("ThisPHPDoesNotSupportTypeBase",'pgsql');
|
||||||
$ok=0;
|
$ok=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ok)
|
if ($ok)
|
||||||
{
|
{
|
||||||
$nom = $dolibarr_main_db_user;
|
$nom = $dolibarr_main_db_user;
|
||||||
$con=pg_connect("host=".$dolibarr_main_db_host." dbname=".$dolibarr_main_db_name." user=postgres");
|
$con=pg_connect("host=".$dolibarr_main_db_host." dbname=".$dolibarr_main_db_name." user=postgres");
|
||||||
$query_str = "create user \"".$nom."\" with password '".$dolibarr_main_db_pass."';";
|
$query_str = "create user \"".$nom."\" with password '".$dolibarr_main_db_pass."';";
|
||||||
//print $query_str;
|
//print $query_str;
|
||||||
$ret = pg_query($con,$query_str);
|
$ret = pg_query($con,$query_str);
|
||||||
|
|
||||||
if ($ret)
|
if ($ret)
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
@ -342,19 +361,19 @@ if ($_POST["action"] == "set")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Fin si "creation utilisateur"
|
} // Fin si "creation utilisateur"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Si creation database demandée, on la crée
|
* Si creation database demandée, on la crée
|
||||||
*/
|
*/
|
||||||
if (isset($_POST["db_create_database"]) && $_POST["db_create_database"] == "on")
|
if (isset($_POST["db_create_database"]) && $_POST["db_create_database"] == "on")
|
||||||
{
|
{
|
||||||
dolibarr_syslog ("Creation de la base : ".$dolibarr_main_db_name);
|
dolibarr_syslog ("Creation de la base : ".$dolibarr_main_db_name);
|
||||||
|
|
||||||
$db = new DoliDb($conf->db->type,$conf->db->host,$userroot,$passroot);
|
$db = new DoliDb($conf->db->type,$conf->db->host,$userroot,$passroot);
|
||||||
|
|
||||||
if ($db->connected)
|
if ($db->connected)
|
||||||
{
|
{
|
||||||
if ($db->create_db($dolibarr_main_db_name))
|
if ($db->create_db($dolibarr_main_db_name))
|
||||||
@ -372,12 +391,12 @@ if ($_POST["action"] == "set")
|
|||||||
print $dolibarr_main_db_name;
|
print $dolibarr_main_db_name;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans("Error").' '.$db->errno().'</td></tr>';
|
print '<td>'.$langs->trans("Error").' '.$db->errno().'</td></tr>';
|
||||||
|
|
||||||
// Affiche aide diagnostique
|
// Affiche aide diagnostique
|
||||||
print '<tr><td colspan="2"><br>La création de la base Dolibarr "<b>'.$dolibarr_main_db_name.'</b>" a échoué.';
|
print '<tr><td colspan="2"><br>La création de la base Dolibarr "<b>'.$dolibarr_main_db_name.'</b>" a échoué.';
|
||||||
print 'Si la base existe déjà, revenez en arrière et désactiver l\'option "Créer la base de donnée".<br>';
|
print 'Si la base existe déjà, revenez en arrière et désactiver l\'option "Créer la base de donnée".<br>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$ok=-1;
|
$ok=-1;
|
||||||
}
|
}
|
||||||
$db->close();
|
$db->close();
|
||||||
@ -389,29 +408,29 @@ if ($_POST["action"] == "set")
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans("Error").'</td>';
|
print '<td>'.$langs->trans("Error").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Affiche aide diagnostique
|
// Affiche aide diagnostique
|
||||||
print '<tr><td colspan="2"><br>Vous avez demandé la création de la base Dolibarr "<b>'.$dolibarr_main_db_name.'</b>", mais pour cela, ';
|
print '<tr><td colspan="2"><br>Vous avez demandé la création de la base Dolibarr "<b>'.$dolibarr_main_db_name.'</b>", mais pour cela, ';
|
||||||
print 'Dolibarr doit se connecter sur le serveur "<b>'.$dolibarr_main_db_host.'</b>" via le super utilisateur "<b>'.$userroot.'</b>", mot de passe "<b>'.$passroot.'</b>".<br>';
|
print 'Dolibarr doit se connecter sur le serveur "<b>'.$dolibarr_main_db_host.'</b>" via le super utilisateur "<b>'.$userroot.'</b>", mot de passe "<b>'.$passroot.'</b>".<br>';
|
||||||
print 'La connexion ayant échoué, les paramètres du serveur ou du super utilisateur sont peut-etre incorrects. ';
|
print 'La connexion ayant échoué, les paramètres du serveur ou du super utilisateur sont peut-etre incorrects. ';
|
||||||
print 'Revenez en arrière pour corriger les paramètres.<br><br>';
|
print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$ok=-1;
|
$ok=-1;
|
||||||
}
|
}
|
||||||
} // Fin si "creation database"
|
} // Fin si "creation database"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On essaie l'accès par le user admin dolibarr
|
* On essaie l'accès par le user admin dolibarr
|
||||||
*/
|
*/
|
||||||
if ($ok == 0)
|
if ($ok == 0)
|
||||||
{
|
{
|
||||||
dolibarr_syslog("connexion de type=".$conf->db->type." sur host=".$conf->db->host." user=".$conf->db->user." name=".$conf->db->name);
|
dolibarr_syslog("connexion de type=".$conf->db->type." sur host=".$conf->db->host." user=".$conf->db->user." name=".$conf->db->name);
|
||||||
//print "connexion de type=".$conf->db->type." sur host=".$conf->db->host." user=".$conf->db->user." name=".$conf->db->name;
|
//print "connexion de type=".$conf->db->type." sur host=".$conf->db->host." user=".$conf->db->user." name=".$conf->db->name;
|
||||||
|
|
||||||
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
|
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
|
||||||
|
|
||||||
if ($db->connected == 1)
|
if ($db->connected == 1)
|
||||||
{
|
{
|
||||||
// si accès serveur ok et accès base ok, tout est ok, on ne va pas plus loin, on a même pas utilisé le compte root.
|
// si accès serveur ok et accès base ok, tout est ok, on ne va pas plus loin, on a même pas utilisé le compte root.
|
||||||
@ -424,7 +443,7 @@ if ($_POST["action"] == "set")
|
|||||||
print "</td><td>";
|
print "</td><td>";
|
||||||
print $langs->trans("OK");
|
print $langs->trans("OK");
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
dolibarr_syslog("la connexion a la base : ".$conf->db->name.",par le user : ".$conf->db->user." est reussie");
|
dolibarr_syslog("la connexion a la base : ".$conf->db->name.",par le user : ".$conf->db->user." est reussie");
|
||||||
print "<tr><td>";
|
print "<tr><td>";
|
||||||
print $langs->trans("DatabaseConnection")." : ";
|
print $langs->trans("DatabaseConnection")." : ";
|
||||||
@ -432,7 +451,7 @@ if ($_POST["action"] == "set")
|
|||||||
print "</td><td>";
|
print "</td><td>";
|
||||||
print $langs->trans("OK");
|
print $langs->trans("OK");
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
$ok = 1;
|
$ok = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -444,21 +463,21 @@ if ($_POST["action"] == "set")
|
|||||||
print "</td><td>";
|
print "</td><td>";
|
||||||
print $langs->trans("OK");
|
print $langs->trans("OK");
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
dolibarr_syslog("la connexion a la base ".$conf->db->name.",par le user ".$conf->db->user." a échoué");
|
dolibarr_syslog("la connexion a la base ".$conf->db->name.",par le user ".$conf->db->user." a échoué");
|
||||||
print "<tr><td>";
|
print "<tr><td>";
|
||||||
print $langs->trans("DatabaseConnection")." : ";
|
print $langs->trans("DatabaseConnection")." : ";
|
||||||
print $dolibarr_main_db_name;
|
print $dolibarr_main_db_name;
|
||||||
print "</td><td>";
|
print '</td><td>';
|
||||||
print $langs->trans("Error");
|
print $langs->trans("Error");
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Affiche aide diagnostique
|
// Affiche aide diagnostique
|
||||||
print '<tr><td colspan="2"><br>Vérifier que le nom de base "<b>'.$dolibarr_main_db_name.'</b>" est correct.<br>';
|
print '<tr><td colspan="2"><br>Vérifier que le nom de base "<b>'.$dolibarr_main_db_name.'</b>" est correct.<br>';
|
||||||
print 'Si ce nom est correct et que cette base n\'existe pas déjà, vous devez cocher l\'option "Créer la base de donnée". ';
|
print 'Si ce nom est correct et que cette base n\'existe pas déjà, vous devez cocher l\'option "Créer la base de donnée". ';
|
||||||
print 'Revenez en arrière pour corriger les paramètres.<br>';
|
print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$ok = -1;
|
$ok = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -468,25 +487,24 @@ if ($_POST["action"] == "set")
|
|||||||
print "<tr><td>";
|
print "<tr><td>";
|
||||||
print $langs->trans("ServerConnection")." : ";
|
print $langs->trans("ServerConnection")." : ";
|
||||||
print $dolibarr_main_db_host;
|
print $dolibarr_main_db_host;
|
||||||
print "</td><td>";
|
print '</td><td>';
|
||||||
print $langs->trans("Error");
|
print $langs->trans("Error");
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Affiche aide diagnostique
|
// Affiche aide diagnostique
|
||||||
print '<tr><td colspan="2"><br>Le serveur "<b>'.$conf->db->host.'</b>", nom de base "<b>'.$conf->db->name.'</b>", login "<b>'.$conf->db->user.'</b>", ou mot de passe <b>"'.$conf->db->pass.'</b>" de la base de donnée est peut-être incorrect ou la version du client PHP trop ancienne par rapport à la version de la base de donnée.<br>';
|
print '<tr><td colspan="2"><br>Le serveur "<b>'.$conf->db->host.'</b>", nom de base "<b>'.$conf->db->name.'</b>", login "<b>'.$conf->db->user.'</b>", ou mot de passe <b>"'.$conf->db->pass.'</b>" de la base de donnée est peut-être incorrect ou la version du client PHP trop ancienne par rapport à la version de la base de donnée.<br>';
|
||||||
print 'Si le login n\'existe pas encore, vous devez cocher l\'option "Créer l\'utilisateur".<br>';
|
print 'Si le login n\'existe pas encore, vous devez cocher l\'option "Créer l\'utilisateur".<br>';
|
||||||
print 'Revenez en arrière pour corriger les paramètres.<br>';
|
print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$ok = -1;
|
$ok = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
pFooter($error);
|
||||||
</table>
|
|
||||||
<?php
|
|
||||||
pFooter($ok==1?0:1);
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,8 +30,11 @@ include_once("./inc.php");
|
|||||||
|
|
||||||
|
|
||||||
// Cette page peut etre longue. On augmente le délai par défaut de 30 à 60.
|
// Cette page peut etre longue. On augmente le délai par défaut de 30 à 60.
|
||||||
set_time_limit(60); // Ne fonctionne que si on est pas en safe_mode
|
// Ne fonctionne que si on est pas en safe_mode.
|
||||||
|
$err=error_reporting();
|
||||||
|
error_reporting(0);
|
||||||
|
set_time_limit(60);
|
||||||
|
error_reporting($err);
|
||||||
|
|
||||||
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:$langcode);
|
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:$langcode);
|
||||||
$langs->defaultlang=$setuplang;
|
$langs->defaultlang=$setuplang;
|
||||||
|
|||||||
@ -5,6 +5,8 @@ ConfFileExists=Configuration file <b>conf.php</b> exists.
|
|||||||
ConfFileCouldBeCreated=Configuration file <b>conf.php</b> could be created.
|
ConfFileCouldBeCreated=Configuration file <b>conf.php</b> could be created.
|
||||||
ConfFileIsNotWritable=Configuration file <b>conf.php</b> is not writable, check its permissions, your web server must be granted to be able to write into this file during configuration process (chmod 666 for example on Unix like OS).
|
ConfFileIsNotWritable=Configuration file <b>conf.php</b> is not writable, check its permissions, your web server must be granted to be able to write into this file during configuration process (chmod 666 for example on Unix like OS).
|
||||||
ConfFileIsWritable=Configuration file <b>conf.php</b> is writable.
|
ConfFileIsWritable=Configuration file <b>conf.php</b> is writable.
|
||||||
|
ErrorDirDoesNotExists=Directory %s does not exists.
|
||||||
|
ErrorGoBackAndCorrectParameters=Go backward and correct wrong parameters.
|
||||||
YouCanContinue=You can continue...
|
YouCanContinue=You can continue...
|
||||||
License=Using license
|
License=Using license
|
||||||
ConfigurationFile=Configuration file
|
ConfigurationFile=Configuration file
|
||||||
|
|||||||
@ -5,6 +5,8 @@ ConfFileExists=Le fichier de configuration <b>conf.php</b> existe.
|
|||||||
ConfFileCouldBeCreated=Le fichier de configuration <b>conf.php</b> a pu être créé.
|
ConfFileCouldBeCreated=Le fichier de configuration <b>conf.php</b> a pu être créé.
|
||||||
ConfFileIsNotWritable=Le fichier <b>conf.php</b> n'est pas modifiable, vérifiez les permissions qui lui sont associées. Le serveur Web doit avoir le droit d'écrire dans ce fichier le temps de la configuration (chmod 666 par exemple sur un OS compatible Unix).
|
ConfFileIsNotWritable=Le fichier <b>conf.php</b> n'est pas modifiable, vérifiez les permissions qui lui sont associées. Le serveur Web doit avoir le droit d'écrire dans ce fichier le temps de la configuration (chmod 666 par exemple sur un OS compatible Unix).
|
||||||
ConfFileIsWritable=Le fichier <b>conf.php</b> est modifiable.
|
ConfFileIsWritable=Le fichier <b>conf.php</b> est modifiable.
|
||||||
|
ErrorDirDoesNotExists=Le répertoire %s n'existe pas.
|
||||||
|
ErrorGoBackAndCorrectParameters=Revenez en arrière et corrigez les paramètres invalides.
|
||||||
YouCanContinue=Vous pouvez continuer...
|
YouCanContinue=Vous pouvez continuer...
|
||||||
License=Licence d'utilisation
|
License=Licence d'utilisation
|
||||||
ConfigurationFile=Fichier de configuration
|
ConfigurationFile=Fichier de configuration
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user