Module: nagvis
Branch: master
Commit: 448b409cd70f1581249064f6702e28f058b24d97
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=448b409cd70f1581249064f6702e28f058b24d97

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

---

 share/server/core/classes/GlobalMainCfg.php |   33 +++++++++++++--------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/share/server/core/classes/GlobalMainCfg.php 
b/share/server/core/classes/GlobalMainCfg.php
index 9741e3b..9b7720a 100644
--- a/share/server/core/classes/GlobalMainCfg.php
+++ b/share/server/core/classes/GlobalMainCfg.php
@@ -1178,6 +1178,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
@@ -1190,24 +1191,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

Reply via email to