diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ca25f13316..26fb6ef503 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2014-05-08 Alejandro Gallardo + + * pandora_console/extensions/matrix_events/ajax.php, + pandora_console/extensions/matrix_events.php: Added + files. New extension to see the latest events like if + you were the operator of the Nebuchadnezzar. + 2014-05-08 Vanessa Gil * godmode/servers/plugin.php: Removed 'max. retries'. diff --git a/pandora_console/extensions/matrix_events.php b/pandora_console/extensions/matrix_events.php new file mode 100644 index 0000000000..21ca7d27a4 --- /dev/null +++ b/pandora_console/extensions/matrix_events.php @@ -0,0 +1,265 @@ +' + . html_print_image ("images/full_screen.png", true, array ("title" => __('Full screen mode'))) + . ""; + $onheader = array('fullscreen' => $fullscreen); + ui_print_page_header ($title_menu, "images/op_monitoring.png", false, "", false, $onheader); + } + + echo ""; + +?> + + diff --git a/pandora_console/extensions/matrix_events/ajax.php b/pandora_console/extensions/matrix_events/ajax.php new file mode 100644 index 0000000000..fc05d45f19 --- /dev/null +++ b/pandora_console/extensions/matrix_events/ajax.php @@ -0,0 +1,77 @@ +1 $tags_condition"; + + switch ($config["dbtype"]) { + case "mysql": + case "postgresql": + $sql = sprintf ("SELECT id_agente, evento, utimestamp + FROM tevento + WHERE %s + ORDER BY utimestamp DESC LIMIT %d", + $filter, $limit); + break; + case "oracle": + $sql = sprintf ("SELECT * + FROM tevento + WHERE %s + AND rownum <= %d + ORDER BY utimestamp DESC", + $filter, $limit); + break; + } + $result = db_get_all_rows_sql ($sql); + + $events = array(); + if (! empty($result)) { + foreach ($result as $key => $value) { + $event = array(); + $event['agent'] = (empty($value['id_agente'])) ? "System" : agents_get_name($value['id_agente']); + $event['text'] = io_safe_output($value['evento']); + $event['date'] = date(io_safe_output($config['date_format']), $value['utimestamp']); + $events[] = $event; + } + } else { + sleep(5); + } + + echo json_encode($events); + return; + } + + return; +} + +?> \ No newline at end of file