#! /bin/sh /usr/share/dpatch/dpatch-run ## fix-get_class-object.dpatch by Hendrik Frenzel ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: add is_object() to check for object before use get_class() @DPATCH@ diff -urNad nagvis-1.4.6~/nagvis/includes/classes/GlobalHeaderMenu.php nagvis-1.4.6/nagvis/includes/classes/GlobalHeaderMenu.php --- nagvis-1.4.6~/nagvis/includes/classes/GlobalHeaderMenu.php 2010-02-04 21:51:13.000000000 +0100 +++ nagvis-1.4.6/nagvis/includes/classes/GlobalHeaderMenu.php 2010-03-05 11:52:13.000000000 +0100 @@ -84,7 +84,7 @@ */ public function replaceDynamicMacros() { // Replace some special macros - if($this->OBJPAGE !== null && get_class($this->OBJPAGE) == 'NagVisMapCfg') { + if($this->OBJPAGE !== null && (is_object($this->OBJPAGE) && get_class($this->OBJPAGE) == 'NagVisMapCfg')) { $arrKeys[] = '[current_map]'; $arrKeys[] = '[current_map_alias]'; $arrVals[] = $this->OBJPAGE->getName(); @@ -122,7 +122,7 @@ } // auto select current map - if(get_class($this->OBJPAGE) == 'NagVisMapCfg' && ($mapName == $this->OBJPAGE->getName() || $mapName == '__automap' && isset($_GET['automap']))) { + if((is_object($this->OBJPAGE) && get_class($this->OBJPAGE) == 'NagVisMapCfg') && ($mapName == $this->OBJPAGE->getName() || $mapName == '__automap' && isset($_GET['automap']))) { $sReplaceObj = str_replace('[selected]','selected="selected"',$sReplaceObj); } else { $sReplaceObj = str_replace('[selected]','',$sReplaceObj); @@ -138,7 +138,7 @@ } // Select overview in header menu when no map shown - if(get_class($this->OBJPAGE) != 'NagVisMapCfg') { + if((is_object($this->OBJPAGE) && get_class($this->OBJPAGE) != 'NagVisMapCfg')) { $this->code = str_replace('[selected]','selected="selected"', $this->code); } diff -urNad nagvis-1.4.6~/nagvis/includes/classes/NagVisFrontend.php nagvis-1.4.6/nagvis/includes/classes/NagVisFrontend.php --- nagvis-1.4.6~/nagvis/includes/classes/NagVisFrontend.php 2010-02-04 21:51:13.000000000 +0100 +++ nagvis-1.4.6/nagvis/includes/classes/NagVisFrontend.php 2010-03-05 11:44:49.000000000 +0100 @@ -86,7 +86,7 @@ $prop['languageRoot'] = 'nagvis'; // Only do this, when a map needs to be displayed - if($this->MAPCFG !== null && get_class($this->MAPCFG) != '') { + if($this->MAPCFG !== null && (is_object($this->MAPCFG) && get_class($this->MAPCFG) != '')) { $prop['allowedUsers'] = $this->MAPCFG->getValue('global',0, 'allowed_user'); }