From 01997ff479428d9ff3fa0fa86a1c387dee75ac13 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 30 Apr 2018 15:34:18 +0200 Subject: [PATCH 1/7] Added a select component to choose a timezone --- pandora_console/include/functions_html.php | 126 +++++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 04cd81e0dd..a941a96790 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2336,4 +2336,130 @@ function html_print_autocomplete_modules($name = 'module', echo $output; } } + +/** + * @param string Select form name + * @param string Current selected value + * + * @return string HTML code + */ +function html_print_timezone_select ($name, $selected = "") { + $timezones = array( + "Pacific/Midway" => "(GMT-11:00) " . __("Midway Island"), + "US/Samoa" => "(GMT-11:00) " . __("Samoa"), + "US/Hawaii" => "(GMT-10:00) " . __("Hawaii"), + "US/Alaska" => "(GMT-09:00) " . __("Alaska"), + "US/Pacific" => "(GMT-08:00) " . __("Pacific Time (US & Canada)"), + "America/Tijuana" => "(GMT-08:00) " . __("Tijuana"), + "US/Arizona" => "(GMT-07:00) " . __("Arizona"), + "US/Mountain" => "(GMT-07:00) " . __("Mountain Time (US & Canada)"), + "America/Chihuahua" => "(GMT-07:00) " . __("Chihuahua"), + "America/Mazatlan" => "(GMT-07:00) " . __("Mazatlan"), + "America/Mexico_City" => "(GMT-06:00) " . __("Mexico City"), + "America/Monterrey" => "(GMT-06:00) " . __("Monterrey"), + "Canada/Saskatchewan" => "(GMT-06:00) " . __("Saskatchewan"), + "US/Central" => "(GMT-06:00) " . __("Central Time (US & Canada)"), + "US/Eastern" => "(GMT-05:00) " . __("Eastern Time (US & Canada)"), + "US/East-Indiana" => "(GMT-05:00) " . __("Indiana (East)"), + "America/Bogota" => "(GMT-05:00) " . __("Bogota"), + "America/Lima" => "(GMT-05:00) " . __("Lima"), + "America/Caracas" => "(GMT-04:30) " . __("Caracas"), + "Canada/Atlantic" => "(GMT-04:00) " . __("Atlantic Time (Canada)"), + "America/La_Paz" => "(GMT-04:00) " . __("La Paz"), + "America/Santiago" => "(GMT-04:00) " . __("Santiago"), + "Canada/Newfoundland" => "(GMT-03:30) " . __("Newfoundland"), + "America/Buenos_Aires" => "(GMT-03:00) " . __("Buenos Aires"), + "Greenland'" => "(GMT-03:00) " . __("Greenland"), + "Atlantic/Stanley" => "(GMT-02:00) " . __("Stanley"), + "Atlantic/Azores" => "(GMT-01:00) " . __("Azores"), + "Atlantic/Cape_Verde" => "(GMT-01:00) " . __("Cape Verde Is."), + "Africa/Casablanca" => "(GMT+00:00) " . __("Casablanca"), + "Europe/Dublin" => "(GMT+00:00) " . __("Dublin"), + "Europe/Lisbon" => "(GMT+00:00) " . __("Lisbon"), + "Europe/London" => "(GMT+00:00) " . __("London"), + "Africa/Monrovia" => "(GMT+00:00) " . __("Monrovia"), + "Europe/Amsterdam" => "(GMT+01:00) " . __("Amsterdam"), + "Europe/Belgrade" => "(GMT+01:00) " . __("Belgrade"), + "Europe/Berlin" => "(GMT+01:00) " . __("Berlin"), + "Europe/Bratislava" => "(GMT+01:00) " . __("Bratislava"), + "Europe/Brussels" => "(GMT+01:00) " . __("Brussels"), + "Europe/Budapest" => "(GMT+01:00) " . __("Budapest"), + "Europe/Copenhagen" => "(GMT+01:00) " . __("Copenhagen"), + "Europe/Ljubljana" => "(GMT+01:00) " . __("Ljubljana"), + "Europe/Madrid" => "(GMT+01:00) " . __("Madrid"), + "Europe/Paris" => "(GMT+01:00) " . __("Paris"), + "Europe/Prague" => "(GMT+01:00) " . __("Prague"), + "Europe/Rome" => "(GMT+01:00) " . __("Rome"), + "Europe/Sarajevo" => "(GMT+01:00) " . __("Sarajevo"), + "Europe/Skopje" => "(GMT+01:00) " . __("Skopje"), + "Europe/Stockholm" => "(GMT+01:00) " . __("Stockholm"), + "Europe/Vienna" => "(GMT+01:00) " . __("Vienna"), + "Europe/Warsaw" => "(GMT+01:00) " . __("Warsaw"), + "Europe/Zagreb" => "(GMT+01:00) " . __("Zagreb"), + "Europe/Athens" => "(GMT+02:00) " . __("Athens"), + "Europe/Bucharest" => "(GMT+02:00) " . __("Bucharest"), + "Africa/Cairo" => "(GMT+02:00) " . __("Cairo"), + "Africa/Harare" => "(GMT+02:00) " . __("Harare"), + "Europe/Helsinki" => "(GMT+02:00) " . __("Helsinki"), + "Europe/Istanbul" => "(GMT+02:00) " . __("Istanbul"), + "Asia/Jerusalem" => "(GMT+02:00) " . __("Jerusalem"), + "Europe/Kiev" => "(GMT+02:00) " . __("Kyiv"), + "Europe/Minsk" => "(GMT+02:00) " . __("Minsk"), + "Europe/Riga" => "(GMT+02:00) " . __("Riga"), + "Europe/Sofia" => "(GMT+02:00) " . __("Sofia"), + "Europe/Tallinn" => "(GMT+02:00) " . __("Tallinn"), + "Europe/Vilnius" => "(GMT+02:00) " . __("Vilnius"), + "Asia/Baghdad" => "(GMT+03:00) " . __("Baghdad"), + "Asia/Kuwait" => "(GMT+03:00) " . __("Kuwait"), + "Africa/Nairobi" => "(GMT+03:00) " . __("Nairobi"), + "Asia/Riyadh" => "(GMT+03:00) " . __("Riyadh"), + "Europe/Moscow" => "(GMT+03:00) " . __("Moscow"), + "Asia/Tehran" => "(GMT+03:30) " . __("Tehran"), + "Asia/Baku" => "(GMT+04:00) " . __("Baku"), + "Europe/Volgograd" => "(GMT+04:00) " . __("Volgograd"), + "Asia/Muscat" => "(GMT+04:00) " . __("Muscat"), + "Asia/Tbilisi" => "(GMT+04:00) " . __("Tbilisi"), + "Asia/Yerevan" => "(GMT+04:00) " . __("Yerevan"), + "Asia/Kabul" => "(GMT+04:30) " . __("Kabul"), + "Asia/Karachi" => "(GMT+05:00) " . __("Karachi"), + "Asia/Tashkent" => "(GMT+05:00) " . __("Tashkent"), + "Asia/Kolkata" => "(GMT+05:30) " . __("Kolkata"), + "Asia/Kathmandu" => "(GMT+05:45) " . __("Kathmandu"), + "Asia/Yekaterinburg" => "(GMT+06:00) " . __("Ekaterinburg"), + "Asia/Almaty" => "(GMT+06:00) " . __("Almaty"), + "Asia/Dhaka" => "(GMT+06:00) " . __("Dhaka"), + "Asia/Novosibirsk" => "(GMT+07:00) " . __("Novosibirsk"), + "Asia/Bangkok" => "(GMT+07:00) " . __("Bangkok"), + "Asia/Jakarta" => "(GMT+07:00) " . __("Jakarta"), + "Asia/Krasnoyarsk" => "(GMT+08:00) " . __("Krasnoyarsk"), + "Asia/Chongqing" => "(GMT+08:00) " . __("Chongqing"), + "Asia/Hong_Kong" => "(GMT+08:00) " . __("Hong Kong"), + "Asia/Kuala_Lumpur" => "(GMT+08:00) " . __("Kuala Lumpur"), + "Australia/Perth" => "(GMT+08:00) " . __("Perth"), + "Asia/Singapore" => "(GMT+08:00) " . __("Singapore"), + "Asia/Taipei" => "(GMT+08:00) " . __("Taipei"), + "Asia/Ulaanbaatar" => "(GMT+08:00) " . __("Ulaan Bataar"), + "Asia/Urumqi" => "(GMT+08:00) " . __("Urumqi"), + "Asia/Irkutsk" => "(GMT+09:00) " . __("Irkutsk"), + "Asia/Seoul" => "(GMT+09:00) " . __("Seoul"), + "Asia/Tokyo" => "(GMT+09:00) " . __("Tokyo"), + "Australia/Adelaide" => "(GMT+09:30) " . __("Adelaide"), + "Australia/Darwin" => "(GMT+09:30) " . __("Darwin"), + "Asia/Yakutsk" => "(GMT+10:00) " . __("Yakutsk"), + "Australia/Brisbane" => "(GMT+10:00) " . __("Brisbane"), + "Australia/Canberra" => "(GMT+10:00) " . __("Canberra"), + "Pacific/Guam" => "(GMT+10:00) " . __("Guam"), + "Australia/Hobart" => "(GMT+10:00) " . __("Hobart"), + "Australia/Melbourne" => "(GMT+10:00) " . __("Melbourne"), + "Pacific/Port_Moresby" => "(GMT+10:00) " . __("Port Moresby"), + "Australia/Sydney" => "(GMT+10:00) " . __("Sydney"), + "Asia/Vladivostok" => "(GMT+11:00) " . __("Vladivostok"), + "Asia/Magadan" => "(GMT+12:00) " . __("Magadan"), + "Pacific/Auckland" => "(GMT+12:00) " . __("Auckland"), + "Pacific/Fiji" => "(GMT+12:00) " . __("Fiji"), + ); + + return html_print_select($timezones, $name, $selected, "", __("None"), "", true, false, false); +} + ?> From 26338dab4fb56f15a9ebc593c4dd500d3c72d0c2 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 30 Apr 2018 15:34:46 +0200 Subject: [PATCH 2/7] Add timezone selection to the user profile --- pandora_console/operation/users/user_edit.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index f5d1057941..eb72aaa9a6 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -76,6 +76,7 @@ if (isset ($_GET["modified"]) && !$view_mode) { $upd_info["phone"] = get_parameter_post ("phone", $user_info["phone"]); $upd_info["comments"] = get_parameter_post ("comments", $user_info["comments"]); $upd_info["language"] = get_parameter_post ("language", $user_info["language"]); + $upd_info["timezone"] = get_parameter_post ("timezone", ""); $upd_info["id_skin"] = get_parameter ("skin", $user_info["id_skin"]); $upd_info["id_filter"] = get_parameter ("event_filter",NULL); $upd_info["block_size"] = get_parameter ("block_size", $config["block_size"]); @@ -271,8 +272,10 @@ else $usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group)); $id_usr = $config['id_user']; + +$data = array(); + if (!$meta) { - $data = array(); $data[0] = ''.__('Home screen'). ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true).''; $values = array ( 'Default' =>__('Default'), @@ -326,10 +329,18 @@ if (!$meta) { $data[1] .= $jump . ''. skins_print_select($id_usr,'skin', $user_info['id_skin'], '', __('None'), 0, true).''; } } - $table->rowclass[] = ''; - $table->rowstyle[] = 'font-weight: bold;'; - $table->data[] = $data; } +else { + $data[0] = ""; + $data[1] = ""; +} + +$data[2] = ''.__('Timezone').''; +$data[2] .= $jump . html_print_timezone_select("timezone", $user_info["timezone"]); + +$table->rowclass[] = ''; +$table->rowstyle[] = 'font-weight: bold;'; +$table->data[] = $data; // Double auth $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']); From 0b1546be221c54f45aecf84dfeb711ab005bb85e Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 30 Apr 2018 15:35:41 +0200 Subject: [PATCH 3/7] Fixed a date --- pandora_console/include/functions_events.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index e9faaba84e..5549c3508e 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2467,11 +2467,12 @@ function events_page_general ($event) { $data = array(); $data[0] = __('Timestamp'); + if ($group_rep == 1 && $event["event_rep"] > 1) { $data[1] = __('First event').': '.date ($config["date_format"], $event['timestamp_first']).'
'.__('Last event').': '.date ($config["date_format"], $event['timestamp_last']); } else { - $data[1] = date ($config["date_format"], strtotime($event["timestamp"])); + $data[1] = date ($config["date_format"], $event["utimestamp"]); } $table_general->data[] = $data; From f1985313ab4479ea975fbefc87bce7a85fd67a71 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 7 May 2018 16:10:31 +0200 Subject: [PATCH 4/7] The audit view and csv now use the user defined timezone --- pandora_console/godmode/admin_access_logs.php | 3 ++- pandora_console/include/functions.php | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index c3a8c9d0b0..7f359ef2c5 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -245,7 +245,8 @@ foreach ($result as $row) { } $data[1] = ui_print_session_action_icon ($row['accion'], true); $data[1] .= $row["accion"]; - $data[2] = ui_print_help_tip($row['fecha'], true) . ui_print_timestamp($row['utimestamp'], true); + $data[2] = ui_print_help_tip(date($config["date_format"], $row['utimestamp']), true) + . ui_print_timestamp($row['utimestamp'], true); switch ($config['dbtype']) { case "mysql": case "postgresql": diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 6c4d0a8199..9510036021 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2359,7 +2359,11 @@ function print_audit_csv ($data) { __('Source ID') . ';' . __('Comments') ."\n"; foreach ($data as $line) { - echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n"; + echo io_safe_output($line['id_usuario']) . ';' + . io_safe_output($line['accion']) . ';' + . date($config["date_format"], $line['utimestamp']) . ';' + . $line['ip_origen'] . ';' + . io_safe_output($line['descripcion']). "\n"; } exit; From 6bc8cee2375c82ee1586d75ffbe8ff72a882f090 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 10 May 2018 11:43:03 +0200 Subject: [PATCH 5/7] Added the user defined timezone to some dates --- pandora_console/general/logon_ok.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 3a43795fd5..34b19dad9f 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -230,19 +230,19 @@ if (!empty($all_data)) { switch ($config["dbtype"]) { case "mysql": - $sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion,utimestamp + $sql = sprintf ("SELECT id_usuario,accion, ip_origen,descripcion,utimestamp FROM tsesion WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - " . SECONDS_1WEEK . ") AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]); break; case "postgresql": - $sql = sprintf ("SELECT \"id_usuario\", accion, fecha, \"ip_origen\", descripcion, utimestamp + $sql = sprintf ("SELECT \"id_usuario\", accion, \"ip_origen\", descripcion, utimestamp FROM tsesion WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - " . SECONDS_1WEEK . ") AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config["id_user"]); break; case "oracle": - $sql = sprintf ("SELECT id_usuario, accion, fecha, ip_origen, descripcion, utimestamp + $sql = sprintf ("SELECT id_usuario, accion, ip_origen, descripcion, utimestamp FROM tsesion WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - " . SECONDS_1WEEK . ") AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config["id_user"]); @@ -272,7 +272,8 @@ if (!empty($all_data)) { $data[0] = '' . $session_id_usuario . ''; $data[1] = ui_print_session_action_icon ($session['accion'], true) . ' ' . $session['accion']; - $data[2] = ui_print_help_tip($session['fecha'], true) . human_time_comparation($session['utimestamp'], 'tiny'); + $data[2] = ui_print_help_tip(date($config["date_format"], $session['utimestamp']), true) + . human_time_comparation($session['utimestamp'], 'tiny'); $data[3] = $session_ip_origen; $description = str_replace(array(',', ', '), ', ', $session['descripcion']); $data[4] = '
' . io_safe_output($description) . '
'; @@ -427,19 +428,19 @@ $options = array(); switch ($config["dbtype"]) { case "mysql": - $sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion,utimestamp + $sql = sprintf ("SELECT id_usuario,accion,ip_origen,descripcion,utimestamp FROM tsesion WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - " . SECONDS_1WEEK . ") AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]); break; case "postgresql": - $sql = sprintf ("SELECT \"id_usuario\", accion, fecha, \"ip_origen\", descripcion, utimestamp + $sql = sprintf ("SELECT \"id_usuario\", accion, \"ip_origen\", descripcion, utimestamp FROM tsesion WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - " . SECONDS_1WEEK . ") AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config["id_user"]); break; case "oracle": - $sql = sprintf ("SELECT id_usuario, accion, fecha, ip_origen, descripcion, utimestamp + $sql = sprintf ("SELECT id_usuario, accion, ip_origen, descripcion, utimestamp FROM tsesion WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - " . SECONDS_1WEEK . ") AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config["id_user"]); @@ -470,7 +471,8 @@ $options = array(); $data[0] = '' . $session_id_usuario . ''; $data[1] = ui_print_session_action_icon ($session['accion'], true); $data[2] = $session['accion']; - $data[3] = ui_print_help_tip($session['fecha'], true) . human_time_comparation($session['utimestamp'], 'tiny'); + $data[3] = ui_print_help_tip(date($config["date_format"], $session['utimestamp']), true) + . human_time_comparation($session['utimestamp'], 'tiny'); $data[4] = $session_ip_origen; $data[5] = io_safe_output ($session['descripcion']); From fac3e21829aa36c361a2ac153afa7c2d8749c8b9 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 11 Jun 2018 16:40:10 +0200 Subject: [PATCH 6/7] Added a lot of fixes to the dates stored as strings without timezone information to made them use the user timezone --- pandora_console/extensions/insert_data.php | 65 ++++++++++--------- pandora_console/godmode/admin_access_logs.php | 3 +- .../agentes/planned_downtime.editor.php | 19 ++++-- .../alerts/configure_alert_template.php | 4 ++ .../reporting_builder.item_editor.php | 3 +- .../godmode/servers/servers.build_table.php | 2 +- pandora_console/godmode/setup/news.php | 32 ++++----- .../godmode/users/configure_user.php | 9 ++- pandora_console/include/ajax/module.php | 11 ++-- pandora_console/include/functions.php | 59 ++++++++++++++++- pandora_console/include/functions_agents.php | 21 ++---- pandora_console/include/functions_alerts.php | 8 +-- pandora_console/include/functions_api.php | 4 +- pandora_console/include/functions_events.php | 16 ++--- pandora_console/include/functions_ui.php | 18 ++++- pandora_console/mobile/include/user.class.php | 2 + pandora_console/mobile/operation/agents.php | 8 ++- pandora_console/mobile/operation/events.php | 2 +- .../agentes/estado_generalagente.php | 2 +- .../operation/agentes/exportdata.php | 27 +++++--- .../operation/agentes/gis_view.php | 4 +- .../operation/events/events.build_query.php | 37 +++++------ .../operation/events/export_csv.php | 36 +++++++--- pandora_console/operation/gis_maps/ajax.php | 4 +- .../operation/incidents/incident_detail.php | 4 +- pandora_console/operation/search_agents.php | 4 +- 26 files changed, 258 insertions(+), 146 deletions(-) diff --git a/pandora_console/extensions/insert_data.php b/pandora_console/extensions/insert_data.php index 8357c96113..ff5b113627 100644 --- a/pandora_console/extensions/insert_data.php +++ b/pandora_console/extensions/insert_data.php @@ -25,7 +25,7 @@ function createXMLData($agent, $agentModule, $time, $data) { $xmlTemplate = " + " os_version='%s' interval='%d' version='%s' timestamp='%s' agent_name='%s' timezone_offset='0'> @@ -34,20 +34,22 @@ function createXMLData($agent, $agentModule, $time, $data) { "; - $xml = sprintf($xmlTemplate, io_safe_output(get_os_name($agent['id_os'])), - io_safe_output($agent['os_version']), $agent['intervalo'], - io_safe_output($agent['agent_version']), $time, + $xml = sprintf( + $xmlTemplate, + io_safe_output(get_os_name($agent['id_os'])), + io_safe_output($agent['os_version']), + $agent['intervalo'], + io_safe_output($agent['agent_version']), + $time, io_safe_output($agent['nombre']), - $agent['timezone_offset'], - io_safe_output($agentModule['nombre']), io_safe_output($agentModule['descripcion']), modules_get_type_name($agentModule['id_tipo_modulo']), $data); - - - if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['alias']) . '.' . strtotime($time) . '.data', $xml)) { - return false; - } - else { - return true; - } + io_safe_output($agentModule['nombre']), + io_safe_output($agentModule['descripcion']), + modules_get_type_name($agentModule['id_tipo_modulo']), + $data + ); + + $file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . str_replace($time, " ", "_") . ".data"; + return (bool) @file_put_contents($file_name, $xml); } function mainInsertData() { @@ -61,18 +63,12 @@ function mainInsertData() { return; } - $save = (bool)get_parameter('save', false); - $id_agent = (string)get_parameter('id_agent', ''); + $save = (bool) get_parameter("save"); + $agent_id = (int) get_parameter("agent_id"); + $agent_name = (string) get_parameter("agent_name"); - foreach ($_POST as $key => $value) { - if(strpos($key,"agent_autocomplete_idagent")!== false){ - $id_agente = $value; - } - } - - - $id_agent_module = (int)get_parameter('id_agent_module', ''); - $data = (string)get_parameter('data'); + $id_agent_module = (int) get_parameter("id_agent_module"); + $data = (string) get_parameter('data'); $date = (string) get_parameter('date', date(DATE_FORMAT)); $time = (string) get_parameter('time', date(TIME_FORMAT)); if (isset($_FILES['csv'])) { @@ -89,12 +85,11 @@ function mainInsertData() { if ($save) { - if (!check_acl($config['id_user'], agents_get_agent_group(agents_get_agent_id($id_agent)), "AW")) { + if (!check_acl($config['id_user'], agents_get_agent_group($agent_id), "AW")) { ui_print_error_message(__('You haven\'t privileges for insert data in the agent.')); } else { - - $agent = db_get_row_filter('tagente', array('id_agente' => $id_agente)); + $agent = db_get_row_filter('tagente', array('id_agente' => $agent_id)); $agentModule = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module)); $done = 0; @@ -104,7 +99,9 @@ function mainInsertData() { foreach ($file as $line) { $tokens = explode(';', $line); - $result = createXMLData($agent, $agentModule, trim($tokens[0]), trim($tokens[1])); + $utimestamp = strtotime(trim($tokens[0])) - get_fixed_offset(); + $timestamp = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp); + $result = createXMLData($agent, $agentModule, $timestamp, trim($tokens[1])); if ($result) { $done++; @@ -115,7 +112,9 @@ function mainInsertData() { } } else { - $result = createXMLData($agent, $agentModule, $date . ' ' . $time, $data); + $utimestamp = strtotime($date . " " . $time) - get_fixed_offset(); + $timestamp = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp); + $result = createXMLData($agent, $agentModule, $timestamp, $data); if ($result) { $done++; @@ -159,14 +158,16 @@ function mainInsertData() { $params = array(); $params['return'] = true; $params['show_helptip'] = true; - $params['input_name'] = 'id_agent'; - $params['value'] = $id_agent; + $params['input_name'] = 'agent_name'; + $params['value'] = $agent_name; $params['javascript_is_function_select'] = true; $params['javascript_name_function_select'] = 'custom_select_function'; $params['javascript_code_function_select'] = ''; $params['use_hidden_input_idagent'] = true; $params['print_hidden_input_idagent'] = true; $params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent'; + $params['hidden_input_idagent_name'] = 'agent_id'; + $params['hidden_input_idagent_value'] = $agent_id; $table->data[0][1] = ui_print_agent_autocomplete_input($params); diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index 5bfdfb4fcf..160eb1180c 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -232,7 +232,8 @@ foreach ($result as $row) { $data = array(); $data[0] = $row["id_usuario"]; $data[1] = ui_print_session_action_icon($row["accion"], true) . $row["accion"]; - $data[2] = ui_print_help_tip($row["fecha"], true) . ui_print_timestamp($row["utimestamp"], true); + $data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true) + . ui_print_timestamp($row["utimestamp"], true); $data[3] = $row["ip_origen"]; $data[4] = $row["descripcion"]; diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index d9646c5a98..0122f4e03a 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -60,15 +60,19 @@ $type_downtime = (string) get_parameter('type_downtime', 'quiet'); $type_execution = (string) get_parameter('type_execution', 'once'); $type_periodicity = (string) get_parameter('type_periodicity', 'weekly'); -$once_date_from = (string) get_parameter ('once_date_from', date(DATE_FORMAT)); -$once_time_from = (string) get_parameter ('once_time_from', date(TIME_FORMAT)); -$once_date_to = (string) get_parameter ('once_date_to', date(DATE_FORMAT)); -$once_time_to = (string) get_parameter ('once_time_to', date(TIME_FORMAT, time() + SECONDS_1HOUR)); +$utimestamp = get_system_time(); +// Fake utimestamp to retrieve the string date of the system +$system_time = $utimestamp - get_fixed_offset(); + +$once_date_from = (string) get_parameter ('once_date_from', date(DATE_FORMAT, $utimestamp)); +$once_time_from = (string) get_parameter ('once_time_from', date(TIME_FORMAT, $utimestamp)); +$once_date_to = (string) get_parameter ('once_date_to', date(DATE_FORMAT, $utimestamp)); +$once_time_to = (string) get_parameter ('once_time_to', date(TIME_FORMAT, $utimestamp + SECONDS_1HOUR)); $periodically_day_from = (int) get_parameter ('periodically_day_from', 1); $periodically_day_to = (int) get_parameter ('periodically_day_to', 31); -$periodically_time_from = (string) get_parameter ('periodically_time_from', date(TIME_FORMAT)); -$periodically_time_to = (string) get_parameter ('periodically_time_to', date(TIME_FORMAT, time() + SECONDS_1HOUR)); +$periodically_time_from = (string) get_parameter ('periodically_time_from', date(TIME_FORMAT, $system_time)); +$periodically_time_to = (string) get_parameter ('periodically_time_to', date(TIME_FORMAT, $system_time + SECONDS_1HOUR)); $monday = (bool) get_parameter ('monday'); $tuesday = (bool) get_parameter ('tuesday'); @@ -542,6 +546,7 @@ $table->data[5][1] = "