From f8f532c9b4906c59c3a6321bdffa2aa7e16bd271 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Apr 2008 00:30:57 +0000 Subject: [PATCH] Minor changes for installer --- build/exe/doliwamp/install.forced.php.install | 1 + htdocs/install/etape5.php | 37 ++++++++++++++++++- htdocs/install/inc.php | 24 ++++++++---- 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/build/exe/doliwamp/install.forced.php.install b/build/exe/doliwamp/install.forced.php.install index f4e4df1e89c..2cbe29455c5 100644 --- a/build/exe/doliwamp/install.forced.php.install +++ b/build/exe/doliwamp/install.forced.php.install @@ -9,4 +9,5 @@ $force_install_databasepass='WAMPMYSQLNEWPASSWORD'; $force_install_databaserootlogin='root'; $force_install_databaserootpass='WAMPMYSQLNEWPASSWORD'; $force_install_dolibarrlogin='admin'; +$force_install_renamedir='1'; ?> \ No newline at end of file diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index eca449c8b4a..72660fee652 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -35,6 +35,19 @@ $langs->load("install"); $success=0; +// Init "forced values" to nothing. "forced values" are used after an doliwamp install wizard. +if (! isset($force_install_type)) $force_install_type=''; +if (! isset($force_install_port)) $force_install_port=''; +if (! isset($force_install_database)) $force_install_database=''; +if (! isset($force_install_createdatabase)) $force_install_createdatabase=''; +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=''; +if (! isset($force_install_renamedir)) $force_install_renamedir=''; +if (file_exists("./install.forced.php")) include_once("./install.forced.php"); + + dolibarr_install_syslog("etape5: Entering etape5.php page", LOG_INFO); @@ -176,7 +189,17 @@ if ($_POST["action"] == "set") { // Fin install print $langs->trans("SystemIsInstalled")."
"; - print '
'.$langs->trans("WarningRemoveInstallDir")."
"; + if (empty($force_install_renamedir)) + { + print '
'.$langs->trans("WarningRemoveInstallDir")."
"; + } + else + { + // Open the file and erase the contents if any + $fp = fopen("../../install.lock", "w"); + fwrite($fp, "This is a lock file to prevent use of install pages"); + fclose($fp); + } print "
"; @@ -188,7 +211,17 @@ if ($_POST["action"] == "upgrade") { // Fin install print $langs->trans("SystemIsUpgraded")."
"; - print '
'.$langs->trans("WarningRemoveInstallDir")."
"; + if (empty($force_install_renamedir)) + { + print '
'.$langs->trans("WarningRemoveInstallDir")."
"; + } + else + { + // Open the file and erase the contents if any + $fp = fopen("../../install.lock", "w"); + fwrite($fp, "This is a lock file to prevent use of install pages"); + fclose($fp); + } print "
"; } diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 51f5a9fa42c..c2dde69e0e3 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -30,13 +30,6 @@ require_once('../lib/admin.lib.php'); // DOL_DOCUMENT_ROOT has been defined in function.inc.php to '..' -// Security check -if (eregi('install.norun',$_SERVER["SCRIPT_FILENAME"])) -{ - dolibarr_print_error('','Install pages have been disabled for security reason.'); - exit; -} - // Correction PHP_SELF (ex pour apache via caudium) car PHP_SELF doit valoir URL relative // et non path absolu. if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"]) @@ -114,7 +107,24 @@ define('DOL_DATA_ROOT',(isset($dolibarr_main_data_root)?$dolibarr_main_data_root if (! isset($conf->character_set_client)) $conf->character_set_client='iso-8859-1'; if (! isset($conf->db->dolibarr_main_db_collation)) $conf->db->dolibarr_main_db_collation='latin1_swedish_ci'; if (! isset($conf->db->user)) $conf->db->user=''; + +// Security check +if (eregi('install.norun',$_SERVER["SCRIPT_FILENAME"])) +{ + print 'Install pages have been disabled for security reason (directory renamed with .norun).'; + exit; +} +if (file_exists('../../install.lock')) +{ + print 'Install pages have been disabled for security reason (by lock file install.lock).
'; + print ''; + print 'Click here to go to Dolibarr'; + print ''; + exit; +} + + // Forcage constante LOG