-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathsyslog_saved_searches.php
More file actions
671 lines (566 loc) · 21.6 KB
/
Copy pathsyslog_saved_searches.php
File metadata and controls
671 lines (566 loc) · 21.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
<?php
chdir('../../');
include('./include/auth.php');
include_once('./plugins/syslog/functions.php');
include_once('./plugins/syslog/database.php');
// The page was originally registered in its own realm and is now part of
// Syslog Administration. Accept both mappings so existing installations do
// not lose access when the realm registration changes.
if (!api_plugin_user_realm_auth('syslog_saved_searches.php') && !api_plugin_user_realm_auth('syslog_alerts.php')) {
die(__('Permission denied.', 'syslog'));
}
syslog_connect();
set_default_action();
global $syslogdb_default;
$db = $syslogdb_default;
$error = '';
$edit = get_filter_request_var('edit', FILTER_VALIDATE_INT);
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset_request_var('save_template')) {
$id = get_filter_request_var('id', FILTER_VALIDATE_INT);
$name = trim((string) get_nfilter_request_var('name'));
$search = (string) get_nfilter_request_var('search');
$owner = trim((string) get_nfilter_request_var('owner'));
$edit = $id;
if ($id > 0 && $name !== '' && strlen($name) <= 128) {
$usernames = array_rekey(db_fetch_assoc('SELECT username FROM user_auth'), 'username', 'username');
if ($owner === '' || !isset($usernames[$owner])) {
$error = __('Select a valid owner.', 'syslog');
} else {
try {
syslog_parse_logical_search($search);
if (!syslog_db_execute_prepared("UPDATE $db.syslog_saved_searches SET name = ?, search = ?, `user` = ? WHERE id = ? AND is_global = 'on'", [$name, $search, $owner, $id])) {
$error = __('Unable to save the template. Please try again.', 'syslog');
} else {
// Replace the user/group grants with the posted selections.
syslog_save_item_shares('saved_search', $id,
syslog_parse_share_ids('shared_users'),
syslog_parse_share_ids('shared_groups'));
}
} catch (InvalidArgumentException $error) {
$error = $error->getMessage();
}
}
} else {
$error = __('Enter a template name between 1 and 128 characters.', 'syslog');
}
if ($error === '') {
header('Location: syslog_saved_searches.php');
exit;
}
}
if ((isset_request_var('import') || isset_request_var('save_component_import')) && syslog_allow_edits()) {
set_request_var('action', 'import');
}
$row = $edit > 0 ? syslog_db_fetch_row_prepared("SELECT id, name, search, removal, grouping, user FROM $db.syslog_saved_searches WHERE id = ? AND is_global = 'on'", [$edit]) : false;
if ($row && $error !== '') {
$row['name'] = $name;
$row['search'] = $search;
}
switch (get_request_var('action')) {
case 'actions':
syslog_template_actions();
exit;
case 'export':
syslog_saved_search_export();
exit;
case 'import':
if (isset_request_var('save_component_import')) {
syslog_saved_search_import();
} else {
top_header();
syslog_include_js();
syslog_saved_search_import_form();
bottom_footer();
}
exit;
case 'edit':
default:
top_header();
syslog_include_js();
if ($row) {
syslog_template_edit($row, $error);
} else {
syslog_saved_searches();
}
break;
}
?>
<script type='text/javascript'>
$(function() {
initSyslogTemplates();
<?php if ($row) { ?>
$('#shared_users').multiselect({
selectedList: 7,
noneSelectedText: '<?php print __esc('Share with users…', 'syslog'); ?>',
header: false,
height: 200,
menuWidth: 300
});
$('#shared_groups').multiselect({
selectedList: 7,
noneSelectedText: '<?php print __esc('Share with groups…', 'syslog'); ?>',
header: false,
height: 200,
menuWidth: 300
});
<?php } ?>
});
</script>
<?php
bottom_footer();
/**
* Render the saved search templates list page.
*
* @return void
*/
function syslog_saved_searches() {
global $db, $config;
// ================= input validation and session storage =================
$filters = [
'rows' => [
'filter' => FILTER_VALIDATE_INT,
'pageset' => true,
'default' => '-1',
],
'page' => [
'filter' => FILTER_VALIDATE_INT,
'default' => '1'
],
'filter' => [
'filter' => FILTER_DEFAULT,
'pageset' => true,
'default' => ''
],
'sort_column' => [
'filter' => FILTER_CALLBACK,
'default' => 'name',
'options' => ['options' => 'sanitize_search_string']
],
'sort_direction' => [
'filter' => FILTER_CALLBACK,
'default' => 'ASC',
'options' => ['options' => 'sanitize_search_string']
]
];
validate_store_request_vars($filters, 'sess_syslogsst');
// ================= input validation =================
if (get_request_var('rows') == '-1') {
$rows = read_config_option('num_rows_table');
} elseif (get_request_var('rows') == -2) {
$rows = 999999;
} else {
$rows = get_request_var('rows');
}
$sql_where = "WHERE is_global = 'on'";
$sql_params = [];
if (get_request_var('filter') != '') {
$sql_where .= ' AND (name LIKE ? OR `user` LIKE ? OR search LIKE ?)';
$filter = '%' . get_request_var('filter') . '%';
$sql_params = [$filter, $filter, $filter];
}
$sql_order = get_order_string();
$sql_limit = ' LIMIT ' . ($rows * (get_request_var('page') - 1)) . ',' . $rows;
$templates = syslog_db_fetch_assoc_prepared("SELECT id, name, search, user
FROM $db.syslog_saved_searches
$sql_where
$sql_order
$sql_limit", $sql_params) ?: [];
$total_rows = syslog_db_fetch_cell_prepared("SELECT COUNT(*)
FROM $db.syslog_saved_searches
$sql_where", $sql_params);
$nav = html_nav_bar('syslog_saved_searches.php?filter=' . get_request_var('filter'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 4, __('Templates', 'syslog'), 'page', 'main');
html_start_box(__('Saved Search Templates', 'syslog'), '100%', '', '3', 'center', '');
syslog_saved_search_filter();
html_end_box();
syslog_template_list($templates, $nav);
}
/**
* Render the filter row for the saved search templates list.
*
* @return void
*/
function syslog_saved_search_filter() {
global $config, $item_rows;
?>
<tr class='even'>
<td>
<form id='saved_searches' action='syslog_saved_searches.php' method='get'>
<table class='filterTable'>
<tr>
<td>
<?php print __('Search', 'syslog'); ?>
</td>
<td>
<input type='text' id='filter' size='25' value='<?php print html_escape_request_var('filter'); ?>'>
</td>
<td>
<?php print __('Rows', 'syslog'); ?>
</td>
<td>
<select id='rows' onChange='applyFilterSavedSearches()'>
<option value='-1'<?php if (get_request_var('rows') == '-1') {?> selected<?php }?>><?php print __('Default', 'syslog'); ?></option>
<?php
if (cacti_sizeof($item_rows)) {
foreach ($item_rows as $key => $value) {
print '<option value="' . $key . '"';
if (get_request_var('rows') == $key) {
print ' selected';
} print '>' . $value . "</option>\n";
}
}
?>
</select>
</td>
<td>
<span>
<input id='refresh' type='button' value='<?php print __esc('Go', 'syslog'); ?>'>
<input id='clear' type='button' value='<?php print __esc('Clear', 'syslog'); ?>'>
<?php if (syslog_allow_edits()) {?><input id='import' type='button' value='<?php print __esc('Import', 'syslog'); ?>'><?php } ?>
</span>
</td>
</tr>
</table>
<input type='hidden' id='page' value='<?php print get_filter_request_var('page'); ?>'>
</form>
<script type='text/javascript'>
initSyslogSavedSearches();
</script>
</td>
</tr>
<?php
}
/**
* Render the saved search templates table.
*
* @param list<array<string, mixed>> $rows The template rows to display.
* @param string $nav The navigation bar HTML to print above and below the table.
*
* @return void
*/
function syslog_template_list($rows, $nav = '') {
$actions = [1 => __('Delete', 'syslog'), 2 => __('Export', 'syslog')];
form_start('syslog_saved_searches.php', 'chk');
if ($nav !== '') {
print $nav;
}
html_start_box('', '100%', '', '3', 'center', '');
html_header_checkbox([__('Name', 'syslog'), __('Owner', 'syslog'), __('Query', 'syslog')], false);
if (cacti_sizeof($rows)) {
foreach ($rows as $template) {
$id = (int) $template['id'];
form_alternate_row('line' . $id, true);
print "<td><a class='linkEditMain' href='syslog_saved_searches.php?edit=$id'>" . html_escape($template['name']) . '</a></td>';
print '<td>' . html_escape($template['user']) . "</td><td class='syslogTemplateQuery'>" . html_escape($template['search']) . '</td>';
form_checkbox_cell($template['name'], $id);
form_end_row();
}
} else {
print "<tr><td colspan='4'><em>" . __('No shared search templates. Save a search for all users from Syslog to create one.', 'syslog') . '</em></td></tr>';
}
html_end_box(false);
if ($nav !== '') {
print $nav;
}
draw_actions_dropdown($actions);
// Bulk actions can return a JSON attachment; bypass Cacti's HTML AJAX handler.
form_end(false);
}
/**
* Run the bulk action requested for the selected saved search templates.
*
* @return void
*/
function syslog_template_actions() {
global $db;
$actions = [1 => __('Delete', 'syslog'), 2 => __('Export', 'syslog')];
get_filter_request_var('drp_action', FILTER_VALIDATE_REGEXP,
['options' => ['regexp' => '/^([a-zA-Z0-9_]+)$/']]);
if (!isset($actions[get_request_var('drp_action')])) {
header('Location: syslog_saved_searches.php');
exit;
}
// if we are to save this form, instead of display it
if (isset_request_var('selected_items')) {
$selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items'));
if ($selected_items != false && get_request_var('drp_action') == '2') {
syslog_saved_search_export();
exit;
}
$action_map = ['1' => 'api_syslog_saved_search_remove'];
syslog_apply_selected_items_action($selected_items, (string) get_request_var('drp_action'), $action_map);
header('Location: syslog_saved_searches.php');
exit;
}
top_header();
form_start('syslog_saved_searches.php');
html_start_box($actions[get_request_var('drp_action')], '60%', '', '3', 'center', '');
// loop through each of the templates selected on the previous page and get more info about them
$template_list = '';
$template_array = [];
foreach ($_POST as $var => $val) {
if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) {
// ================= input validation =================
input_validate_input_number($matches[1]);
// ====================================================
$name = syslog_db_fetch_cell_prepared("SELECT name
FROM $db.syslog_saved_searches
WHERE id = ? AND is_global = 'on'",
[$matches[1]]);
if ($name !== false && $name !== null) {
$template_list .= '<li>' . html_escape($name) . '</li>';
$template_array[] = $matches[1];
}
}
}
if (cacti_sizeof($template_array)) {
$export = get_request_var('drp_action') == '2';
print "<tr>
<td class='textArea'>
<p>" . ($export
? __('Click \'Continue\' to Export the following Saved Search Template(s).', 'syslog')
: __('Click \'Continue\' to Delete the following Saved Search Template(s).', 'syslog')) . "</p>
<div class='itemlist'><ul>$template_list</ul></div>
</td>
</tr>";
$title = $export ? __esc('Export Saved Search Template(s)', 'syslog') : __esc('Delete Saved Search Template(s)', 'syslog');
$save_html = "<input type='button' value='" . __esc('Cancel', 'syslog') . "' onClick='cactiReturnTo()'> <input type='submit' class='export' value='" . __esc('Continue', 'syslog') . "' title='$title'>";
} else {
raise_message(40);
header('Location: syslog_saved_searches.php');
exit;
}
print "<tr>
<td align='right' class='saveRow'>
<input type='hidden' name='action' value='actions'>
<input type='hidden' name='selected_items' value='" . serialize($template_array) . "'>
<input type='hidden' name='drp_action' value='" . get_request_var('drp_action') . "'>
$save_html
</td>
</tr>";
html_end_box();
// Bulk actions can return a JSON attachment; bypass Cacti's HTML AJAX handler.
syslog_export_form_end(get_request_var('drp_action') == '2');
bottom_footer();
}
/**
* Remove a saved search template and its shares.
*
* @param int $id The id of the saved search template to remove.
*
* @return void
*/
function api_syslog_saved_search_remove($id) {
global $db;
syslog_db_execute_prepared("DELETE FROM $db.syslog_saved_searches WHERE id = ? AND is_global = 'on'", [$id]);
syslog_db_execute_prepared("DELETE FROM $db.syslog_saved_searches_perm WHERE search_id = ?", [$id]);
}
/**
* Export the selected saved search templates as a JSON attachment.
*
* @return void
*/
function syslog_saved_search_export() {
global $db;
if (isset_request_var('selected_items')) {
$selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items'));
if ($selected_items != false) {
$templates = [];
foreach ($selected_items as $id) {
if ($id <= 0) {
continue;
}
$template = syslog_db_fetch_row_prepared("SELECT *
FROM $db.syslog_saved_searches
WHERE id = ? AND is_global = 'on'",
[$id]);
if (!cacti_sizeof($template)) {
continue;
}
unset($template['id']);
$template['shared_users'] = array_column(syslog_fetch_item_shares('saved_search', $id)['users'], 'id');
$template['shared_groups'] = array_column(syslog_fetch_item_shares('saved_search', $id)['groups'], 'id');
$templates[] = $template;
}
$output = syslog_rules_array2json('syslog_saved_searches', $templates);
header('Content-type: application/json');
header('Content-Disposition: attachment; filename=syslog_saved_searches_export.json');
print $output;
}
}
}
/**
* Import saved search templates from the posted JSON payload.
*
* @return void
*/
function syslog_saved_search_import() {
global $db;
$import_data = syslog_get_import_xml_payload('syslog_saved_searches.php');
$import_array = syslog_parse_rule_import($import_data, 'syslog_saved_searches');
if ($import_array === false || !$import_array) {
raise_message('syslog_import_error', __('Import rejected: the file is empty, invalid, or contains a different type of Syslog object.', 'syslog'), MESSAGE_LEVEL_ERROR);
header('Location: syslog_saved_searches.php');
return;
}
$imported = 0;
$updated = 0;
$failed = 0;
if ($import_array !== false && cacti_sizeof($import_array)) {
foreach ($import_array as $contents) {
if (!is_array($contents)) {
continue;
}
$save = [
'name' => $contents['name'] ?? '',
'search' => $contents['search'] ?? '',
'removal' => $contents['removal'] ?? 1,
'grouping' => $contents['grouping'] ?? 0,
'user' => $contents['user'] ?? get_username($_SESSION['sess_user_id']),
'is_global' => 'on',
'date' => $contents['date'] ?? time(),
];
if (isset($contents['hash']) && $contents['hash'] !== '') {
$save['hash'] = $contents['hash'];
$found = syslog_db_fetch_cell_prepared("SELECT id
FROM $db.syslog_saved_searches
WHERE hash = ? AND is_global = 'on'",
[$contents['hash']]);
if (!empty($found)) {
$save['id'] = $found;
} else {
$save['id'] = 0;
}
} else {
$save['hash'] = generate_hash();
$save['id'] = 0;
}
if ($save['name'] === '' || strlen($save['name']) > 128) {
$failed++;
continue;
}
if (isset($contents['shared_users']) && is_array($contents['shared_users'])) {
$shared_users = $contents['shared_users'];
} else {
$shared_users = [];
}
if (isset($contents['shared_groups']) && is_array($contents['shared_groups'])) {
$shared_groups = $contents['shared_groups'];
} else {
$shared_groups = [];
}
unset($contents['shared_users'], $contents['shared_groups']);
foreach ($contents as $name => $value) {
if (syslog_db_column_exists('syslog_saved_searches', $name) && !isset($save[$name])) {
$save[$name] = $value;
}
}
$id = syslog_sql_save($save, 'syslog_saved_searches', 'id');
if (!$id) {
$failed++;
continue;
}
syslog_save_item_shares('saved_search', $id, $shared_users, $shared_groups);
if ($save['id'] > 0) {
$updated++;
} else {
$imported++;
}
}
}
if ($imported || $updated) {
raise_message('syslog_info', __esc('NOTE: Imported %d and updated %d Saved Search Template(s).', $imported, $updated, 'syslog'), MESSAGE_LEVEL_INFO);
}
if ($failed) {
raise_message('syslog_error', __esc('ERROR: %d Saved Search Template(s) failed to import.', $failed, 'syslog'), MESSAGE_LEVEL_ERROR);
}
header('Location: syslog_saved_searches.php');
}
/**
* Display the saved search template import form.
*
* @return void
*/
function syslog_saved_search_import_form() {
if (!syslog_allow_edits()) {
header('Location: syslog_saved_searches.php');
exit;
}
$form_data = [
'import_file' => [
'friendly_name' => __('Import Saved Search Template from Local File', 'syslog'),
'description' => __('If the JSON file containing the Saved Search Template definition data is located on your local machine, select it here.', 'syslog'),
'method' => 'file'
],
'import_text' => [
'method' => 'textarea',
'friendly_name' => __('Import Saved Search Template from Text', 'syslog'),
'description' => __('If you have the JSON file containing the Saved Search Template definition data as text, you can paste it into this box to import it.', 'syslog'),
'value' => '',
'default' => '',
'textarea_rows' => '10',
'textarea_cols' => '80',
'class' => 'textAreaNotes'
]
];
print "<form method='post' action='syslog_saved_searches.php' enctype='multipart/form-data'>";
html_start_box(__('Import Saved Search Template', 'syslog'), '100%', false, '3', 'center', '');
draw_edit_form(
[
'config' => ['no_form_tag' => true],
'fields' => $form_data
]
);
html_end_box();
form_hidden_box('save_component_import', '1', '');
form_save_button('', 'import', 'id', false);
}
/**
* Display the saved search template edit form.
*
* @param array<string, mixed> $row The template row being edited.
* @param string $error The error message to display, if any.
*
* @return void
*/
function syslog_template_edit($row, $error) {
$tree = null;
try {
$tree = syslog_parse_logical_search($row['search']);
} catch (InvalidArgumentException $exception) {
$error = $error ?: $exception->getMessage();
}
// Cacti accounts and groups to grant this template to, beyond global
// availability. The 'all' entry shares it with every signed-in user.
$usernames = array_rekey(db_fetch_assoc('SELECT username FROM user_auth ORDER BY username'), 'username', 'username');
$users = array_rekey(db_fetch_assoc('SELECT id, username FROM user_auth ORDER BY username'), 'id', 'username');
$groups = array_rekey(db_fetch_assoc('SELECT id, name FROM user_auth_group ORDER BY name'), 'id', 'name');
$shares = syslog_fetch_item_shares('saved_search', (int) $row['id']);
$users = ['all' => __('All Users', 'syslog')] + $users;
$groups = ['all' => __('All Groups', 'syslog')] + $groups;
form_start('syslog_saved_searches.php', 'syslog_template_form');
html_start_box(__('Edit Saved Search Template', 'syslog'), '100%', '', '3', 'center', '');
draw_edit_form(['config' => ['no_form_tag' => true], 'fields' => [
'name' => ['friendly_name' => __('Name', 'syslog'), 'method' => 'textbox', 'value' => $row['name'], 'max_length' => 128, 'size' => 60, 'description' => __('The name shown to all users in Saved Searches.', 'syslog')],
'owner' => ['friendly_name' => __('Owner', 'syslog'), 'method' => 'drop_array', 'array' => $usernames, 'value' => $row['user'], 'description' => __('The account that owns this template and can manage it in Saved Searches.', 'syslog')],
'shared_users' => ['friendly_name' => __('Shared With Users', 'syslog'), 'method' => 'drop_multi', 'array' => $users, 'value' => $shares['users'], 'description' => __('Users who can use this template in addition to its owner. All Users shares it with everyone.', 'syslog')],
'shared_groups' => ['friendly_name' => __('Shared With Groups', 'syslog'), 'method' => 'drop_multi', 'array' => $groups, 'value' => $shares['groups'], 'description' => __('Groups who can use this template in addition to its owner. All Groups shares it with everyone.', 'syslog')],
'id' => ['method' => 'hidden', 'value' => (int) $row['id']],
'save_template' => ['method' => 'hidden', 'value' => '1']
]]);
html_end_box();
html_start_box(__('Search Query', 'syslog'), '100%', '', '3', 'center', '');
print "<tr><td class='syslogTemplateEditor'>";
if ($error !== '') {
print "<p class='ui-state-error ui-corner-all' role='alert'>" . html_escape($error) . '</p>';
}
// Keep malformed legacy expressions editable instead of silently replacing them.
if ($tree === null && trim($row['search']) !== '') {
print "<label for='template_search'>" . __('Correct the query syntax to use the query builder.', 'syslog') . "</label><textarea id='template_search' name='search' rows='4' class='textAreaNotes'>" . html_escape($row['search']) . '</textarea>';
} else {
print "<input type='hidden' id='template_search' name='search' value='" . html_escape($row['search']) . "'>";
print "<div id='syslog_template_builder' class='syslogSearchBuilder' data-theme='cacti' data-fields='" . html_escape(json_encode(syslog_search_fields())) . "' data-choices='" . html_escape(json_encode(syslog_search_choices())) . "' data-tree='" . html_escape(json_encode($tree)) . "' data-message='" . __esc('Message', 'syslog') . "' data-placeholder='" . __esc('Enter message text…', 'syslog') . "' data-remove='" . __esc('Remove condition', 'syslog') . "' data-match='" . __esc('Match group', 'syslog') . "' data-exclude='" . __esc('Exclude group', 'syslog') . "'></div>";
}
print "<p class='textInfo'>" . __('Choose a field, operator, and value. Use AND, OR, NOT, or Group to build the query. Changes apply to this shared template for all users.', 'syslog') . '</p></td></tr>';
html_end_box();
form_save_button('syslog_saved_searches.php', '', 'edit', false);
}