Source
66
66
// actions
67
67
'action' => [T_ZBX_STR, O_OPT, P_SYS|P_ACT, IN('"graph.masscopyto","graph.massdelete","graph.updatediscover"'), null],
68
68
'add' => [T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null],
69
69
'update' => [T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null],
70
70
'clone' => [T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null],
71
71
'copy' => [T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null],
72
72
'delete' => [T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null],
73
73
'cancel' => [T_ZBX_STR, O_OPT, P_SYS, null, null],
74
74
'form' => [T_ZBX_STR, O_OPT, P_SYS, null, null],
75
75
'form_refresh' => [T_ZBX_INT, O_OPT, P_SYS, null, null],
76
+
'backurl' => [T_ZBX_STR, O_OPT, null, null, null],
76
77
// filter
77
78
'filter_set' => [T_ZBX_STR, O_OPT, P_SYS, null, null],
78
79
'filter_rst' => [T_ZBX_STR, O_OPT, P_SYS, null, null],
79
80
'filter_groupids' => [T_ZBX_INT, O_OPT, P_ONLY_ARRAY, DB_ID, null],
80
81
'filter_hostids' => [T_ZBX_INT, O_OPT, P_ONLY_ARRAY, DB_ID, null],
81
82
// sort and sortorder
82
83
'sort' => [T_ZBX_STR, O_OPT, P_SYS, IN('"graphtype","name","discover"'), null],
83
84
'sortorder' => [T_ZBX_STR, O_OPT, P_SYS, IN('"'.ZBX_SORT_DOWN.'","'.ZBX_SORT_UP.'"'), null]
84
85
];
85
86
$percentVisible = getRequest('visible', []);
148
149
'editable' => true
149
150
]);
150
151
if (!$graph) {
151
152
access_deny();
152
153
}
153
154
}
154
155
elseif ($hostid && !isWritableHostTemplates([$hostid])) {
155
156
access_deny();
156
157
}
157
158
159
+
// Validate backurl.
160
+
if (hasRequest('backurl') && !CHtmlUrlValidator::validateSameSite(getRequest('backurl'))) {
161
+
access_deny();
162
+
}
163
+
158
164
/*
159
165
* Actions
160
166
*/
161
167
if (isset($_REQUEST['clone']) && isset($_REQUEST['graphid'])) {
162
168
// graph
163
169
$options = [
164
170
'graphids' => $_REQUEST['graphid'],
165
171
'output' => API_OUTPUT_EXTEND
166
172
];
167
173
$graph = empty($_REQUEST['parent_discoveryid'])
290
296
if ($result) {
291
297
unset($_REQUEST['form']);
292
298
}
293
299
}
294
300
elseif (getRequest('graphid', '') && getRequest('action', '') === 'graph.updatediscover') {
295
301
$result = API::GraphPrototype()->update([
296
302
'graphid' => getRequest('graphid'),
297
303
'discover' => getRequest('discover', DB::getDefault('graphs', 'discover'))
298
304
]);
299
305
300
-
show_messages($result, _('Graph prototype updated'), _('Cannot update graph prototype'));
306
+
if ($result) {
307
+
CMessageHelper::setSuccessTitle(_('Graph prototype updated'));
308
+
}
309
+
else {
310
+
CMessageHelper::setErrorTitle(_('Cannot update graph prototype'));
311
+
}
312
+
313
+
if (hasRequest('backurl')) {
314
+
$response = new CControllerResponseRedirect(getRequest('backurl'));
315
+
$response->redirect();
316
+
}
301
317
}
302
318
elseif (hasRequest('action') && getRequest('action') === 'graph.massdelete' && hasRequest('group_graphid')) {
303
319
$graphIds = getRequest('group_graphid');
304
320
305
321
if (hasRequest('parent_discoveryid')) {
306
322
$result = API::GraphPrototype()->delete($graphIds);
307
323
308
324
if ($result) {
309
325
uncheckTableRows(getRequest('parent_discoveryid'));
310
326
}