diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 441bf091ef..1b2c42e679 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,16 @@ +2013-06-11 Miguel de Dios + + * extensions/insert_data.php, + godmode/alerts/configure_alert_template.php, + godmode/reporting/reporting_builder.item_editor.php, + godmode/agentes/planned_downtime.editor.php, + include/ajax/module.php, include/constants.php, operation/tree.php, + operation/netflow/nf_live_view.php, + operation/reporting/reporting_viewer.php, + operation/reporting/graph_viewer.php, + operation/agentes/datos_agente.php: fixed the date and time format + and set a help tip to say the Pandora's format. + 2013-06-11 Miguel de Dios * include/functions_html.php: revert completly the diff --git a/pandora_console/extensions/insert_data.php b/pandora_console/extensions/insert_data.php index d1d4c3c671..e8a71c603a 100644 --- a/pandora_console/extensions/insert_data.php +++ b/pandora_console/extensions/insert_data.php @@ -39,7 +39,7 @@ function createXMLData($agent, $agentModule, $time, $data) { 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['nombre']) . '.' . strtotime($time) . '.data', $xml)) { return false; } @@ -52,7 +52,7 @@ function mainInsertData() { global $config; ui_print_page_header (__("Insert data"), "images/extensions.png", false, "", true, ""); - + if (! check_acl ($config['id_user'], 0, "AW") && ! is_user_admin ($config['id_user'])) { db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); @@ -63,8 +63,8 @@ function mainInsertData() { $id_agent = (string)get_parameter('id_agent', ''); $id_agent_module = (int)get_parameter('id_agent_module', ''); $data = (string)get_parameter('data'); - $date = (string) get_parameter ('date', date ('Y-m-d')); - $time = (string) get_parameter ('time', date ('h:00A')); + $date = (string) get_parameter('date', date(DATE_FORMAT)); + $time = (string) get_parameter('time', date(TIME_FORMAT)); if (isset($_FILES['csv'])) { if ($_FILES['csv']['error'] != 4) { $csv = $_FILES['csv']; @@ -87,7 +87,7 @@ function mainInsertData() { $agentModule = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module)); $date2 = str_replace('-', '/', $date); - $time2 = DATE("H:i", strtotime($time)); + $time2 = DATE(TIME_FORMAT, strtotime($time)); $date_xml = $date2 . ' ' . $time2 . ':00'; @@ -194,7 +194,7 @@ function mainInsertData() { $('#text-time').timepicker({ showSecond: true, - timeFormat: 'hh:mm:ss', + timeFormat: '', timeOnlyTitle: '', timeText: '', hourText: '', @@ -203,7 +203,7 @@ function mainInsertData() { currentText: '', closeText: ''}); - $("#text-date").datepicker (); + $("#text-date").datepicker({dateFormat: ""}); $.datepicker.setDefaults($.datepicker.regional[ ""]); }); diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index cd5582d8b4..e31d9d937c 100755 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -46,14 +46,14 @@ $id_agent = get_parameter ("id_agent"); $id_group = (int) get_parameter ("id_group", 0); $name = (string) get_parameter ('name', ''); $description = (string) get_parameter ('description', ''); -$once_date_from = (string) get_parameter ('once_date_from', date ('Y-m-j')); -$once_time_from = (string) get_parameter ('once_time_from', date ('h:iA')); -$once_date_to = (string) get_parameter ('once_date_to', date ('Y-m-j')); -$once_time_to = (string) get_parameter ('once_time_to', date ('h:iA')); +$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)); $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 ('h:iA')); -$periodically_time_to = (string) get_parameter ('periodically_time_to', date ('h:iA')); +$periodically_time_from = (string) get_parameter ('periodically_time_from', date(TIME_FORMAT)); +$periodically_time_to = (string) get_parameter ('periodically_time_to', date(TIME_FORMAT)); $first_create = (int) get_parameter ('first_create', 0); @@ -88,8 +88,9 @@ if ($insert_downtime_agent == 1) { $agents = (array)get_parameter("id_agents", array()); $module_names = (array)get_parameter("module", array()); $all_modules = false; - if (empty($module_names)) + if (empty($module_names)) { $all_modules = true; + } else { //It is empty. if ($module_names[0] == "0") @@ -258,17 +259,20 @@ if ($id_downtime > 0) { switch ($config["dbtype"]) { case "mysql": $sql = sprintf ("SELECT * - FROM `tplanned_downtime` WHERE `id` = %d", + FROM `tplanned_downtime` + WHERE `id` = %d", $id_downtime); break; case "postgresql": $sql = sprintf ("SELECT * - FROM \"tplanned_downtime\" WHERE \"id\" = %d", + FROM \"tplanned_downtime\" + WHERE \"id\" = %d", $id_downtime); break; case "oracle": $sql = sprintf ("SELECT * - FROM tplanned_downtime WHERE id = %d", + FROM tplanned_downtime + WHERE id = %d", $id_downtime); break; } @@ -276,10 +280,10 @@ if ($id_downtime > 0) { $result = db_get_row_sql ($sql); $name = $result["name"]; $description = $result["description"]; - $once_date_from = strftime ('%Y-%m-%d', $result["date_from"]); - $once_date_to = strftime ('%Y-%m-%d', $result["date_to"]); - $once_time_from = strftime ('%I:%M%p', $result["date_from"]); - $once_time_to = strftime ('%I:%M%p', $result["date_to"]); + $once_date_from = date(DATE_FORMAT, $result["date_from"]); + $once_date_to = date(DATE_FORMAT, $result["date_to"]); + $once_time_from = date(TIME_FORMAT, $result["date_from"]); + $once_time_to = date(TIME_FORMAT, $result["date_to"]); $monday = $result['monday']; $tuesday = $result['tuesday']; $wednesday = $result['wednesday']; @@ -347,9 +351,10 @@ $table->data[5][1] = " " . __('Type Periodicity:') . " ". html_print_select(array( - 'weekly' => __('Weekly'), - 'monthly' => __('Monthly')), - 'type_periodicity', $type_periodicity, 'change_type_periodicity();', '', 0, true) . + 'weekly' => __('Weekly'), + 'monthly' => __('Monthly')), + 'type_periodicity', $type_periodicity, + 'change_type_periodicity();', '', 0, true) . " @@ -511,7 +516,8 @@ if ($id_downtime > 0) { $downtimes = db_get_all_rows_sql ($sql); if ($downtimes === false) { - echo '
'. __('There are no scheduled downtimes').'
'; + echo '
' . + __('There are no scheduled downtimes') . '
'; } else { $table->id = 'list'; @@ -535,9 +541,9 @@ if ($id_downtime > 0) { $data[1] = db_get_sql ("SELECT nombre FROM tgrupo - WHERE id_grupo = ". $downtime["id_grupo"]); + WHERE id_grupo = " . $downtime["id_grupo"]); - $data[2] = ui_print_os_icon ($downtime["id_os"], true, true); + $data[2] = ui_print_os_icon($downtime["id_os"], true, true); $data[3] = $downtime["ultimo_contacto"]; @@ -567,9 +573,10 @@ if ($id_downtime > 0) { $data[5] .= '' . - html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ""; + '&id_downtime_agent=' . $downtime["id"] . + '&id_downtime=' . $id_downtime . '">' . + html_print_image("images/cross.png", true, + array("border" => '0', "alt" => __('Delete'))) . ""; $table->data['agent_' . $downtime["id_agente"]] = $data; } @@ -922,7 +929,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri $("#text-periodically_time_from, #text-periodically_time_to, #text-once_time_from, #text-once_time_to").timepicker({ showSecond: true, - timeFormat: 'hh:mm:ss', + timeFormat: '', timeOnlyTitle: '', timeText: '', hourText: '', @@ -930,7 +937,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri secondText: '', currentText: '', closeText: ''}); - $("#text-once_date_from, #text-once_date_to").datepicker (); + $("#text-once_date_from, #text-once_date_to").datepicker({dateFormat: ""}); $.datepicker.setDefaults($.datepicker.regional[ ""]); diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 7dd3490c6d..b29b6939eb 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -335,8 +335,8 @@ $type = ''; $value = ''; $max = ''; $min = ''; -$time_from = '12:00'; -$time_to = '12:00'; +$time_from = '12:00:00'; +$time_to = '12:00:00'; $monday = true; $tuesday = true; $wednesday = true; @@ -948,7 +948,7 @@ elseif ($step == 2) { ?> $('#text-time_from, #text-time_to').timepicker({ showSecond: true, - timeFormat: 'hh:mm:ss', + timeFormat: '', timeOnlyTitle: '', timeText: '', hourText: '', diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 75fde8d4ee..88e7a26cd7 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -78,8 +78,8 @@ $thursday = true; $friday = true; $saturday = true; $sunday = true; -$time_from = '00:00'; -$time_to = '23:59'; +$time_from = '00:00:00'; +$time_to = '23:59:00'; $show_graph = 0; $sla_sorted_by = 0; $id_agents = ''; @@ -1344,7 +1344,7 @@ $(document).ready (function () { $("#text-time_to, #text-time_from").timepicker({ showSecond: true, - timeFormat: 'hh:mm:ss', + timeFormat: '', timeOnlyTitle: '', timeText: '', hourText: '', diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 69e49fc996..f959d7919e 100644 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -58,7 +58,7 @@ if ($get_plugin_macros) { $get_module_detail = get_parameter ('get_module_detail', 0); if ($get_module_detail) { - + $module_id = get_parameter ('id_module'); $period = get_parameter ("period", 86400); $group = agents_get_agentmodule_group ($module_id); @@ -81,7 +81,7 @@ if ($get_module_detail) { $formtable->class = "databox"; $formtable->data = array (); $formtable->size = array (); - + $periods = array(SECONDS_5MINUTES =>__('5 minutes'), SECONDS_30MINUTES =>__('30 minutes'), SECONDS_1HOUR =>__('1 hour'), @@ -106,17 +106,17 @@ if ($get_module_detail) { $formtable->data[1][0] = html_print_radio_button_extended ("selection_mode", 'range','', $selection_mode, false, '', 'style="margin-right: 15px;"', true) . __("Specify time range"); $formtable->data[1][1] = __('Timestamp from:'); - + $formtable->data[1][2] = html_print_input_text ('date_from', $date_from, '', 10, 10, true); $formtable->data[1][2] .= html_print_input_text ('time_from', $time_from, '', 9, 7, true); - + $formtable->data[1][1] .= '
'; $formtable->data[1][1] .= __('Timestamp to:'); - + $formtable->data[1][2] .= '
'; $formtable->data[1][2] .= html_print_input_text ('date_to', $date_to, '', 10, 10, true); $formtable->data[1][2] .= html_print_input_text ('time_to', $time_to, '', 9, 7, true); - + html_print_table($formtable); $moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($module_id)); @@ -133,10 +133,15 @@ if ($get_module_detail) { $table->width = "100%"; if ($selection_mode == "fromnow") { - $sql_body = sprintf ("FROM tagente_datos_log4x WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period); + $sql_body = sprintf ("FROM tagente_datos_log4x + WHERE id_agente_modulo = %d AND utimestamp > %d + ORDER BY utimestamp DESC", $module_id, get_system_time () - $period); } else { - $sql_body = sprintf ("FROM tagente_datos_log4x WHERE id_agente_modulo = %d AND utimestamp >= %d AND utimestamp <= %d ORDER BY utimestamp DESC", $module_id, $datetime_from, $datetime_to); + $sql_body = sprintf ("FROM tagente_datos_log4x + WHERE id_agente_modulo = %d AND utimestamp >= %d + AND utimestamp <= %d + ORDER BY utimestamp DESC", $module_id, $datetime_from, $datetime_to); } $columns = array( @@ -147,43 +152,72 @@ if ($get_module_detail) { ); } else if (preg_match ("/string/", $moduletype_name)) { - + if ($selection_mode == "fromnow") { - $sql_body = sprintf (" FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period); + $sql_body = sprintf (" FROM tagente_datos_string + WHERE id_agente_modulo = %d AND utimestamp > %d + ORDER BY utimestamp DESC", $module_id, get_system_time () - $period); } else { - $sql_body = sprintf (" FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp >= %d AND utimestamp <= %d ORDER BY utimestamp DESC", $module_id, $datetime_from, $datetime_to); + $sql_body = sprintf (" FROM tagente_datos_string + WHERE id_agente_modulo = %d AND utimestamp >= %d + AND utimestamp <= %d + ORDER BY utimestamp DESC", $module_id, $datetime_from, $datetime_to); } $columns = array( - "Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "left"), - "Data" => array("datos", "modules_format_data", "align" => "left"), - "Time" => array("utimestamp", "modules_format_time", "align" => "center") + "Timestamp" => array( + "utimestamp", + "modules_format_timestamp", + "align" => "left"), + "Data" => array( + "datos", + "modules_format_data", + "align" => "left"), + "Time" => array( + "utimestamp", + "modules_format_time", + "align" => "center") ); } else { if ($selection_mode == "fromnow") { - $sql_body = sprintf (" FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period); + $sql_body = sprintf (" FROM tagente_datos + WHERE id_agente_modulo = %d + AND utimestamp > %d + ORDER BY utimestamp DESC", $module_id, get_system_time () - $period); } else { - $sql_body = sprintf (" FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp >= %d AND utimestamp <= %d ORDER BY utimestamp DESC", $module_id, $datetime_from, $datetime_to); - } + $sql_body = sprintf (" FROM tagente_datos + WHERE id_agente_modulo = %d + AND utimestamp >= %d AND utimestamp <= %d + ORDER BY utimestamp DESC", $module_id, $datetime_from, $datetime_to); + } $columns = array( - "Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "left"), - "Data" => array("datos", "modules_format_data", "align" => "left"), - "Time" => array("utimestamp", "modules_format_time", "align" => "center") + "Timestamp" => array( + "utimestamp", + "modules_format_timestamp", + "align" => "left"), + "Data" => array( + "datos", + "modules_format_data", + "align" => "left"), + "Time" => array( + "utimestamp", + "modules_format_time", + "align" => "center") ); } - + $sql_body = io_safe_output($sql_body); // Clean all codification characters - + $sql = "SELECT * " . $sql_body; $sql_count = "SELECT count(*) " . $sql_body; - + $count = db_get_value_sql ($sql_count, $conexion); - + switch ($config["dbtype"]) { case "mysql": $sql .= " LIMIT " . $offset . "," . $block_size; @@ -198,13 +232,13 @@ if ($get_module_detail) { $sql = oracle_recode_query ($sql, $set); break; } - + $result = db_get_all_rows_sql ($sql, false, true, $conexion); - + if ($result === false) { $result = array (); } - + if (($config['dbtype'] == 'oracle') && ($result !== false)) { for ($i=0; $i < count($result); $i++) { unset($result[$i]['rnum']); @@ -213,7 +247,7 @@ if ($get_module_detail) { $table->width = '98%'; $table->data = array(); - + $index = 0; foreach($columns as $col => $attr) { $table->head[$index] = $col; @@ -226,10 +260,10 @@ if ($get_module_detail) { $index++; } - + $id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo', 'nombre', 'web_content_string'); - + foreach ($result as $row) { $data = array (); @@ -238,9 +272,9 @@ if ($get_module_detail) { array('id_agente_modulo' => $row['id_agente_modulo'], 'id_tipo_modulo' => $id_type_web_content_string)); - foreach($columns as $col => $attr) { + foreach ($columns as $col => $attr) { if ($attr[1] != "modules_format_data") { - $data[] = $attr[1] ($row[$attr[0]]); + $data[] = $attr[1] ($row[$attr[0]]); } elseif (($config['command_snapshot']) && (preg_match ("/[\n]+/i", $row[$attr[0]]))) { @@ -254,19 +288,19 @@ if ($get_module_detail) { // Because this *SHIT* of print_table monster, I cannot format properly this cells // so, eat this, motherfucker :)) - $datos = "".$datos.""; + $datos = "" . $datos . ""; // I dont why, but using index (value) method, data is automatically converted to html entities ¿? - $data[$attr[1]] = $datos; + $data[$attr[1]] = $datos; } elseif ($is_web_content_string) { //Fixed the goliat sends the strings from web //without HTML entities - $data[$attr[1]] = io_safe_input($row[$attr[0]]); + $data[$attr[1]] = io_safe_input($row[$attr[0]]); } else { - // Just a string of alphanumerical data... just do print + // Just a string of alphanumerical data... just do print //Fixed the data from Selenium Plugin if ($row[$attr[0]] != strip_tags($row[$attr[0]])) $data[$attr[1]] = io_safe_input($row[$attr[0]]); @@ -274,11 +308,12 @@ if ($get_module_detail) { $data[$attr[1]] = $row[$attr[0]]; } } - + array_push ($table->data, $data); - if (count($table->data) > 200) break; + if (count($table->data) > 200) + break; } - + if (empty ($table->data)) { ui_print_error_message(__('No available data to show')); } @@ -286,8 +321,7 @@ if ($get_module_detail) { ui_pagination($count, false, $offset); html_print_table($table); } - return; - } - - -?> + + return; +} +?> \ No newline at end of file diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index c883f879b9..a51b3915c7 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -22,6 +22,11 @@ define ('ENTERPRISE_NOT_HOOK', -1); +/**/ +define('DATE_FORMAT', 'Y/m/d'); +define('DATE_FORMAT_JS', 'yy/mm/d'); +define('TIME_FORMAT', 'H:i:s'); +define('TIME_FORMAT_JS', 'HH:mm:ss'); /* Events state constants */ define ('EVENT_NEW', 0); diff --git a/pandora_console/operation/agentes/datos_agente.php b/pandora_console/operation/agentes/datos_agente.php index 60485d1e4c..05e4c02729 100755 --- a/pandora_console/operation/agentes/datos_agente.php +++ b/pandora_console/operation/agentes/datos_agente.php @@ -41,10 +41,10 @@ else { } $selection_mode = get_parameter('selection_mode', 'fromnow'); -$date_from = (string) get_parameter ('date_from', date ('Y-m-j')); -$time_from = (string) get_parameter ('time_from', date ('h:iA')); -$date_to = (string) get_parameter ('date_to', date ('Y-m-j')); -$time_to = (string) get_parameter ('time_to', date ('h:iA')); +$date_from = (string) get_parameter ('date_from', date(DATE_FORMAT)); +$time_from = (string) get_parameter ('time_from', date(TIME_FORMAT)); +$date_to = (string) get_parameter ('date_to', date(DATE_FORMAT)); +$time_to = (string) get_parameter ('time_to', date(TIME_FORMAT)); if (! check_acl ($config['id_user'], $group, "AR") || $module_id == 0) { db_pandora_audit("ACL Violation", @@ -303,7 +303,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri $(document).ready (function () { $("#text-time_from, #text-time_to").timepicker({ showSecond: true, - timeFormat: 'hh:mm:ss', + timeFormat: '', timeOnlyTitle: '', timeText: '', hourText: '', @@ -312,7 +312,7 @@ $(document).ready (function () { currentText: '', closeText: ''}); - $("#text-date_from, #text-date_to").datepicker(); + $("#text-date_from, #text-date_to").datepicker({dateFormat: ""}); $.datepicker.setDefaults($.datepicker.regional[ ""]); }); diff --git a/pandora_console/operation/netflow/nf_live_view.php b/pandora_console/operation/netflow/nf_live_view.php index c9e34cdbfb..372f85bfa9 100644 --- a/pandora_console/operation/netflow/nf_live_view.php +++ b/pandora_console/operation/netflow/nf_live_view.php @@ -86,8 +86,8 @@ $chart_type = get_parameter('chart_type', 'netflow_area'); $max_aggregates = (int) get_parameter('max_aggregates', 0); $period = (int) get_parameter('period', '86400'); $update_date = (int) get_parameter('update_date', 0); -$date = get_parameter_post ('date', date ("Y/m/d", get_system_time ())); -$time = get_parameter_post ('time', date ("H:i:s", get_system_time ())); +$date = get_parameter_post ('date', date (DATE_FORMAT, get_system_time ())); +$time = get_parameter_post ('time', date (TIME_FORMAT, get_system_time ())); $connection_name = get_parameter('connection_name', ''); $interval_length = (int) get_parameter('interval_length', 300); @@ -558,7 +558,7 @@ ui_require_jquery_file ("ui-timepicker-addon"); $("#text-time").timepicker({ showSecond: true, - timeFormat: 'hh:mm:ss', + timeFormat: '', timeOnlyTitle: '', timeText: '', hourText: '', @@ -567,7 +567,7 @@ ui_require_jquery_file ("ui-timepicker-addon"); currentText: '', closeText: ''}); - $("#text-date").datepicker (); + $("#text-date").datepicker({dateFormat: ""}); $.datepicker.regional[""]; diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php index 3297b9afd3..c1f1a3a60b 100644 --- a/pandora_console/operation/reporting/graph_viewer.php +++ b/pandora_console/operation/reporting/graph_viewer.php @@ -53,10 +53,10 @@ if ($delete_graph) { if ($view_graph) { $sql="SELECT * FROM tgraph_source WHERE id_graph = $id_graph"; $sources = db_get_all_rows_sql($sql); - + $sql="SELECT * FROM tgraph WHERE id_graph = $id_graph"; $graph = db_get_row_sql($sql); - + $id_user = $graph["id_user"]; $private = $graph["private"]; $width = $graph["width"]; @@ -79,12 +79,12 @@ if ($view_graph) { break; } } - + // Get different date to search the report. - $date = (string) get_parameter ('date', date ('Y-m-j')); - $time = (string) get_parameter ('time', date ('h:iA')); - $unixdate = strtotime ($date.' '.$time); - + $date = (string) get_parameter ('date', date(DATE_FORMAT)); + $time = (string) get_parameter ('time', date(TIME_FORMAT)); + $unixdate = strtotime ($date . ' ' . $time); + $period = (int) get_parameter ('period'); if (! $period) $period = $graph["period"]; @@ -97,7 +97,7 @@ if ($view_graph) { $stacked = $graph["stacked"]; $name = $graph["name"]; - if (($graph["private"]==1) && ($graph["id_user"] != $id_user)){ + if (($graph["private"]==1) && ($graph["id_user"] != $id_user)) { db_pandora_audit("ACL Violation","Trying to access to a custom graph not allowed"); include ("general/noaccess.php"); exit; @@ -119,9 +119,10 @@ if ($view_graph) { } $options['view']['text'] = '' . - html_print_image("images/operation.png", true, array ("title" => __('View graph'))) .''; + html_print_image("images/operation.png", true, + array ("title" => __('View graph'))) .''; $options['view']['active'] = true; - + if ($config["pure"] == 0) { $options['screen']['text'] = "" . html_print_image ("images/full_screen.png", true, array ("title" => __('Full screen mode'))) @@ -137,7 +138,9 @@ if ($view_graph) { } // Header - ui_print_page_header (__('Reporting'). " » ". __('Custom graphs')." - ".$graph['name'], "images/chart.png", false, "", false, $options); + ui_print_page_header (__('Reporting') . " » " . + __('Custom graphs') . " - " . $graph['name'], + "images/chart.png", false, "", false, $options); echo ""; echo "
"; @@ -148,7 +151,7 @@ if ($view_graph) { echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; - echo "".__('Date').""." "; + echo "" . __('Date') . "" . " "; echo ""; echo html_print_input_text ('date', $date, '', 12, 10, true). ' '; @@ -157,7 +160,7 @@ if ($view_graph) { echo html_print_input_text ('time', $time, '', 7, 7, true). ' '; echo ""; - echo "".__('Time range').""; + echo "" . __('Time range') . ""; echo ""; @@ -202,7 +205,7 @@ if ($view_graph) { $("#loading").slideUp (); $("#text-time").timepicker({ showSecond: true, - timeFormat: 'hh:mm:ss', + timeFormat: '', timeOnlyTitle: '', timeText: '', hourText: '', @@ -213,7 +216,11 @@ if ($view_graph) { $.datepicker.setDefaults($.datepicker.regional[ ""]); - $("#text-date").datepicker ({changeMonth: true, changeYear: true, showAnim: "slideDown"}); + $("#text-date").datepicker({ + dateFormat: "", + changeMonth: true, + changeYear: true, + showAnim: "slideDown"}); }); diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index 39964f3449..d2ab7fc719 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -46,16 +46,16 @@ enterprise_include("include/functions_reporting.php"); $pure = get_parameter('pure',0); // Get different date to search the report. -$date = (string) get_parameter ('date', date ('Y-m-j')); -$time = (string) get_parameter ('time', date ('h:iA')); +$date = (string) get_parameter ('date', date(DATE_FORMAT)); +$time = (string) get_parameter ('time', date(TIME_FORMAT)); -$datetime = strtotime ($date.' '.$time); +$datetime = strtotime ($date . ' ' . $time); $report["datetime"] = $datetime; // Calculations in order to modify init date of the report -$date_init_less = strtotime(date ('Y-m-j')) - 86400; -$date_init = get_parameter('date_init', date ('Y-m-j', $date_init_less)); -$time_init = get_parameter('time_init', date ('h:iA', $date_init_less)); +$date_init_less = strtotime(date('Y-m-j')) - 86400; +$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less)); +$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less)); $datetime_init = strtotime ($date_init.' '.$time_init); $enable_init_date = get_parameter('enable_init_date', 0); @@ -194,7 +194,7 @@ $(document).ready (function () { $("#loading").slideUp (); $("#text-time").timepicker({ showSecond: true, - timeFormat: 'hh:mm:ss', + timeFormat: '', timeOnlyTitle: '', timeText: '', hourText: '', @@ -206,6 +206,7 @@ $(document).ready (function () { $.datepicker.setDefaults($.datepicker.regional[ ""]); $("#text-date").datepicker({ + dateFormat: "", changeMonth: true, changeYear: true, showAnim: "slideDown"}); @@ -213,7 +214,7 @@ $(document).ready (function () { $('[id^=text-time_init]').timepicker({ showSecond: true, - timeFormat: 'hh:mm:ss', + timeFormat: '', timeOnlyTitle: '', timeText: '', hourText: '', @@ -223,6 +224,7 @@ $(document).ready (function () { closeText: ''}); $('[id^=text-date_init]').datepicker ({ + dateFormat: "", changeMonth: true, changeYear: true, showAnim: "slideDown"}); diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php index a020752023..ba1582baf1 100644 --- a/pandora_console/operation/tree.php +++ b/pandora_console/operation/tree.php @@ -887,7 +887,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri function datetime_picker_callback() { $("#text-time_from, #text-time_to").timepicker({ showSecond: true, - timeFormat: 'hh:mm:ss', + timeFormat: '', timeOnlyTitle: '', timeText: '', hourText: '', @@ -896,7 +896,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri currentText: '', closeText: ''}); - $("#text-date_from, #text-date_to").datepicker (); + $("#text-date_from, #text-date_to").datepicker({dateFormat: ""}); $.datepicker.setDefaults($.datepicker.regional[ ""]); }