summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-09-01 12:20:42 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-09-01 12:20:42 +0000
commit625662bcb0d08e9228eeeae987dec996eead4efa (patch)
tree79e24bdb3c387c287e8df924fa87f772d573f5f5 /frontends/php
parente0391b3736f5f150182b7ca9e1bb47459e709af1 (diff)
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@2019 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/chart_diff.php215
-rw-r--r--frontends/php/history.php23
-rw-r--r--frontends/php/include/config.inc.php56
-rw-r--r--frontends/php/include/locales/en_gb.inc.php1
4 files changed, 20 insertions, 275 deletions
diff --git a/frontends/php/chart_diff.php b/frontends/php/chart_diff.php
deleted file mode 100644
index e3009446..00000000
--- a/frontends/php/chart_diff.php
+++ /dev/null
@@ -1,215 +0,0 @@
-<?php
-/*
-** ZABBIX
-** Copyright (C) 2000-2005 SIA Zabbix
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**/
-?>
-<?php
- include "include/config.inc.php";
-
-# PARAMETERS:
-
-# itemid
-# period
-# from
-
- if(!isset($_GET["period"]))
- {
- $period=0;
- }
- else
- {
- $period=$_GET["period"];
- }
-
- if(!isset($_GET["from"]))
- {
- $from=0;
- }
- else
- {
- $from=$_GET["from"];
- }
-
- if(isset($_GET["width"]))
- {
- $sizeX=$_GET["width"];
- }
- else
- {
- $sizeX=200;
- }
-
- $sizeY=200;
-
- $shiftX=10;
- $shiftY=17;
-
- $nodata=1;
-
-
-// Header( "Content-type: text/html");
- Header( "Content-type: image/png");
- Header( "Expires: Mon, 17 Aug 1998 12:51:50 GMT");
-
- check_authorisation();
-
- $im = imagecreate($sizeX+$shiftX+61,$sizeY+2*$shiftY+10);
-
- $red=ImageColorAllocate($im,255,0,0);
- $darkred=ImageColorAllocate($im,150,0,0);
- $green=ImageColorAllocate($im,0,255,0);
- $darkgreen=ImageColorAllocate($im,0,150,0);
- $blue=ImageColorAllocate($im,0,0,255);
- $yellow=ImageColorAllocate($im,255,255,0);
- $cyan=ImageColorAllocate($im,0,255,255);
- $black=ImageColorAllocate($im,0,0,0);
- $gray=ImageColorAllocate($im,150,150,150);
- $white=ImageColorAllocate($im,255,255,255);
-
- $x=imagesx($im);
- $y=imagesy($im);
-
- ImageFilledRectangle($im,0,0,$sizeX+$shiftX+61,$sizeY+2*$shiftY+10,$white);
- ImageRectangle($im,0,0,$x-1,$y-1,$black);
-
- if(!check_right("Item","R",$_GET["itemid"]))
- {
-// show_table_header("<font color=\"AA0000\">No permissions !</font>");
-// show_footer();
- ImageOut($im);
- ImageDestroy($im);
- exit;
- }
-
- for($i=0;$i<=$sizeY;$i+=$sizeY/5)
- {
- DashedLine($im,$shiftX,$i+$shiftY,$sizeX+$shiftX,$i+$shiftY,$gray);
- }
- for($i=0;$i<=$sizeX;$i+=$sizeX/24)
- {
- DashedLine($im,$i+$shiftX,$shiftY,$i+$shiftX,$sizeY+$shiftY,$gray);
- }
- $item=get_item_by_itemid($_GET["itemid"]);
- $host=get_host_by_hostid($item["hostid"]);
-
- $str=$host["host"].":".$item["description"]." (diff)";
- $x=imagesx($im)/2-ImageFontWidth(4)*strlen($str)/2;
- ImageString($im, 4,$x,1, $str , $darkred);
-
- $from_time = time(NULL)-$period-3600*$from;
- $to_time = time(NULL)-3600*$from;
- $result=DBselect("select count(clock),min(clock),max(clock),min(value),max(value) from history where itemid=".$_GET["itemid"]." and clock>$from_time and clock<$to_time ");
- $count=DBget_field($result,0,0);
- if($count>0)
- {
- $nodata=0;
- $minX=DBget_field($result,0,1);
- $maxX=DBget_field($result,0,2);
- $minY=DBget_field($result,0,3);
- $maxY=DBget_field($result,0,4);
-
- }
- else
- {
- unset($maxX);
- unset($maxY);
- unset($minX);
- unset($minY);
- }
-
- $minY=0;
- $maxY=0.0001;
-// $minX=0;
-// $maxX=1000;
-
-
-// echo "MIN/MAX:",$minX," - ",$maxX," - ",$minY," - ",$maxY,"<Br>";
-
- $result=DBselect("select clock,value from history where itemid=".$_GET["itemid"]." and clock>$from_time and clock<$to_time order by clock");
- if(isset($minX)&&($minX!=$maxX)&&($minY!=$maxY))
- {
- for($i=0;$i<DBnum_rows($result)-3;$i++)
- {
- $x=DBget_field($result,$i,0);
- $x_next=DBget_field($result,$i+1,0);
- $x_next_next=DBget_field($result,$i+2,0);
- $y=DBget_field($result,$i,1);
- $y_next=DBget_field($result,$i+1,1);
- $y_next_next=DBget_field($result,$i+2,1);
-
- if(!isset($minY)||($y_next-$y<$minY))
- {
- $minY=$y_next-$y;
- }
- if(!isset($maxY)||($y_next-$y>$maxY))
- {
- $maxY=$y_next-$y;
- }
- }
- $y1=$sizeY*(-$minY)/($maxY-$minY);
- $y1=$sizeY-$y1;
- DashedLine($im,$shiftX,$y1+$shiftY,$sizeX+$shiftX,$y1+$shiftY,$darkred);
- for($i=0;$i<DBnum_rows($result)-3;$i++)
- {
- $x=DBget_field($result,$i,0);
- $x_next=DBget_field($result,$i+1,0);
- $x_next_next=DBget_field($result,$i+2,0);
- $y=DBget_field($result,$i,1);
- $y_next=DBget_field($result,$i+1,1);
- $y_next_next=DBget_field($result,$i+2,1);
-
- $x1=$sizeX*($x-$minX)/($maxX-$minX);
- $y1=$sizeY*(($y_next-$y)-$minY)/($maxY-$minY);
- $x2=$sizeX*($x_next-$minX)/($maxX-$minX);
- $y2=$sizeY*(($y_next_next-$y_next)-$minY)/($maxY-$minY);
-
- $y1=$sizeY-$y1;
- $y2=$sizeY-$y2;
-
-// echo $x1," - ",$x2," - ",$y1," - ",$y2,"<Br>";
- ImageLine($im,$x1+$shiftX,$y1+$shiftY,$x2+$shiftX,$y2+$shiftY,$darkgreen);
- }
- }
- else
- {
- if(isset($minX))
- {
- ImageLine($im,$shiftX,$shiftY+$sizeY/2,$sizeX+$shiftX,$shiftY+$sizeY/2,$darkgreen);
- }
- }
-
- if($nodata == 0)
- {
- for($i=0;$i<=$sizeY;$i+=$sizeY/5)
- {
- ImageString($im, 1, $sizeX+5+$shiftX, $sizeY-$i-4+$shiftY, $i*($maxY-$minY)/$sizeY+$minY , $darkred);
- }
-
- ImageString($im, 1,10, $sizeY+$shiftY+5, date("dS of F Y h:i:s A",$minX) , $darkred);
- ImageString($im, 1,$sizeX+$shiftX-168,$sizeY+$shiftY+5, date("dS of F Y h:i:s A",$maxX) , $darkred);
- }
- else
- {
- ImageString($im, 2,$sizeX/2-50, $sizeY+$shiftY+3, "NO DATA FOUND FOR THIS PERIOD" , $darkred);
- }
-
- ImageStringUp($im,0,imagesx($im)-10,imagesy($im)-50, "http://www.zabbix.com", $gray);
-
- ImageOut($im);
- ImageDestroy($im);
-?>
diff --git a/frontends/php/history.php b/frontends/php/history.php
index 788a0bc3..576f7788 100644
--- a/frontends/php/history.php
+++ b/frontends/php/history.php
@@ -47,10 +47,6 @@
show_header("$host:$description",$beforenextcheck,0);
}
}
- if($_GET["action"]=="showhistory2")
- {
- show_header("$host:$description",0,0);
- }
if($_GET["action"]=="showvalues")
{
show_header("$host:$description",0,0);
@@ -107,7 +103,6 @@
$h2="<input class=\"biginput\" name=\"itemid\" type=\"hidden\" value=\"".$_GET["itemid"]."\">";
$h2=$h2."<select class=\"biginput\" name=\"action\" onChange=\"submit()\">";
$h2=$h2.form_select("action","showhistory",S_LAST_HOUR_GRAPH);
- $h2=$h2.form_select("action","showhistory2",S_LAST_HOUR_GRAPH_DIFF);
$h2=$h2.form_select("action","showvalues",S_VALUES_OF_LAST_HOUR);
$h2=$h2.form_select("action","showfreehist",S_VALUES_OF_SPECIFIED_PERIOD);
$h2=$h2.form_select("action","showplaintxt",S_VALUES_IN_PLAIN_TEXT_FORMAT);
@@ -119,17 +114,13 @@
<?php
if($_GET["action"]=="showfreehist")
{
- if(!isset($_GET["period"]))
- {
- show_freehist($_GET["itemid"],$_GET["period"]);
- }
+ show_freehist($_GET["itemid"],$_GET["period"]);
exit;
-
}
if($_GET["action"]=="showplaintxt")
{
- if(!isset($_GET["period"]))
+// if(!isset($_GET["period"]))
{
show_plaintxt($_GET["itemid"],$_GET["period"]);
}
@@ -253,16 +244,8 @@
{
$_GET["from"]=($now-mktime($_GET["hour"], 0, 0, $_GET["month"], $_GET["day"],$_GET["year"]))/3600;
}
- @show_history($_GET["itemid"],$_GET["from"],$_GET["period"],0);
+ @show_history($_GET["itemid"],$_GET["from"],$_GET["period"]);
show_footer();
exit;
}
-
- if($_GET["action"]=="showhistory2")
- {
- @show_history($_GET["itemid"],$_GET["from"],$_GET["period"],1);
- show_footer();
- exit;
- }
-
?>
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index bbc3a32a..13092af4 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -2359,7 +2359,7 @@ echo "</head>";
# Show History Graph
- function show_history($itemid,$from,$period,$diff)
+ function show_history($itemid,$from,$period)
{
if (!isset($from))
{
@@ -2389,49 +2389,27 @@ echo "</head>";
echo "<TR BGCOLOR=#DDDDDD>";
echo "<TD ALIGN=CENTER>";
- if($diff==0)
- {
- echo "<script language=\"JavaScript\">";
- echo "if (navigator.appName == \"Microsoft Internet Explorer\")";
- echo "{";
- echo " document.write(\"<IMG SRC='chart.php?itemid=$itemid&period=$period&from=$from&width=\"+(document.body.clientWidth-108)+\"'>\")";
- echo "}";
- echo "else if (navigator.appName == \"Netscape\")";
- echo "{";
- echo " document.write(\"<IMG SRC='chart.php?itemid=$itemid&period=$period&from=$from&width=\"+(document.width-108)+\"'>\")";
- echo "}";
- echo "else";
- echo "{";
- echo " document.write(\"<IMG SRC='chart.php?itemid=$itemid&period=$period&from=$from'>\")";
- echo "}";
- echo "</script>";
- }
- else
- {
- echo "<script language=\"JavaScript\">";
- echo "if (navigator.appName == \"Microsoft Internet Explorer\")";
- echo "{";
- echo " document.write(\"<IMG SRC='chart_diff.php?itemid=$itemid&period=$period&from=$from&width=\"+(document.body.clientWidth-108)+\"'>\")";
- echo "}";
- echo "else if (navigator.appName == \"Netscape\")";
- echo "{";
- echo " document.write(\"<IMG SRC='chart_diff.php?itemid=$itemid&period=$period&from=$from&width=\"+(document.width-108)+\"'>\")";
- echo "}";
- echo "else";
- echo "{";
- echo " document.write(\"<IMG SRC='chart_diff.php?itemid=$itemid&period=$period&from=$from'>\")";
- echo "}";
- echo "</script>";
- }
+ echo "<script language=\"JavaScript\">";
+ echo "if (navigator.appName == \"Microsoft Internet Explorer\")";
+ echo "{";
+ echo " document.write(\"<IMG SRC='chart.php?itemid=$itemid&period=$period&from=$from&width=\"+(document.body.clientWidth-108)+\"'>\")";
+ echo "}";
+ echo "else if (navigator.appName == \"Netscape\")";
+ echo "{";
+ echo " document.write(\"<IMG SRC='chart.php?itemid=$itemid&period=$period&from=$from&width=\"+(document.width-108)+\"'>\")";
+ echo "}";
+ echo "else";
+ echo "{";
+ echo " document.write(\"<IMG SRC='chart.php?itemid=$itemid&period=$period&from=$from'>\")";
+ echo "}";
+ echo "</script>";
+
echo "</TD>";
echo "</TR>";
echo "</TABLE>";
echo "</center>";
-// echo("<hr>");
+
navigation_bar("history.php");
-// insert_time_navigator($itemid,$period,$from);
-
-// echo("<hr>");
}
# Show history
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 667d6803..a3495adf 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -262,7 +262,6 @@
// history.php
"S_LAST_HOUR_GRAPH"=> "Last hour graph",
- "S_LAST_HOUR_GRAPH_DIFF"=> "Last hour graph (diff)",
"S_VALUES_OF_LAST_HOUR"=> "Values of last hour",
"S_VALUES_OF_SPECIFIED_PERIOD"=> "Values of specified period",
"S_VALUES_IN_PLAIN_TEXT_FORMAT"=> "Values in plain text format",