Module: nagvis Branch: nagvis-1.4 Commit: e5fe38406a2ee9a202bbec7a60bbf757e86cdb7c URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=e5fe38406a2ee9a202bbec7a60bbf757e86cdb7c
Author: Lars Michelsen <[email protected]> Date: Fri Oct 16 22:55:34 2009 +0200 #139 Fixed php notice error which was caused by a empty string check where no should be made --- nagvis/nagvis/includes/classes/GlobalMainCfg.php | 33 ++++++++++----------- 1 files changed, 16 insertions(+), 17 deletions(-) diff --git a/nagvis/nagvis/includes/classes/GlobalMainCfg.php b/nagvis/nagvis/includes/classes/GlobalMainCfg.php index 09002cf..dfe16b6 100644 --- a/nagvis/nagvis/includes/classes/GlobalMainCfg.php +++ b/nagvis/nagvis/includes/classes/GlobalMainCfg.php @@ -877,6 +877,7 @@ class GlobalMainCfg { * @param Bool $ignoreDefault Don't read default value * @return String $val Value * @author Lars Michelsen <[email protected]> + * FIXME: Needs to be simplified */ public function getValue($sec, $var, $ignoreDefault=FALSE) { // if nothing is set in the config file, use the default value @@ -889,24 +890,22 @@ class GlobalMainCfg { if($sec == 'global' || $sec == 'defaults' || $sec == 'paths') { return $this->validConfig[$sec][$var]['default']; } elseif(strpos($sec, 'backend_') === 0) { - // If backendtype specified, return the default value of this backend - if(isset($this->config[$sec]['backendtype']) && $this->config[$sec]['backendtype'] != '') { - if(isset($this->validConfig['backend']['options'][$this->config[$sec]['backendtype']][$var]['default']) && $this->validConfig['backend']['options'][$this->config[$sec]['backendtype']][$var]['default'] != '') { - return $this->validConfig['backend']['options'][$this->config[$sec]['backendtype']][$var]['default']; - } else { - return $this->validConfig['backend'][$var]['default']; - } + + // Choose the backend type (Configured one or the system default) + $backendType = ''; + if(isset($this->config[$sec]['backendtype']) && $this->config[$sec]['backendtype'] !== '') { + $backendType = $this->config[$sec]['backendtype']; } else { - // When existing, return the default value of the default backend - if(isset($this->validConfig['backend']['options'][$this->validConfig['backend']['backendtype']['default']][$var]['default']) && $this->validConfig['backend']['options'][$this->validConfig['backend']['backendtype']['default']][$var]['default'] != '') { - return $this->validConfig['backend']['options'][$this->validConfig['backend']['backendtype']['default']][$var]['default']; - } else { - // When existing, return the default value of backend-global options - if(isset($this->validConfig['backend'][$var]['default']) && $this->validConfig['backend'][$var]['default'] != '') { - return $this->validConfig['backend'][$var]['default']; - } else { - return $this->validConfig['backend']['backendtype']['default']; - } + $backendType = $this->validConfig['backend']['backendtype']['default']; + } + + // This value could be emtpy - so only check if it is set + if(isset($this->validConfig['backend']['options'][$backendType][$var]['default'])) { + return $this->validConfig['backend']['options'][$backendType][$var]['default']; + } else { + // This value could be emtpy - so only check if it is set + if(isset($this->validConfig['backend'][$var]['default'])) { + return $this->validConfig['backend'][$var]['default']; } } } elseif(strpos($sec, 'rotation_') === 0) { ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
