diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-22 12:15:34 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-22 12:15:34 +0000 |
| commit | 1bbf47cea6defff97a8ecd794c4c70b8b922cf7d (patch) | |
| tree | 0bec9862f4698d2b10c279d49fc711e36ae9924d /frontends/php/include/hosts.inc.php | |
| parent | 079d0f286f845bfb3071dd784616d33fed073a5c (diff) | |
- fixed oracle SQL request creating (Eugene)
- fixed first host selection from list of accessed hosts (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2874 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/hosts.inc.php')
| -rw-r--r-- | frontends/php/include/hosts.inc.php | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/frontends/php/include/hosts.inc.php b/frontends/php/include/hosts.inc.php index f0e2e0f1..3a4496eb 100644 --- a/frontends/php/include/hosts.inc.php +++ b/frontends/php/include/hosts.inc.php @@ -412,6 +412,7 @@ $first_hostig_in_group = 0; $allow_all_hosts = (in_array("allow_all_hosts",$options)) ? 1 : 0; + $always_select_first_host = in_array("always_select_first_host",$options) ? 1 : 0; if(in_array("monitored_hosts",$options)) $with_host_status = " and h.status=".HOST_STATUS_MONITORED; @@ -465,43 +466,44 @@ else { $hostid = $a_hostid; - - if($groupid == 0) + if(!($hostid == 0 && $allow_all_hosts == 1)) /* is not 'All' selected */ { - $sql = "select distinct h.hostid,h.host from hosts h".$item_table. - " where h.status<>".HOST_STATUS_DELETED.$with_host_status.$with_items. - " order by h.host"; - - $db_hosts = DBselect($sql); - while($db_host = DBfetch($db_hosts)) + if($groupid == 0) { - if(!check_right("Host",$right,$db_host["hostid"])) continue; - $first_hostig_in_group = $db_host["hostid"]; - break; + $sql = "select distinct h.hostid,h.host from hosts h".$item_table. + " where h.status<>".HOST_STATUS_DELETED.$with_host_status.$with_items. + " order by h.host"; + + $db_hosts = DBselect($sql); + while($db_host = DBfetch($db_hosts)) + { + if(!check_right("Host",$right,$db_host["hostid"])) continue; + $first_hostig_in_group = $db_host["hostid"]; + break; + } + if($first_hostig_in_group == 0) $hostid = 0; } - if($first_hostig_in_group == 0) $hostid = 0; - } - if($groupid > 0) - { - if(!DBfetch(DBselect("select hg.hostid from hosts_groups hg". - " where hg.groupid=".$groupid." and hg.hostid=".$hostid))) - $hostid = 0; - } + if($groupid > 0) + { + if(!DBfetch(DBselect("select hg.hostid from hosts_groups hg". + " where hg.groupid=".$groupid." and hg.hostid=".$hostid))) + $hostid = 0; + } - if(!check_right("Host",$right,$hostid)) $hostid = 0; + if(!check_right("Host",$right,$hostid)) $hostid = 0; - if($hostid > 0) - { - if(!DBfetch(DBselect("select distinct h.hostid from hosts h".$item_table. - " where h.status<>".HOST_STATUS_DELETED.$with_host_status.$with_items. - " and h.hostid=".$hostid))) - $hostid = 0; - } - - if(($hostid < 0) || ($hostid == 0 && !($allow_all_hosts ==1 && $groupid==0))) - { - $hostid = $first_hostig_in_group; + if($hostid > 0) + { + if(!DBfetch(DBselect("select distinct h.hostid from hosts h".$item_table. + " where h.status<>".HOST_STATUS_DELETED.$with_host_status.$with_items. + " and h.hostid=".$hostid))) + $hostid = 0; + } + if(($hostid < 0) || ($hostid == 0 && $always_select_first_host == 1)) /* incorrect host */ + { + $hostid = $first_hostig_in_group; + } } } |
