0 && isset ($groups[$id_group])) $agents = agents_get_group_agents ($id_group, false, "none"); else $agents = 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 ui_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 = alerts_update_alert_compound ($id, array ('recovery_notify' => $recovery_notify, 'field2_recovery' => $field2_recovery, 'field3_recovery' => $field3_recovery)); ui_print_result_message ($result, __('Successfully updated'), __('Could not be updated')); } if ($delete_alert) { $id = (int) get_parameter ('id'); $result = alerts_delete_alert_compound ($id); ui_print_result_message ($result, __('Successfully deleted'), __('Could not be deleted')); if (is_ajax ()) return; } if ($enable_alert) { $id = (int) get_parameter ('id'); $result = alerts_set_alerts_compound_disable ($id, false); ui_print_result_message ($result, __('Successfully enabled'), __('Could not be enabled')); if (is_ajax ()) return; } if ($disable_alert) { $id = (int) get_parameter ('id'); $result = alerts_set_alerts_compound_disable ($id, true); ui_print_result_message ($result, __('Successfully disabled'), __('Could not be disabled')); if (is_ajax ()) return; } $table->id = 'filter_compound_table'; $table->width = '98%'; $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] = html_print_select_groups(0, "LM", true, 'id_group', $id_group, false, '', '', true); $table->data[0][2] = __('Agent'); $table->data[0][2] .= ' '; $table->data[0][2] .= html_print_image("images/spinner.png", true); $table->data[0][2] .= ''; $table->data[0][3] = html_print_select ($agents, 'id_agent', $id_agent, false, __('All'), 0, true); $table->data[1][0] = __('Free search'); $table->data[1][1] = html_print_input_text ('search', $search, '', 20, 40, true); $table->colspan[1][1] = 3; echo '
'; unset ($table); $where = ''; if ($search != '') { switch ($config["dbtype"]) { case "mysql": case "postgresql": $where = sprintf (' AND (description LIKE "%%%s%%" OR name LIKE "%%%s%%")', $search, $search); break; case "oracle": $where = sprintf (' AND (description LIKE \'%%%s%%\' OR name LIKE \'%%%s%%\')', $search, $search); break; } } 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) db_get_sql ($sql); } ui_pagination ($total, $url); $table->id = 'alert_list'; $table->class = 'alert_list databox'; $table->width = '98%'; $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)) { switch ($config["dbtype"]) { case "mysql": case "postgresql": $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')); break; case "oracle": $set = array(); $set['offset'] = get_parameter ('offset'); $set['limit'] = $config['block_size']; $sql = sprintf ('SELECT id FROM talert_compound WHERE id_agent in (%s)%s', implode (',', array_keys ($agents)), $where); $sql = oracle_recode_query($sql, $set); break; } $id_alerts = db_get_all_rows_sql ($sql); if (($config["dbtype"] == 'oracle') && ($id_alerts !== false)) { for ($i=0; $i < count($id_alerts); $i++) { unset($id_alerts[$i]['rnum']); } } } if ($id_alerts === false) $id_alerts = array (); foreach ($id_alerts as $alert) { $alert = alerts_get_alert_compound ($alert['id']); if ($alert === false) continue; $data = array (); $data[0] = ''; $data[1] = ''; $data[1] .= $alert['name']; $data[1] .= ''; $data[2] = agents_get_name ($alert['id_agent']); $data[3] = ''; $data[3] .= html_print_image("images/cross.png", true, array("title" => __('Delete'))); $data[3] .= ''; array_push ($table->data, $data); } if (isset($data)){ html_print_table ($table); } else { echo "