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/scripts_exec.php | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 frontends/php/scripts_exec.php (limited to 'frontends/php/scripts_exec.php') diff --git a/frontends/php/scripts_exec.php b/frontends/php/scripts_exec.php new file mode 100644 index 00000000..b96d29cd --- /dev/null +++ b/frontends/php/scripts_exec.php @@ -0,0 +1,69 @@ + + array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({execute})'), + 'scriptid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({execute})'), + 'execute'=> array(T_ZBX_INT, O_OPT, P_ACT, IN('0,1'), null), + ); + + +check_fields($fields); + +if(isset($_REQUEST['execute'])){ + if($script = get_script_by_scriptid($_REQUEST['scriptid'])){ + if($script['host_access'] == SCRIPT_HOST_ACCESS_WRITE){ + $hosts_read_write = explode(',',get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE,null,null,get_current_nodeid())); + + if(in_array($_REQUEST['hostid'],$hosts_read_write)){ +SDI('WRITE: '.$_REQUEST['scriptid'].' : '.$_REQUEST['hostid']); + $result = execute_script($_REQUEST['scriptid'],$_REQUEST['hostid']); + } + } + else{ + $hosts_read_only = explode(',',get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,null,null,get_current_nodeid())); + + if(in_array($_REQUEST['hostid'],$hosts_read_only)){ +SDI('READ: '.$_REQUEST['scriptid'].' : '.$_REQUEST['hostid']); + $result = execute_script($_REQUEST['scriptid'],$_REQUEST['hostid']); + } + } + } +} +?> + \ No newline at end of file -- cgit