~ubuntu-dev/ubuntu/lucid/zabbix/lucid-201002110857

« back to all changes in this revision

Viewing changes to frontends/php/popup_httpstep.php

  • Committer: Bazaar Package Importer
  • Author(s): Michael Ablassmeier
  • Date: 2007-07-02 09:06:51 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070702090651-8l6fl3fjw9rh6l2u
Tags: 1:1.4.1-2
Add patch from SVN in order to fix Incorrect processing of character '%'
in user parameters and remote commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/* 
 
3
** ZABBIX
 
4
** Copyright (C) 2000-2005 SIA Zabbix
 
5
**
 
6
** This program is free software; you can redistribute it and/or modify
 
7
** it under the terms of the GNU General Public License as published by
 
8
** the Free Software Foundation; either version 2 of the License, or
 
9
** (at your option) any later version.
 
10
**
 
11
** This program is distributed in the hope that it will be useful,
 
12
** but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
** GNU General Public License for more details.
 
15
**
 
16
** You should have received a copy of the GNU General Public License
 
17
** along with this program; if not, write to the Free Software
 
18
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
**/
 
20
?>
 
21
<?php
 
22
        require_once "include/config.inc.php";
 
23
        require_once "include/triggers.inc.php";
 
24
        require_once "include/forms.inc.php";
 
25
 
 
26
        $dstfrm         = get_request("dstfrm",         0);     // destination form
 
27
 
 
28
        $page["title"] = "S_STEP_OF_SCENARIO";
 
29
        $page["file"] = "popup_httpstep.php";
 
30
 
 
31
        define('ZBX_PAGE_NO_MENU', 1);
 
32
        
 
33
include_once "include/page_header.php";
 
34
 
 
35
?>
 
36
<?php
 
37
//              VAR                     TYPE    OPTIONAL FLAGS  VALIDATION      EXCEPTION
 
38
        $fields=array(
 
39
                "dstfrm"=>      array(T_ZBX_STR, O_MAND,P_SYS,  NOT_EMPTY,              null),
 
40
 
 
41
                "sid"=>         array(T_ZBX_INT, O_OPT,  P_SYS, BETWEEN(0,65535),       null),
 
42
                "list_name"=>   array(T_ZBX_STR, O_OPT,  P_SYS, NOT_EMPTY,              'isset({save})&&isset({sid})'),
 
43
                
 
44
                "name"=>        array(T_ZBX_STR, O_OPT,  null,  NOT_EMPTY.KEY_PARAM(),'isset({save})'),
 
45
                "url"=>         array(T_ZBX_STR, O_OPT,  null,  NOT_EMPTY,              'isset({save})'),
 
46
                "posts"=>       array(T_ZBX_STR, O_OPT,  null,  null,                   'isset({save})'),
 
47
                "timeout"=>     array(T_ZBX_INT, O_OPT,  null,  BETWEEN(0,65535),       'isset({save})'),
 
48
                "required"=>    array(T_ZBX_STR, O_OPT,  null,  null,                   'isset({save})'),
 
49
                "status_codes"=>array(T_ZBX_INT_RANGE, O_OPT,  null,    null,           'isset({save})'),
 
50
 
 
51
                "add"=>         array(T_ZBX_STR, O_OPT, P_SYS|P_ACT,    null,   null),
 
52
                "save"=>        array(T_ZBX_STR, O_OPT, P_SYS|P_ACT,    null,   null),
 
53
                
 
54
                "form"=>        array(T_ZBX_STR, O_OPT, P_SYS,  null,   null),
 
55
                "form_refresh"=>array(T_ZBX_STR, O_OPT, null,   null,   null)
 
56
        );
 
57
 
 
58
        check_fields($fields);
 
59
?>
 
60
<script language="JavaScript" type="text/javascript">
 
61
<!--
 
62
 
 
63
function add_var_to_opener_obj(obj,name,value)
 
64
{
 
65
        new_variable = window.opener.document.createElement('input');
 
66
        new_variable.type = 'hidden';
 
67
        new_variable.name = name;
 
68
        new_variable.value = value;
 
69
 
 
70
        obj.appendChild(new_variable);
 
71
}
 
72
 
 
73
-->
 
74
</script>
 
75
<?php
 
76
        if(isset($_REQUEST['save']) && !isset($_REQUEST['sid']))
 
77
        {
 
78
?>
 
79
<script language="JavaScript" type="text/javascript">
 
80
<!--
 
81
 
 
82
function add_httpstep(formname,name,timeout,url,posts,required,status_codes)
 
83
{
 
84
        var form = window.opener.document.forms[formname];
 
85
 
 
86
        if(!form)
 
87
        {
 
88
                close_window();
 
89
                return false;
 
90
        }
 
91
 
 
92
        add_var_to_opener_obj(form,'new_httpstep[name]',name);
 
93
        add_var_to_opener_obj(form,'new_httpstep[timeout]',timeout);
 
94
        add_var_to_opener_obj(form,'new_httpstep[url]',url);
 
95
        add_var_to_opener_obj(form,'new_httpstep[posts]',posts);
 
96
        add_var_to_opener_obj(form,'new_httpstep[required]',required);
 
97
        add_var_to_opener_obj(form,'new_httpstep[status_codes]',status_codes);
 
98
        
 
99
        form.submit();
 
100
        close_window();
 
101
        return true;
 
102
}
 
103
 
 
104
<?php
 
105
                echo "add_httpstep(".
 
106
                        zbx_jsvalue($_REQUEST['dstfrm']).",".
 
107
                        zbx_jsvalue($_REQUEST['name']).",".
 
108
                        zbx_jsvalue($_REQUEST['timeout']).",".
 
109
                        zbx_jsvalue($_REQUEST['url']).",".
 
110
                        zbx_jsvalue($_REQUEST['posts']).",".
 
111
                        zbx_jsvalue($_REQUEST['required']).",".
 
112
                        zbx_jsvalue($_REQUEST['status_codes']).");\n";
 
113
?>
 
114
-->
 
115
</script>
 
116
<?php
 
117
        }
 
118
        if(isset($_REQUEST['save']) && isset($_REQUEST['sid']))
 
119
        {
 
120
?>
 
121
<script language="JavaScript" type="text/javascript">
 
122
<!--
 
123
 
 
124
function update_httpstep(formname,list_name,sid,name,timeout,url,posts,required,status_codes)
 
125
{
 
126
        var form = window.opener.document.forms[formname];
 
127
 
 
128
        if(!form)
 
129
        {
 
130
                close_window();
 
131
                return false;
 
132
        }
 
133
 
 
134
        add_var_to_opener_obj(form,list_name + '[' + sid + '][name]',name);
 
135
        add_var_to_opener_obj(form,list_name + '[' + sid + '][timeout]',timeout);
 
136
        add_var_to_opener_obj(form,list_name + '[' + sid + '][url]',url);
 
137
        add_var_to_opener_obj(form,list_name + '[' + sid + '][posts]',posts);
 
138
        add_var_to_opener_obj(form,list_name + '[' + sid + '][required]',required);
 
139
        add_var_to_opener_obj(form,list_name + '[' + sid + '][status_codes]',status_codes);
 
140
        
 
141
        
 
142
        form.submit();
 
143
        close_window();
 
144
        return true;
 
145
}
 
146
 
 
147
<?php
 
148
                echo "update_httpstep(".
 
149
                        zbx_jsvalue($_REQUEST['dstfrm']).",".
 
150
                        zbx_jsvalue($_REQUEST['list_name']).",".
 
151
                        zbx_jsvalue($_REQUEST['sid']).",".
 
152
                        zbx_jsvalue($_REQUEST['name']).",".
 
153
                        zbx_jsvalue($_REQUEST['timeout']).",".
 
154
                        zbx_jsvalue($_REQUEST['url']).",".
 
155
                        zbx_jsvalue($_REQUEST['posts']).",".
 
156
                        zbx_jsvalue($_REQUEST['required']).",".
 
157
                        zbx_jsvalue($_REQUEST['status_codes']).");\n";
 
158
?>
 
159
-->
 
160
</script>
 
161
<?php
 
162
        }
 
163
        else
 
164
        {
 
165
?>
 
166
<?php
 
167
        echo BR;
 
168
 
 
169
        insert_httpstep_form();
 
170
 
 
171
        }
 
172
?>
 
173
<?php
 
174
 
 
175
include_once "include/page_footer.php";
 
176
 
 
177
?>