}
}
- 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)