Check existance and readability of configuration file before
authorarjen <arjen>
Fri, 6 Dec 2002 22:34:02 +0000 (22:34 +0000)
committerarjen <arjen>
Fri, 6 Dec 2002 22:34:02 +0000 (22:34 +0000)
feeding it to the XML parser.

src/phpclasses/configuration.class.php
src/web/classes/configuration.class.php

index fa25a7d..30a1446 100644 (file)
@@ -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.<br>");
-            $this->system = false;
+            $root = $this->system->root();
+
+            if ($root->tagname != $app_name)
+            {
+               print("Configuration error: Wrong configuration file.<br>");
+               $this->system = false;
+            }
          }
       }
       else
index fa25a7d..30a1446 100644 (file)
@@ -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.<br>");
-            $this->system = false;
+            $root = $this->system->root();
+
+            if ($root->tagname != $app_name)
+            {
+               print("Configuration error: Wrong configuration file.<br>");
+               $this->system = false;
+            }
          }
       }
       else