fixed handling of hidden sections in Config_File

This commit is contained in:
messju
2004-01-22 23:47:46 +00:00
parent 72ee372936
commit 88cf42b0e6
2 changed files with 15 additions and 2 deletions

1
NEWS
View File

@@ -1,3 +1,4 @@
- fix handling of hidden sections in Config_File (messju)
- add handling of resources for {config_load} (messju)
- fix bug when using arrays with tr_attr and td_attr in {html_table} (messju)
- add unit testing to cvs core (Monte)

View File

@@ -289,9 +289,21 @@ class Config_File {
$lines = $match[0];
for ($i=0, $count=count($lines); $i<$count; $i++) {
$line = $lines[$i];
if ( @($line{0} == '[') && preg_match('!^\[(\w+)\]!', $line, $match) ) {
if ( @($line{0} == '[') && preg_match('!^\[(.*?)\]!', $line, $match) ) {
/* section found */
$section_name = $match[1];
if ($match[1]{0} == '.') {
/* hidden section */
if ($this->read_hidden) {
$section_name = substr($match[1], 1);
} else {
/* break reference to $vars to ignore hidden section */
unset($vars);
$vars = array();
continue;
}
} else {
$section_name = $match[1];
}
if (!isset($config_data['sections'][$section_name]))
$config_data['sections'][$section_name] = array('vars' => array());
$vars =& $config_data['sections'][$section_name]['vars'];