diff --git a/Config_File.class.php b/Config_File.class.php index 9205e1aa..2212f5d5 100644 --- a/Config_File.class.php +++ b/Config_File.class.php @@ -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 { + 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 - return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]; } else { - if (empty($section_name)) + if (empty($section_name)) { return (array)$this->_config_data[$file_name]["vars"]; - else - return (array)$this->_config_data[$file_name]["sections"][$section_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(); + } } } diff --git a/NEWS b/NEWS index eb58a63d..c1371b6e 100644 --- a/NEWS +++ b/NEWS @@ -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) diff --git a/libs/Config_File.class.php b/libs/Config_File.class.php index 9205e1aa..2212f5d5 100644 --- a/libs/Config_File.class.php +++ b/libs/Config_File.class.php @@ -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 { + 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 - return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]; } else { - if (empty($section_name)) + if (empty($section_name)) { return (array)$this->_config_data[$file_name]["vars"]; - else - return (array)$this->_config_data[$file_name]["sections"][$section_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(); + } } }