From bc221d321156dd0f78395b3f61a88d7921468920 Mon Sep 17 00:00:00 2001 From: guruevi Date: Wed, 24 Dec 2008 16:53:00 +0000 Subject: [PATCH] 2008-12-24 Evi Vanoost * include/functions_reporting.php, include/functions_db.php, include/functions_html.php, operation/agentes/datos_agente.php, operation/agentes/estado_agente.php, operation/agentes/estado_generalagente.php, operation/agentes/estado_grupo.php, operation/agentes/estado_monitores.php, operation/agentes/networkmap.php, operation/agentes/status_monitor.php, operation/incidents/incident_detail.php, operation/reporting/reporting_viewer.php, operation/reporting/reporting_xml.php, reporting/fgraph.php, godmode/db/db_audit.php, godmode/db/db_event.php, godmode/db/db_purge.php: Added get_system_time in favor of time (); * include/functions.php: Added get_system_time which gets the time from a source based on user preference * include/help/en/help_timesource.php: Explanation of timesource. * godmode/setup/setup.php, include/config_process.php: Added timesource selection and preference git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1310 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 22 +++++++++++++++ pandora_console/godmode/db/db_audit.php | 2 +- pandora_console/godmode/db/db_event.php | 2 +- pandora_console/godmode/db/db_purge.php | 2 +- pandora_console/godmode/setup/setup.php | 11 ++++++-- pandora_console/include/config_process.php | 5 ++++ pandora_console/include/functions.php | 23 ++++++++++++++- pandora_console/include/functions_db.php | 20 ++++++------- pandora_console/include/functions_html.php | 6 ++-- .../include/functions_reporting.php | 10 +++---- .../include/help/en/help_timesource.php | 28 +++++++++++++++++++ .../operation/agentes/datos_agente.php | 4 +-- .../operation/agentes/estado_agente.php | 2 +- .../agentes/estado_generalagente.php | 2 +- .../operation/agentes/estado_grupo.php | 2 +- .../operation/agentes/estado_monitores.php | 2 +- .../operation/agentes/networkmap.php | 2 +- .../operation/agentes/status_monitor.php | 12 ++++---- .../operation/incidents/incident_detail.php | 4 +-- .../operation/reporting/reporting_viewer.php | 2 +- .../operation/reporting/reporting_xml.php | 4 +-- pandora_console/reporting/fgraph.php | 12 ++++---- 22 files changed, 130 insertions(+), 49 deletions(-) create mode 100644 pandora_console/include/help/en/help_timesource.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 550853cf62..d6b1ef2e8c 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,25 @@ +2008-12-24 Evi Vanoost + + * include/functions_reporting.php, include/functions_db.php, + include/functions_html.php, operation/agentes/datos_agente.php, + operation/agentes/estado_agente.php, + operation/agentes/estado_generalagente.php, + operation/agentes/estado_grupo.php, operation/agentes/estado_monitores.php, + operation/agentes/networkmap.php, operation/agentes/status_monitor.php, + operation/incidents/incident_detail.php, + operation/reporting/reporting_viewer.php, + operation/reporting/reporting_xml.php, reporting/fgraph.php, + godmode/db/db_audit.php, godmode/db/db_event.php, godmode/db/db_purge.php: + Added get_system_time in favor of time (); + + * include/functions.php: Added get_system_time which gets the time from + a source based on user preference + + * include/help/en/help_timesource.php: Explanation of timesource. + + * godmode/setup/setup.php, include/config_process.php: Added timesource + selection and preference + 2008-12-24 Raul Mateos * index.php: Updated build, again due to the use of the new custom ID. diff --git a/pandora_console/godmode/db/db_audit.php b/pandora_console/godmode/db/db_audit.php index a63715e969..6ae681ae2a 100644 --- a/pandora_console/godmode/db/db_audit.php +++ b/pandora_console/godmode/db/db_audit.php @@ -29,7 +29,7 @@ if (! give_acl ($config['id_user'], 0, "DM")) { } // All data (now) -$time["all"] = time (); +$time["all"] = get_system_time (); // 1 day ago $time["1day"] = $time["all"]-86400; diff --git a/pandora_console/godmode/db/db_event.php b/pandora_console/godmode/db/db_event.php index 7174ee1db7..bbd3133976 100644 --- a/pandora_console/godmode/db/db_event.php +++ b/pandora_console/godmode/db/db_event.php @@ -70,7 +70,7 @@ echo '
'; -$time = time (); +$time = get_system_time (); $fields = array (); $fields[$time - 7776000] = __('Purge event data over 90 days'); $fields[$time - 2592000] = __('Purge event data over 30 days'); diff --git a/pandora_console/godmode/db/db_purge.php b/pandora_console/godmode/db/db_purge.php index 9770d08ec6..142174be8b 100644 --- a/pandora_console/godmode/db/db_purge.php +++ b/pandora_console/godmode/db/db_purge.php @@ -44,7 +44,7 @@ echo '

'.__('Database Maintenance').' > '.__('Database purge').'

'.__('Get data from agent').'

'; // All data (now) -$time["all"] = time (); +$time["all"] = get_system_time (); // 1 day ago $time["1day"] = $time["all"]-86400; diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 4f08b3f215..bd6b0e9258 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -53,6 +53,7 @@ if ($update_settings) { $config["trap2agent"] = (string) get_parameter ('trap2agent', $config["trap2agent"]); $config["autoupdate"] = (string) get_parameter ('autoupdate', $config["autoupdate"]); $config["prominent_time"] = (string) get_parameter ('prominent_time', $config["prominent_time"]); + $config["timesource"] = (string) get_parameter ('timesource', $config["timesource"]); $config["style"] = substr ($config["style"], 0, strlen ($config["style"]) - 4); @@ -74,6 +75,7 @@ if ($update_settings) { process_sql ("UPDATE tconfig SET VALUE='".$config["trap2agent"]."' WHERE token = 'trap2agent'"); process_sql ("UPDATE tconfig SET VALUE='".$config["autoupdate"]."' WHERE token = 'autoupdate'"); process_sql ("UPDATE tconfig SET VALUE='".$config["prominent_time"]."' WHERE token = 'prominent_time'"); + process_sql ("UPDATE tconfig SET VALUE='".$config["timesource"]."' WHERE token = 'timesource'"); } echo "

".__('Pandora Setup')." > "; @@ -134,8 +136,13 @@ $table->data[15][1] .= print_radio_button ('prominent_time', "timestamp", '', $ $table->data[15][1] .= '
'.__('Timestamp in rollover').' '; $table->data[15][1] .= print_radio_button ('prominent_time', "comparation", '', $config["prominent_time"], true); -$table->data[16][0] = __('Automatic update check'); -$table->data[16][1] = print_checkbox ('autoupdate', 1, $config["autoupdate"], true); +$table->data[16][0] = __('Time source') . pandora_help("timesource", true); +$sources["system"] = __('System'); +$sources["sql"] = __('Database'); +$table->data[16][1] = print_select ($sources, 'timesource', $config["timesource"], '', '', '', true); + +$table->data[17][0] = __('Automatic update check'); +$table->data[17][1] = print_checkbox ('autoupdate', 1, $config["autoupdate"], true); enterprise_hook ('load_snmpforward_enterprise'); diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 1c913a25a1..af844da9ef 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -142,4 +142,9 @@ if (!isset ($config["prominent_time"])) { process_sql ("INSERT INTO tconfig (token,value) VALUES ('prominent_time','comparation')"); } +if (!isset ($config["timesource"])) { + // Prominent time tells us what to show prominently when a timestamp is displayed. The comparation (... days ago) or the timestamp (full date) + $config["timesource"] = "system"; + process_sql ("INSERT INTO tconfig (token,value) VALUES ('timesource','system')"); +} ?> diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index ef44f51a94..173060e821 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -426,15 +426,36 @@ function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands * time and given timestamp. */ function human_time_comparation ($timestamp) { + global $config; + if (!is_numeric ($timestamp)) { $timestamp = strtotime ($timestamp); } - $seconds = time () - $timestamp; + $seconds = get_system_time () - $timestamp; return human_time_description_raw ($seconds); } +/** + * @function get_system_time + * @abstract This function gets the time from either system or sql based on preference and returns it + * @result Unix timestamp +**/ +function get_system_time () { + global $config; + + if ($config["timesource"] = "sql") { + $time = get_db_sql ("SELECT UNIX_TIMESTAMP()"); + if (empty ($time)) { + return time (); + } + return $time; + } else { + return time (); + } +} + /** * Transform an amount of time in seconds into a human readable * strings of minutes, hours or days. diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index ba07b903a7..fdac7fc52c 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -540,7 +540,7 @@ function dame_nombre_real ($id_user) { */ function get_monitor_downs_in_period ($id_agent_module, $period, $date = 0) { if ($date == 0) { - $date = time (); + $date = get_system_time (); } $datelimit = $date - $period; $sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE @@ -564,7 +564,7 @@ function get_monitor_downs_in_period ($id_agent_module, $period, $date = 0) { */ function get_monitor_last_down_timestamp_in_period ($id_agent_module, $period, $date = 0) { if ($date == 0) { - $date = time (); + $date = get_system_time (); } $datelimit = $date - $period; $sql = sprintf ("SELECT MAX(`timestamp`) FROM `tevento` WHERE @@ -685,7 +685,7 @@ function get_monitors_down ($monitors, $period = 0, $date = 0) { */ function get_alert_fires_in_period ($id_agent_module, $period, $date = 0) { if (!$date) - $date = time (); + $date = get_system_time (); $datelimit = $date - $period; $sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE `event_type` = 'alert_fired' @@ -729,7 +729,7 @@ function get_alerts_in_group ($id_group) { */ function get_alerts_fired ($alerts, $period = 0, $date = 0) { if (! $date) - $date = time (); + $date = get_system_time (); $datelimit = $date - $period; $alerts_fired = array (); @@ -755,7 +755,7 @@ function get_alerts_fired ($alerts, $period = 0, $date = 0) { */ function get_alert_last_fire_timestamp_in_period ($id_agent_module, $period, $date = 0) { if ($date == 0) { - $date = time (); + $date = get_system_time (); } $datelimit = $date - $period; $sql = sprintf ("SELECT MAX(`timestamp`) FROM `tevento` WHERE @@ -1648,7 +1648,7 @@ function get_previous_data ($id_agent_module, $utimestamp) { */ function get_agent_module_value_average ($id_agent_module, $period, $date = 0) { if (! $date) - $date = time (); + $date = get_system_time (); $datelimit = $date - $period; $sql = sprintf ("SELECT SUM(datos), COUNT(*) FROM tagente_datos @@ -1680,7 +1680,7 @@ function get_agent_module_value_average ($id_agent_module, $period, $date = 0) { */ function get_agent_module_value_max ($id_agent_module, $period, $date = 0) { if (! $date) - $date = time (); + $date = get_system_time (); $datelimit = $date - $period; $sql = sprintf ("SELECT MAX(datos) FROM tagente_datos @@ -1708,7 +1708,7 @@ function get_agent_module_value_max ($id_agent_module, $period, $date = 0) { */ function get_agent_module_value_min ($id_agent_module, $period, $date = 0) { if (! $date) - $date = time (); + $date = get_system_time (); $datelimit = $date - $period; $sql = sprintf ("SELECT MIN(datos) FROM tagente_datos @@ -1735,7 +1735,7 @@ function get_agent_module_value_min ($id_agent_module, $period, $date = 0) { */ function get_agent_module_value_sumatory ($id_agent_module, $period, $date = 0) { if (! $date) - $date = time (); + $date = get_system_time (); $datelimit = $date - $period; // limit date $id_module_type = get_db_value ('id_tipo_modulo', 'tagente_modulo','id_agente_modulo', $id_agent_module); $module_name = get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', $id_module_type); @@ -2146,7 +2146,7 @@ function get_server_info ($id_server = -1) { if (empty ($server["lag"])) { $server["lag"] = 0; } else { - $server["lag"] = time () - $server["lag"]; + $server["lag"] = get_system_time () - $server["lag"]; } //Push the raw data on the return stack diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index c41915d3f2..bea6649b83 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -777,10 +777,8 @@ function print_timestamp ($unixtime, $return = false, $option = array ()) { $tag = "span"; } - if (isset ($option["prominent"]) && $option["prominent"] == "timestamp") { - $prominent = "timestamp"; - } elseif (isset ($option["prominent"]) && $option["prominent"] == "comparation") { - $prominent = "comparation"; + if (!empty ($option["prominent"])) { + $prominent = $option["prominent"]; } else { $prominent = $config["prominent_time"]; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 08284a1dd5..7dd3efb883 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -30,7 +30,7 @@ */ function get_agent_module_sla ($id_agent_module, $period, $min_value, $max_value, $date = 0) { if (empty ($date)) - $date = time (); + $date = get_system_time (); if (empty ($period)) return false; //We can't calculate a 0 period (division by zero) @@ -158,7 +158,7 @@ function get_group_stats ($id_group) { $data["data_alerts_fire_count"] = 0; - $cur_time = time (); + $cur_time = get_system_time (); foreach ($result as $row) { $last_update = $cur_time - $row["utimestamp"]; @@ -293,8 +293,8 @@ function get_group_stats ($id_group) { */ function event_reporting ($id_group, $period, $date = 0, $return = false) { if (empty ($date)) { - $date = time (); - } elseif (!is_int ($date)) { + $date = get_system_time (); + } elseif (!is_numeric ($date)) { $date = strtotime ($date); } @@ -430,7 +430,7 @@ function alert_reporting ($id_group, $period = 0, $date = 0, $return = false) { */ function monitor_health_reporting ($id_group, $period = 0, $date = 0, $return = false) { if (empty ($date)) //If date is 0, false or empty - $date = time (); + $date = get_system_time (); $datelimit = $date - $period; $output = ''; diff --git a/pandora_console/include/help/en/help_timesource.php b/pandora_console/include/help/en/help_timesource.php new file mode 100644 index 0000000000..e309906e63 --- /dev/null +++ b/pandora_console/include/help/en/help_timesource.php @@ -0,0 +1,28 @@ +

+What source to use for the time. This can be (for now) either the local system (System) or database (Database).

+This is useful when your database is not on the same system as your webserver or your Pandora FMS servers. +In that case any time difference will miscalculate the time differences and timestamps. +You should use NTP to sync all your pandora servers and your MySQL server. +By using these preferences you don't have to sync your webserver but it's still recommended. +

+Feel free to implement more sources (eg: ntp, ldap, $_SERVER...) +

+Note: The database query will be cached the first time it's called so the time will always be the same on a page load throughout while System time is returned whenever the function is called which might differ slightly (especially near the ending of a second). +

+

+These examples are all returning Unixtime +
+
+ "timestamp"); +?> +Current System time: +
+Current Database time: +
+Your browser time: +

\ No newline at end of file diff --git a/pandora_console/operation/agentes/datos_agente.php b/pandora_console/operation/agentes/datos_agente.php index af3a1452e5..f9d961ef6d 100644 --- a/pandora_console/operation/agentes/datos_agente.php +++ b/pandora_console/operation/agentes/datos_agente.php @@ -44,10 +44,10 @@ if (isset ($_GET["delete"])) { // Different query for string data type if (preg_match ("/string/", get_moduletype_name (get_agentmodule_type ($module_id)))) { - $sql = sprintf ("SELECT * FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY timestamp DESC", $module_id, time () - $period); + $sql = sprintf ("SELECT * FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY timestamp DESC", $module_id, get_system_time () - $period); $string_type = 1; } else { - $sql = sprintf ("SELECT * FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY timestamp DESC", $module_id, time () - $period); + $sql = sprintf ("SELECT * FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY timestamp DESC", $module_id, get_system_time () - $period); $string_type = 0; } diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 6908db64da..a5b2c4605c 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -192,7 +192,7 @@ if ($agents !== false) { $numero_datamodules = 0; $estado_cambio = 0; $agent_down = 0; - $now = time (); + $now = get_system_time (); // Calculate module/monitor totals for this agent foreach ($modules as $module) { diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index e34618480c..7961e701ca 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -110,7 +110,7 @@ if ($agent["ultimo_contacto_remoto"] == "0000-00-00 00:00:00") { echo ''; // Next contact (agent) -$difference = time () - strtotime ($agent["ultimo_contacto"]); +$difference = get_system_time () - strtotime ($agent["ultimo_contacto"]); $sql = sprintf ("SELECT MAX(module_interval) FROM tagente_modulo WHERE id_agente = %d", $id_agente); $max = (int) get_db_sql ($sql); if ($max > 0) { diff --git a/pandora_console/operation/agentes/estado_grupo.php b/pandora_console/operation/agentes/estado_grupo.php index 17fd75a235..05a928e65f 100644 --- a/pandora_console/operation/agentes/estado_grupo.php +++ b/pandora_console/operation/agentes/estado_grupo.php @@ -50,7 +50,7 @@ if (isset ($_GET["update_netgroup"])) { $groups = get_user_groups ($config['id_user']); $groups_info = array (); $total_agents = 0; -$now = time (); +$now = get_system_time (); // Prepare data to show // For each valid group for this user, take data from agent and modules foreach ($groups as $id_group => $group_name) { diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index d1330bd896..26bfead17b 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -91,7 +91,7 @@ foreach ($modules as $module) { $data[5] = "--"; } - $seconds = time () - $module["utimestamp"]; + $seconds = get_system_time () - $module["utimestamp"]; if ($module["current_interval"] > 0 && $module["utimestamp"] > 0 && $seconds >= ($module["current_interval"] * 2)) { $data[6] = ''; } else { diff --git a/pandora_console/operation/agentes/networkmap.php b/pandora_console/operation/agentes/networkmap.php index 4ceafd510f..79fc2fa21c 100644 --- a/pandora_console/operation/agentes/networkmap.php +++ b/pandora_console/operation/agentes/networkmap.php @@ -340,7 +340,7 @@ if($nooverlap) { $filename_map .= ".map"; $filename_img .= ".png"; -if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > time () - 300) { +if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) { $result = true; } else { $cmd = "echo " . escapeshellarg($graph) . " | $filter -Tcmapx -o".$filename_map." -Tpng -o".$filename_img; diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 55e0a256a9..cd95a73f32 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -182,7 +182,7 @@ $table->head[5] = __('Status'); $table->align[5] = "center"; $table->head[6] = __('Timestamp'); -$table->algin[6] = "center"; +$table->align[6] = "right"; foreach ($result as $row) { $data = array (); @@ -211,16 +211,16 @@ foreach ($result as $row) { $data[5] = ''; } - $seconds = time () - $row["utimestamp"]; + $seconds = get_system_time () - $row["utimestamp"]; + if ($seconds >= ($row["agent_interval"] * 2)) { - $data[6] = ''; + $option = array ("html_attr" => 'class="redb"'); } else { - $data[6] = ''; + $option = array (); } - $data[6] .= human_time_comparation ($row["utimestamp"]); - $data[6] .= ""; + $data[6] = print_timestamp ($row["utimestamp"], true, $option); array_push ($table->data, $data); } diff --git a/pandora_console/operation/incidents/incident_detail.php b/pandora_console/operation/incidents/incident_detail.php index 8621a7fb78..233858c0b6 100644 --- a/pandora_console/operation/incidents/incident_detail.php +++ b/pandora_console/operation/incidents/incident_detail.php @@ -32,8 +32,8 @@ if (! give_acl ($config["id_user"], 0, "IR")) { exit; } -$inicio = time (); //Just inits the variable -$actualizacion = time (); +$inicio = get_system_time (); //Just inits the variable +$actualizacion = get_system_time (); // EDITION MODE if (isset ($_GET["id"])) { diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index e8e9762a25..29fd601fff 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -113,7 +113,7 @@ if ($datetime === false || $datetime == -1) { return; } /* Date must not be older than now */ -if ($datetime > time ()) { +if ($datetime > get_system_time ()) { echo '

'.__('Selected date is older than current date').'

'; return; } diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index 7a7bfa6db4..bbde724834 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -134,7 +134,7 @@ if ($datetime === false || $datetime == -1) { exit; } /* Date must not be older than now */ -if ($datetime > time ()) { +if ($datetime > get_system_time ()) { echo "Date is larger than current time"; //Not translatable because this is an error message exit; } @@ -307,7 +307,7 @@ function xml_array ($array) { } } -$time = time (); +$time = get_system_time (); echo ''; echo ''.$time.''; echo ''.date ("r",$time).''; diff --git a/pandora_console/reporting/fgraph.php b/pandora_console/reporting/fgraph.php index 5011f5c149..bf12b0e267 100644 --- a/pandora_console/reporting/fgraph.php +++ b/pandora_console/reporting/fgraph.php @@ -95,7 +95,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width, $resolution = $config['graph_res'] * 50; // Number of "slices" we want in graph if (! $date) - $date = time (); + $date = get_system_time (); //$unix_timestamp = strtotime($mysql_timestamp) // Convert MYSQL format tio utime $fechatope = $date - $periodo; // limit date $horasint = $periodo / $resolution; // Each intervalo is $horasint seconds length @@ -401,7 +401,7 @@ function grafico_modulo_sparse ($id_agente_modulo, $periodo, $show_event, require_once 'Image/Graph.php'; if (empty ($date)) - $date = time (); + $date = get_system_time (); $resolution = $config["graph_res"] * 50; // Number of "slices" we want in graph $fechatope = $date - $periodo; @@ -883,15 +883,15 @@ function graphic_agentaccess ($id_agent, $periodo, $width, $height) { $Graph->done(); } -function graphic_string_data ($id_agent_module, $periodo, $width, $height, $pure = 0, $date = "") { +function graphic_string_data ($id_agent_module, $periodo, $width, $height, $pure = 0, $date = 0) { global $config; // $color = $config["color_graph1"]; //#437722"; // Green pandora 1.1 octopus color $color = "#437722"; - if ($date == "") - $date = time (); + if ($date == 0) + $date = get_system_time (); $resolution = $config["graph_res"] * 5; // Number of "slices" we want in graph $fechatope = $date - $periodo; $horasint = $periodo / $resolution; // Each intervalo is $horasint seconds length @@ -1452,7 +1452,7 @@ function grafico_db_agentes_purge ($id_agent, $width, $height) { } // All data (now) - $time["all"] = time (); + $time["all"] = get_system_time (); // 1 day ago $time["1day"] = $time["all"]-86400;