2003-06-18 15:29:32 +02:00
< ? PHP
2003-08-12 13:54:22 +02:00
if ( $HTTP_POST_VARS [ " action " ] == " set " )
2003-06-22 12:41:48 +02:00
{
2003-08-12 13:54:22 +02:00
print '<h2>Enregistrement des valeurs</h2>' ;
2003-06-22 13:46:52 +02:00
print '<table cellspacing="0" cellpadding="4" border="1">' ;
$error = 0 ;
2003-06-22 12:41:48 +02:00
$fp = fopen ( " conf/conf.php " , " w " );
if ( $fp )
{
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 );
}
if ( substr ( $HTTP_POST_VARS [ " main_url " ], strlen ( $HTTP_POST_VARS [ " main_url " ]) - 1 ) == " / " )
{
$HTTP_POST_VARS [ " main_url " ] = substr ( $HTTP_POST_VARS [ " main_url " ], 0 , strlen ( $HTTP_POST_VARS [ " main_url " ]) - 1 );
}
2003-06-22 13:22:23 +02:00
clearstatcache ();
2003-06-22 12:41:48 +02:00
fwrite ( $fp , '<?PHP' );
fputs ( $fp , " \n " );
fputs ( $fp , '$dolibarr_main_document_root="' . $HTTP_POST_VARS [ " main_dir " ] . '";' );
fputs ( $fp , " \n " );
fputs ( $fp , '$dolibarr_main_url_root="' . $HTTP_POST_VARS [ " main_url " ] . '";' );
fputs ( $fp , " \n " );
fputs ( $fp , '$dolibarr_main_db_host="' . $HTTP_POST_VARS [ " db_host " ] . '";' );
fputs ( $fp , " \n " );
fputs ( $fp , '$dolibarr_main_db_name="' . $HTTP_POST_VARS [ " db_name " ] . '";' );
fputs ( $fp , " \n " );
fputs ( $fp , '$dolibarr_main_db_user="' . $HTTP_POST_VARS [ " db_user " ] . '";' );
fputs ( $fp , " \n " );
fputs ( $fp , '$dolibarr_main_db_pass="' . $HTTP_POST_VARS [ " db_pass " ] . '";' );
fputs ( $fp , " \n " );
fputs ( $fp , '?>' );
fclose ( $fp );
2003-06-22 12:47:00 +02:00
if ( file_exists ( " conf/conf.php " ))
{
include ( " conf/conf.php " );
}
2003-06-22 12:41:48 +02:00
2003-06-22 13:46:52 +02:00
print " <tr><td>Configuration enregistr<74> e</td><td>OK</td> " ;
print '<tr><td colspan="2">Test des r<> pertoires</td></tr>' ;
if ( ! is_dir ( $HTTP_POST_VARS [ " main_dir " ]))
{
print " <tr><td>Le dossier " . $HTTP_POST_VARS [ " main_dir " ] . " n'existe pas !</td><td>Erreur</td></tr> " ;
$error ++ ;
}
else
{
print " <tr><td>Le dossier " . $HTTP_POST_VARS [ " main_dir " ] . " existe</td><td>OK</td></tr> " ;
if ( ! is_dir ( $HTTP_POST_VARS [ " main_dir " ] . " /document " ))
{
2003-06-24 00:33:50 +02:00
print " <tr><td>Le dossier " . $HTTP_POST_VARS [ " main_dir " ] . " /document n'existe pas !<p> " ;
2003-06-22 13:46:52 +02:00
print " - Vous devez cr<63> er le dossier : <b> " . $HTTP_POST_VARS [ " main_dir " ] . " /document</b> et permettre au serveur web d'<27> crire dans celui-ci " ;
print " </td><td>Erreur</td></tr> " ;
}
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 " ;
2003-06-30 00:31:04 +02:00
$dir [ 4 ] = $HTTP_POST_VARS [ " main_dir " ] . " /document/produit " ;
2003-06-22 13:46:52 +02:00
for ( $i = 0 ; $i < sizeof ( $dir ) ; $i ++ )
{
if ( is_dir ( $dir [ $i ]))
{
print " <tr><td>Le dossier " . $dir [ $i ] . " existe</td><td>OK</td></tr> " ;
}
else
{
if ( ! @ mkdir ( $dir [ $i ]))
{
print " <tr><td>Impossible de cr<63> er : " . $dir [ $i ] . " </td><td>Erreur</td></tr> " ;
$error ++ ;
}
else
{
print " <tr><td>Cr<43> ation de : " . $dir [ $i ] . " r<> ussie</td><td>OK</td></tr> " ;
}
}
}
}
}
print '<tr><td colspan="2">test de connexion <20> la base de donn<6E> es</td></tr>' ;
2003-06-22 12:41:48 +02:00
require ( $dolibarr_main_document_root . " /lib/mysql.lib.php3 " );
2003-06-24 16:09:55 +02:00
require ( $dolibarr_main_document_root . " /conf/conf.class.php " );
2003-06-22 12:41:48 +02:00
$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 ;
2003-08-26 12:16:57 +02:00
$db = new DoliDb ();
2003-06-22 12:41:48 +02:00
2003-06-22 13:22:23 +02:00
$sql [ 0 ] = " REPLACE INTO llx_const SET name = 'FAC_OUTPUTDIR', value=' " . $dolibarr_main_document_root . " /document/facture', visible=0, type='chaine' " ;
2003-06-22 12:41:48 +02:00
2003-06-22 13:22:23 +02:00
$sql [ 1 ] = " REPLACE INTO llx_const SET name = 'FAC_OUTPUT_URL', value=' " . $dolibarr_main_url_root . " /document/facture', visible=0, type='chaine' " ;
2003-06-22 12:41:48 +02:00
2003-06-22 13:22:23 +02:00
$sql [ 2 ] = " REPLACE INTO llx_const SET name = 'PROPALE_OUTPUTDIR', value=' " . $dolibarr_main_document_root . " /document/propale', visible=0, type='chaine' " ;
2003-06-22 12:53:37 +02:00
2003-06-22 13:22:23 +02:00
$sql [ 3 ] = " REPLACE INTO llx_const SET name = 'PROPALE_OUTPUT_URL', value=' " . $dolibarr_main_url_root . " /document/propale', visible=0, type='chaine' " ;
2003-06-22 12:53:37 +02:00
2003-06-22 13:46:52 +02:00
$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' " ;
2003-06-22 13:03:31 +02:00
$result = 0 ;
for ( $i = 0 ; $i < sizeof ( $sql ); $i ++ )
{
if ( $db -> query ( $sql [ $i ]))
{
2003-06-22 13:46:52 +02:00
print " <tr><td>requete sql $i </td><td>OK</td></tr> " ;
2003-06-22 13:03:31 +02:00
$result ++ ;
2003-06-22 12:53:37 +02:00
}
2003-06-22 13:46:52 +02:00
else
{
print " <tr><td>requete sql $i </td><td>Erreur</td></tr> " ;
}
2003-06-22 12:41:48 +02:00
}
2003-06-22 13:03:31 +02:00
if ( $result == sizeof ( $sql ))
{
2003-06-22 13:46:52 +02:00
print " <tr><td>connexion r<> ussie <20> la base de donn<6E> es</td><td>OK</td></tr> " ;
print '</table>' ;
if ( $error == 0 )
{
2003-09-06 14:38:33 +02:00
$db -> query ( " DELETE FROM llx_const WHERE name='MAIN_NOT_INSTALLED' " );
2003-08-31 00:45:17 +02:00
print ' < div class = " main " >
< div class = " main-inside " > ' ;
2003-06-23 16:36:23 +02:00
print " Votre syst<73> me est maintenant configur<75> , il ne vous reste plus qu'a s<> lectionner les modules que vous souhaitez utiliser. Pour cela cliquer sur l'url ci-dessous : <br> " ;
2003-08-31 00:45:17 +02:00
print '<a href="' . $dolibarr_main_url_root . '/admin/modules.php">Configurer les modules</a></div></div>' ;
2003-06-22 13:46:52 +02:00
}
2003-06-22 13:03:31 +02:00
}
2003-06-22 12:41:48 +02:00
else
{
2003-06-22 13:46:52 +02:00
print '</table>' ;
2003-06-22 12:41:48 +02:00
print $db -> error ();
}
$db -> close ();
}
else
{
print " Erreur le syst<73> me <20> besoin d'<27> crire dans le fichier conf/conf.php veuillez mettre les droits correct pour cela. " ;
}
2003-06-22 12:47:00 +02:00
print " <hr> " ;
}
2003-06-22 12:41:48 +02:00
2003-06-22 12:47:00 +02:00
if ( file_exists ( " conf/conf.php " ))
{
include ( " conf/conf.php " );
}
else
{
print " conf/conf.php does not exists<br> " ;
2003-06-22 12:41:48 +02:00
}
2003-06-22 12:47:00 +02:00
2003-06-22 12:41:48 +02:00
?>
2003-06-22 12:47:00 +02:00
< html >
< head >
2003-08-31 00:45:17 +02:00
< style type = " text/css " >
body {
font - size : 14 px ;
font - family : Verdana , Tahoma , Arial , Helvetica , sans - serif ;
background - color : #cac8c0;
margin - left : 5 % ;
margin - right : 5 % ;
margin - top : 5 % ;
margin - bottom : 5 % ;
}
div . main {
background - color : white ;
text - align : left ;
border : solid black 1 px ;
}
div . main - inside {
background - color : white ;
padding - left : 20 px ;
padding - right : 50 px ;
text - align : center ;
margin - bottom : 50 px ;
margin - top : 30 px ;
}
div . footer {
background - color : #dcdff4;
font - size : 10 px ;
border - top : solid black 1 px ;
padding - left : 5 px ;
text - align : center ;
}
div . header {
background - color : #dcdff4;
border - bottom : solid black 1 px ;
padding - left : 5 px ;
text - align : center ;
}
div . footer p {
margin : 0 px ;
}
a : link , a : visited , a : active {
text - decoration : none ;
color : blue ;
}
a : hover {
text - decoration : underline ;
color : blue ;
}
a . comment {
text - decoration : none ;
color : black ;
font - size : 13 px ;
}
div . main - inside h2 {
font - size : 18 px ;
font - weight : bold ;
color : #990033;
}
</ style >
2003-06-22 12:47:00 +02:00
< title > Dolibarr Install </ title >
</ head >
2003-08-31 00:45:17 +02:00
< body >
< div class = " main " >
< div class = " main-inside " >
< h2 > Installation de Dolibarr </ h2 >
2003-06-22 12:47:00 +02:00
< form action = " install.php " method = " POST " >
< input type = " hidden " name = " action " value = " set " >
2003-08-31 00:45:17 +02:00
< table border = " 0 " cellpadding = " 4 " cellspacing = " 0 " >
2003-06-22 12:47:00 +02:00
< tr >
< td valign = " top " >
< ? PHP print " R<EFBFBD> pertoire d'installation " ; ?>
</ td >< td >< input type = " text " size = " 60 " value = " <?PHP print $dolibarr_main_document_root ?> " name = " main_dir " >
< br >
2003-08-12 13:54:22 +02:00
Sans le slash " / " <EFBFBD> la fin < br >
exemple : / var / www / dolibarr / htdocs
2003-06-22 12:47:00 +02:00
</ td >
</ tr >
< tr >
< td valign = " top " >
URL Racine </ td >< td >< input type = " text " size = " 60 " name = " main_url " value = " <?PHP print $dolibarr_main_url_root ?> " >
< br >
exemples :
< br >
< ul >
< li > http :// dolibarr . lafrere . net </ li >
< li > http :// www . lafrere . net / dolibarr </ li >
</ ul >
</ tr >
< tr >
2003-06-22 12:41:48 +02:00
2003-06-22 12:47:00 +02:00
< td colspan = " 2 " align = " center " > Base de donn<EFBFBD> es </ td >
</ tr >
< tr >
< td > host </ td >< td >< input type = " text " name = " db_host " value = " <?PHP print $dolibarr_main_db_host ?> " ></ td >
</ tr >
< tr >
< td > nom </ td >< td >< input type = " text " name = " db_name " value = " <?PHP print $dolibarr_main_db_name ?> " ></ td >
</ tr >
< tr >
< td valign = " top " > user </ td >
< td >
< input type = " text " name = " db_user " value = " <?PHP print $dolibarr_main_db_user ?> " >
2003-08-31 00:45:17 +02:00
< a class = " comment " > Laisser vide si vous vous connectez en anonymous </ a >
2003-06-22 12:47:00 +02:00
</ td >
</ tr >
< tr >
< td valign = " top " > pass </ td >
< td >
< input type = " text " name = " db_pass " value = " <?PHP print $dolibarr_main_db_pass ?> " >
2003-08-31 00:45:17 +02:00
< a class = " comment " > Laisser vide si vous vous connectez en anonymous </ a >
2003-06-22 12:47:00 +02:00
</ td >
</ tr >
< tr >
2003-08-31 00:45:17 +02:00
< td colspan = " 2 " align = " center " >< input type = " submit " value = " Enregistrer " ></ td >
2003-06-22 12:47:00 +02:00
</ tr >
</ table >
</ form >
2003-08-31 00:45:17 +02:00
</ div >
</ div >
2003-06-18 15:29:32 +02:00
</ body >
</ html >