fix error when there are no sections in config file

This commit is contained in:
mohrt
2002-07-23 13:39:59 +00:00
parent 57a392d6dc
commit 277b692b11
3 changed files with 28 additions and 14 deletions

View File

@@ -124,17 +124,23 @@ class Config_File {
}
if (!empty($var_name)) {
if (empty($section_name))
{
if (empty($section_name)) {
return $this->_config_data[$file_name]["vars"][$var_name];
}
else
return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name];
} else {
if (empty($section_name))
return (array)$this->_config_data[$file_name]["vars"];
if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]))
return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name];
else
return array();
}
} else {
if (empty($section_name)) {
return (array)$this->_config_data[$file_name]["vars"];
} else {
if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"]))
return (array)$this->_config_data[$file_name]["sections"][$section_name]["vars"];
else
return array();
}
}
}

2
NEWS
View File

@@ -1,3 +1,5 @@
- fix Config_File class to not error when there are no
sections (Peter Kmet, Monte)
- add default modifier logic (Monte)
- updated popup_init to be xhtml compliant (Tom Oram, Monte)
- fix filename bug with windows (Gary Loescher, Monte)

View File

@@ -124,17 +124,23 @@ class Config_File {
}
if (!empty($var_name)) {
if (empty($section_name))
{
if (empty($section_name)) {
return $this->_config_data[$file_name]["vars"][$var_name];
}
else
return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name];
} else {
if (empty($section_name))
return (array)$this->_config_data[$file_name]["vars"];
if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]))
return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name];
else
return array();
}
} else {
if (empty($section_name)) {
return (array)$this->_config_data[$file_name]["vars"];
} else {
if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"]))
return (array)$this->_config_data[$file_name]["sections"][$section_name]["vars"];
else
return array();
}
}
}