summaryrefslogtreecommitdiffstats
path: root/frontends/php/latest.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-04-07 07:47:25 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-04-07 07:47:25 +0000
commit7a4b3f6a57f9b063f5acb77ecded743dc139f8cf (patch)
tree80f1d3dbd0af363c16ab00e94f0d09dd736c1f3c /frontends/php/latest.php
parenta3c18691bd39cd254cf8636fceae94c22c1b6a4a (diff)
downloadzabbix-7a4b3f6a57f9b063f5acb77ecded743dc139f8cf.tar.gz
zabbix-7a4b3f6a57f9b063f5acb77ecded743dc139f8cf.tar.xz
zabbix-7a4b3f6a57f9b063f5acb77ecded743dc139f8cf.zip
- improved filter by hosts and groups (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2723 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/latest.php')
-rw-r--r--frontends/php/latest.php29
1 files changed, 10 insertions, 19 deletions
diff --git a/frontends/php/latest.php b/frontends/php/latest.php
index 3fd24cce..c313ef8e 100644
--- a/frontends/php/latest.php
+++ b/frontends/php/latest.php
@@ -43,10 +43,12 @@
);
// check_fields($fields);
+
+ validate_group_with_host("R",array("allow_all_hosts","monitored_hosts","with_monitored_items"));
?>
<?php
- if(isset($_REQUEST["hostid"])&&!check_right("Host","R",$_REQUEST["hostid"]))
+ if(!check_right("Host","R",$_REQUEST["hostid"]))
{
show_table_header("<font color=\"AA0000\">".S_NO_PERMISSIONS."</font>");
show_page_footer();
@@ -54,21 +56,10 @@
}
?>
<?php
- $_REQUEST["groupid"] = get_request("groupid",0);
- $_REQUEST["select"] = get_request("select","");
- $_REQUEST["hostid"]=get_request("hostid",get_profile("web.latest.hostid",0));
- update_profile("web.latest.hostid",$_REQUEST["hostid"]);
- update_profile("web.menu.view.last",$page["file"]);
- if($_REQUEST["hostid"] > 0)
- {
- $result=DBselect("select host from hosts where hostid=".$_REQUEST["hostid"]);
- if(DBnum_rows($result)==0)
- {
- $_REQUEST["hostid"] = 0;
- }
- }
+ $_REQUEST["select"] = get_request("select","");
+ update_profile("web.menu.view.last",$page["file"]);
?>
<?php
@@ -84,8 +75,8 @@
// Check if at least one host with read permission exists for this group
$result2=DBselect("select h.hostid,h.host from hosts h,items i,hosts_groups hg".
" where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid".
- " and hg.groupid=".$row["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host".
- " order by h.host");
+ " and i.status=".ITEM_STATUS_ACTIVE." and hg.groupid=".$row["groupid"]." and hg.hostid=h.hostid".
+ " group by h.hostid,h.host order by h.host");
while($row2=DBfetch($result2))
{
if(!check_right("Host","R",$row2["hostid"]))
@@ -102,13 +93,13 @@
{
$sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status=".HOST_STATUS_MONITORED.
" and h.hostid=i.hostid and hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid".
- " group by h.hostid,h.host order by h.host";
+ " and i.status=".ITEM_STATUS_ACTIVE." group by h.hostid,h.host order by h.host";
}
else
{
$cmbHosts->AddItem(0,S_ALL_SMALL);
$sql="select h.hostid,h.host from hosts h,items i where h.status=".HOST_STATUS_MONITORED.
- " and h.hostid=i.hostid group by h.hostid,h.host order by h.host";
+ " and i.status=".ITEM_STATUS_ACTIVE." and h.hostid=i.hostid group by h.hostid,h.host order by h.host";
}
$result=DBselect($sql);
$first_hostid = -1;
@@ -162,7 +153,7 @@
$sql="select h.host,i.*,h.hostid from items i,hosts h".
" where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED.
- " and i.status=0".$compare_description.$compare_host.
+ " and i.status=".ITEM_STATUS_ACTIVE.$compare_description.$compare_host.
" order by i.description";
$result=DBselect($sql);