mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
fixed handling of hidden sections in Config_File
This commit is contained in:
1
NEWS
1
NEWS
@@ -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)
|
||||
|
@@ -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'];
|
||||
|
Reference in New Issue
Block a user