Code

Remove upstream applied patch
[pkg-nagvis.git] / debian / patches / fix-get_class-object.dpatch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## fix-get_class-object.dpatch by Hendrik Frenzel <hfrenzel@scunc.net>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: add is_object() to check for object before use get_class()
7 @DPATCH@
8 diff -urNad nagvis-1.4.6~/nagvis/includes/classes/GlobalHeaderMenu.php nagvis-1.4.6/nagvis/includes/classes/GlobalHeaderMenu.php
9 --- nagvis-1.4.6~/nagvis/includes/classes/GlobalHeaderMenu.php  2010-02-04 21:51:13.000000000 +0100
10 +++ nagvis-1.4.6/nagvis/includes/classes/GlobalHeaderMenu.php   2010-03-05 11:52:13.000000000 +0100
11 @@ -84,7 +84,7 @@
12          */
13         public function replaceDynamicMacros() {
14                 // Replace some special macros
15 -               if($this->OBJPAGE !== null && get_class($this->OBJPAGE) == 'NagVisMapCfg') {
16 +               if($this->OBJPAGE !== null && (is_object($this->OBJPAGE) && get_class($this->OBJPAGE) == 'NagVisMapCfg')) {
17                         $arrKeys[] = '[current_map]';
18                         $arrKeys[] = '[current_map_alias]';
19                         $arrVals[] = $this->OBJPAGE->getName();
20 @@ -122,7 +122,7 @@
21                                                                 }
22                                                                 
23                                                                 // auto select current map
24 -                                                               if(get_class($this->OBJPAGE) == 'NagVisMapCfg' && ($mapName == $this->OBJPAGE->getName() || $mapName == '__automap' && isset($_GET['automap']))) {
25 +                                                               if((is_object($this->OBJPAGE) && get_class($this->OBJPAGE) == 'NagVisMapCfg') && ($mapName == $this->OBJPAGE->getName() || $mapName == '__automap' && isset($_GET['automap']))) {
26                                                                         $sReplaceObj = str_replace('[selected]','selected="selected"',$sReplaceObj);
27                                                                 } else {
28                                                                         $sReplaceObj = str_replace('[selected]','',$sReplaceObj);
29 @@ -138,7 +138,7 @@
30                 }
31                 
32                 // Select overview in header menu when no map shown
33 -               if(get_class($this->OBJPAGE) != 'NagVisMapCfg') {
34 +               if((is_object($this->OBJPAGE) && get_class($this->OBJPAGE) != 'NagVisMapCfg')) {
35                         $this->code = str_replace('[selected]','selected="selected"', $this->code);
36                 }
37                 
38 diff -urNad nagvis-1.4.6~/nagvis/includes/classes/NagVisFrontend.php nagvis-1.4.6/nagvis/includes/classes/NagVisFrontend.php
39 --- nagvis-1.4.6~/nagvis/includes/classes/NagVisFrontend.php    2010-02-04 21:51:13.000000000 +0100
40 +++ nagvis-1.4.6/nagvis/includes/classes/NagVisFrontend.php     2010-03-05 11:44:49.000000000 +0100
41 @@ -86,7 +86,7 @@
42                 $prop['languageRoot'] = 'nagvis';
43                 
44                 // Only do this, when a map needs to be displayed
45 -               if($this->MAPCFG !== null && get_class($this->MAPCFG) != '') {
46 +               if($this->MAPCFG !== null && (is_object($this->MAPCFG) && get_class($this->MAPCFG) != '')) {
47                         $prop['allowedUsers'] = $this->MAPCFG->getValue('global',0, 'allowed_user');
48                 }
49