From b78abc370f3a63c55c2df72bf5fe5be3bf005d7f Mon Sep 17 00:00:00 2001 From: Ivan Tcholakov <ivantcholakov@gmail.com> Date: Sun, 14 Feb 2010 19:20:58 +0200 Subject: [PATCH] Feature #272 - Installation scripts: Renaming some lexems in the code (mostly). --- main/install/index.php | 6 +++--- main/install/install_files.inc.php | 4 ++-- main/install/install_upgrade.lib.php | 18 +++++++----------- main/install/update-files-1.6.x-1.8.0.inc.php | 4 ++-- main/install/update_files.inc.php | 4 ++-- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/main/install/index.php b/main/install/index.php index 6bff9cd7b9..a18359803d 100755 --- a/main/install/index.php +++ b/main/install/index.php @@ -246,7 +246,7 @@ if (!isset($_GET['running'])) { } else { foreach ($_POST as $key => $val) { - $magic_quotes_gpc = ini_get('magic_quotes_gpc') ? true : false; + $magic_quotes_gpc = ini_get('magic_quotes_gpc'); if (is_string($val)) { if ($magic_quotes_gpc) { $val = stripslashes($val); @@ -589,7 +589,7 @@ if ($_POST['step2']) { ?> <?php echo get_lang('AdminPhone').' : '.$adminPhoneForm; ?><br /> - <?php if($installType == 'new'): ?> + <?php if ($installType == 'new'): ?> <?php echo get_lang('AdminLogin').' : <strong>'.$loginForm; ?></strong><br /> <?php echo get_lang('AdminPass').' : <strong>'.$passForm; /* TODO: Maybe this password should be hidden too? */ ?></strong><br /><br /> <?php else: ?> @@ -606,7 +606,7 @@ if ($_POST['step2']) { <?php if ($installType == 'new'): ?> <div style="background-color:#FFFFFF"> <p align="center"><strong><font color="red"> - <?php echo get_lang('Warning');?> !<br /> + <?php echo get_lang('Warning'); ?> !<br /> <?php echo get_lang('TheInstallScriptWillEraseAllTables'); ?> </font></strong></p> </div> diff --git a/main/install/install_files.inc.php b/main/install/install_files.inc.php index 09e6880941..b55abd411a 100755 --- a/main/install/install_files.inc.php +++ b/main/install/install_files.inc.php @@ -18,10 +18,10 @@ if (defined('SYSTEM_INSTALLATION')) { // Write the system config file - write_dokeos_config_file('../inc/conf/configuration.php'); + write_system_config_file('../inc/conf/configuration.php'); // Write a distribution file with the config as a backup for the admin - write_dokeos_config_file('../inc/conf/configuration.dist.php'); + write_system_config_file('../inc/conf/configuration.dist.php'); // Write a .htaccess file in the course repository write_courses_htaccess_file($urlAppendPath); diff --git a/main/install/install_upgrade.lib.php b/main/install/install_upgrade.lib.php index dc6325fd6f..384465c48d 100755 --- a/main/install/install_upgrade.lib.php +++ b/main/install/install_upgrade.lib.php @@ -19,10 +19,10 @@ CONSTANTS ============================================================================== */ -define("DOKEOS_MAIN_DATABASE_FILE", "dokeos_main.sql"); +define("SYSTEM_MAIN_DATABASE_FILE", "dokeos_main.sql"); define("COUNTRY_DATA_FILENAME", "country_data.csv"); define("COURSES_HTACCESS_FILENAME", "htaccess.dist"); -define("DOKEOS_CONFIG_FILENAME", "configuration.dist.php"); +define("SYSTEM_CONFIG_FILENAME", "configuration.dist.php"); require_once api_get_path(LIBRARY_PATH).'database.lib.php'; @@ -70,7 +70,7 @@ function write_courses_htaccess_file($url_append) { * Write the main system config file * @param string $path Path to the config file */ -function write_dokeos_config_file($path) { +function write_system_config_file($path) { global $dbHostForm; global $dbUsernameForm; @@ -93,13 +93,9 @@ function write_dokeos_config_file($path) { global $new_version; global $new_version_stable; - // TODO: api_get_path() to be tested here. - $seek = array('\\', '//'); - $destroy = array('/', '/'); - $rootSys = str_replace($seek, $destroy, realpath($pathForm).'/'); - $file_path = dirname(__FILE__).'/'.DOKEOS_CONFIG_FILENAME; + $root_sys = api_add_trailing_slash(str_replace('\\', '/', realpath($pathForm))); + $content = file_get_contents(dirname(__FILE__).'/'.SYSTEM_CONFIG_FILENAME); - $content = file_get_contents($file_path); $config['{DATE_GENERATED}'] = date('r'); $config['{DATABASE_HOST}'] = $dbHostForm; $config['{DATABASE_USER}'] = $dbUsernameForm; @@ -114,7 +110,7 @@ function write_dokeos_config_file($path) { $config['{DATABASE_SCORM}'] = (($singleDbForm && empty($dbScormForm)) ? $dbNameForm : $dbScormForm); $config['{DATABASE_PERSONAL}'] =(($singleDbForm && empty($dbUserForm)) ? $dbNameForm : $dbUserForm); $config['{ROOT_WEB}'] = $urlForm; - $config['{ROOT_SYS}'] = $rootSys; + $config['{ROOT_SYS}'] = $root_sys; $config['{URL_APPEND_PATH}'] = $urlAppendPath; $config['{PLATFORM_LANGUAGE}'] = $languageForm; $config['{SECURITY_KEY}'] = md5(uniqid(rand().time())); @@ -164,7 +160,7 @@ function load_main_database($installation_settings, $db_script = '') { if (!empty($db_script)) { $dokeos_main_sql_file_string = file_get_contents($db_script); } else { - $dokeos_main_sql_file_string = file_get_contents(DOKEOS_MAIN_DATABASE_FILE); + $dokeos_main_sql_file_string = file_get_contents(SYSTEM_MAIN_DATABASE_FILE); } //replace symbolic parameters with user-specified values diff --git a/main/install/update-files-1.6.x-1.8.0.inc.php b/main/install/update-files-1.6.x-1.8.0.inc.php index 1c66666b32..9f9cf44bc1 100755 --- a/main/install/update-files-1.6.x-1.8.0.inc.php +++ b/main/install/update-files-1.6.x-1.8.0.inc.php @@ -170,9 +170,9 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) { //umask($old_umask); // This function is not thread-safe. // Write the Dokeos config file - write_dokeos_config_file('../inc/conf/configuration.php'); + write_system_config_file('../inc/conf/configuration.php'); // Write a distribution file with the config as a backup for the admin - write_dokeos_config_file('../inc/conf/configuration.dist.php'); + write_system_config_file('../inc/conf/configuration.dist.php'); // Write a .htaccess file in the course repository write_courses_htaccess_file($urlAppendPath); copy($updatePath.'claroline/inc/conf/add_course.conf.php', $pathForm.'main/inc/conf/add_course.conf.php'); diff --git a/main/install/update_files.inc.php b/main/install/update_files.inc.php index 96ca32b7a5..a4becdf3f6 100755 --- a/main/install/update_files.inc.php +++ b/main/install/update_files.inc.php @@ -202,10 +202,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) { if (defined('SYSTEM_INSTALLATION')) { // Write the Dokeos config file - write_dokeos_config_file($newPath.'main/inc/conf/configuration.php'); + write_system_config_file($newPath.'main/inc/conf/configuration.php'); // Write a distribution file with the config as a backup for the admin - write_dokeos_config_file($newPath.'main/inc/conf/configuration.dist.php'); + write_system_config_file($newPath.'main/inc/conf/configuration.dist.php'); // Write a .htaccess file in the course repository write_courses_htaccess_file($urlAppendPath);