diff -uNr lms_OLD/index.php lms/index.php --- lms_OLD/index.php 2009-07-16 16:14:25.000000000 +0200 +++ lms/index.php 2009-08-11 12:01:37.000000000 +0200 @@ -44,55 +44,12 @@ die('Unable to read configuration file ['.$CONFIG_FILE.']!'); // Parse configuration file -function lms_parse_ini_file($filename, $process_sections = false) -{ - $ini_array = array(); - $section = ''; - $lines = file($filename); - foreach($lines as $line) - { - $line = trim($line); - - if($line == '' || $line[0] == ';' || $line[0] == '#') - continue; - - list($sec_name) = sscanf($line, "[%[^]]"); - - if( $sec_name ) - $section = trim($sec_name); - else - { - list($property, $value) = sscanf($line, "%[^=] = '%[^']'"); - if ( !$property || !$value ) - { - list($property, $value) = sscanf($line, "%[^=] = \"%[^\"]\""); - if ( !$property || !$value ) - { - list($property, $value) = sscanf($line, "%[^=] = %[^;#]"); - if( !$property || !$value ) - continue; - else - $value = trim($value, "\"'"); - } - } - - $property = trim($property); - $value = trim($value); - - if($process_sections) - $ini_array[$section][$property] = $value; - else - $ini_array[$property] = $value; - } - } - - return $ini_array; -} $CONFIG = array(); -foreach(lms_parse_ini_file($CONFIG_FILE, true) as $key => $val) - $CONFIG[$key] = $val; +$ini_array = parse_ini_file($CONFIG_FILE, true); +foreach ($ini_array as $key => $val) + $CONFIG[$key] = $val; // Check for configuration vars and set default values $CONFIG['directories']['sys_dir'] = (!isset($CONFIG['directories']['sys_dir']) ? getcwd() : $CONFIG['directories']['sys_dir']);