diff --git a/main/install/index.php b/main/install/index.php index a18359803d..6d6f2621fe 100755 --- a/main/install/index.php +++ b/main/install/index.php @@ -53,6 +53,7 @@ $_setting = array( ); // Loading language files. +// TODO: It would be nice browser's intrface language to be detected at this point. require api_get_path(SYS_LANG_PATH).'english/trad4all.inc.php'; require api_get_path(SYS_LANG_PATH).'english/install.inc.php'; if (!empty($_POST['language_list'])) { @@ -202,14 +203,14 @@ if ($installType == 'update' && in_array($my_old_version, $update_from_version_8 if (!isset($_GET['running'])) { - $dbHostForm ='localhost'; - $dbUsernameForm ='root'; - $dbPassForm =''; - $dbPrefixForm =''; - $dbNameForm ='chamilo_main'; - $dbStatsForm ='chamilo_stats'; - $dbScormForm ='chamilo_scorm'; - $dbUserForm ='chamilo_user'; + $dbHostForm = 'localhost'; + $dbUsernameForm = 'root'; + $dbPassForm = ''; + $dbPrefixForm = ''; + $dbNameForm = 'chamilo_main'; + $dbStatsForm = 'chamilo_stats'; + $dbScormForm = 'chamilo_scorm'; + $dbUserForm = 'chamilo_user'; // Extract the path to append to the url if Chamilo is not installed on the web root directory. $urlAppendPath = api_remove_trailing_slash(api_get_path(REL_PATH)); @@ -232,16 +233,18 @@ if (!isset($_GET['running'])) { $institutionForm = 'My Organisation'; $institutionUrlForm = 'http://www.chamilo.org'; $languageForm = 'english'; + // TODO: A better choice to be tested: + //$languageForm = api_get_interface_language(); - $checkEmailByHashSent = 0; + $checkEmailByHashSent = 0; $ShowEmailnotcheckedToStudent = 1; - $userMailCanBeEmpty = 1; - $allowSelfReg = 1; - $allowSelfRegProf = 1; - $enableTrackingForm = 1; - $singleDbForm = 0; - $encryptPassForm = 'md5'; - $session_lifetime = 360000; + $userMailCanBeEmpty = 1; + $allowSelfReg = 1; + $allowSelfRegProf = 1; + $enableTrackingForm = 1; + $singleDbForm = 0; + $encryptPassForm = 'md5'; + $session_lifetime = 360000; } else { diff --git a/main/install/install_functions.inc.php b/main/install/install_functions.inc.php index bf2b640e74..784c43dac1 100755 --- a/main/install/install_functions.inc.php +++ b/main/install/install_functions.inc.php @@ -253,7 +253,7 @@ function get_config_param_from_db($host, $login, $pass, $db_name, $param = '') { /** * Displays a drop down box for selection the preferred language. */ -function display_language_selection_box() { +function display_language_selection_box($name = 'language_list', $default_language = 'english') { // Reading language list. $language_list = get_language_folder_list(); @@ -268,11 +268,26 @@ function display_language_selection_box() { } */ - // The default selection, it may be customized too. - $default_language = 'english'; + // Sanity checks due to the possibility for customizations. + if (!is_array($language_list) || empty($language_list)) { + $language_list = array('english' => 'English'); + } + + // Sorting again, if it is necessary. + //asort($language_list); + + // More sanity checks. + if (!array_key_exists($default_language, $language_list)) { + if (array_key_exists('english', $language_list)) { + $default_language = 'english'; + } else { + $language_keys = array_keys($language_list); + $default_language = $language_keys[0]; + } + } // Displaying the box. - echo "\t\t\n"; foreach ($language_list as $key => $value) { if ($key == $default_language) { $option_end = ' selected="selected">'; @@ -295,7 +310,7 @@ function display_language_selection() { ?>

:

- +
@@ -903,44 +918,8 @@ function display_configuration_settings_form($installType, $urlForm, $languageFo echo ''; - $array_lang = array('asturian', 'bulgarian', 'english', 'italian', 'french', 'slovenian', 'spanish'); - - ////Only display Language have 90% + // TODO: Ivan: Is this policy actual? I am going to change it. - echo "\t\t\n"; - - //Display all language - /*echo "';*/ echo "\n"; } echo "\n"; diff --git a/main/install/install_upgrade.lib.php b/main/install/install_upgrade.lib.php index 847f52b5a5..397e696192 100755 --- a/main/install/install_upgrade.lib.php +++ b/main/install/install_upgrade.lib.php @@ -158,19 +158,19 @@ function write_system_config_file($path) { */ function load_main_database($installation_settings, $db_script = '') { if (!empty($db_script)) { - $dokeos_main_sql_file_string = file_get_contents($db_script); + $sql_text = file_get_contents($db_script); } else { - $dokeos_main_sql_file_string = file_get_contents(SYSTEM_MAIN_DATABASE_FILE); + $sql_text = file_get_contents(SYSTEM_MAIN_DATABASE_FILE); } //replace symbolic parameters with user-specified values foreach ($installation_settings as $key => $value) { - $dokeos_main_sql_file_string = str_replace($key, Database::escape_string($value), $dokeos_main_sql_file_string); + $sql_text = str_replace($key, Database::escape_string($value), $sql_text); } //split in array of sql strings $sql_instructions = array(); - $success = split_sql_file($sql_instructions, $dokeos_main_sql_file_string); + $success = split_sql_file($sql_instructions, $sql_text); //execute the sql instructions $count = count($sql_instructions); @@ -185,11 +185,11 @@ function load_main_database($installation_settings, $db_script = '') { * @param string Name of the file containing the SQL script inside the install directory */ function load_database_script($db_script) { - $dokeos_sql_file_string = file_get_contents($db_script); + $sql_text = file_get_contents($db_script); //split in array of sql strings $sql_instructions = array(); - $success = split_sql_file($sql_instructions, $dokeos_sql_file_string); + $success = split_sql_file($sql_instructions, $sql_text); //execute the sql instructions $count = count($sql_instructions);