0 && isset ($groups[$id_group])) $agents = get_group_agents ($id_group, false, "none"); else $agents = get_group_agents (array_keys ($groups), false, "none"); $update_compound = (bool) get_parameter ('update_compound'); $delete_alert = (int) get_parameter ('delete_alert'); $enable_alert = (int) get_parameter ('enable_alert'); $disable_alert = (int) get_parameter ('disable_alert'); // Header print_page_header (__('Alerts').' » '.__('Correlated alerts'), "images/god2.png", false, "", true); if ($update_compound) { $id = (int) get_parameter ('id'); $recovery_notify = (bool) get_parameter ('recovery_notify'); $field2_recovery = (string) get_parameter ('field2_recovery'); $field3_recovery = (string) get_parameter ('field3_recovery'); $result = update_alert_compound ($id, array ('recovery_notify' => $recovery_notify, 'field2_recovery' => $field2_recovery, 'field3_recovery' => $field3_recovery)); print_result_message ($result, __('Successfully updated'), __('Could not be updated')); } if ($delete_alert) { $id = (int) get_parameter ('id'); $result = delete_alert_compound ($id); print_result_message ($result, __('Successfully deleted'), __('Could not be deleted')); if (is_ajax ()) return; } if ($enable_alert) { $id = (int) get_parameter ('id'); $result = set_alerts_compound_disable ($id, false); print_result_message ($result, __('Successfully enabled'), __('Could not be enabled')); if (is_ajax ()) return; } if ($disable_alert) { $id = (int) get_parameter ('id'); $result = set_alerts_compound_disable ($id, true); print_result_message ($result, __('Successfully disabled'), __('Could not be disabled')); if (is_ajax ()) return; } $table->id = 'filter_compound_table'; $table->width = '90%'; $table->data = array (); $table->style = array (); $table->style[0] = 'font-weight: bold; vertical-align:top'; $table->style[2] = 'font-weight: bold'; $table->size = array (); $table->colspan = array (); $table->size[0] = '15%'; $table->size[1] = '35%'; $table->size[2] = '15%'; $table->size[3] = '35%'; $table->data[0][0] = __('Group'); $table->data[0][1] = print_select_groups(0, "LM", true, 'id_group', $id_group, false, '', '', true); $table->data[0][2] = __('Agent'); $table->data[0][2] .= ' '; $table->data[0][3] = print_select ($agents, 'id_agent', $id_agent, false, __('All'), 0, true); $table->data[1][0] = __('Free search'); $table->data[1][1] = print_input_text ('search', $search, '', 20, 40, true); $table->colspan[1][1] = 3; echo '
'; print_table ($table); echo '
'; print_input_hidden ('do_search', 1); print_submit_button (__('Search'), 'search_btn', false, 'class="sub search"'); echo '
'; echo '
'; unset ($table); $where = ''; if ($search != '') $where = sprintf (' AND (description LIKE "%%%s%%" OR name LIKE "%%%s%%")', $search, $search); if ($id_agent) $agents = array ($id_agent => $id_agent); $total = 0; if (count($agents) > 0) { $sql = sprintf ('SELECT COUNT(*) FROM talert_compound WHERE id_agent in (%s)%s', implode (',', array_keys ($agents)), $where); $total = (int) get_db_sql ($sql); } pagination ($total, $url); $table->id = 'alert_list'; $table->class = 'alert_list databox'; $table->width = '90%'; $table->data = array (); $table->head = array (); $table->style = array (); $table->style[1] = 'font-weight: bold'; $table->align = array (); $table->align[3] = 'center'; $table->size = array (); $table->size[0] = '20px'; $table->size[3] = '20px'; $table->head[0] = ''; $table->head[1] = __('Name'); $table->head[2] = __('Agent'); $table->head[3] = __('Delete'); $id_alerts = false; if (count($agents)) { $sql = sprintf ('SELECT id FROM talert_compound WHERE id_agent in (%s)%s LIMIT %d OFFSET %d', implode (',', array_keys ($agents)), $where, $config['block_size'], get_parameter ('offset')); $id_alerts = get_db_all_rows_sql ($sql); } if ($id_alerts === false) $id_alerts = array (); foreach ($id_alerts as $alert) { $alert = get_alert_compound ($alert['id']); if ($alert === false) continue; $data = array (); $data[0] = '
'; if ($alert['disabled']) { $data[0] .= print_input_image ('enable', 'images/lightbulb_off.png', 1, '', true); $data[0] .= print_input_hidden ('enable_alert', 1, true); } else { $data[0] .= print_input_image ('disable', 'images/lightbulb.png', 1, '', true); $data[0] .= print_input_hidden ('disable_alert', 1, true); } $data[0] .= print_input_hidden ('id', $alert['id'], true); $data[0] .= '
'; $data[1] = ''; $data[1] .= $alert['name']; $data[1] .= ''; $data[2] = get_agent_name ($alert['id_agent']); $data[3] = ''; $data[3] .= ''; $data[3] .= ''; array_push ($table->data, $data); } if (isset($data)){ print_table ($table); } else { echo "
".__('No alerts found')."
"; } echo '
'; echo '
'; print_submit_button (__('Create'), 'crtbtn', false, 'class="sub next"'); print_input_hidden ('new_compound', 1); echo '
'; echo '
'; require_jquery_file ('pandora.controls'); ?>