}
}
- 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.
- $this->user = domxml_open_file($filename);
+ $filename = $_ENV['HOME'] . "/." . $app_name . ".conf";
+ }
+ }
+ if (is_readable($filename))
+ {
- if ($this->user)
- {
- $root = $this->user->root();
+ $this->user = domxml_open_file($filename);
- if ($root->tagname != $app_name)
- {
- print("Configuration error: Wrong configuration file.<br>");
- $this->user = false;
- }
+ if ($this->user)
+ {
+ $root = $this->user->root();
+
+ if ($root->tagname != $app_name)
+ {
+ print("Configuration error: Wrong configuration file.<br>");
+ $this->user = false;
}
}
-
}
+
if ($this->system == false && $this->user == false)
{
- print("Configuration error: Configuration file for $app_name not found.<br>\n");
+ print("Configuration error: Configuration file for $app_name is not found.<br>\n");
}
return $this->system != false || $this->user != false;