From 8586918ae51297d8be70ff360a8cac4d58f593eb Mon Sep 17 00:00:00 2001 From: artem Date: Mon, 22 Oct 2007 14:26:35 +0000 Subject: - [DEV-48] merged rev. 4890:4891 of branches/1.4.j/ (Artem) [added scripts form,scripts list, script call menu] git-svn-id: svn://svn.zabbix.com/trunk@4893 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/include/scripts.inc.php | 80 +++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 frontends/php/include/scripts.inc.php (limited to 'frontends/php/include/scripts.inc.php') diff --git a/frontends/php/include/scripts.inc.php b/frontends/php/include/scripts.inc.php new file mode 100644 index 00000000..071b45f9 --- /dev/null +++ b/frontends/php/include/scripts.inc.php @@ -0,0 +1,80 @@ + hosts); + } + + $hosts_read_only = explode(',',get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,null,null,get_current_nodeid())); + $hosts_read_write = explode(',',get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE,null,null,get_current_nodeid())); + + $scripts_by_host = array(); + + $sql = 'SELECT * FROM scripts '. + ' WHERE '.DBin_node('scriptid'). + ' ORDER BY scriptid ASC'; + + $res=DBselect($sql); + + while($script = DBfetch($res)){ + foreach($hosts as $id => $hostid){ + if($script['host_access'] == SCRIPT_HOST_ACCESS_WRITE){ + if(in_array($hostid,$hosts_read_write)){ + $scripts_by_host[$hostid][] = $script; + } + } + else{ + if(in_array($hostid,$hosts_read_only)){ + $scripts_by_host[$hostid][] = $script; + } + } + } + } + +return $scripts_by_host; +} +?> \ No newline at end of file -- cgit