Configuration from current directory
[gnucomo.git] / src / phpclasses / configuration.class.php5
index 68c529e..88419e2 100644 (file)
@@ -86,28 +86,33 @@ class configuration
          }
       }
 
-      if (isset($_ENV['HOME']) && $_ENV['HOME'] != '/')
+      // First try the user's config in the current dir.
+      $filename = $app_name . ".conf";
+      if (!is_readable($filename))
       {
-         //  Read configurations from the user's homedir.
-
-         $filename = $_ENV['HOME'] . "/." . $app_name . ".conf";
-         if (is_readable($filename))
+         print("Can not read $filename");
+         if (isset($_ENV['HOME']) && $_ENV['HOME'] != '/')
          {
+            //  Read configurations from the user's homedir.
+
+            $filename = $_ENV['HOME'] . "/." . $app_name . ".conf";
+         }
+      }
+      if (is_readable($filename))
+      {
 
-            $this->user = new DOMDocument();
+         $this->user = new DOMDocument();
+         if ($this->user->load($filename))
+         {
+            $root = $this->user->documentElement;
 
-            if ($this->user->load($filename))
+            if ($root->tagName != $app_name)
             {
-               $root = $this->user->documentElement;
-
-               if ($root->tagName != $app_name)
-               {
-                  print("Configuration error: Wrong configuration file.<br>");
-                  $this->user = false;
-               }
+               print("Configuration error: Wrong configuration file.<br>");
+               $this->user = false;
             }
          }
-         
+
       }
 
       if ($this->system == false && $this->user == false)