Enabled a param so that some calls to getValue() are not fatal

This commit is contained in:
Deon George 2009-07-05 13:55:27 +10:00
parent 8e8db2e4ed
commit db2e8861fa
2 changed files with 6 additions and 4 deletions

View File

@ -45,7 +45,7 @@ printf('<tr><td><b>%s:</b></td></tr>',
($app['server']->getValue('login','attr') == 'dn' ? _('Login DN') : $_SESSION[APPCONFIG]->getFriendlyName($app['server']->getValue('login','attr'))));
printf('<tr><td><input type="text" id="login" name="login" size="40" value="%s" /></td></tr>',
$app['server']->getValue('login','attr') == 'dn' ? $app['server']->getValue('login','bind_id') : '');
$app['server']->getValue('login','attr',false) == 'dn' ? $app['server']->getValue('login','bind_id') : '');
echo '<tr><td colspan=2>&nbsp;</td></tr>';
printf('<tr><td><b>%s:</b></td></tr>',_('Password'));

View File

@ -69,16 +69,18 @@ abstract class DS {
/**
* Return a configuration value
*/
public function getValue($key,$setting) {
public function getValue($key,$setting,$fatal=true) {
if (isset($this->custom->{$key}[$setting]))
return $this->custom->{$key}[$setting];
elseif (isset($this->default->{$key}[$setting]) && array_key_exists('default',$this->default->{$key}[$setting]))
return $this->default->{$key}[$setting]['default'];
else {
elseif ($fatal)
debug_dump_backtrace("Error trying to get a non-existant value ($key,$setting)",1);
}
else
return null;
}
/**