summaryrefslogtreecommitdiffstats
path: root/frontends
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-21 10:47:01 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-21 10:47:01 +0000
commitacb94184d3be234c51afae80428233c548977b7f (patch)
tree28b56548ab2c492427dc60db359ce783ffc5a5fb /frontends
parent0cc27d49dd291e679531fa5c197d86d4f192377c (diff)
downloadzabbix-acb94184d3be234c51afae80428233c548977b7f.tar.gz
zabbix-acb94184d3be234c51afae80428233c548977b7f.tar.xz
zabbix-acb94184d3be234c51afae80428233c548977b7f.zip
- renamed latestalarms.php and alerts.php (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2553 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends')
-rw-r--r--frontends/php/actions.php (renamed from frontends/php/alerts.php)31
-rw-r--r--frontends/php/events.php (renamed from frontends/php/latestalarms.php)37
-rw-r--r--frontends/php/include/config.inc.php10
-rw-r--r--frontends/php/include/defines.inc.php1
-rw-r--r--frontends/php/include/validate.inc.php53
-rw-r--r--frontends/php/latest.php66
-rw-r--r--frontends/php/overview.php10
-rw-r--r--frontends/php/queue.php9
8 files changed, 127 insertions, 90 deletions
diff --git a/frontends/php/alerts.php b/frontends/php/actions.php
index 2f744bbd..1a10fd47 100644
--- a/frontends/php/alerts.php
+++ b/frontends/php/actions.php
@@ -21,16 +21,30 @@
<?php
include "include/config.inc.php";
$page["title"] = "S_ALERT_HISTORY_SMALL";
- $page["file"] = "alerts.php";
+ $page["file"] = "actions.php";
show_header($page["title"],1,0);
?>
<?php
- if(isset($_REQUEST["start"])&&isset($_REQUEST["do"])&&($_REQUEST["do"]=="<< Prev 100"))
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+ $fields=array(
+ "groupid"=> array(T_ZBX_INT, O_OPT, P_SYS|P_NZERO, BETWEEN(0,65535), NULL),
+ "hostid"=> array(T_ZBX_INT, O_OPT, P_SYS|P_NZERO, BETWEEN(0,65535), NULL),
+ "start"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535), NULL),
+ "next"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL),
+ "prev"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL)
+ );
+
+ check_fields($fields);
+?>
+
+<?php
+ if(isset($_REQUEST["start"])&&isset($_REQUEST["prev"]))
{
$_REQUEST["start"]-=100;
+ if($_REQUEST["start"]<=0) unset($_REQUEST["start"]);
}
- if(isset($_REQUEST["do"])&&($_REQUEST["do"]=="Next 100 >>"))
+ if(isset($_REQUEST["next"]))
{
if(isset($_REQUEST["start"]))
{
@@ -41,10 +55,6 @@
$_REQUEST["start"]=100;
}
}
- if(isset($_REQUEST["start"])&&($_REQUEST["start"]<=0))
- {
- unset($_REQUEST["start"]);
- }
?>
<?php
@@ -59,15 +69,15 @@
if(isset($_REQUEST["start"]))
{
$h2=$h2."<input class=\"biginput\" name=\"start\" type=hidden value=".$_REQUEST["start"]." size=8>";
- $h2=$h2."<input class=\"button\" type=\"submit\" name=\"do\" value=\"<< Prev 100\">";
+ $h2=$h2."<input class=\"button\" type=\"submit\" name=\"prev\" value=\"<< Prev 100\">";
}
else
{
$h2=$h2."<input class=\"button\" type=\"submit\" disabled name=\"do\" value=\"<< Prev 100\">";
}
- $h2=$h2."<input class=\"button\" type=\"submit\" name=\"do\" value=\"Next 100 >>\">";
+ $h2=$h2."<input class=\"button\" type=\"submit\" name=\"next\" value=\"Next 100 >>\">";
- show_header2($h1,$h2,"<form name=\"form2\" method=\"get\" action=\"alerts.php\">","</form>");
+ show_header2($h1,$h2,"<form name=\"form2\" method=\"get\" action=\"actions.php\">","</form>");
?>
@@ -86,6 +96,7 @@
{
$sql="select a.alertid,a.clock,mt.description,a.sendto,a.subject,a.message,a.status,a.retries,a.error from alerts a,media_type mt where mt.mediatypeid=a.mediatypeid and a.alertid>$maxalertid-200-".$_REQUEST["start"]." order by a.clock desc limit ".($_REQUEST["start"]+500);
}
+ echo $sql,"<br>";
$result=DBselect($sql);
$table = new CTableInfo(S_NO_ALERTS);
diff --git a/frontends/php/latestalarms.php b/frontends/php/events.php
index 050fb64b..0eb43163 100644
--- a/frontends/php/latestalarms.php
+++ b/frontends/php/events.php
@@ -21,16 +21,31 @@
<?php
include "include/config.inc.php";
$page["title"] = "S_LATEST_EVENTS";
- $page["file"] = "latestalarms.php";
+ $page["file"] = "events.php";
show_header($page["title"],1,0);
?>
<?php
- if(isset($_REQUEST["start"])&&isset($_REQUEST["do"])&&($_REQUEST["do"]=="<< Prev 100"))
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+ $fields=array(
+ "groupid"=> array(T_ZBX_INT, O_OPT, P_SYS|P_NZERO, BETWEEN(0,65535), NULL),
+ "hostid"=> array(T_ZBX_INT, O_OPT, P_SYS|P_NZERO, BETWEEN(0,65535), NULL),
+ "start"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535), NULL),
+ "next"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL),
+ "prev"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL)
+ );
+
+ check_fields($fields);
+?>
+
+
+<?php
+ if(isset($_REQUEST["start"])&&isset($_REQUEST["prev"]))
{
$_REQUEST["start"]-=100;
+ if($_REQUEST["start"]<=0) unset($_REQUEST["start"]);
}
- if(isset($_REQUEST["do"])&&($_REQUEST["do"]=="Next 100 >>"))
+ if(isset($_REQUEST["next"]))
{
if(isset($_REQUEST["start"]))
{
@@ -41,14 +56,6 @@
$_REQUEST["start"]=100;
}
}
- if(isset($_REQUEST["start"])&&($_REQUEST["start"]<=0))
- {
- unset($_REQUEST["start"]);
- }
- if(isset($_REQUEST["groupid"])&&($_REQUEST["groupid"]==0))
- {
- unset($_REQUEST{"groupid"});
- }
?>
<?php
@@ -111,15 +118,15 @@
if(isset($_REQUEST["start"]))
{
$h2=$h2."<input class=\"biginput\" name=\"start\" type=hidden value=".$_REQUEST["start"]." size=8>";
- $h2=$h2."<input class=\"button\" type=\"submit\" name=\"do\" value=\"<< Prev 100\">";
+ $h2=$h2."<input class=\"button\" type=\"submit\" name=\"prev\" value=\"<< Prev 100\">";
}
else
{
- $h2=$h2."<input class=\"button\" type=\"submit\" disabled name=\"do\" value=\"<< Prev 100\">";
+ $h2=$h2."<input class=\"button\" type=\"submit\" disabled name=\"prev\" value=\"<< Prev 100\">";
}
- $h2=$h2."<input class=\"button\" type=\"submit\" name=\"do\" value=\"Next 100 >>\">";
+ $h2=$h2."<input class=\"button\" type=\"submit\" name=\"next\" value=\"Next 100 >>\">";
- show_header2($h1,$h2,"<form name=\"form2\" method=\"get\" action=\"latestalarms.php\">","</form>");
+ show_header2($h1,$h2,"<form name=\"form2\" method=\"get\" action=\"events.php\">","</form>");
?>
<?php
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 9871459e..ee494f9c 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -1041,14 +1041,14 @@ function SDI($msg) { echo "DEBUG INFO: $msg ".BR; } # DEBUG INFO!!!
$menu=array(
"view"=>array(
"label"=>S_MONITORING,
- "pages"=>array("overview.php","latest.php","tr_status.php","queue.php","latestalarms.php","alerts.php","maps.php","charts.php","screens.php","srv_status.php","alarms.php","history.php","tr_comments.php","report3.php","profile.php"),
+ "pages"=>array("overview.php","latest.php","tr_status.php","queue.php","events.php","actions.php","maps.php","charts.php","screens.php","srv_status.php","alarms.php","history.php","tr_comments.php","report3.php","profile.php"),
"level2"=>array(
array("label"=>S_OVERVIEW,"url"=>"overview.php"),
array("label"=>S_LATEST_DATA,"url"=>"latest.php"),
array("label"=>S_TRIGGERS,"url"=>"tr_status.php"),
array("label"=>S_QUEUE,"url"=>"queue.php"),
- array("label"=>S_EVENTS,"url"=>"latestalarms.php"),
- array("label"=>S_ACTIONS,"url"=>"alerts.php"),
+ array("label"=>S_EVENTS,"url"=>"events.php"),
+ array("label"=>S_ACTIONS,"url"=>"actions.php"),
array("label"=>S_MAPS,"url"=>"maps.php"),
array("label"=>S_GRAPHS,"url"=>"charts.php"),
array("label"=>S_SCREENS,"url"=>"screens.php"),
@@ -1184,8 +1184,8 @@ function SDI($msg) { echo "DEBUG INFO: $msg ".BR; } # DEBUG INFO!!!
if(($sub["url"]=="overview.php")&&!check_anyright("Host","R")) continue;
if(($sub["url"]=="tr_status.php?onlytrue=true&noactions=true&compact=true")&&!check_anyright("Host","R")) continue;
if(($sub["url"]=="queue.php")&&!check_anyright("Host","R")) continue;
- if(($sub["url"]=="latestalarms.php")&&!check_anyright("Default permission","R")) continue;
- if(($sub["url"]=="alerts.php")&&!check_anyright("Default permission","R")) continue;
+ if(($sub["url"]=="events.php")&&!check_anyright("Default permission","R")) continue;
+ if(($sub["url"]=="actions.php")&&!check_anyright("Default permission","R")) continue;
if(($sub["url"]=="maps.php")&&!check_anyright("Network map","R")) continue;
if(($sub["url"]=="charts.php")&&!check_anyright("Graph","R")) continue;
if(($sub["url"]=="screens.php")&&!check_anyright("Screen","R")) continue;
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index e69ee804..dadc08f3 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -33,6 +33,7 @@
define("P_GET", 4);
define("P_POST", 8);
define("P_ACT", 16);
+ define("P_NZERO", 32);
// MISC PARAMETERS
define("MAP_OUTPUT_FORMAT", "DEFAULT");
diff --git a/frontends/php/include/validate.inc.php b/frontends/php/include/validate.inc.php
index 89090b51..c7800cd6 100644
--- a/frontends/php/include/validate.inc.php
+++ b/frontends/php/include/validate.inc.php
@@ -71,12 +71,27 @@
{
if(!isset($fields[$key]))
{
-// info("Unset:".$key);
+ echo "Unset: $key<br>";
unset($_REQUEST[$key]);
}
}
}
+ function unset_if_zero($fields)
+ {
+ foreach($fields as $field => $checks)
+ {
+ list($type,$opt,$flags,$validation,$exception)=$checks;
+
+ if(($flags&P_NZERO)&&(isset($_REQUEST[$field]))&&($_REQUEST[$field]==0))
+ {
+ echo "Unset: $field<br>";
+ unset($_REQUEST[$field]);
+ }
+ }
+ }
+
+
function unset_action_vars($fields)
{
foreach($fields as $field => $checks)
@@ -126,7 +141,6 @@
if(!isset($_REQUEST[$field]))
{
$ret = FALSE;
- info("Warning. Field [".$field."] is mandatory");
if($flags&P_SYS)
{
info("Critical error. Field [".$field."] is mandatory");
@@ -134,7 +148,11 @@
$critical = TRUE;
break;
}
- else continue;
+ else
+ {
+ info("Warning. Field [".$field."] is mandatory");
+ continue;
+ }
}
}
@@ -143,7 +161,6 @@
if(isset($_REQUEST[$field]))
{
$ret = FALSE;
- info("Warning. Field [".$field."] must be missing");
if($flags&P_SYS)
{
info("Critical error. Field [".$field."] must be missing");
@@ -151,7 +168,11 @@
$critical = TRUE;
break;
}
- else continue;
+ else
+ {
+ info("Warning. Field [".$field."] must be missing");
+ continue;
+ }
}
else continue;
}
@@ -164,7 +185,6 @@
if( ($type == T_ZBX_INT) && !is_numeric($_REQUEST[$field])) {
$ret = FALSE;
- info("Warning. Field [".$field."] is not integer");
if($flags&P_SYS)
{
info("Critical error. Field [".$field."] is not integer");
@@ -172,12 +192,15 @@
$critical = TRUE;
break;
}
- else continue;
+ else
+ {
+ info("Warning. Field [".$field."] is not integer");
+ continue;
+ }
}
if( ($type == T_ZBX_DBL) && !is_numeric($_REQUEST[$field])) {
$ret = FALSE;
- info("Warning. Field [".$field."] is not double");
if($flags&P_SYS)
{
info("Critical error. Field [".$field."] is not double");
@@ -185,7 +208,11 @@
$critical = TRUE;
break;
}
- else continue;
+ else
+ {
+ info("Warning. Field [".$field."] is not double");
+ continue;
+ }
}
if(($exception==NULL)||($except==TRUE))
@@ -196,7 +223,6 @@
if(!$valid)
{
$ret = FALSE;
- info("Warning. Incorrect value for [".$field."]");
if($flags&P_SYS)
{
info("Critical error. Incorrect value for [".$field."]");
@@ -204,7 +230,11 @@
$critical = TRUE;
break;
}
- else continue;
+ else
+ {
+ info("Warning. Incorrect value for [".$field."]");
+ continue;
+ }
}
}
@@ -213,6 +243,7 @@
}
}
unset_not_in_list($fields);
+ unset_if_zero($fields);
if($critical)
{
show_messages(FALSE, "", "Invalid URL");
diff --git a/frontends/php/latest.php b/frontends/php/latest.php
index d161b07a..ce63f9d6 100644
--- a/frontends/php/latest.php
+++ b/frontends/php/latest.php
@@ -32,6 +32,20 @@
show_page_footer();
exit;
}
+?>
+
+<?php
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+ $fields=array(
+ "groupid"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535), NULL),
+ "hostid"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535), NULL),
+ "select"=> array(T_ZBX_STR, O_OPT, NULL, NULL, NULL)
+ );
+
+ check_fields($fields);
+?>
+
+<?php
if(isset($_REQUEST["select"])&&($_REQUEST["select"]!=""))
{
unset($_REQUEST["groupid"]);
@@ -133,11 +147,6 @@
?>
<?php
- if(!isset($_REQUEST["sort"]))
- {
- $_REQUEST["sort"]="description";
- }
-
if(isset($_REQUEST["hostid"]))
{
$result=DBselect("select host from hosts where hostid=".$_REQUEST["hostid"]);
@@ -171,56 +180,15 @@
{
$header=array_merge($header,array(S_HOST));
}
- if(!isset($_REQUEST["sort"])||(isset($_REQUEST["sort"])&&($_REQUEST["sort"]=="description")))
- {
- $header=array_merge($header,array(S_DESCRIPTION_LARGE));
- }
- else
- {
- if(isset($_REQUEST["select"]))
- $header=array_merge($header,array("<a href=\"latest.php?select=".$_REQUEST["select"]."&sort=description\">".S_DESCRIPTION_SMALL));
- else
- $header=array_merge($header,array("<a href=\"latest.php?hostid=".$_REQUEST["hostid"]."&sort=description\">".S_DESCRIPTION_SMALL));
- }
- if(isset($_REQUEST["sort"])&&($_REQUEST["sort"]=="lastcheck"))
- {
- $header=array_merge($header,array(S_LAST_CHECK_BIG));
- }
- else
- {
- if(isset($_REQUEST["select"]))
- $header=array_merge($header,array("<a href=\"latest.php?select=".$_REQUEST["select"]."&sort=lastcheck\">".S_LAST_CHECK));
- else
- $header=array_merge($header,array("<a href=\"latest.php?hostid=".$_REQUEST["hostid"]."&sort=lastcheck\">".S_LAST_CHECK));
- }
- $header=array_merge($header,array(S_LAST_VALUE,S_CHANGE,S_HISTORY));
+ $header=array_merge($header,array(S_DESCRIPTION, S_LAST_CHECK, S_LAST_VALUE,S_CHANGE,S_HISTORY));
table_header($header);
$col=0;
- if(isset($_REQUEST["sort"]))
- {
- switch ($_REQUEST["sort"])
- {
- case "description":
- $_REQUEST["sort"]="order by i.description";
- break;
- case "lastcheck":
- $_REQUEST["sort"]="order by i.lastclock";
- break;
- default:
- $_REQUEST["sort"]="order by i.description";
- break;
- }
- }
- else
- {
- $_REQUEST["sort"]="order by i.description";
- }
if(isset($_REQUEST["select"]))
- $sql="select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type,i.units,i.multiplier,i.key_ from items i,hosts h where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 and i.description like '%".$_REQUEST["select"]."%' ".$_REQUEST["sort"];
+ $sql="select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type,i.units,i.multiplier,i.key_ from items i,hosts h where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 and i.description like '%".$_REQUEST["select"]."%' order by i.description";
else
- $sql="select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type,i.units,i.multiplier,i.key_ from items i,hosts h where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 and h.hostid=".$_REQUEST["hostid"]." ".$_REQUEST["sort"];
+ $sql="select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type,i.units,i.multiplier,i.key_ from items i,hosts h where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 and h.hostid=".$_REQUEST["hostid"]." order by i.description";
$result=DBselect($sql);
while($row=DBfetch($result))
{
diff --git a/frontends/php/overview.php b/frontends/php/overview.php
index 3d67d3a3..40f15781 100644
--- a/frontends/php/overview.php
+++ b/frontends/php/overview.php
@@ -53,6 +53,16 @@
?>
<?php
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+ $fields=array(
+ "groupid"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535), NULL),
+ "type"=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"), NULL)
+ );
+
+ check_fields($fields);
+?>
+
+<?php
if(isset($_REQUEST["groupid"])&&($_REQUEST["groupid"]==0))
{
unset($_REQUEST["groupid"]);
diff --git a/frontends/php/queue.php b/frontends/php/queue.php
index ffc73f4b..a1815cb4 100644
--- a/frontends/php/queue.php
+++ b/frontends/php/queue.php
@@ -36,6 +36,15 @@
?>
<?php
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+ $fields=array(
+ "show"=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"), NULL)
+ );
+
+ check_fields($fields);
+?>
+
+<?php
if(!isset($_REQUEST["show"]))
{
$_REQUEST["show"]=0;