diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b0845169be..2597cebfa3 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2009-12-22 Miguel de Dios + + * include/functions_html.php: add debug function "f2str" that return as + string any call of function, for example "var_dump". + + *include/fgraph.php: into function "grafico_modulo_boolean" re-add alarms, + clean source code and show again the flash graph. + + *include/functions_db.php: fix the access to IP client, it used very + deprecate var, that clean of notice php message of error for this cause. + 2009-12-21 Ramon Novoa * include/api.php: Added an Enterprise API. diff --git a/pandora_console/include/fgraph.php b/pandora_console/include/fgraph.php index 13da9d87b0..aefdc9a77e 100644 --- a/pandora_console/include/fgraph.php +++ b/pandora_console/include/fgraph.php @@ -1233,8 +1233,7 @@ function grafico_modulo_boolean ($idModuleAgent, $period, $show_event, $date = 0 ) { global $config; global $graphic_type; - - /******WIP****************************************/ + $nameAgent = get_agentmodule_agent_name ($idModuleAgent); $idAgent = get_agent_id ($nameAgent); $nameModule = get_agentmodule_name ($idModuleAgent); @@ -1246,9 +1245,23 @@ function grafico_modulo_boolean ($idModuleAgent, $period, $show_event, $interval = (int) ($period / $resolution); - //TODO - //EVENTS AND ALERTS - //NEEED TO CODE + if ($show_event == 1) + $real_event = array (); + + if ($show_alert == 1) { + $alert_high = false; + $alert_low = false; + // If we want to show alerts limits + + $alert_high = get_db_value ('MAX(max_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo, true); + $alert_low = get_db_value ('MIN(min_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo, true); + + // if no valid alert defined to render limits, disable it + if (($alert_low === false || $alert_low === NULL) && + ($alert_high === false || $alert_high === NULL)) { + $show_alert = 0; + } + } $data = get_db_all_rows_filter ('tagente_datos', array ('id_agente_modulo' => $idModuleAgent, @@ -1313,9 +1326,24 @@ function grafico_modulo_boolean ($idModuleAgent, $period, $show_event, $max_value = 1; - if (! $graphic_type) - return fs_module_chart ($data, $width, $height, $avg_only, $resolution / 10, $time_format); - + //if flash graph + if (! $graphic_type) { + $graphPoints2 = array(); + foreach($graphPoints as $time => $value) { + $graphPoints2[] = array( + 'sum' => $value, + 'count' => 0, + 'timestamp_bottom' => $time, + 'timestamp_top' => ($time + $interval), + 'min' => 1, + 'max' => 1, + 'last' => 1, + 'events' => 0); + } + + return fs_module_chart ($graphPoints2, $width, $height, $avg_only, $resolution / 10, $time_format); + } + $engine = get_graph_engine ($period); $engine->width = $width; @@ -1337,10 +1365,7 @@ function grafico_modulo_boolean ($idModuleAgent, $period, $show_event, $engine->single_graph (); return; - - /******WIP****************************************/ - - } +} /** * Draw a graph of Module data of agent diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 0070524be7..81f833f5f7 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -1514,7 +1514,7 @@ function agent_delete_address ($id_agent, $ip_address) { process_sql ($sql); } $agent_name = get_agent_name($id_agent, ""); - audit_db ($config['id_user'], $REMOTE_ADDR, "Agent management", + audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management", "Deleted IP $ip_address from agent '$agent_name'"); // Need to change main address? @@ -2935,7 +2935,7 @@ function delete_agent ($id_agents, $disableACL = false) { //And at long last, the agent temp_sql_delete ("tagente", "id_agente", $id_agent); - audit_db ($config['id_user'], $REMOTE_ADDR, "Agent management", + audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management", "Deleted agent '$agent_name'"); diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 3fc937e5f6..4a40c742d4 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -40,6 +40,14 @@ function debugPrint ($var, $file = '') { } } +function f2str($function, $params) { + ob_start(); + + call_user_func_array($function, $params); + + return ob_get_clean(); +} + /** * Prints an array of fields in a popup menu of a form.