diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 1f593b086e..77fdc4f99b 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -1,25 +1,35 @@ '; $form_filter .= ""; $form_filter .= ''; @@ -60,7 +70,7 @@ $temp = agents_get_agents(); $arrayAgents = []; // Avoid empty arrays, warning messages are UGLY ! -if ($temp) { +if ($temp !== false) { foreach ($temp as $agentElement) { $arrayAgents[$agentElement['id_agente']] = $agentElement['nombre']; } @@ -93,11 +103,11 @@ $form_filter .= ''; $all_groups = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']); -if (check_acl($config['id_user'], 0, 'AD')) { +if ((bool) check_acl($config['id_user'], 0, 'AD') === true) { $groups_user = users_get_groups($config['id_user'], 'AD', $all_groups); -} else if (check_acl($config['id_user'], 0, 'LW')) { +} else if ((bool) check_acl($config['id_user'], 0, 'LW') === true) { $groups_user = users_get_groups($config['id_user'], 'LW', $all_groups); -} else if (check_acl($config['id_user'], 0, 'LM')) { +} else if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { $groups_user = users_get_groups($config['id_user'], 'LM', $all_groups); } @@ -109,16 +119,16 @@ $groups_id = implode(',', array_keys($groups_user)); $form_filter .= ''; -$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id);"); +$temp = db_get_all_rows_sql('SELECT id, name FROM talert_actions WHERE id_group IN ('.$groups_id.');'); $arrayActions = []; -if (is_array($temp)) { +if (is_array($temp) === true) { foreach ($temp as $actionElement) { $arrayActions[$actionElement['id']] = $actionElement['name']; } } $form_filter .= "'; $form_filter .= "'; -if (defined('METACONSOLE')) { +if (is_metaconsole() === true) { $form_filter .= ''; $form_filter .= "
".__('Actions').''; -$form_filter .= html_print_select($arrayActions, 'action_id', $actionID, '', __('All'), -1, true); +$form_filter .= html_print_select($arrayActions, 'action_id', $actionID, '', __('All'), -1, true, false, true, '', false, 'width:95%'); $form_filter .= '".__('Field content').''; $form_filter .= html_print_input_text('field_content', $fieldContent, '', 12, 255, true); @@ -155,7 +165,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_ $form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false); $form_filter .= '
"; $form_filter .= html_print_submit_button(__('Update'), '', false, 'class="sub upd"', true); @@ -170,7 +180,7 @@ if (defined('METACONSOLE')) { } $form_filter .= ''; -if (defined('METACONSOLE')) { +if (is_metaconsole() === true) { echo '
'; } @@ -253,7 +263,7 @@ $total = agents_get_alerts_simple( true ); -if (empty($total)) { +if (empty($total) === true) { $total = 0; } @@ -277,14 +287,6 @@ $selectTemplateDown = false; switch ($sortField) { case 'disabled': switch ($sort) { - case 'up': - $selectDisabledUp = $selected; - $order = [ - 'field' => 'disabled', - 'order' => 'ASC', - ]; - break; - case 'down': $selectDisabledDown = $selected; $order = [ @@ -292,19 +294,20 @@ switch ($sortField) { 'order' => 'DESC', ]; break; + + default: + case 'up': + $selectDisabledUp = $selected; + $order = [ + 'field' => 'disabled', + 'order' => 'ASC', + ]; + break; } break; case 'standby': switch ($sort) { - case 'up': - $selectStandbyUp = $selected; - $order = [ - 'field' => 'standby', - 'order' => 'ASC', - ]; - break; - case 'down': $selectStandbyDown = $selected; $order = [ @@ -312,19 +315,20 @@ switch ($sortField) { 'order' => 'DESC', ]; break; + + default: + case 'up': + $selectStandbyUp = $selected; + $order = [ + 'field' => 'standby', + 'order' => 'ASC', + ]; + break; } break; case 'agent': switch ($sort) { - case 'up': - $selectAgentUp = $selected; - $order = [ - 'field' => 'agent_name', - 'order' => 'ASC', - ]; - break; - case 'down': $selectAgentDown = $selected; $order = [ @@ -332,19 +336,20 @@ switch ($sortField) { 'order' => 'DESC', ]; break; + + default: + case 'up': + $selectAgentUp = $selected; + $order = [ + 'field' => 'agent_name', + 'order' => 'ASC', + ]; + break; } break; case 'module': switch ($sort) { - case 'up': - $selectModuleUp = $selected; - $order = [ - 'field' => 'agent_module_name', - 'order' => 'ASC', - ]; - break; - case 'down': $selectModuleDown = $selected; $order = [ @@ -352,19 +357,20 @@ switch ($sortField) { 'order' => 'DESC', ]; break; + + default: + case 'up': + $selectModuleUp = $selected; + $order = [ + 'field' => 'agent_module_name', + 'order' => 'ASC', + ]; + break; } break; case 'template': switch ($sort) { - case 'up': - $selectTemplateUp = $selected; - $order = [ - 'field' => 'template_name', - 'order' => 'ASC', - ]; - break; - case 'down': $selectTemplateDown = $selected; $order = [ @@ -372,6 +378,15 @@ switch ($sortField) { 'order' => 'DESC', ]; break; + + default: + case 'up': + $selectTemplateUp = $selected; + $order = [ + 'field' => 'template_name', + 'order' => 'ASC', + ]; + break; } break; @@ -717,13 +732,13 @@ foreach ($simple_alerts as $alert) { $data[3] .= '