2005-02-13 16:40:15 +01:00
< ? php
2005-04-02 12:06:57 +02:00
/* Copyright ( C ) 2004 - 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2005-02-13 16:40:15 +01:00
* Copyright ( C ) 2004 Laurent Destailleur < eldy @ users . sourceforge . net >
*
* 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 $
*
*/
/**
2005-04-02 12:06:57 +02:00
\file htdocs / install / check . php
\ingroup install
\brief Test si le fichier conf est modifiable et si il n ' existe pas , test la possibilit<EFBFBD> de le cr<EFBFBD> er
\version $Revision $
2005-02-13 16:40:15 +01:00
*/
2005-04-02 12:06:57 +02:00
$err = 0 ;
2005-02-13 16:40:15 +01:00
include_once ( " ./inc.php " );
2005-02-13 17:47:32 +01:00
$setuplang = isset ( $_POST [ " selectlang " ]) ? $_POST [ " selectlang " ] : ( isset ( $_GET [ " selectlang " ]) ? $_GET [ " selectlang " ] : $langcode );
2005-02-13 16:40:15 +01:00
$langs -> defaultlang = $setuplang ;
$langs -> load ( " install " );
pHeader ( $langs -> trans ( " DolibarrWelcome " ), " licence " ); // Etape suivante = license
print $langs -> trans ( " InstallEasy " ) . " <br> " ;
2005-03-26 13:15:11 +01:00
// Si fichier pr<70> sent et lisible
2005-02-13 16:40:15 +01:00
if ( is_readable ( $conffile ))
{
2005-04-02 12:06:57 +02:00
$confexists = 1 ;
include_once ( $conffile );
2005-02-13 16:40:15 +01:00
}
else
{
2005-04-02 12:06:57 +02:00
// Si non on le cr<63> e
$confexists = 0 ;
$fp = @ fopen ( " $conffile " , " w " );
if ( $fp )
2005-02-13 16:40:15 +01:00
{
@ fwrite ( $fp , '<?php' );
@ fputs ( $fp , " \n " );
@ fputs ( $fp , " ?> " );
fclose ( $fp );
}
}
2005-03-26 13:15:11 +01:00
// Si fichier absent et n'a pu etre cr<63> <72>
2005-02-13 16:40:15 +01:00
if ( ! file_exists ( $conffile ))
{
2005-02-13 17:47:32 +01:00
print " <br /><br /> " ;
print " Le fichier de configuration <b>conf.php</b> n'existe pas ! " ;
print " <br /> " ;
2005-03-26 13:15:11 +01:00
print " Vous devez cr<63> er un fichier <b>htdocs/conf/conf.php</b> et donner les droits d'<27> criture dans celui-ci au serveur web durant le processus d'installation. " ;
2005-02-13 17:47:32 +01:00
print " <br /><br /> " ;
2005-02-13 16:40:15 +01:00
2005-02-13 17:47:32 +01:00
print 'Corrigez le probl<62> me et <a href="index.php">rechargez la page</a>.' ;
2005-02-13 16:40:15 +01:00
$err ++ ;
}
else
{
2005-03-26 13:15:11 +01:00
print " <br /><br /> " ;
// Si ficiher pr<70> sent mais ne peut etre modifi<66>
if ( ! is_writable ( $conffile ))
2005-02-13 16:40:15 +01:00
{
2005-03-26 13:15:11 +01:00
if ( $confexists ) {
print $langs -> trans ( " ConfFileExists " );
}
else {
print $langs -> trans ( " ConfFileCouldBeCreated " );
}
print " <br /> " ;
print $langs -> trans ( " ConfFileIsNotWritable " );
print " <br /> " ;
$err ++ ;
2005-02-13 16:40:15 +01:00
}
2005-03-26 13:15:11 +01:00
// Si fichier pr<70> sent et peut etre modifi<66>
else
2005-02-13 16:40:15 +01:00
{
2005-03-26 13:15:11 +01:00
if ( $confexists ) {
print $langs -> trans ( " ConfFileExists " );
}
else {
print $langs -> trans ( " ConfFileCouldBeCreated " );
}
print " <br /> " ;
print $langs -> trans ( " ConfFileIsWritable " );
print " <br /><br /> " ;
print $langs -> trans ( " YouCanContinue " );
2005-02-13 16:40:15 +01:00
}
}
// Si pas d'erreur, on affiche le bouton pour passer <20> l'<27> tape suivante
if ( $err == 0 ) pFooter ();
?>