config : if the parameter is an array, check if all the keys are defined or use the default one
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2097 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
11
config.php
11
config.php
@@ -66,7 +66,18 @@ class config
|
|||||||
if ($rc !== 1)
|
if ($rc !== 1)
|
||||||
throw new Exception ("Error in configuration file");
|
throw new Exception ("Error in configuration file");
|
||||||
if (array_key_exists ($param, $conf))
|
if (array_key_exists ($param, $conf))
|
||||||
|
{
|
||||||
|
if (! is_array ($conf[$param]))
|
||||||
|
return $conf[$param];
|
||||||
|
// if the configuration is an array, check if all the keys are defined
|
||||||
|
// or use the default
|
||||||
|
foreach ($this->default[$param] as $key=>$val)
|
||||||
|
{
|
||||||
|
if (! isset ($conf[$param][$key]))
|
||||||
|
$conf[$param][$key] = $val;
|
||||||
|
}
|
||||||
return $conf[$param];
|
return $conf[$param];
|
||||||
|
}
|
||||||
return $this->default[$param];
|
return $this->default[$param];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user