This commit is contained in:
Rodolphe Quiedeville 2004-02-12 14:47:09 +00:00
parent f8c237d05e
commit 0dfb072c13
4 changed files with 215 additions and 226 deletions

View File

@ -20,32 +20,17 @@
* *
*/ */
//
// Essaye de créer le fichier de conf
//
$conf = "../conf/conf.php"; $conf = "../conf/conf.php";
if (is_readable($conf)) if (is_readable($conf))
{ {
include ($conf); include ($conf);
} }
else
{
$fp = @fopen("$conf", "w");
if($fp)
{
@fwrite($fp, '<?PHP');
@fputs($fp,"\n");
@fputs($fp,"?>");
fclose($fp);
}
}
include("./inc.php"); include("./inc.php");
pHeader(); pHeader();
$docurl = '<a href="doc/dolibarr-install.html">documentation</a>';
if (!file_exists("../conf/conf.php")) if (!file_exists("../conf/conf.php"))
{ {
@ -116,12 +101,15 @@ exemples :
<li>http://www.lafrere.net/dolibarr</li> <li>http://www.lafrere.net/dolibarr</li>
</ul> </ul>
</tr> </tr>
<tr> <tr>
<td colspan="3" align="center"><h2>Base de données<h2></td> <td colspan="3" align="center"><h2>Base de données<h2></td>
</tr> </tr>
<?PHP
if (!isset($dolibarr_main_db_host))
{
$dolibarr_main_db_host = "localhost";
}
?>
<tr class="bg1"> <tr class="bg1">
<td valign="top">Serveur</td><td valign="top"><input type="text" name="db_host" value="<?PHP print $dolibarr_main_db_host ?>"></td> <td valign="top">Serveur</td><td valign="top"><input type="text" name="db_host" value="<?PHP print $dolibarr_main_db_host ?>"></td>
<td><div class="comment">Nom du serveur de base de données, généralement 'localhost' quand le serveur est installé sur la même machine que le serveur web</div></td> <td><div class="comment">Nom du serveur de base de données, généralement 'localhost' quand le serveur est installé sur la même machine que le serveur web</div></td>

View File

@ -139,3 +139,13 @@ td.label {
border-bottom: 1px solid #8CACBB; border-bottom: 1px solid #8CACBB;
} }
td.comment {
background: #dcdcd3;
color: black;
padding: 0.5em 0.5em 0.5em;
margin: 0em 0em 0em 0em;
text-decoration:none;
font-size: 13px;
border-bottom: 1px solid #8CACBB;
}

View File

@ -20,20 +20,11 @@
* $Source$ * $Source$
* *
*/ */
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso8859-1">
<link rel="stylesheet" type="text/css" href="./default.css">
<title>Dolibarr Install</title>
</head>
<body>
<div class="main">
<div class="main-inside">
<?PHP
include("./inc.php"); include("./inc.php");
pHeader("Fichier de configuration","etape2");
$etape = 1; $etape = 1;
print "<h2>Installation de Dolibarr - Etape $etape/$etapes</h2>";
$conf = "../conf/conf.php"; $conf = "../conf/conf.php";
@ -47,7 +38,6 @@ if ($HTTP_POST_VARS["action"] == "set")
$fp = fopen("$conf", "w"); $fp = fopen("$conf", "w");
if($fp) if($fp)
{ {
if (substr($HTTP_POST_VARS["main_dir"], strlen($HTTP_POST_VARS["main_dir"]) -1) == "/") if (substr($HTTP_POST_VARS["main_dir"], strlen($HTTP_POST_VARS["main_dir"]) -1) == "/")
{ {
$HTTP_POST_VARS["main_dir"] = substr($HTTP_POST_VARS["main_dir"], 0, strlen($HTTP_POST_VARS["main_dir"])-1); $HTTP_POST_VARS["main_dir"] = substr($HTTP_POST_VARS["main_dir"], 0, strlen($HTTP_POST_VARS["main_dir"])-1);
@ -87,11 +77,30 @@ if ($HTTP_POST_VARS["action"] == "set")
if (file_exists("$conf")) if (file_exists("$conf"))
{ {
include ("$conf"); include ("$conf");
print "<tr><td>Configuration enregistrée</td><td>OK</td>"; print "<tr><td>Configuration enregistrée</td><td>OK</td>";
$error = 0;
}
else
{
$error = 1;
}
}
print '<tr><td colspan="2">Test des répertoires</td></tr>'; /***************************************************************************
*
* Creation des répertoires
*
***************************************************************************/
if ($error == 0)
{
$dir[0] = $HTTP_POST_VARS["main_dir"]."/document/facture";
$dir[1] = $HTTP_POST_VARS["main_dir"]."/document/propale";
$dir[2] = $HTTP_POST_VARS["main_dir"]."/document/societe";
$dir[3] = $HTTP_POST_VARS["main_dir"]."/document/ficheinter";
$dir[4] = $HTTP_POST_VARS["main_dir"]."/document/produit";
$dir[5] = $HTTP_POST_VARS["main_dir"]."/document/images";
$dir[6] = $HTTP_POST_VARS["main_dir"]."/document/rapport";
if (! is_dir($HTTP_POST_VARS["main_dir"])) if (! is_dir($HTTP_POST_VARS["main_dir"]))
{ {
@ -100,8 +109,7 @@ if ($HTTP_POST_VARS["action"] == "set")
} }
else else
{ {
dolibarr_syslog ("Le dossier ".$HTTP_POST_VARS["main_dir"]." existe");
print "<tr><td>Le dossier ".$HTTP_POST_VARS["main_dir"]." existe</td><td>OK</td></tr>";
/* /*
* Répertoire des documents * Répertoire des documents
*/ */
@ -120,19 +128,11 @@ if ($HTTP_POST_VARS["action"] == "set")
} }
else else
{ {
$dir[0] = $HTTP_POST_VARS["main_dir"]."/document/facture";
$dir[1] = $HTTP_POST_VARS["main_dir"]."/document/propale";
$dir[2] = $HTTP_POST_VARS["main_dir"]."/document/societe";
$dir[3] = $HTTP_POST_VARS["main_dir"]."/document/ficheinter";
$dir[4] = $HTTP_POST_VARS["main_dir"]."/document/produit";
$dir[5] = $HTTP_POST_VARS["main_dir"]."/document/images";
$dir[6] = $HTTP_POST_VARS["main_dir"]."/document/rapport";
for ($i = 0 ; $i < sizeof($dir) ; $i++) for ($i = 0 ; $i < sizeof($dir) ; $i++)
{ {
if (is_dir($dir[$i])) if (is_dir($dir[$i]))
{ {
print "<tr><td>Le dossier ".$dir[$i]." existe</td><td>OK</td></tr>"; dolibarr_syslog ("Le dossier ".$dir[$i]." existe");
} }
else else
{ {
@ -143,24 +143,19 @@ if ($HTTP_POST_VARS["action"] == "set")
} }
else else
{ {
print "<tr><td>Création de : ".$dir[$i]." réussie</td><td>OK</td></tr>"; dolibarr_syslog ("Le dossier ".$dir[$i]." create ok");
} }
} }
} }
} }
} }
} }
}
else
{
print "Erreur le système à besoin d'écrire dans le fichier $conf veuillez mettre les droits correct pour cela.";
}
/* /*
* Base de données * Base de données
* *
*/ */
if ($error == 0)
{
require ($dolibarr_main_document_root . "/lib/mysql.lib.php"); require ($dolibarr_main_document_root . "/lib/mysql.lib.php");
require ($dolibarr_main_document_root . "/conf/conf.class.php"); require ($dolibarr_main_document_root . "/conf/conf.class.php");
@ -193,9 +188,12 @@ if ($HTTP_POST_VARS["action"] == "set")
} }
else else
{ {
if ($db->errno() == 1062) { if ($db->errno() == 1062)
{
print "<tr><td>Création de l'utilisateur : $dolibarr_main_db_user</td><td>Deja existant</td></tr>"; print "<tr><td>Création de l'utilisateur : $dolibarr_main_db_user</td><td>Deja existant</td></tr>";
} else { }
else
{
print "<tr><td>Création de l'utilisateur : $dolibarr_main_db_user</td><td>ERREUR</td></tr>"; print "<tr><td>Création de l'utilisateur : $dolibarr_main_db_user</td><td>ERREUR</td></tr>";
} }
} }
@ -295,30 +293,10 @@ if ($HTTP_POST_VARS["action"] == "set")
} }
} }
}
} }
?> ?>
</table> </table>
</div>
</div>
<?PHP <?PHP
if ($ok) pFooter($err);
{
print '
<div class="barrebottom">
<form action="etape2.php" method="POST">
<input type="hidden" name="action" value="set">
<input type="submit" value="Etape suivante ->">
</form>
</div>
';
}
?> ?>
</body>
</html>

View File

@ -21,6 +21,7 @@
*/ */
$etapes=5; $etapes=5;
$docurl = '<a href="doc/dolibarr-install.html">documentation</a>';
Function pHeader($soutitre,$next) Function pHeader($soutitre,$next)
{ {
@ -37,8 +38,8 @@ print '
<span class="titre"><a class="titre" href="index.php">Dolibarr Installation</a></span> <span class="titre"><a class="titre" href="index.php">Dolibarr Installation</a></span>
</div> </div>
'; ';
print '<form action="'.$next.'.php" method="POST">'; print '<form action="'.$next.'.php" method="POST">
<input type="hidden" name="action" value="set">';
print '<div class="main"><div class="soustitre">'.$soutitre.'</div> print '<div class="main"><div class="soustitre">'.$soutitre.'</div>
<div class="main-inside"> <div class="main-inside">
'; ';
@ -58,4 +59,16 @@ print '
</html>'; </html>';
} }
Function dolibarr_syslog($message)
{
define_syslog_variables();
openlog("dolibarr", LOG_PID | LOG_PERROR, LOG_LOCAL0);
syslog(LOG_WARNING, $message);
closelog();
}
?> ?>