From: arjen Date: Fri, 6 Dec 2002 22:34:02 +0000 (+0000) Subject: Check existance and readability of configuration file before X-Git-Tag: V0_0_3~2 X-Git-Url: http://www.andromeda.nl/gitweb/?p=gnucomo.git;a=commitdiff_plain;h=0157349b3c421a8ec76eb3b21702c0100c88e9e6 Check existance and readability of configuration file before feeding it to the XML parser. --- diff --git a/src/phpclasses/configuration.class.php b/src/phpclasses/configuration.class.php index fa25a7d..30a1446 100644 --- a/src/phpclasses/configuration.class.php +++ b/src/phpclasses/configuration.class.php @@ -61,22 +61,24 @@ class configuration function read($app_name) { $filename = "/etc/" . $app_name . ".conf"; - $this->system = xmldocfile($filename); - - if (!$this->system) + if (!is_readable($filename)) { $filename = "/usr/local/etc/" . $app_name . ".conf"; - $this->system = xmldocfile($filename); } - - if ($this->system) + if (is_readable($filename)) { - $root = $this->system->root(); - if ($root->tagname != $app_name) + $this->system = xmldocfile($filename); + + if ($this->system) { - print("Configuration error: Wrong configuration file.
"); - $this->system = false; + $root = $this->system->root(); + + if ($root->tagname != $app_name) + { + print("Configuration error: Wrong configuration file.
"); + $this->system = false; + } } } else diff --git a/src/web/classes/configuration.class.php b/src/web/classes/configuration.class.php index fa25a7d..30a1446 100644 --- a/src/web/classes/configuration.class.php +++ b/src/web/classes/configuration.class.php @@ -61,22 +61,24 @@ class configuration function read($app_name) { $filename = "/etc/" . $app_name . ".conf"; - $this->system = xmldocfile($filename); - - if (!$this->system) + if (!is_readable($filename)) { $filename = "/usr/local/etc/" . $app_name . ".conf"; - $this->system = xmldocfile($filename); } - - if ($this->system) + if (is_readable($filename)) { - $root = $this->system->root(); - if ($root->tagname != $app_name) + $this->system = xmldocfile($filename); + + if ($this->system) { - print("Configuration error: Wrong configuration file.
"); - $this->system = false; + $root = $this->system->root(); + + if ($root->tagname != $app_name) + { + print("Configuration error: Wrong configuration file.
"); + $this->system = false; + } } } else