fix lint errors
Former-commit-id: fc0a4502e571495b5ac17174a594aa767e882b21
This commit is contained in:
parent
5b3dfcbf74
commit
7d8f9f7798
|
@ -11,7 +11,7 @@
|
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_alerts.php';
|
||||
|
@ -46,7 +46,7 @@ if (is_ajax()) {
|
|||
$id = (int) get_parameter('id', 0);
|
||||
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
|
||||
|
||||
// If command ID is not provided, check for action id
|
||||
// If command ID is not provided, check for action id.
|
||||
if ($id == 0) {
|
||||
$id_action = (int) get_parameter('id_action');
|
||||
$id = alerts_get_alert_action_alert_command_id($id_action);
|
||||
|
@ -59,11 +59,11 @@ if (is_ajax()) {
|
|||
$command['description'] = io_safe_input(str_replace("\r\n", '<br>', io_safe_output($command['description'])));
|
||||
}
|
||||
|
||||
// Descriptions are stored in json
|
||||
// Descriptions are stored in json.
|
||||
$fields_descriptions = empty($command['fields_descriptions']) ? '' : json_decode(io_safe_output($command['fields_descriptions']), true);
|
||||
// Fields values are stored in json
|
||||
// Fields values are stored in json.
|
||||
$fields_values = empty($command['fields_values']) ? '' : io_safe_output(json_decode($command['fields_values'], true));
|
||||
// Fields hidden conditions are stored in json
|
||||
// Fields hidden conditions are stored in json.
|
||||
$fields_hidden_checked = empty($command['fields_hidden']) ? '' : io_safe_output(json_decode($command['fields_hidden'], true));
|
||||
|
||||
$fields_rows = [];
|
||||
|
@ -78,16 +78,16 @@ if (is_ajax()) {
|
|||
|
||||
|
||||
if (!empty($field_description)) {
|
||||
// If the value is 5, this because severity in snmp alerts is not permit to show
|
||||
// If the value is 5, this because severity in snmp alerts is not permit to show.
|
||||
if (($i > 5) && ($command['id'] == 3)) {
|
||||
$fdesc = $field_description.' <br><span style="font-size:xx-small; font-weight:normal;">'.sprintf(__('Field %s'), ($i - 1)).'</span>';
|
||||
} else {
|
||||
$fdesc = $field_description.' <br><span style="font-size:xx-small; font-weight:normal;">'.sprintf(__('Field %s'), $i).'</span>';
|
||||
}
|
||||
|
||||
// If the field is the number one, print the help message
|
||||
// If the field is the number one, print the help message.
|
||||
if ($i == 1) {
|
||||
// If our context is snmpconsole, show snmp_alert helps
|
||||
// If our context is snmpconsole, show snmp_alert helps.
|
||||
if ((isset($_SERVER['HTTP_REFERER'])) && ( preg_match('/snmp_alert/', $_SERVER['HTTP_REFERER']) > 0 )) {
|
||||
$fdesc .= ui_print_help_icon('snmp_alert_field1', true);
|
||||
} else {
|
||||
|
@ -95,7 +95,7 @@ if (is_ajax()) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// If the macro hasn't description and doesnt appear in command, set with empty description to dont show it
|
||||
// If the macro hasn't description and doesnt appear in command, set with empty description to dont show it.
|
||||
if (($i > 5) && ($command['id'] == 3)) {
|
||||
if (substr_count($command['command'], '_field'.($i - 1).'_') > 0) {
|
||||
$fdesc = sprintf(__('Field %s'), ($i - 1));
|
||||
|
@ -115,7 +115,7 @@ if (is_ajax()) {
|
|||
|
||||
if (!empty($field_value)) {
|
||||
$field_value = io_safe_output($field_value);
|
||||
// HTML type
|
||||
// HTML type.
|
||||
if (preg_match('/^_html_editor_$/i', $field_value)) {
|
||||
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
||||
$editor_type_chkbx .= __('Basic').ui_print_help_tip(__('For sending emails, text must be HTML format, if you want to use plain text, type it between the following labels: <pre></pre>'), true);
|
||||
|
@ -154,7 +154,7 @@ if (is_ajax()) {
|
|||
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_recovery_value', 'text/html', '', 'text/html', false, '', '', true);
|
||||
$editor_type_chkbx .= '</small></b></div>';
|
||||
$rfield = $editor_type_chkbx;
|
||||
// Select type
|
||||
// Select type.
|
||||
} else {
|
||||
$fields_value_select = [];
|
||||
$fv = explode(';', $field_value);
|
||||
|
@ -239,7 +239,7 @@ if (is_ajax()) {
|
|||
}
|
||||
|
||||
|
||||
// The empty descriptions will be ignored
|
||||
// The empty descriptions will be ignored.
|
||||
if ($fdesc == '') {
|
||||
$fields_rows[$i] = '';
|
||||
} else {
|
||||
|
@ -254,7 +254,7 @@ if (is_ajax()) {
|
|||
}
|
||||
}
|
||||
|
||||
// If command is PandoraFMS event, field 5 must be empty because "severity" must be set by the alert
|
||||
// If command is PandoraFMS event, field 5 must be empty because "severity" must be set by the alert.
|
||||
if ($command['id'] == 3) {
|
||||
$fields_rows[5] = '';
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ if ($update_command) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header();
|
||||
} else {
|
||||
|
@ -325,7 +325,7 @@ if ($create_command) {
|
|||
db_pandora_audit('Command management', 'Fail try to create alert command', false, false);
|
||||
}
|
||||
|
||||
// Show errors
|
||||
// Show errors.
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be created');
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ if ($create_command) {
|
|||
if ($delete_command) {
|
||||
$id = (int) get_parameter('id');
|
||||
|
||||
// Internal commands cannot be deleted
|
||||
// Internal commands cannot be deleted.
|
||||
if (alerts_get_alert_command_internal($id)) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
|
@ -377,17 +377,17 @@ if ($delete_command) {
|
|||
if ($copy_command) {
|
||||
$id = (int) get_parameter('id');
|
||||
|
||||
// Get the info from the source command
|
||||
// Get the info from the source command.
|
||||
$command_to_copy = db_get_row('talert_commands', 'id', $id);
|
||||
if ($command_to_copy === false) {
|
||||
ui_print_error_message(__("Command with id $id does not found."));
|
||||
} else {
|
||||
// Prepare to insert the copy with same values
|
||||
// Prepare to insert the copy with same values.
|
||||
unset($command_to_copy['id']);
|
||||
$command_to_copy['name'] .= __(' (copy)');
|
||||
$result = db_process_sql_insert('talert_commands', $command_to_copy);
|
||||
|
||||
// Print the result
|
||||
// Print the result.
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully copied'),
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_alerts.php';
|
||||
|
@ -34,7 +34,7 @@ $update_command = (bool) get_parameter('update_command');
|
|||
$id = (int) get_parameter('id');
|
||||
$pure = get_parameter('pure', 0);
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header();
|
||||
} else {
|
||||
|
@ -187,7 +187,7 @@ $table->data['description'][1] = html_print_textarea('description', 10, 30, $des
|
|||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);
|
||||
|
||||
// Only show help on first row
|
||||
// Only show help on first row.
|
||||
if ($i == 1) {
|
||||
$table->data['field'.$i][0] .= ui_print_help_icon('alert_fields_description', true);
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
|||
|
||||
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i);
|
||||
|
||||
// Only show help on first row
|
||||
// Only show help on first row.
|
||||
if ($i == 1) {
|
||||
$table->data['field'.$i][2] .= ui_print_help_icon('alert_fields_values', true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue