2013-02-04 Miguel de Dios <miguel.dedios@artica.es>

* godmode/alerts/alert_list.list.php,
	godmode/reporting/graph_builder.php, godmode/setup/news.php,
	godmode/setup/setup_general.php, godmode/netflow/nf_edit_form.php,
	godmode/db/db_purge.php, godmode/db/db_main.php,
	godmode/extensions.php, include/functions_reporting.php,
	operation/reporting/reporting_viewer.php: improved the source code
	style.
	
	* operation/reporting/reporting_xml.php, include/functions_xml.php:
	fixed the output of xml when have some html entities that is not
	as hexadecimal entities.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7564 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-02-04 09:21:27 +00:00
parent b98b045203
commit 3750c7fc46
13 changed files with 218 additions and 139 deletions

View File

@ -1,3 +1,17 @@
2013-02-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/alerts/alert_list.list.php,
godmode/reporting/graph_builder.php, godmode/setup/news.php,
godmode/setup/setup_general.php, godmode/netflow/nf_edit_form.php,
godmode/db/db_purge.php, godmode/db/db_main.php,
godmode/extensions.php, include/functions_reporting.php,
operation/reporting/reporting_viewer.php: improved the source code
style.
* operation/reporting/reporting_xml.php, include/functions_xml.php:
fixed the output of xml when have some html entities that is not
as hexadecimal entities.
2013-02-04 Junichi Satoh <junichi@rworks.jp>
* include/help/ja/help_events_replication.php: Added more info as

View File

@ -53,9 +53,9 @@ $arrayAgents = array();
# Avoid empty arrays, warning messages are UGLY !
if ($temp){
foreach ($temp as $agentElement) {
$arrayAgents[$agentElement['id_agente']] = $agentElement['nombre'];
}
foreach ($temp as $agentElement) {
$arrayAgents[$agentElement['id_agente']] = $agentElement['nombre'];
}
}
$form_filter .= "<td>".__('Agents')."</td><td>";

View File

@ -79,7 +79,7 @@ echo '</i></td></tr>';
echo '<tr class="rowOdd"><td>';
echo __('Max. time before compact data');
echo '<td><b>';
echo $config['days_compact'].' '.__('days');
echo $config['days_compact'] . ' ' . __('days');
echo '</b></td></tr>';
echo '<tr class="rowPair"><td>';

View File

@ -178,37 +178,93 @@ else {
$query = "";
}
$data["1day"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE 1=1 %s", $query));
$data["1day"] = db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] = db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] = db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] = db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] = db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] = db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] = db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos
WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_inc WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_inc
WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_string
WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE 1=1 %s", $query));
$table->width = '98%';
$table->border = 0;

View File

@ -42,14 +42,12 @@ $disabled = get_parameter("disabled", "");
if ($delete != ""){
if ($enterprise) {
if (!file_exists($config["homedir"]."/enterprise/extensions/ext_backup"))
{
if (!file_exists($config["homedir"]."/enterprise/extensions/ext_backup")) {
mkdir($config["homedir"]."/enterprise/extensions/ext_backup");
}
}
else {
if (!file_exists($config["homedir"]."/extensions/ext_backup"))
{
if (!file_exists($config["homedir"]."/extensions/ext_backup")) {
mkdir($config["homedir"]."/extensions/ext_backup");
}
}
@ -62,7 +60,7 @@ if ($delete != ""){
$source = $config["homedir"]."/extensions/" . $delete;
$endFile = $config["homedir"]."/extensions/ext_backup/" . $delete;
}
rename($source, $endFile);
@ -103,14 +101,12 @@ if ($enabled != '') {
if ($disabled != '') {
if ($enterprise) {
if (!file_exists($config["homedir"]."/enterprise/extensions/disabled"))
{
if (!file_exists($config["homedir"]."/enterprise/extensions/disabled")) {
mkdir($config["homedir"]."/enterprise/extensions/disabled");
}
}
else {
if (!file_exists($config["homedir"]."/extensions/disabled"))
{
if (!file_exists($config["homedir"]."/extensions/disabled")) {
mkdir($config["homedir"]."/extensions/disabled");
}
}
@ -123,7 +119,7 @@ if ($disabled != '') {
$source = $config["homedir"]."/extensions/" . $disabled;
$endFile = $config["homedir"]."/extensions/disabled/" . $disabled;
}
rename($source, $endFile);
@ -191,42 +187,43 @@ foreach ($extensions as $file => $extension) {
$on = html_print_image("images/dot_green.disabled.png", true);
$off = html_print_image("images/dot_red.disabled.png", true);
$data[] = '<i style="color: grey;">' . $file . '</i>';
//Get version of this extensions
if ($config['extensions'][$file]['operation_menu']) {
$data[] = $config['extensions'][$file]['operation_menu']['version'];
}
if ($config['extensions'][$file]['godmode_menu']) {
$data[] = $config['extensions'][$file]['godmode_menu']['version'];
}
if ($config['extensions'][$file]['extension_ope_tab']) {
$data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
} else if ($config['extensions'][$file]['extension_god_tab']) {
$data[] = $config['extensions'][$file]['extension_god_tab']['version'];
}
if ($config['extensions'][$file]['extension_ope_tab']) {
$data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
}
else if ($config['extensions'][$file]['extension_god_tab']) {
$data[] = $config['extensions'][$file]['extension_god_tab']['version'];
}
}
else {
$data[] = $file;
//Get version of this extension
if ($config['extensions'][$file]['operation_menu']) {
$data[] = $config['extensions'][$file]['operation_menu']['version'];
}
else if ($config['extensions'][$file]['godmode_menu']) {
$data[] = $config['extensions'][$file]['godmode_menu']['version'];
}
else if (isset($config['extensions'][$file]['extension_ope_tab'])) {
$data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
}
else if ($config['extensions'][$file]['extension_god_tab']) {
$data[] = $config['extensions'][$file]['extension_god_tab']['version'];
}
if ($config['extensions'][$file]['operation_menu']) {
$data[] = $config['extensions'][$file]['operation_menu']['version'];
}
else if ($config['extensions'][$file]['godmode_menu']) {
$data[] = $config['extensions'][$file]['godmode_menu']['version'];
}
else if (isset($config['extensions'][$file]['extension_ope_tab'])) {
$data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
}
else if ($config['extensions'][$file]['extension_god_tab']) {
$data[] = $config['extensions'][$file]['extension_god_tab']['version'];
}
}
if ($extension['enterprise']) {
@ -293,7 +290,7 @@ foreach ($extensions as $file => $extension) {
$data[] = '<a title="' . __('Delete') . '" href="index.php?sec=gextensions&amp;sec2=godmode/extensions&enterprise=' . (int)$extension['enterprise'] . '&delete='.$file.'" class="mn">' . html_print_image("images/cross.png", true) . '</a>' .
' <a title="' . __('Disable') . '" href="index.php?sec=gextensions&amp;sec2=godmode/extensions&enterprise=' . (int)$extension['enterprise'] . '&disabled='.$file.'" class="mn">' . html_print_image("images/lightbulb.png", true) . '</a>';
}
$table->data[] = $data;
}
html_print_table ($table);

View File

@ -38,14 +38,14 @@ $create = (string)get_parameter('create', 0);
$pure = get_parameter('pure', 0);
if ($id){
if ($id) {
$permission = netflow_check_filter_group ($id);
if (!$permission) { //no tiene permisos para acceder a un filtro
require ($config['homedir'] . "/general/noaccess.php");
return;
}
}
//Header
if (! defined ('METACONSOLE')) {
$buttons['edit'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_edit">'
@ -55,13 +55,14 @@ if (! defined ('METACONSOLE')) {
$buttons['add'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_edit_form">'
. html_print_image ("images/add.png", true, array ("title" => __('Add filter')))
. '</a>';
ui_print_page_header (__('Netflow Filter'), "images/networkmap/so_cisco_new.png", false, "", true, $buttons);
} else {
}
else {
$nav_bar = array(array('link' => 'index.php?sec=main', 'text' => __('Main')),
array('link' => 'index.php?sec=netf&sec2=' . $config['homedir'] . '/godmode/netflow/nf_edit', 'text' => __('Netflow filters')),
array('link' => 'index.php?sec=netf&sec2=' . $config['homedir'] . '/godmode/netflow/nf_edit_form', 'text' => __('Add filter')));
array('link' => 'index.php?sec=netf&sec2=' . $config['homedir'] . '/godmode/netflow/nf_edit', 'text' => __('Netflow filters')),
array('link' => 'index.php?sec=netf&sec2=' . $config['homedir'] . '/godmode/netflow/nf_edit_form', 'text' => __('Add filter')));
ui_meta_print_page_header($nav_bar);
ui_meta_print_header(__("Netflow filters"));
@ -141,16 +142,15 @@ if ($create) {
$advanced_filter = (string) get_parameter('advanced_filter', '');
$values = array (
'id_name'=>$name,
'id_group' => $assign_group,
'ip_dst'=>$ip_dst,
'ip_src'=>$ip_src,
'dst_port'=>$dst_port,
'src_port'=>$src_port,
'aggregate'=>$aggregate,
'advanced_filter'=>$advanced_filter,
'output'=>$output
);
'id_name'=>$name,
'id_group' => $assign_group,
'ip_dst'=>$ip_dst,
'ip_src'=>$ip_src,
'dst_port'=>$dst_port,
'src_port'=>$src_port,
'aggregate'=>$aggregate,
'advanced_filter'=>$advanced_filter,
'output'=>$output);
// Save filter args
$values['filter_args'] = netflow_get_filter_arguments ($values);

View File

@ -141,21 +141,21 @@ if ($add_module) {
$id_modules = get_parameter('module');
$id_agents = get_parameter('id_agents');
$weight = get_parameter('weight');
//Id modules has double entities conversion
//Safe output remove all entities
io_safe_output_array($id_modules, "");
io_safe_output_array($id_modules, "");
//We need to put the entities again
//to browse in db
io_safe_input_array($id_modules);
$id_agent_modules = db_get_all_rows_sql("SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN (".
implode(',', $id_agents).
") AND nombre IN ('".
implode("','", $id_modules).
"')");
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
foreach($id_agent_modules as $id_agent_module)
$result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight));
@ -189,9 +189,9 @@ if ($edit_graph) {
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id=' . $id_graph . '">' .
html_print_image("images/chart_curve.png", true, array ("title" => __('View graph'))) .'</a>')
);
$buttons[$active_tab]['active'] = true;
$graphInTgraph = db_get_row_sql("SELECT name FROM tgraph WHERE id_graph = " . $id_graph);
$name = $graphInTgraph['name'];
}

View File

@ -99,7 +99,7 @@ if ((isset ($_GET["form_add"])) || (isset ($_GET["form_edit"]))) {
// Create news
echo '<table class="databox" cellpadding="4" cellspacing="4" width="98%">';
echo '<table class="databox" cellpadding="4" cellspacing="4" width="98%">';
echo '<form name="ilink" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/news">';
if ($creation_mode == 1)
echo "<input type='hidden' name='create' value='1'>";
@ -119,7 +119,7 @@ if ((isset ($_GET["form_add"])) || (isset ($_GET["form_edit"]))) {
<textarea rows=4 cols=50 name="text" >';
echo $text;
echo '</textarea></td>';
echo '</tr>';
echo '</tr>';
echo "</table>";
echo "<table width='98%'>";
echo "<tr><td align='right'>";
@ -145,7 +145,7 @@ else {
echo "<th>".__('Timestamp')."</th>";
echo "<th>".__('Delete')."</th>";
$color = 1;
foreach ($rows as $row) {

View File

@ -108,8 +108,8 @@ if ($config["integria_enabled"]) {
$bad_input = true;
}
$inventories = array();
// Right connection but theres is no inventories
$inventories = array();
// Right connection but theres is no inventories
if ($invent == 'false') {
unset($invent);
$invent = array();
@ -178,7 +178,7 @@ if ($zone_selected == "") {
$timezones = timezone_identifiers_list();
foreach ($timezones as $timezone) {
if (strpos($timezone, $zone_selected) !== false) {
$timezone_n[$timezone] = $timezone;
$timezone_n[$timezone] = $timezone;
}
}
@ -292,12 +292,14 @@ $(document).ready (function () {
$("#zone").attr("disabled", true);
$("#timezone").attr("disabled", true);
$("input[name='acl_enterprise']").click(function(){
flag = $(this).is(':checked');
if (flag == true){
<?php echo "if (! confirm ('" . __('If Enterprise ACL System is enabled without rules you will lose access to Pandora FMS Console (even admin). Do you want to continue?') . "')) return false" ?>
}
});
$("input[name='acl_enterprise']").click(function() {
flag = $(this).is(':checked');
if (flag == true) {
<?php
echo "if (! confirm ('" . __('If Enterprise ACL System is enabled without rules you will lose access to Pandora FMS Console (even admin). Do you want to continue?') . "')) return false;";
?>
}
});
$("#change_timezone").click(function () {

View File

@ -2507,24 +2507,26 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array ();
$moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($content['id_agent_module']));
$moduletype_name = modules_get_moduletype_name(
modules_get_agentmodule_type(
$content['id_agent_module']));
if (preg_match ("/string/", $moduletype_name)) {
$urlImage = ui_get_full_url(false, false, false, false);
$data[0] = grafico_modulo_string ($content['id_agent_module'], $content['period'],
false, $sizgraph_w, $sizgraph_h, '', '', false, 1, false,
$report["datetime"], true, $urlImage);
}
}
else {
$data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'],
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
$report["datetime"], '', 0, 0, true, true, ui_get_full_url(false) . '/');
}
array_push ($table->data, $data);
break;
case 'projection_graph':
@ -2631,7 +2633,7 @@ $moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($c
$data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'],
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
$report["datetime"], '', true, 0, true, true, ui_get_full_url(false) . '/');
/*$data[0] = graphic_combined_module(
$modules,
$weights,
@ -2644,7 +2646,7 @@ $moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($c
0,
$graph["stacked"],
$report["datetime"]); */
array_push ($table->data, $data);
break;

View File

@ -108,17 +108,17 @@ function xml_file_agent_conf ($modules = array(), $file_temp, $position = 0, $id
function xml_file_event ($events = array(), $file_temp, $position = 0, $id_agent) {
$file = fopen($file_temp, 'a+');
foreach ($events as $event) {
$content_report = " <object id=\"$position\">\n";
$content_report .= " <event>".$event['evento']."</event>\n";
$content_report .= " <event_type>".$event['event_type']."</event_type>\n";
$content_report .= " <criticity>".get_priority_name($event['criticity'])."</criticity>\n";
$content_report .= " <count>".$event['count_rep']."</count>\n";
$content_report .= " <timestamp>".$event['time2']."</timestamp>\n";
$content_report .= " <module_name>".modules_get_agentmodule_name ($event['id_agentmodule'])."</module_name>\n";
$content_report .= " <agent_name>".agents_get_name ($id_agent)."</agent_name>\n";
$content_report .= " <event>" . io_safe_output($event['evento']) . "</event>\n";
$content_report .= " <event_type>" . $event['event_type'] . "</event_type>\n";
$content_report .= " <criticity>" . get_priority_name($event['criticity']) . "</criticity>\n";
$content_report .= " <count>" . $event['count_rep'] . "</count>\n";
$content_report .= " <timestamp>" . $event['time2'] . "</timestamp>\n";
$content_report .= " <module_name>" . io_safe_output(modules_get_agentmodule_name ($event['id_agentmodule'])) . "</module_name>\n";
$content_report .= " <agent_name>" . io_safe_output(agents_get_name ($id_agent)) . "</agent_name>\n";
if ($event['estado'] == 0)
$status = __('New');
@ -128,13 +128,13 @@ function xml_file_event ($events = array(), $file_temp, $position = 0, $id_agent
$status = __('In process');
else
$status = "";
$content_report .= " <event_status>".$status."</event_status>\n";
$content_report .= " <user_comment>".$event['user_comment']."</user_comment>\n";
$content_report .= " <tags>".$event['tags']."</tags>\n";
$content_report .= " <event_source>".$event['source']."</event_source>\n";
$content_report .= " <extra_id>".$event['id_extra']."</extra_id>\n";
$content_report .= " <user_validation>".$event['owner_user']."</user_validation>\n";
$content_report .= " <event_status>".$status."</event_status>\n";
$content_report .= " <user_comment>".$event['user_comment']."</user_comment>\n";
$content_report .= " <tags>".$event['tags']."</tags>\n";
$content_report .= " <event_source>".$event['source']."</event_source>\n";
$content_report .= " <extra_id>".$event['id_extra']."</extra_id>\n";
$content_report .= " <user_validation>".$event['owner_user']."</user_validation>\n";
$content_report .= " </object>\n";
$result = fwrite($file, $content_report);
@ -149,7 +149,7 @@ function xml_file_event ($events = array(), $file_temp, $position = 0, $id_agent
function xml_file_graph ($data_module = array(), $file_temp, $position = 0) {
$file = fopen($file_temp, 'a+');
foreach ($data_module as $data_m) {
$content_report = " <object id=\"$position\">\n";

View File

@ -191,7 +191,7 @@ $(document).ready (function () {
minuteText: '<?php echo __('Minute');?>',
secondText: '<?php echo __('Second');?>',
currentText: '<?php echo __('Now');?>',
closeText: '<?php echo __('Close');?>'});
closeText: '<?php echo __('Close');?>'});
$('[id^=text-date_init]').datepicker ({changeMonth: true, changeYear: true, showAnim: "slideDown"});
@ -225,7 +225,10 @@ if ($datetime === false || $datetime == -1) {
return;
}
// TODO: Evaluate if it's better to render blocks when are calculated (enabling realtime flush) or if it's better to wait report to be finished before showing anything (this could break the execution by overflowing the running PHP memory on HUGE reports).
// TODO: Evaluate if it's better to render blocks when are calculated
// (enabling realtime flush) or if it's better to wait report to be
// finished before showing anything (this could break the execution
// by overflowing the running PHP memory on HUGE reports).
$table->size = array ();
@ -267,7 +270,7 @@ foreach ($contents as $content) {
if ($datetime_init >= $datetime) {
$datetime_init = $date_init_less;
}
$new_interval = $report['datetime'] - $datetime_init;
$new_interval = $report['datetime'] - $datetime_init;
$content['period'] = $new_interval;
}

View File

@ -612,12 +612,17 @@ foreach ($contents as $content) {
$result = fwrite($file, $content_report);
fclose($file);
$sql = sprintf ('SELECT evento, event_type, criticity, count(*) as count_rep,
max(timestamp) AS time2, id_agentmodule, estado, user_comment, tags, source, id_extra, owner_user
FROM tevento
WHERE id_agente = %d AND utimestamp > %d AND utimestamp <= %d
GROUP BY id_agentmodule, evento
ORDER BY time2 DESC', $content['id_agent'], $datelimit, $date);
$sql = sprintf ('
SELECT evento, event_type, criticity,
count(*) AS count_rep, max(timestamp) AS time2,
id_agentmodule, estado, user_comment, tags,
source, id_extra, owner_user
FROM tevento
WHERE id_agente = %d AND utimestamp > %d
AND utimestamp <= %d
GROUP BY id_agentmodule, evento
ORDER BY time2 DESC', $content['id_agent'],
$datelimit, $date);
$events = db_get_all_rows_sql ($sql);
xml_file_event ($events, $temp_file,0, $content['id_agent']);