From 640abcbf3b48e5b4778c9d80696653f95e07b2a8 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 5 Jul 2009 13:55:27 +1000 Subject: [PATCH] Enabled a param so that some calls to getValue() are not fatal --- htdocs/login_form.php | 2 +- lib/ds.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/login_form.php b/htdocs/login_form.php index e8e02ca..669e915 100644 --- a/htdocs/login_form.php +++ b/htdocs/login_form.php @@ -45,7 +45,7 @@ printf('%s:', ($app['server']->getValue('login','attr') == 'dn' ? _('Login DN') : $_SESSION[APPCONFIG]->getFriendlyName($app['server']->getValue('login','attr')))); printf('', - $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 ' '; printf('%s:',_('Password')); diff --git a/lib/ds.php b/lib/ds.php index 1c2ff14..bd8cc5e 100644 --- a/lib/ds.php +++ b/lib/ds.php @@ -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; } /**