diff options
author | 2011-11-02 06:42:54 +0100 | |
---|---|---|
committer | 2011-11-02 06:42:54 +0100 | |
commit | d16ca9235157042604f23949f2fa6e479e882d7d (patch) | |
tree | 0a282528a0517f1e95a9c152c17372518541bf35 /src/SemanticScuttle | |
parent | 37a7bd4d316f2128504a88cbdeb7976db80e959c (diff) | |
parent | 8d9e1665f7ba42eb290b480acbcae9e710d06fea (diff) | |
download | scuttle-d16ca9235157042604f23949f2fa6e479e882d7d.tar.gz scuttle-d16ca9235157042604f23949f2fa6e479e882d7d.zip |
Merge branch '0.98'
Diffstat (limited to 'src/SemanticScuttle')
-rw-r--r-- | src/SemanticScuttle/Config.php | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/SemanticScuttle/Config.php b/src/SemanticScuttle/Config.php index 0773310..756c303 100644 --- a/src/SemanticScuttle/Config.php +++ b/src/SemanticScuttle/Config.php @@ -62,6 +62,9 @@ class SemanticScuttle_Config * * Paths with host name have priority. * + * When open_basedir restrictions are in effect and /etc is not part of + * the setting, /etc/semanticscuttle/ is not checked for config files. + * * @return array Array with config file path as first value * and default config file path as second value. * Any may be NULL if not found @@ -72,12 +75,23 @@ class SemanticScuttle_Config $host = basename($_SERVER['HTTP_HOST']); $datadir = $this->getDataDir(); - $arFiles = array( - $datadir . 'config.' . $host . '.php', - '/etc/semanticscuttle/config.' . $host . '.php', - $datadir . 'config.php', - '/etc/semanticscuttle/config.php', - ); + $openbase = ini_get('open_basedir'); + if ($openbase && strpos($openbase, '/etc') === false) { + //open_basedir restrictions enabled and /etc not allowed? + // then don't look in /etc for config files. + // the check is not perfect, but it covers most cases + $arFiles = array( + $datadir . 'config.' . $host . '.php', + $datadir . 'config.php', + ); + } else { + $arFiles = array( + $datadir . 'config.' . $host . '.php', + '/etc/semanticscuttle/config.' . $host . '.php', + $datadir . 'config.php', + '/etc/semanticscuttle/config.php', + ); + } $configfile = null; foreach ($arFiles as $file) { |