From 945d1134c825c4eb32e829ed5688740c08bc54b2 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 12 Feb 2004 16:44:49 +0000 Subject: [PATCH] Fin pour moi, pour l'instant --- htdocs/install/default.css | 11 +- htdocs/install/etape2.php | 318 ++++++++++++++++++++++--------------- htdocs/install/etape4.php | 101 ++++++------ htdocs/install/etape5.php | 49 +++--- 4 files changed, 276 insertions(+), 203 deletions(-) diff --git a/htdocs/install/default.css b/htdocs/install/default.css index 0430987ec2d..5998c00eaf0 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -60,7 +60,7 @@ div.soustitre { div.main { background: #dcdcd3; text-align: left; - border: 1px solid #8CACBB; + border: 1px solid #8CACBB; } div.main-inside { @@ -71,6 +71,15 @@ div.main-inside { } +div.error { + font-size: 1.3em; + padding: 10px; + margin-top: 10px; + border: 1px solid red; + } + + + div.barrebottom { text-align: right; margin-top: 10px; diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index 1c87823819a..6af3c99802d 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -20,20 +20,10 @@ * $Source$ * */ -?> - - - - -Dolibarr Install - - -
-
-Installation de Dolibarr - Etape $etape/$etapes"; $conf = "../conf/conf.php"; if (file_exists($conf)) @@ -45,7 +35,6 @@ require ($dolibarr_main_document_root . "/conf/conf.class.php"); if ($HTTP_POST_VARS["action"] == "set") { - umask(0); print '

Base de donnée

'; print ''; @@ -63,127 +52,206 @@ if ($HTTP_POST_VARS["action"] == "set") if ($db->connected == 1) { print ""; - + $ok = 1 ; + } + else + { + print ""; + } + /*************************************************************************************** + * + * + */ + if ($ok) + { if($db->database_selected == 1) { - print ""; - - $ok = 1 ; - - //$result = $db->list_tables($dolibarr_main_db_name); - //if ($result) - //{ - // while ($row = $db->fetch_row()) - // { - // print "Table : $row[0]
\n"; - // } - //} - - // Création des tables - $dir = "../../mysql/tables/"; - - $handle=opendir($dir); - - while (($file = readdir($handle))!==false) - { - if (substr($file, strlen($file) - 4) == '.sql' && - substr($file,0,4) == 'llx_') - { - $name = substr($file, 0, strlen($file) - 4); - print ""; - $buffer = ''; - $fp = fopen($dir.$file,"r"); - if ($fp) - { - while (!feof ($fp)) - { - $buffer .= fgets($fp, 4096); - } - fclose($fp); - } - - if ($db->query($buffer)) - { - print ""; - } - else - { - if ($db->errno() == 1050) { - print ""; - } - else { - print ""; - $error++; - } - } - } - - } - closedir($handle); - - // - // Données - // - $dir = "../../mysql/data/"; - $file = "data.sql"; - - $fp = fopen($dir.$file,"r"); - if ($fp) - { - while (!feof ($fp)) - { - $buffer = fgets($fp, 4096); - - if (strlen(trim(ereg_replace("--","",$buffer)))) - { - if ($db->query($buffer)) - { - $ok = 1; - } - else - { - $ok = 0; - if ($db->errno() == 1062) { - // print ""; - } - else { - print "Erreur SQL ".$db->errno()." sur requete '$buffer'
"; - } - } - } - } - fclose($fp); - } - - print ""; - if ($ok) - { - print ""; - } - else - { - $ok = 1 ; - } - + dolibarr_syslog("Connexion réussie à la base : $dolibarr_main_db_name"); } else { - print ""; + $ok = 0 ; } - } + /*************************************************************************************** + * + * + */ + if ($ok) + { + $ok = 0; + //$result = $db->list_tables($dolibarr_main_db_name); + //if ($result) + //{ + // while ($row = $db->fetch_row()) + // { + // print "Table : $row[0]
\n"; + // } + //} + + // Création des tables + $dir = "../../mysql/tables/"; + + $handle=opendir($dir); + $table_exists = 0; + while (($file = readdir($handle))!==false) + { + if (substr($file, strlen($file) - 4) == '.sql' && substr($file,0,4) == 'llx_') + { + $name = substr($file, 0, strlen($file) - 4); + //print ""; + $buffer = ''; + $fp = fopen($dir.$file,"r"); + if ($fp) + { + while (!feof ($fp)) + { + $buffer .= fgets($fp, 4096); + } + fclose($fp); + } + + if ($db->query($buffer)) + { + print ""; + } + else + { + if ($db->errno() == 1050) + { + //print ""; + $table_exists = 1; + } + else + { + print ""; + print ""; + $error++; + } + } + } + + } + closedir($handle); + + if ($error == 0) + { + print ''; + $ok = 1; + } + } + /*************************************************************************************** + * + * + * + * + ***************************************************************************************/ + if ($ok == 1) + { + // + // Données + // + $dir = "../../mysql/data/"; + $file = "data.sql"; + + $fp = fopen($dir.$file,"r"); + if ($fp) + { + while (!feof ($fp)) + { + $buffer = fgets($fp, 4096); + + if (strlen(trim(ereg_replace("--","",$buffer)))) + { + if ($db->query($buffer)) + { + $ok = 1; + } + else + { + $ok = 0; + if ($db->errno() == 1062) + { + // print ""; + } + else + { + print "Erreur SQL ".$db->errno()." sur requete '$buffer'
"; + } + } + } + } + fclose($fp); + } + + print ""; + if ($ok) + { + print ""; + } + else + { + $ok = 1 ; + } + } + + + /*************************************************************************************** + * + * + * + * + ***************************************************************************************/ + if ($ok == 1) + { + /* + * + * + */ + + $sql[0] = "REPLACE INTO llx_const SET name = 'FAC_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/facture', visible=0, type='chaine'"; + + $sql[1] = "REPLACE INTO llx_const SET name = 'FAC_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/facture', visible=0, type='chaine'"; + + $sql[2] = "REPLACE INTO llx_const SET name = 'PROPALE_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/propale', visible=0, type='chaine'"; + + $sql[3] = "REPLACE INTO llx_const SET name = 'PROPALE_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/propale', visible=0, type='chaine'"; + + $sql[4] = "REPLACE INTO llx_const SET name = 'FICHEINTER_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/ficheinter', visible=0, type='chaine'"; + + $sql[5] = "REPLACE INTO llx_const SET name = 'FICHEINTER_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/ficheinter', visible=0, type='chaine'"; + + $sql[6] = "REPLACE INTO llx_const SET name = 'SOCIETE_OUTPUTDIR', value='".$dolibarr_main_document_root."/document/societe', visible=0, type='chaine'"; + + $sql[7] = "REPLACE INTO llx_const SET name = 'SOCIETE_OUTPUT_URL', value='".$dolibarr_main_url_root."/document/societe', visible=0, type='chaine'"; + $result = 0; + + for ($i=0; $i < sizeof($sql);$i++) + { + if ($db->query($sql[$i])) + { + $result++; + } + } + + if ($result == sizeof($sql)) + { + if ($error == 0) + { + $db->query("DELETE FROM llx_const WHERE name='MAIN_NOT_INSTALLED'"); + } + } + } + /*************************************************************************************** + * + * + * + * + ***************************************************************************************/ + print '
Connexion réussie au serveur : $dolibarr_main_db_hostOK
Erreur lors de la création de : $dolibarr_main_db_nameERREUR
Connexion réussie à la base : $dolibarr_main_db_nameOK
Création de la table $nameOK
Déjà existante
ERREUR ".$db->errno()."
Insertion ligne : $bufferDéja existante
Chargement des données de baseOK
Erreur lors de la création de : $dolibarr_main_db_nameERREUR
Création de la table $nameOK
Déjà existante
Création de la table $nameERREUR ".$db->errno()."
Création des tables réussie
Insertion ligne : $bufferDéja existante
Chargement des données de baseOK
'; $db->close(); } +pFooter(!$ok); ?> -
-
-
-
- - -
-
- - diff --git a/htdocs/install/etape4.php b/htdocs/install/etape4.php index 3d57d0f6cc4..7e99c52ba9a 100644 --- a/htdocs/install/etape4.php +++ b/htdocs/install/etape4.php @@ -1,18 +1,26 @@ - - - - -Dolibarr Install - - -
-
- + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ include("./inc.php"); -$etape = 4; -print "

Installation de Dolibarr - Etape $etape/$etapes

"; - +pHeader("Création du compte administrateur","etape5"); $conf = "../conf/conf.php"; if (file_exists($conf)) { @@ -21,43 +29,44 @@ if (file_exists($conf)) require ($dolibarr_main_document_root . "/lib/mysql.lib.php"); require ($dolibarr_main_document_root . "/conf/conf.class.php"); -if ($HTTP_POST_VARS["action"] == "set") +print ''; + +$error=0; + +$conf = new Conf(); +$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(); +$ok = 0; +if ($db->ok == 1) { - umask(0); - print '

Création du compte admin

'; - print ''; - print '
'; + + print ''; + print ''; + print ''; + print '
Compte administrateur :'; + print '
Mot de passe :'; + print '
Vérification du mot de passe :'; + print '
'; - $error=0; - - $conf = new Conf(); - $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(); - $ok = 0; - if ($db->ok == 1) + if ($_GET["error"] == 1) { - - print 'Compte administrateur :'; - print ''; - print 'Mot de passe :'; - print ''; - print 'Vérification du mot de passe :'; - print ''; - print ''; - $db->close(); + print '
Les mots de passe ne concordent pas, veuillez recommencer !
'; } + + if ($_GET["error"] == 2) + { + print '
Veuillez saisir un mot de passe, les mots de passe vides ne sont pas acceptés !
'; + } + + if ($_GET["error"] == 3) + { + print '
Veuillez saisir un login !
'; + } + $db->close(); } +pFooter($err); ?> -
-
-
- - - -
- - diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index 9dab65ebf87..6b19a7a9793 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -20,22 +20,7 @@ * $Source$ * */ -?> - - - - -Dolibarr Install - - -
-
- -Installation de Dolibarr - Etape $etape/$etapes"; - $success=0; $conf = "../conf/conf.php"; @@ -48,8 +33,23 @@ require ($dolibarr_main_document_root . "/conf/conf.class.php"); if ($HTTP_POST_VARS["action"] == "set") { - umask(0); - print '

Base de donnée

'; + if ($HTTP_POST_VARS["pass"] <> $HTTP_POST_VARS["pass_verif"]) + { + Header("Location: etape4.php?error=1"); + } + + if (strlen(trim($HTTP_POST_VARS["pass"])) == 0) + { + Header("Location: etape4.php?error=2"); + } + + if (strlen(trim($HTTP_POST_VARS["login"])) == 0) + { + Header("Location: etape4.php?error=3"); + } + + + pHeader("Fin de l'installation","etape5"); print ''; $error=0; @@ -87,22 +87,9 @@ if ($HTTP_POST_VARS["action"] == "set") ?>
-
-
"; print 'Configurer les modules'; -?> -
-
- - - - -