diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-11-24 16:43:23 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-11-24 16:43:23 +0000 |
| commit | 4eeeb02ee16f99f6b2d692f7e863ebfca66c1c63 (patch) | |
| tree | f2ad9a8bca15f6bef61a8156b88f7ea35ed5f707 /frontends/php | |
| parent | 3cbe6adc1f59c83ccdf319d31e7c03cb70db6351 (diff) | |
| download | zabbix-4eeeb02ee16f99f6b2d692f7e863ebfca66c1c63.tar.gz zabbix-4eeeb02ee16f99f6b2d692f7e863ebfca66c1c63.tar.xz zabbix-4eeeb02ee16f99f6b2d692f7e863ebfca66c1c63.zip | |
Misc cleanup.
git-svn-id: svn://svn.zabbix.com/trunk@2356 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
| -rw-r--r-- | frontends/php/actions.php | 27 | ||||
| -rw-r--r-- | frontends/php/chart2.php | 25 | ||||
| -rw-r--r-- | frontends/php/charts.php | 3 | ||||
| -rw-r--r-- | frontends/php/config.php | 15 | ||||
| -rw-r--r-- | frontends/php/graph.php | 19 | ||||
| -rw-r--r-- | frontends/php/graphs.php | 3 | ||||
| -rw-r--r-- | frontends/php/include/db.inc.php | 2 |
7 files changed, 49 insertions, 45 deletions
diff --git a/frontends/php/actions.php b/frontends/php/actions.php index a6409a42..6f2379f6 100644 --- a/frontends/php/actions.php +++ b/frontends/php/actions.php @@ -217,22 +217,21 @@ if(isset($_REQUEST["actionid"])) { - $sql="select a.actionid,a.triggerid,a.good,a.delay,a.subject,a.message,a.userid,a.scope,a.severity,a.recipient,a.maxrepeats,a.repeatdelay from actions a where a.actionid=".$_REQUEST["actionid"]; - $result=DBselect($sql); + $action=get_action_by_actionid($_REQUEST["actionid"]); - $actionid=DBget_field($result,0,0); - $triggerid=DBget_field($result,0,1); - $good=DBget_field($result,0,2); - $delay=DBget_field($result,0,3); + $actionid=$action["actionid"]; + $triggerid=$action["triggerid"]; + $good=$action["good"]; + $delay=$action["delay"]; // Otherwise symbols like ",' will not be shown - $subject=htmlspecialchars(DBget_field($result,0,4)); - $message=DBget_field($result,0,5); - $uid=DBget_field($result,0,6); - $scope=@iif(isset($_REQUEST["scope"]),$_REQUEST["scope"],DBget_field($result,0,7)); - $severity=DBget_field($result,0,8); - $recipient=@iif(isset($_REQUEST["recipient"]),$_REQUEST["recipient"],DBget_field($result,0,9)); - $maxrepeats=DBget_field($result,0,10); - $repeatdelay=DBget_field($result,0,11); + $subject=htmlspecialchars($action["subject"]); + $message=$action["message"]; + $uid=$action["uid"]; + $scope=@iif(isset($_REQUEST["scope"]),$_REQUEST["scope"],$action["scope"]); + $severity=$action["severity"]; + $recipient=@iif(isset($_REQUEST["recipient"]),$_REQUEST["recipient"],$action["recipient"]); + $maxrepeats=$action["maxrepeats"]; + $repeatdelay=$action["repeatdelay"]; if(isset($_REQUEST["repeat"])) { $repeat=$_REQUEST["repeat"]; diff --git a/frontends/php/chart2.php b/frontends/php/chart2.php index 7e7a62df..3946732d 100644 --- a/frontends/php/chart2.php +++ b/frontends/php/chart2.php @@ -41,15 +41,16 @@ } $result=DBselect("select name,width,height,yaxistype,yaxismin,yaxismax from graphs where graphid=".$_REQUEST["graphid"]); + $row=DBfetch($result); - $name=DBget_field($result,0,0); + $name=$row["name"]; if(isset($_REQUEST["width"])&&$_REQUEST["width"]>0) { $width=$_REQUEST["width"]; } else { - $width=DBget_field($result,0,1); + $width=$row["width"]; } if(isset($_REQUEST["height"])&&$_REQUEST["height"]>0) { @@ -57,24 +58,24 @@ } else { - $height=DBget_field($result,0,2); + $height=$row["height"]; } $graph->setWidth($width); $graph->setHeight($height); - $graph->setHeader(DBget_field($result,0,0)); - $graph->setYAxisType(DBget_field($result,0,3)); - $graph->setYAxisMin(DBget_field($result,0,4)); - $graph->setYAxisMax(DBget_field($result,0,5)); + $graph->setHeader($row["name"]); + $graph->setYAxisType($row["yaxistype"]); + $graph->setYAxisMin($row["yaxismin"]); + $graph->setYAxisMax($row["yaxismax"]); $result=DBselect("select gi.itemid,i.description,gi.color,h.host,gi.drawtype,gi.yaxisside from graphs_items gi,items i,hosts h where gi.itemid=i.itemid and gi.graphid=".$_REQUEST["graphid"]." and i.hostid=h.hostid order by gi.sortorder"); - for($i=0;$i<DBnum_rows($result);$i++) + while($row=DBfetch($result)) { - $graph->addItem(DBget_field($result,$i,0)); - $graph->setColor(DBget_field($result,$i,0), DBget_field($result,$i,2)); - $graph->setDrawtype(DBget_field($result,$i,0), DBget_field($result,$i,4)); - $graph->setYAxisSide(DBget_field($result,$i,0), DBget_field($result,$i,5)); + $graph->addItem($row["itemid"]); + $graph->setColor($row["itemid"], $row["color"]); + $graph->setDrawtype($row["itemid"], $row["drawtype"]); + $graph->setYAxisSide($row["itemid"], $row["yaxisside"]); } $graph->Draw(); diff --git a/frontends/php/charts.php b/frontends/php/charts.php index 86ac99f5..afa32d0f 100644 --- a/frontends/php/charts.php +++ b/frontends/php/charts.php @@ -74,7 +74,8 @@ if(isset($_REQUEST["graphid"])) { $result=DBselect("select name from graphs where graphid=".$_REQUEST["graphid"]); - $graph=DBget_field($result,0,0); + $row=DBfetch($result); + $graph=$row["name"]; $h1=iif(isset($_REQUEST["fullscreen"]), "<a href=\"charts.php?graphid=".$_REQUEST["graphid"]."\">".$graph."</a>", "<a href=\"charts.php?graphid=".$_REQUEST["graphid"]."&fullscreen=1\">".$graph."</a>"); diff --git a/frontends/php/config.php b/frontends/php/config.php index 99ab67fe..2557d606 100644 --- a/frontends/php/config.php +++ b/frontends/php/config.php @@ -415,13 +415,14 @@ if(isset($_REQUEST["register"]) && ($_REQUEST["register"] == "change")) { $result=DBselect("select mediatypeid,type,description,smtp_server,smtp_helo,smtp_email,exec_path from media_type where mediatypeid=".$_REQUEST["mediatypeid"]); - $mediatypeid=DBget_field($result,0,0); - $type=@iif(isset($_REQUEST["type"]),$_REQUEST["type"],DBget_field($result,0,1)); - $description=DBget_field($result,0,2); - $smtp_server=DBget_field($result,0,3); - $smtp_helo=DBget_field($result,0,4); - $smtp_email=DBget_field($result,0,5); - $exec_path=DBget_field($result,0,6); + $row=DBfetch($result); + $mediatypeid=$row["mediatypeid"]; + $type=@iif(isset($_REQUEST["type"]),$_REQUEST["type"],$row["type"]); + $description=$row["description"]; + $smtp_server=$row["smtp_server"]; + $smtp_helo=$row["smtp_helo"]; + $smtp_email=$row["smtp_email"]; + $exec_path=$row["exec_path"]; } ?> diff --git a/frontends/php/graph.php b/frontends/php/graph.php index 4aa803ac..962d1b59 100644 --- a/frontends/php/graph.php +++ b/frontends/php/graph.php @@ -153,11 +153,12 @@ { $sql="select itemid,color,drawtype,sortorder,yaxisside from graphs_items where gitemid=".$_REQUEST["gitemid"]; $result=DBselect($sql); - $itemid=DBget_field($result,0,0); - $color=DBget_field($result,0,1); - $drawtype=DBget_field($result,0,2); - $sortorder=DBget_field($result,0,3); - $yaxisside=DBget_field($result,0,4); + $row=DBfetch($result); + $itemid=$row["itemid"]; + $color=$row["color"]; + $drawtype=$row["drawtype"]; + $sortorder=$row["sortorder"]; + $yaxisside=$row["yaxisside"]; } else { @@ -180,11 +181,11 @@ show_table2_h_delimiter(); $result=DBselect("select h.host,i.description,i.itemid,i.key_ from hosts h,items i where h.hostid=i.hostid and h.status in(".HOST_STATUS_MONITORED.",".HOST_STATUS_TEMPLATE.") and i.status=".ITEM_STATUS_ACTIVE." order by h.host,i.description"); echo "<select name=\"itemid\" size=1>"; - for($i=0;$i<DBnum_rows($result);$i++) + while($row=DBfetch($result)) { - $host_=DBget_field($result,$i,0); - $description_=item_description(DBget_field($result,$i,1),DBget_field($result,$i,3)); - $itemid_=DBget_field($result,$i,2); + $host_=$row["host"]; + $description_=item_description($row["itemid"],$row["key_"]); + $itemid_=$row["itemid"]; if(isset($itemid)&&($itemid==$itemid_)) { echo "<OPTION VALUE='$itemid_' SELECTED>$host_: $description_"; diff --git a/frontends/php/graphs.php b/frontends/php/graphs.php index 6fe914d9..683b76ac 100644 --- a/frontends/php/graphs.php +++ b/frontends/php/graphs.php @@ -90,7 +90,8 @@ if(isset($_REQUEST["graphid"])) { $result=DBselect("select name from graphs where graphid=".$_REQUEST["graphid"]); - $graph=DBget_field($result,0,0); + $row=DBfetch($result); + $graph=$row["name"]; $h1=iif(isset($_REQUEST["fullscreen"]), "<a href=\"charts.php?graphid=".$_REQUEST["graphid"]."\">".$graph."</a>", "<a href=\"charts.php?graphid=".$_REQUEST["graphid"]."&fullscreen=1\">".$graph."</a>"); diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index dc61fa37..dc235ee5 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -25,7 +25,7 @@ // $DB_TYPE ="POSTGRESQL"; $DB_TYPE ="MYSQL"; $DB_SERVER ="localhost"; - $DB_DATABASE ="zabbix"; + $DB_DATABASE ="test"; $DB_USER ="root"; $DB_PASSWORD =""; // END OF DATABASE CONFIGURATION |
