diff --git a/main/install/install.lib.php b/main/install/install.lib.php index 1f1d27a997..39fd1d1d0c 100644 --- a/main/install/install.lib.php +++ b/main/install/install.lib.php @@ -33,12 +33,12 @@ function is_already_installed_system() { return true; // Must be initialized. } - $current_config_file = str_replace('\\', '/', realpath('../inc/conf/configuration.php')); + $current_config_file = api_get_path(CONFIGURATION_PATH).'configuration.php'; if (!file_exists($current_config_file)) { return false; // Configuration file does not exist, install the system. } require $current_config_file; - + $current_version = trim($_configuration['dokeos_version']); if (empty($current_version)) { $current_version = trim($_configuration['system_version']); @@ -213,7 +213,7 @@ function detect_browser_language() { * This function checks if the given folder is writable */ function check_writable($folder, $suggestion = false) { - if (is_writable('../'.$folder)) { + if (is_writable(api_get_path(SYS_CODE_PATH).$folder)) { return ''.get_lang('Writable').''; } else { if ($suggestion) { @@ -251,10 +251,9 @@ function set_file_folder_permissions() { * @param string $url_append The path from your webroot to your chamilo root */ function write_courses_htaccess_file($url_append) { - $file_path = dirname(__FILE__).'/'.COURSES_HTACCESS_FILENAME; - $content = file_get_contents($file_path); + $content = file_get_contents(dirname(__FILE__).'/'.COURSES_HTACCESS_FILENAME); $content = str_replace('{CHAMILO_URL_APPEND_PATH}', $url_append, $content); - $fp = @ fopen('../../courses/.htaccess', 'w'); + $fp = @ fopen(api_get_path(SYS_PATH).'courses/.htaccess', 'w'); if ($fp) { fwrite($fp, $content); return fclose($fp); @@ -1173,11 +1172,11 @@ function display_requirements($installType, $badUpdatePath, $updatePath = '', $u
| - + |
| - + | diff --git a/main/install/install_files.inc.php b/main/install/install_files.inc.php index 4a41eee104..3841cd03bd 100755 --- a/main/install/install_files.inc.php +++ b/main/install/install_files.inc.php @@ -17,19 +17,19 @@ if (defined('SYSTEM_INSTALLATION')) { // Write the system config file - write_system_config_file('../inc/conf/configuration.php'); + write_system_config_file(api_get_path(CONFIGURATION_PATH).'configuration.php'); // Write a distribution file with the config as a backup for the admin - write_system_config_file('../inc/conf/configuration.dist.php'); + write_system_config_file(api_get_path(CONFIGURATION_PATH).'configuration.dist.php'); // Write a .htaccess file in the course repository write_courses_htaccess_file($urlAppendPath); // Copy distribution files with renaming for being the actual system configuration files. - copy('../inc/conf/add_course.conf.dist.php', '../inc/conf/add_course.conf.php'); - copy('../inc/conf/course_info.conf.dist.php', '../inc/conf/course_info.conf.php'); - copy('../inc/conf/mail.conf.dist.php', '../inc/conf/mail.conf.php'); - copy('../inc/conf/profile.conf.dist.php', '../inc/conf/profile.conf.php'); + copy(api_get_path(CONFIGURATION_PATH).'add_course.conf.dist.php', api_get_path(CONFIGURATION_PATH).'add_course.conf.php'); + copy(api_get_path(CONFIGURATION_PATH).'course_info.conf.dist.php', api_get_path(CONFIGURATION_PATH).'course_info.conf.php'); + copy(api_get_path(CONFIGURATION_PATH).'mail.conf.dist.php', api_get_path(CONFIGURATION_PATH).'mail.conf.php'); + copy(api_get_path(CONFIGURATION_PATH).'profile.conf.dist.php', api_get_path(CONFIGURATION_PATH).'profile.conf.php'); } else { diff --git a/main/install/update-db-scorm-1.6.x-1.8.0.inc.php b/main/install/update-db-scorm-1.6.x-1.8.0.inc.php index a08d44f9db..b44b613d00 100644 --- a/main/install/update-db-scorm-1.6.x-1.8.0.inc.php +++ b/main/install/update-db-scorm-1.6.x-1.8.0.inc.php @@ -37,9 +37,9 @@ function my_get_time($time) { } // Open log file -$fh = fopen('../../archive/newscorm_'.time().'.log', 'w'); -$fh_revert = fopen('../../archive/newscorm_'.time().'_revert.log', 'w'); -$fh_res = fopen('../../archive/newscorm_'.time().'_res.log', 'w'); +$fh = fopen(api_get_path(SYS_ARCHIVE_PATH).'newscorm_'.time().'.log', 'w'); +$fh_revert = fopen(api_get_path(SYS_ARCHIVE_PATH).'newscorm_'.time().'_revert.log', 'w'); +$fh_res = fopen(api_get_path(SYS_ARCHIVE_PATH)'newscorm_'.time().'_res.log', 'w'); fwrite($fh, "-- Recording course homepages links changes to enable reverting\n"); fwrite($fh_revert, "-- Recording reverted course homepages links changes to enable reverting\n"); fwrite($fh_res, "-- Recording resulting course homepages links changes\n"); 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 f1ea972636..a8db12ac5d 100644 --- 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 @@ -125,9 +125,9 @@ if (defined('SYSTEM_INSTALLATION')) { } // Write the config file - write_system_config_file('../inc/conf/configuration.php'); + write_system_config_file(api_get_path(CONFIGURATION_PATH).'configuration.php'); // Write a distribution file with the config as a backup for the admin - write_system_config_file('../inc/conf/configuration.dist.php'); + write_system_config_file(api_get_path(CONFIGURATION_PATH).'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-1.8.3-1.8.4.inc.php b/main/install/update-files-1.8.3-1.8.4.inc.php index c94f898c6d..6bd61cf2fa 100644 --- a/main/install/update-files-1.8.3-1.8.4.inc.php +++ b/main/install/update-files-1.8.3-1.8.4.inc.php @@ -20,19 +20,19 @@ if (defined('SYSTEM_INSTALLATION')) { // Edit the configuration file - $file = file('../inc/conf/configuration.php'); - $fh = fopen('../inc/conf/configuration.php', 'w'); + $file = file(api_get_path(CONFIGURATION_PATH).'configuration.php'); + $fh = fopen(api_get_path(CONFIGURATION_PATH).'configuration.php', 'w'); $found_version = false; $found_stable = false; foreach ($file as $line) { $ignore = false; - if (stristr($line, '$_configuration[\'dokeos_version\']')) { + if (stripos($line, '$_configuration[\'dokeos_version\']') !== false) { $found_version = true; $line = '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n"; - } elseif (stristr($line, '$_configuration[\'dokeos_stable\']')) { + } elseif (stripos($line, '$_configuration[\'dokeos_stable\']') !== false) { $found_stable = true; $line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n"; - } elseif (stristr($line, '?>')) { + } elseif (stripos($line, '?>') !== false) { // Ignore the line $ignore = true; } diff --git a/main/install/update-files-1.8.4-1.8.5.inc.php b/main/install/update-files-1.8.4-1.8.5.inc.php index 1fbef936b4..ae1b84543c 100644 --- a/main/install/update-files-1.8.4-1.8.5.inc.php +++ b/main/install/update-files-1.8.4-1.8.5.inc.php @@ -20,19 +20,19 @@ if (defined('SYSTEM_INSTALLATION')) { // Edit the configuration file - $file = file('../inc/conf/configuration.php'); - $fh = fopen('../inc/conf/configuration.php', 'w'); + $file = file(api_get_path(CONFIGURATION_PATH).'configuration.php'); + $fh = fopen(api_get_path(CONFIGURATION_PATH).'configuration.php', 'w'); $found_version = false; $found_stable = false; foreach ($file as $line) { $ignore = false; - if (stristr($line, '$_configuration[\'dokeos_version\']')) { + if (stripos($line, '$_configuration[\'dokeos_version\']') !== false) { $found_version = true; $line = '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n"; - } elseif (stristr($line, '$_configuration[\'dokeos_stable\']')) { + } elseif (stripos($line, '$_configuration[\'dokeos_stable\']') !== false) { $found_stable = true; $line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n"; - } elseif (stristr($line, '?>')) { + } elseif (stripos($line, '?>') !== false) { // Ignore the line $ignore = true; } diff --git a/main/install/update-files-1.8.5-1.8.6.inc.php b/main/install/update-files-1.8.5-1.8.6.inc.php index 23e7a30d9c..172814f7fc 100644 --- a/main/install/update-files-1.8.5-1.8.6.inc.php +++ b/main/install/update-files-1.8.5-1.8.6.inc.php @@ -20,21 +20,21 @@ if (defined('SYSTEM_INSTALLATION')) { // Edit the configuration file - $file = file('../inc/conf/configuration.php'); - $fh = fopen('../inc/conf/configuration.php', 'w'); + $file = file(api_get_path(CONFIGURATION_PATH).'configuration.php'); + $fh = fopen(api_get_path(CONFIGURATION_PATH).'configuration.php', 'w'); $found_version = false; $found_stable = false; foreach ($file as $line) { $ignore = false; - if (stristr($line, '$_configuration[\'dokeos_version\']')) { + if (stripos($line, '$_configuration[\'dokeos_version\']') !== false) { $found_version = true; $line = '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n"; - } elseif (stristr($line, '$_configuration[\'dokeos_stable\']')) { + } elseif (stripos($line, '$_configuration[\'dokeos_stable\']') !== false) { $found_stable = true; $line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n"; - } elseif (stristr($line,'$userPasswordCrypted')) { + } elseif (stripos($line,'$userPasswordCrypted') !== false) { $line = '$userPasswordCrypted = \''.($userPasswordCrypted).'\';'."\r\n"; - } elseif (stristr($line, '?>')) { + } elseif (stripos($line, '?>') !== false) { // Ignore the line $ignore = true; } diff --git a/main/install/update-files-1.8.6-1.8.6.1.inc.php b/main/install/update-files-1.8.6-1.8.6.1.inc.php index 245f8bc03f..59a9bebfc3 100644 --- a/main/install/update-files-1.8.6-1.8.6.1.inc.php +++ b/main/install/update-files-1.8.6-1.8.6.1.inc.php @@ -20,21 +20,21 @@ if (defined('SYSTEM_INSTALLATION')) { // Edit the configuration file - $file = file('../inc/conf/configuration.php'); - $fh = fopen('../inc/conf/configuration.php', 'w'); + $file = file(api_get_path(CONFIGURATION_PATH).'configuration.php'); + $fh = fopen(api_get_path(CONFIGURATION_PATH).'configuration.php', 'w'); $found_version = false; $found_stable = false; foreach ($file as $line) { $ignore = false; - if (stristr($line, '$_configuration[\'dokeos_version\']')) { + if (stripos($line, '$_configuration[\'dokeos_version\']') !== false) { $found_version = true; $line = '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n"; - } elseif (stristr($line, '$_configuration[\'dokeos_stable\']')) { + } elseif (stripos($line, '$_configuration[\'dokeos_stable\']') !== false) { $found_stable = true; $line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n"; - } elseif (stristr($line, '$userPasswordCrypted')) { + } elseif (stripos($line, '$userPasswordCrypted') !== false) { $line = '$userPasswordCrypted = \''.($userPasswordCrypted).'\';'."\r\n"; - } elseif (stristr($line, '?>')) { + } elseif (stripos($line, '?>') !== false) { //ignore the line $ignore = true; } diff --git a/main/install/update-files-1.8.6.1-1.8.6.2.inc.php b/main/install/update-files-1.8.6.1-1.8.6.2.inc.php index cf2f5c4287..53846b84a0 100644 --- a/main/install/update-files-1.8.6.1-1.8.6.2.inc.php +++ b/main/install/update-files-1.8.6.1-1.8.6.2.inc.php @@ -14,21 +14,21 @@ if (defined('SYSTEM_INSTALLATION')) { // Edit the configuration file - $file = file('../inc/conf/configuration.php'); - $fh = fopen('../inc/conf/configuration.php', 'w'); + $file = file(api_get_path(CONFIGURATION_PATH).'configuration.php'); + $fh = fopen(api_get_path(CONFIGURATION_PATH).'configuration.php', 'w'); $found_version = false; $found_stable = false; foreach ($file as $line) { $ignore = false; - if (stristr($line, '$_configuration[\'dokeos_version\']')) { + if (stripos($line, '$_configuration[\'dokeos_version\']') !== false) { $found_version = true; $line = '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n"; - } elseif(stristr($line, '$_configuration[\'dokeos_stable\']')) { + } elseif (stripos($line, '$_configuration[\'dokeos_stable\']') !== false) { $found_stable = true; $line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable?'true':'false').';'."\r\n"; - } elseif(stristr($line,'$userPasswordCrypted')) { + } elseif (stripos($line,'$userPasswordCrypted') !== false) { $line = '$userPasswordCrypted = \''.($userPasswordCrypted).'\';'."\r\n"; - } elseif(stristr($line, '?>')) { + } elseif (stripos($line, '?>') !== false) { //ignore the line $ignore = true; } diff --git a/main/install/update-files-1.8.6.2-1.8.7.inc.php b/main/install/update-files-1.8.6.2-1.8.7.inc.php index 511e0ded03..c008f6997d 100755 --- a/main/install/update-files-1.8.6.2-1.8.7.inc.php +++ b/main/install/update-files-1.8.6.2-1.8.7.inc.php @@ -14,8 +14,8 @@ if (defined('SYSTEM_INSTALLATION')) { // Edit the configuration file - $file = file('../inc/conf/configuration.php'); - $fh = fopen('../inc/conf/configuration.php', 'w'); + $file = file(api_get_path(CONFIGURATION_PATH).'configuration.php'); + $fh = fopen(api_get_path(CONFIGURATION_PATH).'configuration.php', 'w'); $found_version_old = false; $found_stable_old = false; $found_version = false; |