#11612 Fix template
This commit is contained in:
parent
ad45202484
commit
ceb0ec9f16
|
@ -322,6 +322,13 @@ function update_template($step)
|
|||
|
||||
if ($step == 1) {
|
||||
$name = (string) get_parameter('name');
|
||||
$name = trim(io_safe_output($name));
|
||||
if (strlen($name) === 0) {
|
||||
ui_print_warning_message(__('You can\'t named a template with spaces'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$name = io_safe_input($name);
|
||||
$description = (string) get_parameter('description');
|
||||
$wizard_level = (string) get_parameter('wizard_level');
|
||||
$priority = (int) get_parameter('priority');
|
||||
|
@ -487,6 +494,13 @@ $wizard_level = 'nowizard';
|
|||
|
||||
if ($create_template) {
|
||||
$name = (string) get_parameter('name');
|
||||
$name = trim(io_safe_output($name));
|
||||
if (strlen($name) === 0) {
|
||||
ui_print_warning_message(__('You can\'t named a template with spaces'));
|
||||
}
|
||||
|
||||
$name = io_safe_input($name);
|
||||
|
||||
$description = (string) get_parameter('description');
|
||||
$type = (string) get_parameter('type', 'critical');
|
||||
$value = (string) get_parameter('value');
|
||||
|
@ -515,10 +529,11 @@ if ($create_template) {
|
|||
$values['field3_recovery'] = ' ';
|
||||
}
|
||||
|
||||
if (!$name_check) {
|
||||
if ($name_check === false) {
|
||||
$result = alerts_create_alert_template($name, $type, $values);
|
||||
} else {
|
||||
$result = '';
|
||||
ui_print_warning_message(__('Another template with the same name already exists'));
|
||||
$result = false;
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
|
|
Loading…
Reference in New Issue