1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- if (defined('SYSTEM_INSTALLATION')) {
-
- $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 (stripos($line, '$_configuration[\'dokeos_version\']') !== false) {
- $found_version = true;
- $line = '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n";
- } elseif (stripos($line, '$_configuration[\'dokeos_stable\']') !== false) {
- $found_stable = true;
- $line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n";
- } elseif (stripos($line, '?>') !== false) {
-
- $ignore = true;
- }
- if (!$ignore) {
- fwrite($fh, $line);
- }
- }
- if (!$found_version) {
- fwrite($fh, '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n");
- }
- if (!$found_stable) {
- fwrite($fh, '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n");
- }
- fwrite($fh, '?>');
- fclose($fh);
- } else {
- echo 'You are not allowed here !';
- }
|