New: More controls on install
This commit is contained in:
parent
8174973ba1
commit
90886bb97f
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
|
||||
*
|
||||
@ -23,7 +23,7 @@
|
||||
/**
|
||||
* \file htdocs/install/fileconf.php
|
||||
* \ingroup install
|
||||
* \brief Demande les infos qui constituerons le contenu du fichier conf.php (qui sera remplie a l'etape suivante)
|
||||
* \brief Ask all informations required to build Dolibarr htdocs/conf/conf.php file (will be wrote on disk on next page)
|
||||
* \version $Id$
|
||||
*/
|
||||
include_once("./inc.php");
|
||||
@ -31,12 +31,15 @@ include_once("./inc.php");
|
||||
|
||||
$err=0;
|
||||
|
||||
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:'auto');
|
||||
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:(isset($_GET["lang"])?$_GET["lang"]:'auto'));
|
||||
$langs->setDefaultLang($setuplang);
|
||||
|
||||
$langs->load("install");
|
||||
|
||||
// Init "forced values" to nothing. "forced values" are used after an doliwamp install wizard.
|
||||
// You can force preselected values of the config step of Dolibarr by adding a file
|
||||
// install.forced.php into directory htdocs/install (This is the case with some installer
|
||||
// lile DoliWamp, DoliMamp or DoliDeb.
|
||||
// We first init "forced values" to nothing.
|
||||
if (! isset($force_install_type)) $force_install_type='';
|
||||
if (! isset($force_install_port)) $force_install_port='';
|
||||
if (! isset($force_install_database)) $force_install_database='';
|
||||
@ -45,6 +48,7 @@ if (! isset($force_install_databaselogin)) $force_install_databaselogin='';
|
||||
if (! isset($force_install_databasepass)) $force_install_databasepass='';
|
||||
if (! isset($force_install_databaserootlogin)) $force_install_databaserootlogin='';
|
||||
if (! isset($force_install_databaserootpass)) $force_install_databaserootpass='';
|
||||
// Now we load forced value from install.forced.php file.
|
||||
if (file_exists("./install.forced.php")) include_once("./install.forced.php");
|
||||
|
||||
dolibarr_install_syslog("Fileconf: Entering fileconf.php page");
|
||||
@ -236,7 +240,7 @@ while (($file = readdir($handle))!==false)
|
||||
if ($type=='mysqli') $note='(Mysql >= '.versiontostring($versionbasemin).')';
|
||||
if ($type=='pgsql') $note='(Postgresql >= '.versiontostring($versionbasemin).')';
|
||||
if ($type=='mssql') $note='(SQL Server >= '.versiontostring($versionbasemin).')';
|
||||
|
||||
|
||||
// Switch to mysql if mysqli is not present
|
||||
if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql';
|
||||
|
||||
@ -379,9 +383,66 @@ while (($file = readdir($handle))!==false)
|
||||
|
||||
</table>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
function jscheckparam()
|
||||
{
|
||||
ok=true;
|
||||
|
||||
if (document.forminstall.main_dir.value == '')
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired",$langs->transnoentitiesnoconv("WebPagesDirectory"))); ?>');
|
||||
}
|
||||
else if (document.forminstall.main_data_dir.value == '')
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired",$langs->transnoentitiesnoconv("DocumentsDirectory"))); ?>');
|
||||
}
|
||||
else if (document.forminstall.main_url.value == '')
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired",$langs->transnoentitiesnoconv("URLRoot"))); ?>');
|
||||
}
|
||||
else if (document.forminstall.db_host.value == '')
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired",$langs->transnoentitiesnoconv("Server"))); ?>');
|
||||
}
|
||||
else if (document.forminstall.db_name.value == '')
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired",$langs->transnoentitiesnoconv("DatabaseName"))); ?>');
|
||||
}
|
||||
// If create database asked
|
||||
else if (document.forminstall.db_create_database.checked == true && (document.forminstall.db_user_root.value == '' || document.forminstall.db_pass_root.value == ''))
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?>');
|
||||
}
|
||||
else if (document.forminstall.db_create_database.checked == true && (document.forminstall.db_user_root.value == '' || document.forminstall.db_pass_root.value == ''))
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?>');
|
||||
}
|
||||
// If create user asked
|
||||
else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == '' || document.forminstall.db_pass_root.value == ''))
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?>');
|
||||
}
|
||||
else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == '' || document.forminstall.db_pass_root.value == ''))
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?>');
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
// $db->close(); Not database connexion yet
|
||||
|
||||
pFooter($err,$setuplang);
|
||||
pFooter($err,$setuplang,'jscheckparam');
|
||||
?>
|
||||
|
||||
@ -170,7 +170,7 @@ if (! defined('SYSLOG_FILE_NO_ERROR'))
|
||||
// En mode off (recommande il faut juste faire addslashes au moment d'un insert/update.
|
||||
function stripslashes_deep($value)
|
||||
{
|
||||
return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value));
|
||||
return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value));
|
||||
}
|
||||
//if (! preg_match('/PHP\/6/i', $_SERVER['SERVER_SOFTWARE']))
|
||||
if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* plus pris en compte dans PHP6
|
||||
@ -193,11 +193,11 @@ $bc[false]=' class="bg1"';
|
||||
$bc[true]=' class="bg2"';
|
||||
|
||||
|
||||
/*
|
||||
* \brief Load conf file (file must exists)
|
||||
* \param dolibarr_main_document_root Root directory of Dolibarr bin files
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
/**
|
||||
* \brief Load conf file (file must exists)
|
||||
* \param dolibarr_main_document_root Root directory of Dolibarr bin files
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function conf($dolibarr_main_document_root)
|
||||
{
|
||||
global $conf;
|
||||
@ -209,8 +209,8 @@ function conf($dolibarr_main_document_root)
|
||||
global $dolibarr_main_db_pass;
|
||||
global $character_set_client;
|
||||
|
||||
$return=include_once($dolibarr_main_document_root."/core/conf.class.php");
|
||||
if (! $return) return -1;
|
||||
$return=include_once($dolibarr_main_document_root."/core/conf.class.php");
|
||||
if (! $return) return -1;
|
||||
|
||||
$conf=new Conf();
|
||||
$conf->db->type = trim($dolibarr_main_db_type);
|
||||
@ -252,83 +252,102 @@ function conf($dolibarr_main_document_root)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Show header of install pages
|
||||
*/
|
||||
/**
|
||||
* Show header of install pages
|
||||
*
|
||||
* @param unknown_type $soutitre
|
||||
* @param unknown_type $next
|
||||
* @param unknown_type $action
|
||||
* @param unknown_type $param
|
||||
*/
|
||||
function pHeader($soutitre,$next,$action='set',$param='')
|
||||
{
|
||||
global $conf;
|
||||
global $langs;
|
||||
$langs->load("main");
|
||||
$langs->load("admin");
|
||||
global $langs;
|
||||
$langs->load("main");
|
||||
$langs->load("admin");
|
||||
|
||||
// On force contenu dans format sortie
|
||||
header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
||||
|
||||
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
|
||||
print '<html>'."\n";
|
||||
print '<head>'."\n";
|
||||
print '<meta http-equiv="content-type" content="text/html; charset='.$conf->file->character_set_client.'">'."\n";
|
||||
print '<link rel="stylesheet" type="text/css" href="./default.css">'."\n";
|
||||
print '<title>'.$langs->trans("DolibarrSetup").'</title>'."\n";
|
||||
print '</head>'."\n";
|
||||
print '<body>'."\n";
|
||||
print '<span class="titre">'.$langs->trans("DolibarrSetup");
|
||||
if ($soutitre) {
|
||||
print ' - '.$soutitre;
|
||||
}
|
||||
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
|
||||
print '<html>'."\n";
|
||||
print '<head>'."\n";
|
||||
print '<meta http-equiv="content-type" content="text/html; charset='.$conf->file->character_set_client.'">'."\n";
|
||||
print '<link rel="stylesheet" type="text/css" href="./default.css">'."\n";
|
||||
print '<title>'.$langs->trans("DolibarrSetup").'</title>'."\n";
|
||||
print '</head>'."\n";
|
||||
print '<body>'."\n";
|
||||
print '<span class="titre">'.$langs->trans("DolibarrSetup");
|
||||
if ($soutitre) {
|
||||
print ' - '.$soutitre;
|
||||
}
|
||||
print '</span>'."\n";
|
||||
|
||||
print '<form action="'.$next.'.php'.($param?'?'.$param:'').'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="testpost" value="ok">'."\n";
|
||||
print '<input type="hidden" name="action" value="'.$action.'">'."\n";
|
||||
print '<form name="forminstall" action="'.$next.'.php'.($param?'?'.$param:'').'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="testpost" value="ok">'."\n";
|
||||
print '<input type="hidden" name="action" value="'.$action.'">'."\n";
|
||||
|
||||
print '<table class="main" width="100%"><tr><td>'."\n";
|
||||
|
||||
print '<table class="main-inside" width="100%"><tr><td>'."\n";
|
||||
}
|
||||
|
||||
function pFooter($nonext=0,$setuplang='')
|
||||
/**
|
||||
* Output footer of install pages
|
||||
*
|
||||
* @param unknown_type $nonext
|
||||
* @param unknown_type $setuplang
|
||||
* @param unknown_type $jscheckfunction
|
||||
*/
|
||||
function pFooter($nonext=0,$setuplang='',$jscheckfunction='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf,$langs;
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("admin");
|
||||
$langs->load("main");
|
||||
$langs->load("admin");
|
||||
|
||||
print '</td></tr></table>'."\n";
|
||||
print '</td></tr></table>'."\n";
|
||||
print '</td></tr></table>'."\n";
|
||||
print '</td></tr></table>'."\n";
|
||||
|
||||
if (! $nonext)
|
||||
{
|
||||
print '<div class="barrebottom"><input type="submit" value="'.$langs->trans("NextStep").' ->"></div>';
|
||||
}
|
||||
if ($setuplang)
|
||||
{
|
||||
print '<input type="hidden" name="selectlang" value="'.$setuplang.'">';
|
||||
}
|
||||
if (! $nonext)
|
||||
{
|
||||
print '<div class="barrebottom"><input type="submit" value="'.$langs->trans("NextStep").' ->"';
|
||||
if ($jscheckfunction) print ' onClick="return '.$jscheckfunction.'();"';
|
||||
print '></div>';
|
||||
}
|
||||
if ($setuplang)
|
||||
{
|
||||
print '<input type="hidden" name="selectlang" value="'.$setuplang.'">';
|
||||
}
|
||||
|
||||
print '</form>'."\n";
|
||||
print '</form>'."\n";
|
||||
|
||||
// If there is some logs in buffer to show
|
||||
if (isset($conf->logbuffer) && sizeof($conf->logbuffer))
|
||||
{
|
||||
// If there is some logs in buffer to show
|
||||
if (isset($conf->logbuffer) && sizeof($conf->logbuffer))
|
||||
{
|
||||
print "\n";
|
||||
print "<!-- Start of log output\n";
|
||||
//print '<div class="hidden">'."\n";
|
||||
foreach($conf->logbuffer as $logline)
|
||||
{
|
||||
print $logline."<br>\n";
|
||||
}
|
||||
//print '</div>'."\n";
|
||||
//print '<div class="hidden">'."\n";
|
||||
foreach($conf->logbuffer as $logline)
|
||||
{
|
||||
print $logline."<br>\n";
|
||||
}
|
||||
//print '</div>'."\n";
|
||||
print "End of log output -->\n";
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '</body>'."\n";
|
||||
print '</html>'."\n";
|
||||
print '</body>'."\n";
|
||||
print '</html>'."\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Log function for install pages
|
||||
*
|
||||
* @param unknown_type $message
|
||||
* @param unknown_type $level
|
||||
*/
|
||||
function dolibarr_install_syslog($message, $level=LOG_DEBUG)
|
||||
{
|
||||
if (! defined('LOG_DEBUG')) define('LOG_DEBUG',6);
|
||||
|
||||
@ -53,10 +53,10 @@ Password=Password
|
||||
PasswordAgain=Retype password a second time
|
||||
AdminPassword=Password for Dolibarr database owner.
|
||||
CreateDatabase=Create database
|
||||
CreateUser=Create user
|
||||
CreateUser=Create owner
|
||||
DatabaseSuperUserAccess=Database server - Superuser access
|
||||
CheckToCreateDatabase=Check box if database does not exist and must be created.<br>In this case, you must fill the login/password for superuser account at the bottom of this page.
|
||||
CheckToCreateUser=Check box if owner does not exist and must be created.<br>In this case, you must choose its login and password and also fill the login/password for the superuser account at the bottom of this page. If this box is unchecked, owner database and its passwords must exists.
|
||||
CheckToCreateUser=Check box if database owner does not exist and must be created.<br>In this case, you must choose its login and password and also fill the login/password for the superuser account at the bottom of this page. If this box is unchecked, owner database and its passwords must exists.
|
||||
Experimental=(experimental)
|
||||
DatabaseRootLoginDescription=Login of the user allowed to create new databases or new users, useless if your database and your database login already exists (like when you're hosted by a web hosting provider).
|
||||
KeepEmptyIfNoPassword=Leave empty if user has no password (avoid this)
|
||||
@ -137,6 +137,8 @@ InstallChoiceSuggested=<b>Install choice suggested by installer</b>.
|
||||
CheckThatDatabasenameIsCorrect=Check that database name "<b>%s</b>" is correct.
|
||||
IfAlreadyExistsCheckOption=If this name is correct and that database does not exist yet, you must check option "Create database".
|
||||
OpenBaseDir=PHP openbasedir parameter
|
||||
YouAskToCreateDatabaseSoRootRequired=You checked the box "Create database". For this, you need to provide login/password of superuser (bottom of form).
|
||||
YouAskToCreateDatabaseUserSoRootRequired=You checked the box "Create database owner". For this, you need to provide login/password of superuser (bottom of form).
|
||||
|
||||
#########
|
||||
# upgrade
|
||||
|
||||
@ -53,7 +53,7 @@ Password=Mot de passe
|
||||
PasswordAgain=Vérification du mot de passe
|
||||
AdminPassword=Mot de passe du propriétaire de la base de données Dolibarr.
|
||||
CreateDatabase=Créer la base de donnée
|
||||
CreateUser=Créer l'utilisateur
|
||||
CreateUser=Créer le propriétaire
|
||||
DatabaseSuperUserAccess=Serveur de base de données - Accès super utilisateur
|
||||
CheckToCreateDatabase=Cochez cette option si la base de données n'existe pas et doit être créée.<br>Dans ce cas, il faut renseigner le login/mot de passe du superutilisateur au bas de cette page.
|
||||
CheckToCreateUser=Cochez cette option si l'utilisateur propriétaire n'existe pas et doit être créé.<br>Dans ce cas, il faut renseigner le nom et mot de passe du propriétaire à créer ainsi que le login/mot de passe du superutilisateur au bas de cette page. Si la case n'est pas cochée, le nom et mot de passe du propriétaire doivent exister.
|
||||
@ -138,6 +138,8 @@ InstallChoiceSuggested=<b>Choix suggéré par l'installeur</b>.
|
||||
CheckThatDatabasenameIsCorrect=Vérifiez que le nom de base "<b>%s</b>" est correct.
|
||||
IfAlreadyExistsCheckOption=Si ce nom est correct et que cette base n'existe pas déjà, vous devez cocher l'option "Créer la base de donnée".
|
||||
OpenBaseDir=Paramètre php openbasedir
|
||||
YouAskToCreateDatabaseSoRootRequired=Vous avez coché la case "Créer la base de donnée". Pour cela, le login/mot de passe du superutilisateur (en bas de formulaire) sont obligatoire.
|
||||
YouAskToCreateDatabaseUserSoRootRequired=Vous avez coché la case "Créer l'utilisateur propriétaire" de la base. Pour cela, le login/mot de passe du superutilisateur (en bas de formulaire) sont obligatoire.
|
||||
|
||||
#########
|
||||
# upgrade
|
||||
|
||||
Loading…
Reference in New Issue
Block a user