From 8aee7a4bf11b6a36d74892f56d8937219cba0be0 Mon Sep 17 00:00:00 2001 From: hugetoad Date: Fri, 25 Nov 2005 10:27:05 +0000 Subject: Cleanup of PHP code. git-svn-id: svn://svn.zabbix.com/trunk@2357 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/map.php | 95 ++++++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 46 deletions(-) (limited to 'frontends/php/map.php') diff --git a/frontends/php/map.php b/frontends/php/map.php index e513aa66..9b24c5ae 100644 --- a/frontends/php/map.php +++ b/frontends/php/map.php @@ -31,14 +31,13 @@ $grid=50; - $result=DBselect("select * from sysmaps where sysmapid=".$_REQUEST["sysmapid"]); - $row=DBfetch($result); + $map=get_map_by_sysmapid($_REQUEST["sysmapid"]); - $name=$row["name"]; - $width=$row["width"]; - $height=$row["height"]; - $background=$row["background"]; - $label_type=$row["label_type"]; + $name=$map["name"]; + $width=$map["width"]; + $height=$map["height"]; + $background=$map["background"]; + $label_type=$map["label_type"]; // Header( "Content-type: text/html"); if(MAP_OUTPUT_FORMAT == "JPG") Header( "Content-type: image/jpeg"); @@ -91,7 +90,8 @@ $result2=DBselect($sql); if(DBnum_rows($result2)==1) { - $back=ImageCreateFromString(DBget_field($result2,0,0)); + $row2=DBfetch($result2); + $back=ImageCreateFromString($row2["image"]); ImageCopy($im,$back,0,0,0,0,imagesx($back),imagesy($back)); } else @@ -145,25 +145,25 @@ # Draw connectors $result=DBselect("select shostid1,shostid2,triggerid,color_off,drawtype_off,color_on,drawtype_on from sysmaps_links where sysmapid=".$_REQUEST["sysmapid"]); - for($i=0;$i0)) { @@ -279,7 +280,8 @@ } else { - $icons[$icon]=ImageCreateFromString(DBget_field($result2,0,0)); + $row2=DBfetch($result2); + $icons[$icon]=ImageCreateFromString($row2["image"]); } } @@ -323,13 +325,14 @@ if($count==1) { $result1=DBselect("select distinct t.description,t.triggerid, t.priority from items i,functions f,triggers t,hosts h where h.hostid=i.hostid and i.hostid=$hostid and i.itemid=f.itemid and f.triggerid=t.triggerid and t.value=1 and t.status=0 and h.status=".HOST_STATUS_MONITORED." and i.status=0"); - $label=DBget_field($result1,0,0); - if (DBget_field($result1,0,2) > 3) + $row1=DBfetch($result1); + $label=$row1["description"]; + if ($row1["priority"] > 3) $color=$red; else $color=$darkyellow; - $label=expand_trigger_description_simple(DBget_field($result1,0,1)); + $label=expand_trigger_description_simple($row1["triggerid"]); } else if($count>1) { -- cgit