projects
/
gnucomo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Configuration from current directory
[gnucomo.git]
/
src
/
phpclasses
/
configuration.class.php
diff --git
a/src/phpclasses/configuration.class.php
b/src/phpclasses/configuration.class.php
index
692e918
..
84ca56b
100644
(file)
--- a/
src/phpclasses/configuration.class.php
+++ b/
src/phpclasses/configuration.class.php
@@
-84,33
+84,39
@@
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.
- $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)
{
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;
}
return $this->system != false || $this->user != false;