2
0
forked from Wavyzz/dolibarr

Sec: If conf.php file is write protected, then all first install process is locked.

This commit is contained in:
Laurent Destailleur
2010-09-29 08:09:17 +00:00
parent cec9a65b0c
commit a690a6a59c
10 changed files with 340 additions and 298 deletions

View File

@@ -207,8 +207,9 @@ class Conf
if (! $this->global->MAIN_MENUFRONT_BARRETOP) $this->global->MAIN_MENUFRONT_BARRETOP="eldy_backoffice.php"; if (! $this->global->MAIN_MENUFRONT_BARRETOP) $this->global->MAIN_MENUFRONT_BARRETOP="eldy_backoffice.php";
if (! $this->global->MAIN_MENU_BARRELEFT) $this->global->MAIN_MENU_BARRELEFT="eldy_backoffice.php"; if (! $this->global->MAIN_MENU_BARRELEFT) $this->global->MAIN_MENU_BARRELEFT="eldy_backoffice.php";
if (! $this->global->MAIN_MENUFRONT_BARRELEFT) $this->global->MAIN_MENUFRONT_BARRELEFT="eldy_backoffice.php"; if (! $this->global->MAIN_MENUFRONT_BARRELEFT) $this->global->MAIN_MENUFRONT_BARRELEFT="eldy_backoffice.php";
if (! $this->global->MAIN_MENU_SMARTPHONE) $this->global->MAIN_MENU_SMARTPHONE="iphone_backoffice.php";
if (! $this->global->MAIN_MENUFRONT_SMARTPHONE) $this->global->MAIN_MENUFRONT_SMARTPHONE="iphone_backoffice.php"; if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE="iphone_backoffice.php";
if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="iphone_backoffice.php";
// Variable globales LDAP // Variable globales LDAP
if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME=''; if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME='';

View File

@@ -159,7 +159,7 @@ if (is_readable($conffile) && filesize($conffile) > 8)
$confexists=1; $confexists=1;
include_once($conffile); include_once($conffile);
$databaseok=1; // TODO Check if database is ok $databaseok=1;
if ($databaseok) if ($databaseok)
{ {
// Already installed for all parts (config and database). We can propose upgrade. // Already installed for all parts (config and database). We can propose upgrade.

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007 Cyrille de Lambert <cyrille.delambert@auguria.net> /* Copyright (C) 2007 Cyrille de Lambert <cyrille.delambert@auguria.net>
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -59,6 +59,14 @@ dolibarr_install_syslog("etape0: Entering etape0.php page");
pHeader($langs->trans("ConfigurationFile"),"etape1"); pHeader($langs->trans("ConfigurationFile"),"etape1");
// Test if we can run a first install process
if (is_writable($conffile))
{
print $langs->trans("ConfFileIsNotWritable",'htdocs/conf/conf.php');
pFooter(1,$setuplang,'jscheckparam');
exit;
}
// On reporte champ formulaire precedent pour propagation // On reporte champ formulaire precedent pour propagation
if ($_POST["action"] == "set") if ($_POST["action"] == "set")
{ {

View File

@@ -48,6 +48,14 @@ dolibarr_install_syslog("etape1: Entering etape1.php page");
pHeader($langs->trans("ConfigurationFile"),"etape2"); pHeader($langs->trans("ConfigurationFile"),"etape2");
// Test if we can run a first install process
if (! is_writable($conffile))
{
print $langs->trans("ConfFileIsNotWritable",'htdocs/conf/conf.php');
pFooter(1,$setuplang,'jscheckparam');
exit;
}
$error = 0; $error = 0;
// Repertoire des pages dolibarr // Repertoire des pages dolibarr
@@ -70,11 +78,6 @@ $main_data_dir=isset($_POST["main_data_dir"])?$_POST["main_data_dir"]:'';
if (! $main_data_dir) { $main_data_dir="$main_dir/documents"; } if (! $main_data_dir) { $main_data_dir="$main_dir/documents"; }
/*
* Actions
*/
if ($_POST["action"] == "set") if ($_POST["action"] == "set")
{ {
umask(0); umask(0);
@@ -499,7 +502,8 @@ pFooter($error,$setuplang,'jsinfo');
/** /**
* Save configuration file * Save configuration file. No particular permissions are set by installer.
* @param conffile Path to conf file
*/ */
function write_conf_file($conffile) function write_conf_file($conffile)
{ {

View File

@@ -64,6 +64,13 @@ dolibarr_install_syslog("etape2: Entering etape2.php page");
pHeader($langs->trans("CreateDatabaseObjects"),"etape4"); pHeader($langs->trans("CreateDatabaseObjects"),"etape4");
// Test if we can run a first install process
if (! is_writable($conffile))
{
print $langs->trans("ConfFileIsNotWritable",'htdocs/conf/conf.php');
pFooter(1,$setuplang,'jscheckparam');
exit;
}
if ($_POST["action"] == "set") if ($_POST["action"] == "set")
{ {

View File

@@ -56,6 +56,14 @@ $ok = 0;
pHeader($langs->trans("AdminAccountCreation"),"etape5"); pHeader($langs->trans("AdminAccountCreation"),"etape5");
// Test if we can run a first install process
if (! is_writable($conffile))
{
print $langs->trans("ConfFileIsNotWritable",'htdocs/conf/conf.php');
pFooter(1,$setuplang,'jscheckparam');
exit;
}
print '<table cellspacing="0" cellpadding="2" width="100%">'; print '<table cellspacing="0" cellpadding="2" width="100%">';
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); $db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);

View File

@@ -102,6 +102,14 @@ if ($_POST["action"] == "set")
pHeader($langs->trans("SetupEnd"),"etape5"); pHeader($langs->trans("SetupEnd"),"etape5");
// Test if we can run a first install process
if (! is_writable($conffile))
{
print $langs->trans("ConfFileIsNotWritable",'htdocs/conf/conf.php');
pFooter(1,$setuplang,'jscheckparam');
exit;
}
if ($_POST["action"] == "set" || preg_match('/upgrade/i',$_POST["action"])) if ($_POST["action"] == "set" || preg_match('/upgrade/i',$_POST["action"]))
{ {
print '<table cellspacing="0" cellpadding="2" width="100%">'; print '<table cellspacing="0" cellpadding="2" width="100%">';

View File

@@ -56,109 +56,123 @@ if (file_exists("./install.forced.php")) include_once("./install.forced.php");
dolibarr_install_syslog("Fileconf: Entering fileconf.php page"); dolibarr_install_syslog("Fileconf: Entering fileconf.php page");
/* /*
* View * View
*/ */
pHeader($langs->trans("ConfigurationFile"),"etape0"); pHeader($langs->trans("ConfigurationFile"),"etape0");
// Test if we can run a first install process
if (! is_writable($conffile))
{
print $langs->trans("ConfFileIsNotWritable",'htdocs/conf/conf.php');
pFooter(1,$setuplang,'jscheckparam');
exit;
}
if (! empty($force_install_message)) if (! empty($force_install_message))
{ {
print '<b>'.$langs->trans($force_install_message).'</b><br>'; print '<b>'.$langs->trans($force_install_message).'</b><br>';
} }
?> ?>
<table border="0" cellpadding="1" cellspacing="0"> <table border="0" cellpadding="1" cellspacing="0">
<tr> <tr>
<td colspan="3" class="label" align="center"><h3> <td colspan="3" class="label" align="center">
<?php echo $langs->trans("WebServer"); ?> <h3><?php echo $langs->trans("WebServer"); ?></h3>
</h3></td></tr> </td>
</tr>
<tr> <tr>
<?php <?php
print '<td valign="top" class="label"><b>'; print '<td valign="top" class="label"><b>';
print $langs->trans("WebPagesDirectory"); print $langs->trans("WebPagesDirectory");
print "</b></td>"; print "</b></td>";
if(! isset($dolibarr_main_url_root) || dol_strlen($dolibarr_main_url_root) == 0) if(! isset($dolibarr_main_url_root) || dol_strlen($dolibarr_main_url_root) == 0)
{
//print "x".$_SERVER["SCRIPT_FILENAME"]." y".$_SERVER["DOCUMENT_ROOT"];
// Si le php fonctionne en CGI, alors SCRIPT_FILENAME vaut le path du php et
// ce n'est pas ce qu'on veut. Dans ce cas, on propose $_SERVER["DOCUMENT_ROOT"]
if (preg_match('/^php$/i',$_SERVER["SCRIPT_FILENAME"]) || preg_match('/[\\/]php$/i',$_SERVER["SCRIPT_FILENAME"]) || preg_match('/php\.exe$/i',$_SERVER["SCRIPT_FILENAME"]))
{
$dolibarr_main_document_root=$_SERVER["DOCUMENT_ROOT"];
if (! preg_match('/[\\/]dolibarr[\\/]htdocs$/i',$dolibarr_main_document_root))
{
$dolibarr_main_document_root.="/dolibarr/htdocs";
}
}
else
{
$dolibarr_main_document_root = substr($_SERVER["SCRIPT_FILENAME"],0,dol_strlen($_SERVER["SCRIPT_FILENAME"]) - 21);
// Nettoyage du path propose
// Gere les chemins windows avec double "\"
$dolibarr_main_document_root = str_replace('\\\\','/',$dolibarr_main_document_root);
// Supprime les slash ou antislash de fins
$dolibarr_main_document_root = preg_replace('/[\\/]+$/','',$dolibarr_main_document_root);
}
}
//echo $PMA_MYSQL_INT_VERSION;
?>
<td class="label" valign="top"><input type="text" size="60" value="<?php print $dolibarr_main_document_root; ?>" name="main_dir">
</td><td class="comment">
<?php
print $langs->trans("WithNoSlashAtTheEnd")."<br>";
print $langs->trans("Examples").":<br>";
?>
<ul>
<li>/var/www/dolibarr/htdocs</li>
<li>C:/wwwroot/dolibarr/htdocs</li>
</ul>
</td>
</tr>
<tr>
<td valign="top" class="label"><b>
<?php print $langs->trans("DocumentsDirectory"); ?>
</b></td>
<?php
if (empty($dolibarr_main_data_root))
{
// Si le repertoire documents non defini, on en propose un par defaut
if (empty($force_install_main_data_root))
{ {
$dolibarr_main_data_root=preg_replace("/\/htdocs$/","",$dolibarr_main_document_root); //print "x".$_SERVER["SCRIPT_FILENAME"]." y".$_SERVER["DOCUMENT_ROOT"];
$dolibarr_main_data_root.="/documents";
}
else
{
$dolibarr_main_data_root=$force_install_main_data_root;
}
}
?>
<td class="label" valign="top"><input type="text" size="60" value="<?php print $dolibarr_main_data_root; ?>" name="main_data_dir">
</td><td class="comment">
<?php
print $langs->trans("WithNoSlashAtTheEnd")."<br>";
print $langs->trans("DirectoryRecommendation")."<br>";
print $langs->trans("Examples").":<br>";
?>
<ul>
<li>/var/dolibarr_documents</li>
<li>C:/My Documents/dolibarr/</li>
</ul>
</td>
</tr>
<tr> // Si le php fonctionne en CGI, alors SCRIPT_FILENAME vaut le path du php et
<td valign="top" class="label"><b> // ce n'est pas ce qu'on veut. Dans ce cas, on propose $_SERVER["DOCUMENT_ROOT"]
<?php echo $langs->trans("URLRoot"); ?> if (preg_match('/^php$/i',$_SERVER["SCRIPT_FILENAME"]) || preg_match('/[\\/]php$/i',$_SERVER["SCRIPT_FILENAME"]) || preg_match('/php\.exe$/i',$_SERVER["SCRIPT_FILENAME"]))
</b></td><td valign="top" class="label"><input type="text" size="60" name="main_url" value=" {
$dolibarr_main_document_root=$_SERVER["DOCUMENT_ROOT"];
if (! preg_match('/[\\/]dolibarr[\\/]htdocs$/i',$dolibarr_main_document_root))
{
$dolibarr_main_document_root.="/dolibarr/htdocs";
}
}
else
{
$dolibarr_main_document_root = substr($_SERVER["SCRIPT_FILENAME"],0,dol_strlen($_SERVER["SCRIPT_FILENAME"]) - 21);
// Nettoyage du path propose
// Gere les chemins windows avec double "\"
$dolibarr_main_document_root = str_replace('\\\\','/',$dolibarr_main_document_root);
// Supprime les slash ou antislash de fins
$dolibarr_main_document_root = preg_replace('/[\\/]+$/','',$dolibarr_main_document_root);
}
}
//echo $PMA_MYSQL_INT_VERSION;
?>
<td class="label" valign="top"><input type="text" size="60"
value="<?php print $dolibarr_main_document_root; ?>" name="main_dir">
</td>
<td class="comment"><?php
print $langs->trans("WithNoSlashAtTheEnd")."<br>";
print $langs->trans("Examples").":<br>";
?>
<ul>
<li>/var/www/dolibarr/htdocs</li>
<li>C:/wwwroot/dolibarr/htdocs</li>
</ul>
</td>
</tr>
<tr>
<td valign="top" class="label"><b> <?php print $langs->trans("DocumentsDirectory"); ?>
</b></td>
<?php
if (empty($dolibarr_main_data_root))
{
// Si le repertoire documents non defini, on en propose un par defaut
if (empty($force_install_main_data_root))
{
$dolibarr_main_data_root=preg_replace("/\/htdocs$/","",$dolibarr_main_document_root);
$dolibarr_main_data_root.="/documents";
}
else
{
$dolibarr_main_data_root=$force_install_main_data_root;
}
}
?>
<td class="label" valign="top"><input type="text" size="60"
value="<?php print $dolibarr_main_data_root; ?>" name="main_data_dir">
</td>
<td class="comment"><?php
print $langs->trans("WithNoSlashAtTheEnd")."<br>";
print $langs->trans("DirectoryRecommendation")."<br>";
print $langs->trans("Examples").":<br>";
?>
<ul>
<li>/var/dolibarr_documents</li>
<li>C:/My Documents/dolibarr/</li>
</ul>
</td>
</tr>
<tr>
<td valign="top" class="label"><b> <?php echo $langs->trans("URLRoot"); ?>
</b></td>
<td valign="top" class="label"><input type="text" size="60"
name="main_url"
value="
<?php <?php
if (! empty($main_url)) $dolibarr_main_url_root=$main_url; if (! empty($main_url)) $dolibarr_main_url_root=$main_url;
if (empty($dolibarr_main_url_root)) if (empty($dolibarr_main_url_root))
@@ -187,216 +201,200 @@ if (empty($dolibarr_main_url_root))
} }
print $dolibarr_main_url_root; print $dolibarr_main_url_root;
?>"> ?>"></td>
</td><td class="comment"> <td class="comment"><?php
<?php print $langs->trans("Examples").":<br>";
print $langs->trans("Examples").":<br>"; ?>
?> <ul>
<ul> <li>http://localhost/</li>
<li>http://localhost/</li> <li>http://www.myserver.com:8180/dolibarr</li>
<li>http://www.myserver.com:8180/dolibarr</li> </ul>
</ul>
</tr>
<tr> </tr>
<td valign="top" class="label">
<?php echo $langs->trans("ForceHttps"); ?>
<td class="label" valign="top"><input type="checkbox" name="main_force_https"<?php if (! empty($force_install_mainforcehttps)) print ' checked="on"'; ?>></td>
<td class="comment">
<?php echo $langs->trans("CheckToForceHttps"); ?>
</td>
</tr>
<!-- Dolibarr database --> <tr>
<td valign="top" class="label"><?php echo $langs->trans("ForceHttps"); ?>
<td class="label" valign="top"><input type="checkbox"
name="main_force_https"
<?php if (! empty($force_install_mainforcehttps)) print ' checked="on"'; ?>></td>
<td class="comment"><?php echo $langs->trans("CheckToForceHttps"); ?>
</td>
<tr> </tr>
<td colspan="3" class="label" align="center"><br><h3>
<?php echo $langs->trans("DolibarrDatabase"); ?>
</h3></td>
</tr>
<?php
if (!isset($dolibarr_main_db_host))
{
$dolibarr_main_db_host = "localhost";
}
?>
<tr>
<!-- moi-->
<td valign="top" class="label"><b>
<?php echo $langs->trans("DriverType"); ?>
</b></td>
<td class="label"> <!-- Dolibarr database -->
<?php
$defaultype=! empty($dolibarr_main_db_type)?$dolibarr_main_db_type:($force_install_type?$force_install_type:'mysqli'); <tr>
<td colspan="3" class="label" align="center"><br>
<h3><?php echo $langs->trans("DolibarrDatabase"); ?></h3>
</td>
</tr>
<?php
if (!isset($dolibarr_main_db_host))
{
$dolibarr_main_db_host = "localhost";
}
?>
<tr>
<!-- moi-->
<td valign="top" class="label"><b> <?php echo $langs->trans("DriverType"); ?>
</b></td>
// Scan les drivers <td class="label"><?php
$dir=DOL_DOCUMENT_ROOT.'/lib/databases';
$handle=opendir($dir);
$modules = array();
$nbok = $nbko = 0;
$option='';
while (($file = readdir($handle))!==false) $defaultype=! empty($dolibarr_main_db_type)?$dolibarr_main_db_type:($force_install_type?$force_install_type:'mysqli');
{
if (is_readable($dir."/".$file) && preg_match('/^(.*)\.lib\.php/i',$file,$reg))
{
$type=$reg[1];
// Version min de la base // Scan les drivers
$versionbasemin=array(); $dir=DOL_DOCUMENT_ROOT.'/lib/databases';
if ($type=='mysql') { $versionbasemin=array(3,1,0); $testfunction='mysql_connect'; } $handle=opendir($dir);
if ($type=='mysqli') { $versionbasemin=array(4,1,0); $testfunction='mysqli_connect'; } $modules = array();
if ($type=='pgsql') { $versionbasemin=array(8,1,0); $testfunction='pg_connect'; } $nbok = $nbko = 0;
if ($type=='mssql') { $versionbasemin=array(2000); $testfunction='mssql_connect'; } $option='';
// Remarques while (($file = readdir($handle))!==false)
$note=''; {
if ($type=='mysql') $note='(Mysql >= '.versiontostring($versionbasemin).')'; if (is_readable($dir."/".$file) && preg_match('/^(.*)\.lib\.php/i',$file,$reg))
if ($type=='mysqli') $note='(Mysql >= '.versiontostring($versionbasemin).')'; {
if ($type=='pgsql') $note='(Postgresql >= '.versiontostring($versionbasemin).')'; $type=$reg[1];
if ($type=='mssql') $note='(SQL Server >= '.versiontostring($versionbasemin).')';
// Switch to mysql if mysqli is not present // Version min de la base
if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql'; $versionbasemin=array();
if ($type=='mysql') { $versionbasemin=array(3,1,0); $testfunction='mysql_connect'; }
if ($type=='mysqli') { $versionbasemin=array(4,1,0); $testfunction='mysqli_connect'; }
if ($type=='pgsql') { $versionbasemin=array(8,1,0); $testfunction='pg_connect'; }
if ($type=='mssql') { $versionbasemin=array(2000); $testfunction='mssql_connect'; }
// Affiche ligne dans liste // Remarques
$option.='<option value="'.$type.'"'.($defaultype == $type?' selected':''); $note='';
if (! function_exists($testfunction)) $option.=' disabled="disabled"'; if ($type=='mysql') $note='(Mysql >= '.versiontostring($versionbasemin).')';
$option.='>'; if ($type=='mysqli') $note='(Mysql >= '.versiontostring($versionbasemin).')';
$option.=$type.'&nbsp; &nbsp;'; if ($type=='pgsql') $note='(Postgresql >= '.versiontostring($versionbasemin).')';
if ($note) $option.=' '.$note; if ($type=='mssql') $note='(SQL Server >= '.versiontostring($versionbasemin).')';
// Experimental
if ($type=='pgsql') $option.=' '.$langs->trans("Experimental");
elseif ($type=='mssql') $option.=' '.$langs->trans("Experimental");
// No available
elseif (! function_exists($testfunction)) $option.=' - '.$langs->trans("FunctionNotAvailableInThisPHP");
$option.='</option>';
}
}
?> // Switch to mysql if mysqli is not present
<select name='db_type'> if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql';
<?php echo $option ?>
</select>
&nbsp;
</td>
<td class="comment"> // Affiche ligne dans liste
<?php echo $langs->trans("DatabaseType"); ?> $option.='<option value="'.$type.'"'.($defaultype == $type?' selected':'');
</td> if (! function_exists($testfunction)) $option.=' disabled="disabled"';
$option.='>';
$option.=$type.'&nbsp; &nbsp;';
if ($note) $option.=' '.$note;
// Experimental
if ($type=='pgsql') $option.=' '.$langs->trans("Experimental");
elseif ($type=='mssql') $option.=' '.$langs->trans("Experimental");
// No available
elseif (! function_exists($testfunction)) $option.=' - '.$langs->trans("FunctionNotAvailableInThisPHP");
$option.='</option>';
}
}
</tr> ?> <select name='db_type'>
<?php echo $option ?>
</select> &nbsp;</td>
<tr> <td class="comment"><?php echo $langs->trans("DatabaseType"); ?></td>
<td valign="top" class="label"><b>
<?php echo $langs->trans("Server"); ?>
</b></td>
<td valign="top" class="label"><input type="text" name="db_host" value="<?php print (! empty($dolibarr_main_db_host))?$dolibarr_main_db_host:'localhost'; ?>">
<input type="hidden" name="base" value="">
</td>
<td class="comment">
<?php echo $langs->trans("ServerAddressDescription"); ?>
</td>
</tr> </tr>
<tr> <tr>
<td valign="top" class="label"> <td valign="top" class="label"><b> <?php echo $langs->trans("Server"); ?>
<?php echo $langs->trans("Port"); ?> </b></td>
</td> <td valign="top" class="label"><input type="text" name="db_host"
<td valign="top" class="label"><input type="text" name="db_port" value="<?php print (! empty($dolibarr_main_db_port))?$dolibarr_main_db_port:$force_install_port; ?>"> value="<?php print (! empty($dolibarr_main_db_host))?$dolibarr_main_db_host:'localhost'; ?>">
<input type="hidden" name="base" value=""> <input type="hidden" name="base" value=""></td>
</td> <td class="comment"><?php echo $langs->trans("ServerAddressDescription"); ?>
<td class="comment"> </td>
<?php echo $langs->trans("ServerPortDescription"); ?>
</td>
</tr> </tr>
<tr> <tr>
<td class="label" valign="top"><b> <td valign="top" class="label"><?php echo $langs->trans("Port"); ?></td>
<?php echo $langs->trans("DatabaseName"); ?> <td valign="top" class="label"><input type="text" name="db_port"
</b></td> value="<?php print (! empty($dolibarr_main_db_port))?$dolibarr_main_db_port:$force_install_port; ?>">
<input type="hidden" name="base" value=""></td>
<td class="comment"><?php echo $langs->trans("ServerPortDescription"); ?>
</td>
<td class="label" valign="top"><input type="text" name="db_name" value="<?php echo (! empty($dolibarr_main_db_name))?$dolibarr_main_db_name:$force_install_database; ?>"></td> </tr>
<td class="comment">
<?php echo $langs->trans("DatabaseName"); ?>
</td>
</tr>
<tr> <tr>
<td class="label" valign="top"> <td class="label" valign="top"><b> <?php echo $langs->trans("DatabaseName"); ?>
<?php echo $langs->trans("CreateDatabase"); ?> </b></td>
</td>
<td class="label" valign="top"><input type="checkbox" name="db_create_database"<?php if ($force_install_createdatabase) print ' checked="on"'; ?>></td> <td class="label" valign="top"><input type="text" name="db_name"
<td class="comment"> value="<?php echo (! empty($dolibarr_main_db_name))?$dolibarr_main_db_name:$force_install_database; ?>"></td>
<?php echo $langs->trans("CheckToCreateDatabase"); ?> <td class="comment"><?php echo $langs->trans("DatabaseName"); ?></td>
</td> </tr>
</tr>
<tr> <tr>
<td class="label" valign="top"> <td class="label" valign="top"><?php echo $langs->trans("CreateDatabase"); ?>
<b><?php echo $langs->trans("Login"); ?></b> </td>
</td>
<td class="label" valign="top"><input type="text" name="db_user" value="<?php print (! empty($dolibarr_main_db_user))?$dolibarr_main_db_user:$force_install_databaselogin; ?>"></td>
<td class="comment">
<?php echo $langs->trans("AdminLogin"); ?>
</td>
</tr>
<tr> <td class="label" valign="top"><input type="checkbox"
<td class="label" valign="top"> name="db_create_database"
<b><?php echo $langs->trans("Password"); ?></b> <?php if ($force_install_createdatabase) print ' checked="on"'; ?>></td>
</td> <td class="comment"><?php echo $langs->trans("CheckToCreateDatabase"); ?>
<td class="label" valign="top"><input type="password" name="db_pass" value="<?php print (! empty($dolibarr_main_db_pass))?$dolibarr_main_db_pass:$force_install_databasepass; ?>"></td> </td>
<td class="comment"> </tr>
<?php echo $langs->trans("AdminPassword"); ?>
</td>
</tr>
<tr> <tr>
<td class="label" valign="top"> <td class="label" valign="top"><b><?php echo $langs->trans("Login"); ?></b>
<?php echo $langs->trans("CreateUser"); ?> </td>
</td> <td class="label" valign="top"><input type="text" name="db_user"
value="<?php print (! empty($dolibarr_main_db_user))?$dolibarr_main_db_user:$force_install_databaselogin; ?>"></td>
<td class="comment"><?php echo $langs->trans("AdminLogin"); ?></td>
</tr>
<td class="label" valign="top"><input type="checkbox" name="db_create_user"<?php if (! empty($force_install_createuser)) print ' checked="on"'; ?>></td> <tr>
<td class="comment"> <td class="label" valign="top"><b><?php echo $langs->trans("Password"); ?></b>
<?php echo $langs->trans("CheckToCreateUser"); ?> </td>
</td> <td class="label" valign="top"><input type="password" name="db_pass"
</tr> value="<?php print (! empty($dolibarr_main_db_pass))?$dolibarr_main_db_pass:$force_install_databasepass; ?>"></td>
<td class="comment"><?php echo $langs->trans("AdminPassword"); ?></td>
</tr>
<tr>
<td class="label" valign="top"><?php echo $langs->trans("CreateUser"); ?>
</td>
<td class="label" valign="top"><input type="checkbox"
name="db_create_user"
<?php if (! empty($force_install_createuser)) print ' checked="on"'; ?>></td>
<td class="comment"><?php echo $langs->trans("CheckToCreateUser"); ?>
</td>
</tr>
<!-- Super access --> <!-- Super access -->
<tr> <tr>
<td colspan="3" class="label" align="center"><br><h3> <td colspan="3" class="label" align="center"><br>
<?php echo $langs->trans("DatabaseSuperUserAccess"); ?> <h3><?php echo $langs->trans("DatabaseSuperUserAccess"); ?></h3>
</h3></td></tr> </td>
</tr>
<tr> <tr>
<td class="label" valign="top"> <td class="label" valign="top"><?php echo $langs->trans("Login"); ?></td>
<?php echo $langs->trans("Login"); ?> <td class="label" valign="top"><input type="text" name="db_user_root"
</td> value="<?php print (! empty($db_user_root))?$db_user_root:$force_install_databaserootlogin; ?>"></td>
<td class="label" valign="top"><input type="text" name="db_user_root" value="<?php print (! empty($db_user_root))?$db_user_root:$force_install_databaserootlogin; ?>"></td> <td class="label">
<td class="label"><div class="comment"> <div class="comment"><?php echo $langs->trans("DatabaseRootLoginDescription"); ?>
<?php echo $langs->trans("DatabaseRootLoginDescription"); ?> </div>
</div> </td>
</td> </tr>
</tr>
<tr> <tr>
<td class="label" valign="top"> <td class="label" valign="top"><?php echo $langs->trans("Password"); ?>
<?php echo $langs->trans("Password"); ?> </td>
</td> <td class="label" valign="top"><input type="password"
<td class="label" valign="top"><input type="password" name="db_pass_root" value="<?php print (! empty($db_pass_root))?$db_pass_root:$force_install_databaserootpass; ?>"></td> name="db_pass_root"
<td class="label"><div class="comment"> value="<?php print (! empty($db_pass_root))?$db_pass_root:$force_install_databaserootpass; ?>"></td>
<?php echo $langs->trans("KeepEmptyIfNoPassword"); ?> <td class="label">
</div> <div class="comment"><?php echo $langs->trans("KeepEmptyIfNoPassword"); ?>
</td> </div>
</tr> </td>
</tr>
</table> </table>

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -18,11 +18,11 @@
*/ */
/** /**
\file htdocs/install/licence.php * \file htdocs/install/licence.php
\ingroup install * \ingroup install
\brief Page affichage license * \brief Page affichage license
\version $Id$ * \version $Id$
*/ */
include_once("./inc.php"); include_once("./inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
@@ -39,21 +39,28 @@ dolibarr_install_syslog("Licence: Entering licence.php page");
/* /*
* View * View
*/ */
pHeader($langs->trans("License"),"fileconf"); pHeader($langs->trans("License"),"fileconf");
// Test if we can run a first install process
if (! is_writable($conffile))
{
print $langs->trans("ConfFileIsNotWritable",'htdocs/conf/conf.php');
pFooter(1,$setuplang,'jscheckparam');
exit;
}
//print '<pre style="align: center; font-size: 12px">'; //print '<pre style="align: center; font-size: 12px">';
$result=dol_print_file($langs,"html/gpl.html",1); $result=dol_print_file($langs,"html/gpl.html",1);
if (! $result) if (! $result)
{ {
print '<center>'."\n"; print '<center>'."\n";
print '<textarea readonly="1" rows="26" cols="80">'; print '<textarea readonly="1" rows="26" cols="80">';
dol_print_file($langs,"html/gpl.txt",1); dol_print_file($langs,"html/gpl.txt",1);
print '</textarea>'; print '</textarea>';
print '</center>'."\n"; print '</center>'."\n";
} }
//print '</pre>'; //print '</pre>';

View File

@@ -27,10 +27,11 @@
/** /**
* \brief Renvoi le fichier $filename dans la version de la langue courante, sinon alternative * Output content of a file $filename in version of current language (otherwise may use an alternate language)
* \param filename nom du fichier a rechercher * @param langs Object language to use for output
* \param searchalt cherche aussi dans langue alternative * @param filename Relative filename to output
* \return boolean * @param searchalt 1=Search also in alternative languages
* @return boolean
*/ */
function dol_print_file($langs,$filename,$searchalt=0) function dol_print_file($langs,$filename,$searchalt=0)
{ {
@@ -40,7 +41,7 @@ function dol_print_file($langs,$filename,$searchalt=0)
foreach($langs->dir as $searchdir) foreach($langs->dir as $searchdir)
{ {
$htmlfile=($searchdir."/langs/".$langs->defaultlang."/".$filename); $htmlfile=($searchdir."/langs/".$langs->defaultlang."/".$filename);
dol_syslog('Translate::print_file search file '.$htmlfile, LOG_DEBUG); dol_syslog('functions2::dol_print_file search file '.$htmlfile, LOG_DEBUG);
if (is_readable($htmlfile)) if (is_readable($htmlfile))
{ {
$content=file_get_contents($htmlfile); $content=file_get_contents($htmlfile);
@@ -50,13 +51,13 @@ function dol_print_file($langs,$filename,$searchalt=0)
else print $content; else print $content;
return true; return true;
} }
else dol_syslog('Translate::print_file not found', LOG_DEBUG); else dol_syslog('functions2::dol_print_file not found', LOG_DEBUG);
if ($searchalt) { if ($searchalt) {
// Test si fichier dans repertoire de la langue alternative // Test si fichier dans repertoire de la langue alternative
if ($langs->defaultlang != "en_US") $htmlfilealt = $searchdir."/langs/en_US/".$filename; if ($langs->defaultlang != "en_US") $htmlfilealt = $searchdir."/langs/en_US/".$filename;
else $htmlfilealt = $searchdir."/langs/fr_FR/".$filename; else $htmlfilealt = $searchdir."/langs/fr_FR/".$filename;
dol_syslog('Translate::print_file search alt file '.$htmlfilealt, LOG_DEBUG); dol_syslog('functions2::dol_print_file search alt file '.$htmlfilealt, LOG_DEBUG);
//print 'getcwd='.getcwd().' htmlfilealt='.$htmlfilealt.' X '.file_exists(getcwd().'/'.$htmlfilealt); //print 'getcwd='.getcwd().' htmlfilealt='.$htmlfilealt.' X '.file_exists(getcwd().'/'.$htmlfilealt);
if (is_readable($htmlfilealt)) if (is_readable($htmlfilealt))
{ {
@@ -67,7 +68,7 @@ function dol_print_file($langs,$filename,$searchalt=0)
else print $content; else print $content;
return true; return true;
} }
else dol_syslog('Translate::print_file not found', LOG_DEBUG); else dol_syslog('functions2::dol_print_file not found', LOG_DEBUG);
} }
} }