2013-06-11 Miguel de Dios <miguel.dedios@artica.es>

* 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.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8287 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-06-11 13:14:48 +00:00
parent 5feb3790a3
commit a513b70822
12 changed files with 185 additions and 117 deletions

View File

@ -1,3 +1,16 @@
2013-06-11 Miguel de Dios <miguel.dedios@artica.es>
* 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 <miguel.dedios@artica.es> 2013-06-11 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: revert completly the * include/functions_html.php: revert completly the

View File

@ -39,7 +39,7 @@ function createXMLData($agent, $agentModule, $time, $data) {
io_safe_output($agent['agent_version']), $time, io_safe_output($agent['agent_version']), $time,
io_safe_output($agent['nombre']), $agent['timezone_offset'], 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); 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)) { if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['nombre']) . '.' . strtotime($time) . '.data', $xml)) {
return false; return false;
} }
@ -52,7 +52,7 @@ function mainInsertData() {
global $config; global $config;
ui_print_page_header (__("Insert data"), "images/extensions.png", false, "", true, ""); 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'])) { if (! check_acl ($config['id_user'], 0, "AW") && ! is_user_admin ($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management"); db_pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php"); require ("general/noaccess.php");
@ -63,8 +63,8 @@ function mainInsertData() {
$id_agent = (string)get_parameter('id_agent', ''); $id_agent = (string)get_parameter('id_agent', '');
$id_agent_module = (int)get_parameter('id_agent_module', ''); $id_agent_module = (int)get_parameter('id_agent_module', '');
$data = (string)get_parameter('data'); $data = (string)get_parameter('data');
$date = (string) get_parameter ('date', date ('Y-m-d')); $date = (string) get_parameter('date', date(DATE_FORMAT));
$time = (string) get_parameter ('time', date ('h:00A')); $time = (string) get_parameter('time', date(TIME_FORMAT));
if (isset($_FILES['csv'])) { if (isset($_FILES['csv'])) {
if ($_FILES['csv']['error'] != 4) { if ($_FILES['csv']['error'] != 4) {
$csv = $_FILES['csv']; $csv = $_FILES['csv'];
@ -87,7 +87,7 @@ function mainInsertData() {
$agentModule = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module)); $agentModule = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module));
$date2 = str_replace('-', '/', $date); $date2 = str_replace('-', '/', $date);
$time2 = DATE("H:i", strtotime($time)); $time2 = DATE(TIME_FORMAT, strtotime($time));
$date_xml = $date2 . ' ' . $time2 . ':00'; $date_xml = $date2 . ' ' . $time2 . ':00';
@ -194,7 +194,7 @@ function mainInsertData() {
$('#text-time').timepicker({ $('#text-time').timepicker({
showSecond: true, showSecond: true,
timeFormat: 'hh:mm:ss', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>', timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>', timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>', hourText: '<?php echo __('Hour');?>',
@ -203,7 +203,7 @@ function mainInsertData() {
currentText: '<?php echo __('Now');?>', currentText: '<?php echo __('Now');?>',
closeText: '<?php echo __('Close');?>'}); closeText: '<?php echo __('Close');?>'});
$("#text-date").datepicker (); $("#text-date").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]); $.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
}); });

View File

@ -46,14 +46,14 @@ $id_agent = get_parameter ("id_agent");
$id_group = (int) get_parameter ("id_group", 0); $id_group = (int) get_parameter ("id_group", 0);
$name = (string) get_parameter ('name', ''); $name = (string) get_parameter ('name', '');
$description = (string) get_parameter ('description', ''); $description = (string) get_parameter ('description', '');
$once_date_from = (string) get_parameter ('once_date_from', date ('Y-m-j')); $once_date_from = (string) get_parameter ('once_date_from', date(DATE_FORMAT));
$once_time_from = (string) get_parameter ('once_time_from', date ('h:iA')); $once_time_from = (string) get_parameter ('once_time_from', date(TIME_FORMAT));
$once_date_to = (string) get_parameter ('once_date_to', date ('Y-m-j')); $once_date_to = (string) get_parameter ('once_date_to', date(DATE_FORMAT));
$once_time_to = (string) get_parameter ('once_time_to', date ('h:iA')); $once_time_to = (string) get_parameter ('once_time_to', date(TIME_FORMAT));
$periodically_day_from = (int) get_parameter ('periodically_day_from', 1); $periodically_day_from = (int) get_parameter ('periodically_day_from', 1);
$periodically_day_to = (int) get_parameter ('periodically_day_to', 31); $periodically_day_to = (int) get_parameter ('periodically_day_to', 31);
$periodically_time_from = (string) get_parameter ('periodically_time_from', 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 ('h:iA')); $periodically_time_to = (string) get_parameter ('periodically_time_to', date(TIME_FORMAT));
$first_create = (int) get_parameter ('first_create', 0); $first_create = (int) get_parameter ('first_create', 0);
@ -88,8 +88,9 @@ if ($insert_downtime_agent == 1) {
$agents = (array)get_parameter("id_agents", array()); $agents = (array)get_parameter("id_agents", array());
$module_names = (array)get_parameter("module", array()); $module_names = (array)get_parameter("module", array());
$all_modules = false; $all_modules = false;
if (empty($module_names)) if (empty($module_names)) {
$all_modules = true; $all_modules = true;
}
else { else {
//It is empty. //It is empty.
if ($module_names[0] == "0") if ($module_names[0] == "0")
@ -258,17 +259,20 @@ if ($id_downtime > 0) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql = sprintf ("SELECT * $sql = sprintf ("SELECT *
FROM `tplanned_downtime` WHERE `id` = %d", FROM `tplanned_downtime`
WHERE `id` = %d",
$id_downtime); $id_downtime);
break; break;
case "postgresql": case "postgresql":
$sql = sprintf ("SELECT * $sql = sprintf ("SELECT *
FROM \"tplanned_downtime\" WHERE \"id\" = %d", FROM \"tplanned_downtime\"
WHERE \"id\" = %d",
$id_downtime); $id_downtime);
break; break;
case "oracle": case "oracle":
$sql = sprintf ("SELECT * $sql = sprintf ("SELECT *
FROM tplanned_downtime WHERE id = %d", FROM tplanned_downtime
WHERE id = %d",
$id_downtime); $id_downtime);
break; break;
} }
@ -276,10 +280,10 @@ if ($id_downtime > 0) {
$result = db_get_row_sql ($sql); $result = db_get_row_sql ($sql);
$name = $result["name"]; $name = $result["name"];
$description = $result["description"]; $description = $result["description"];
$once_date_from = strftime ('%Y-%m-%d', $result["date_from"]); $once_date_from = date(DATE_FORMAT, $result["date_from"]);
$once_date_to = strftime ('%Y-%m-%d', $result["date_to"]); $once_date_to = date(DATE_FORMAT, $result["date_to"]);
$once_time_from = strftime ('%I:%M%p', $result["date_from"]); $once_time_from = date(TIME_FORMAT, $result["date_from"]);
$once_time_to = strftime ('%I:%M%p', $result["date_to"]); $once_time_to = date(TIME_FORMAT, $result["date_to"]);
$monday = $result['monday']; $monday = $result['monday'];
$tuesday = $result['tuesday']; $tuesday = $result['tuesday'];
$wednesday = $result['wednesday']; $wednesday = $result['wednesday'];
@ -347,9 +351,10 @@ $table->data[5][1] = "
<td>" . __('Type Periodicity:') . "</td> <td>" . __('Type Periodicity:') . "</td>
<td>". <td>".
html_print_select(array( html_print_select(array(
'weekly' => __('Weekly'), 'weekly' => __('Weekly'),
'monthly' => __('Monthly')), 'monthly' => __('Monthly')),
'type_periodicity', $type_periodicity, 'change_type_periodicity();', '', 0, true) . 'type_periodicity', $type_periodicity,
'change_type_periodicity();', '', 0, true) .
"</td> "</td>
</tr> </tr>
<tr> <tr>
@ -511,7 +516,8 @@ if ($id_downtime > 0) {
$downtimes = db_get_all_rows_sql ($sql); $downtimes = db_get_all_rows_sql ($sql);
if ($downtimes === false) { if ($downtimes === false) {
echo '<div class="nf">'. __('There are no scheduled downtimes').'</div>'; echo '<div class="nf">' .
__('There are no scheduled downtimes') . '</div>';
} }
else { else {
$table->id = 'list'; $table->id = 'list';
@ -535,9 +541,9 @@ if ($id_downtime > 0) {
$data[1] = db_get_sql ("SELECT nombre $data[1] = db_get_sql ("SELECT nombre
FROM tgrupo 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"]; $data[3] = $downtime["ultimo_contacto"];
@ -567,9 +573,10 @@ if ($id_downtime > 0) {
$data[5] .= '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/planned_downtime.editor'. $data[5] .= '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/planned_downtime.editor'.
'&amp;id_agent=' . $downtime["id_agente"] . '&amp;id_agent=' . $downtime["id_agente"] .
'&amp;delete_downtime_agent=1' . '&amp;delete_downtime_agent=1' .
'&amp;id_downtime_agent='.$downtime["id"] . '&amp;id_downtime_agent=' . $downtime["id"] .
'&amp;id_downtime='.$id_downtime.'">' . '&amp;id_downtime=' . $id_downtime . '">' .
html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . "</a>"; html_print_image("images/cross.png", true,
array("border" => '0', "alt" => __('Delete'))) . "</a>";
$table->data['agent_' . $downtime["id_agente"]] = $data; $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({ $("#text-periodically_time_from, #text-periodically_time_to, #text-once_time_from, #text-once_time_to").timepicker({
showSecond: true, showSecond: true,
timeFormat: 'hh:mm:ss', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>', timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>', timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>', hourText: '<?php echo __('Hour');?>',
@ -930,7 +937,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
secondText: '<?php echo __('Second');?>', secondText: '<?php echo __('Second');?>',
currentText: '<?php echo __('Now');?>', currentText: '<?php echo __('Now');?>',
closeText: '<?php echo __('Close');?>'}); closeText: '<?php echo __('Close');?>'});
$("#text-once_date_from, #text-once_date_to").datepicker (); $("#text-once_date_from, #text-once_date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]); $.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);

View File

@ -335,8 +335,8 @@ $type = '';
$value = ''; $value = '';
$max = ''; $max = '';
$min = ''; $min = '';
$time_from = '12:00'; $time_from = '12:00:00';
$time_to = '12:00'; $time_to = '12:00:00';
$monday = true; $monday = true;
$tuesday = true; $tuesday = true;
$wednesday = true; $wednesday = true;
@ -948,7 +948,7 @@ elseif ($step == 2) {
?> ?>
$('#text-time_from, #text-time_to').timepicker({ $('#text-time_from, #text-time_to').timepicker({
showSecond: true, showSecond: true,
timeFormat: 'hh:mm:ss', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>', timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>', timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>', hourText: '<?php echo __('Hour');?>',

View File

@ -78,8 +78,8 @@ $thursday = true;
$friday = true; $friday = true;
$saturday = true; $saturday = true;
$sunday = true; $sunday = true;
$time_from = '00:00'; $time_from = '00:00:00';
$time_to = '23:59'; $time_to = '23:59:00';
$show_graph = 0; $show_graph = 0;
$sla_sorted_by = 0; $sla_sorted_by = 0;
$id_agents = ''; $id_agents = '';
@ -1344,7 +1344,7 @@ $(document).ready (function () {
$("#text-time_to, #text-time_from").timepicker({ $("#text-time_to, #text-time_from").timepicker({
showSecond: true, showSecond: true,
timeFormat: 'hh:mm:ss', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>', timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>', timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>', hourText: '<?php echo __('Hour');?>',

View File

@ -58,7 +58,7 @@ if ($get_plugin_macros) {
$get_module_detail = get_parameter ('get_module_detail', 0); $get_module_detail = get_parameter ('get_module_detail', 0);
if ($get_module_detail) { if ($get_module_detail) {
$module_id = get_parameter ('id_module'); $module_id = get_parameter ('id_module');
$period = get_parameter ("period", 86400); $period = get_parameter ("period", 86400);
$group = agents_get_agentmodule_group ($module_id); $group = agents_get_agentmodule_group ($module_id);
@ -81,7 +81,7 @@ if ($get_module_detail) {
$formtable->class = "databox"; $formtable->class = "databox";
$formtable->data = array (); $formtable->data = array ();
$formtable->size = array (); $formtable->size = array ();
$periods = array(SECONDS_5MINUTES =>__('5 minutes'), $periods = array(SECONDS_5MINUTES =>__('5 minutes'),
SECONDS_30MINUTES =>__('30 minutes'), SECONDS_30MINUTES =>__('30 minutes'),
SECONDS_1HOUR =>__('1 hour'), 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][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][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 ('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][2] .= html_print_input_text ('time_from', $time_from, '', 9, 7, true);
$formtable->data[1][1] .= '<br />'; $formtable->data[1][1] .= '<br />';
$formtable->data[1][1] .= __('Timestamp to:'); $formtable->data[1][1] .= __('Timestamp to:');
$formtable->data[1][2] .= '<br />'; $formtable->data[1][2] .= '<br />';
$formtable->data[1][2] .= html_print_input_text ('date_to', $date_to, '', 10, 10, true); $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); $formtable->data[1][2] .= html_print_input_text ('time_to', $time_to, '', 9, 7, true);
html_print_table($formtable); html_print_table($formtable);
$moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($module_id)); $moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($module_id));
@ -133,10 +133,15 @@ if ($get_module_detail) {
$table->width = "100%"; $table->width = "100%";
if ($selection_mode == "fromnow") { 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 { 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( $columns = array(
@ -147,43 +152,72 @@ if ($get_module_detail) {
); );
} }
else if (preg_match ("/string/", $moduletype_name)) { else if (preg_match ("/string/", $moduletype_name)) {
if ($selection_mode == "fromnow") { 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 { 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( $columns = array(
"Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "left"), "Timestamp" => array(
"Data" => array("datos", "modules_format_data", "align" => "left"), "utimestamp",
"Time" => array("utimestamp", "modules_format_time", "align" => "center") "modules_format_timestamp",
"align" => "left"),
"Data" => array(
"datos",
"modules_format_data",
"align" => "left"),
"Time" => array(
"utimestamp",
"modules_format_time",
"align" => "center")
); );
} }
else { else {
if ($selection_mode == "fromnow") { 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 { 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( $columns = array(
"Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "left"), "Timestamp" => array(
"Data" => array("datos", "modules_format_data", "align" => "left"), "utimestamp",
"Time" => array("utimestamp", "modules_format_time", "align" => "center") "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); $sql_body = io_safe_output($sql_body);
// Clean all codification characters // Clean all codification characters
$sql = "SELECT * " . $sql_body; $sql = "SELECT * " . $sql_body;
$sql_count = "SELECT count(*) " . $sql_body; $sql_count = "SELECT count(*) " . $sql_body;
$count = db_get_value_sql ($sql_count, $conexion); $count = db_get_value_sql ($sql_count, $conexion);
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql .= " LIMIT " . $offset . "," . $block_size; $sql .= " LIMIT " . $offset . "," . $block_size;
@ -198,13 +232,13 @@ if ($get_module_detail) {
$sql = oracle_recode_query ($sql, $set); $sql = oracle_recode_query ($sql, $set);
break; break;
} }
$result = db_get_all_rows_sql ($sql, false, true, $conexion); $result = db_get_all_rows_sql ($sql, false, true, $conexion);
if ($result === false) { if ($result === false) {
$result = array (); $result = array ();
} }
if (($config['dbtype'] == 'oracle') && ($result !== false)) { if (($config['dbtype'] == 'oracle') && ($result !== false)) {
for ($i=0; $i < count($result); $i++) { for ($i=0; $i < count($result); $i++) {
unset($result[$i]['rnum']); unset($result[$i]['rnum']);
@ -213,7 +247,7 @@ if ($get_module_detail) {
$table->width = '98%'; $table->width = '98%';
$table->data = array(); $table->data = array();
$index = 0; $index = 0;
foreach($columns as $col => $attr) { foreach($columns as $col => $attr) {
$table->head[$index] = $col; $table->head[$index] = $col;
@ -226,10 +260,10 @@ if ($get_module_detail) {
$index++; $index++;
} }
$id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo', $id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo',
'nombre', 'web_content_string'); 'nombre', 'web_content_string');
foreach ($result as $row) { foreach ($result as $row) {
$data = array (); $data = array ();
@ -238,9 +272,9 @@ if ($get_module_detail) {
array('id_agente_modulo' => $row['id_agente_modulo'], array('id_agente_modulo' => $row['id_agente_modulo'],
'id_tipo_modulo' => $id_type_web_content_string)); 'id_tipo_modulo' => $id_type_web_content_string));
foreach($columns as $col => $attr) { foreach ($columns as $col => $attr) {
if ($attr[1] != "modules_format_data") { 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]]))) { 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 // Because this *SHIT* of print_table monster, I cannot format properly this cells
// so, eat this, motherfucker :)) // so, eat this, motherfucker :))
$datos = "<span style='font-family: mono,monospace;'>".$datos."</span>"; $datos = "<span style='font-family: mono,monospace;'>" . $datos . "</span>";
// I dont why, but using index (value) method, data is automatically converted to html entities ¿? // 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) { elseif ($is_web_content_string) {
//Fixed the goliat sends the strings from web //Fixed the goliat sends the strings from web
//without HTML entities //without HTML entities
$data[$attr[1]] = io_safe_input($row[$attr[0]]); $data[$attr[1]] = io_safe_input($row[$attr[0]]);
} }
else { 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 //Fixed the data from Selenium Plugin
if ($row[$attr[0]] != strip_tags($row[$attr[0]])) if ($row[$attr[0]] != strip_tags($row[$attr[0]]))
$data[$attr[1]] = io_safe_input($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]]; $data[$attr[1]] = $row[$attr[0]];
} }
} }
array_push ($table->data, $data); array_push ($table->data, $data);
if (count($table->data) > 200) break; if (count($table->data) > 200)
break;
} }
if (empty ($table->data)) { if (empty ($table->data)) {
ui_print_error_message(__('No available data to show')); ui_print_error_message(__('No available data to show'));
} }
@ -286,8 +321,7 @@ if ($get_module_detail) {
ui_pagination($count, false, $offset); ui_pagination($count, false, $offset);
html_print_table($table); html_print_table($table);
} }
return;
} return;
}
?>
?>

View File

@ -22,6 +22,11 @@
define ('ENTERPRISE_NOT_HOOK', -1); 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 */ /* Events state constants */
define ('EVENT_NEW', 0); define ('EVENT_NEW', 0);

View File

@ -41,10 +41,10 @@ else {
} }
$selection_mode = get_parameter('selection_mode', 'fromnow'); $selection_mode = get_parameter('selection_mode', 'fromnow');
$date_from = (string) get_parameter ('date_from', date ('Y-m-j')); $date_from = (string) get_parameter ('date_from', date(DATE_FORMAT));
$time_from = (string) get_parameter ('time_from', date ('h:iA')); $time_from = (string) get_parameter ('time_from', date(TIME_FORMAT));
$date_to = (string) get_parameter ('date_to', date ('Y-m-j')); $date_to = (string) get_parameter ('date_to', date(DATE_FORMAT));
$time_to = (string) get_parameter ('time_to', date ('h:iA')); $time_to = (string) get_parameter ('time_to', date(TIME_FORMAT));
if (! check_acl ($config['id_user'], $group, "AR") || $module_id == 0) { if (! check_acl ($config['id_user'], $group, "AR") || $module_id == 0) {
db_pandora_audit("ACL Violation", db_pandora_audit("ACL Violation",
@ -303,7 +303,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
$(document).ready (function () { $(document).ready (function () {
$("#text-time_from, #text-time_to").timepicker({ $("#text-time_from, #text-time_to").timepicker({
showSecond: true, showSecond: true,
timeFormat: 'hh:mm:ss', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>', timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>', timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>', hourText: '<?php echo __('Hour');?>',
@ -312,7 +312,7 @@ $(document).ready (function () {
currentText: '<?php echo __('Now');?>', currentText: '<?php echo __('Now');?>',
closeText: '<?php echo __('Close');?>'}); closeText: '<?php echo __('Close');?>'});
$("#text-date_from, #text-date_to").datepicker(); $("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]); $.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
}); });

View File

@ -86,8 +86,8 @@ $chart_type = get_parameter('chart_type', 'netflow_area');
$max_aggregates = (int) get_parameter('max_aggregates', 0); $max_aggregates = (int) get_parameter('max_aggregates', 0);
$period = (int) get_parameter('period', '86400'); $period = (int) get_parameter('period', '86400');
$update_date = (int) get_parameter('update_date', 0); $update_date = (int) get_parameter('update_date', 0);
$date = get_parameter_post ('date', date ("Y/m/d", get_system_time ())); $date = get_parameter_post ('date', date (DATE_FORMAT, get_system_time ()));
$time = get_parameter_post ('time', date ("H:i:s", get_system_time ())); $time = get_parameter_post ('time', date (TIME_FORMAT, get_system_time ()));
$connection_name = get_parameter('connection_name', ''); $connection_name = get_parameter('connection_name', '');
$interval_length = (int) get_parameter('interval_length', 300); $interval_length = (int) get_parameter('interval_length', 300);
@ -558,7 +558,7 @@ ui_require_jquery_file ("ui-timepicker-addon");
$("#text-time").timepicker({ $("#text-time").timepicker({
showSecond: true, showSecond: true,
timeFormat: 'hh:mm:ss', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>', timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>', timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>', hourText: '<?php echo __('Hour');?>',
@ -567,7 +567,7 @@ ui_require_jquery_file ("ui-timepicker-addon");
currentText: '<?php echo __('Now');?>', currentText: '<?php echo __('Now');?>',
closeText: '<?php echo __('Close');?>'}); closeText: '<?php echo __('Close');?>'});
$("#text-date").datepicker (); $("#text-date").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$.datepicker.regional["<?php echo get_user_language(); ?>"]; $.datepicker.regional["<?php echo get_user_language(); ?>"];
</script> </script>

View File

@ -53,10 +53,10 @@ if ($delete_graph) {
if ($view_graph) { if ($view_graph) {
$sql="SELECT * FROM tgraph_source WHERE id_graph = $id_graph"; $sql="SELECT * FROM tgraph_source WHERE id_graph = $id_graph";
$sources = db_get_all_rows_sql($sql); $sources = db_get_all_rows_sql($sql);
$sql="SELECT * FROM tgraph WHERE id_graph = $id_graph"; $sql="SELECT * FROM tgraph WHERE id_graph = $id_graph";
$graph = db_get_row_sql($sql); $graph = db_get_row_sql($sql);
$id_user = $graph["id_user"]; $id_user = $graph["id_user"];
$private = $graph["private"]; $private = $graph["private"];
$width = $graph["width"]; $width = $graph["width"];
@ -79,12 +79,12 @@ if ($view_graph) {
break; break;
} }
} }
// Get different date to search the report. // Get different date to search the report.
$date = (string) get_parameter ('date', date ('Y-m-j')); $date = (string) get_parameter ('date', date(DATE_FORMAT));
$time = (string) get_parameter ('time', date ('h:iA')); $time = (string) get_parameter ('time', date(TIME_FORMAT));
$unixdate = strtotime ($date.' '.$time); $unixdate = strtotime ($date . ' ' . $time);
$period = (int) get_parameter ('period'); $period = (int) get_parameter ('period');
if (! $period) if (! $period)
$period = $graph["period"]; $period = $graph["period"];
@ -97,7 +97,7 @@ if ($view_graph) {
$stacked = $graph["stacked"]; $stacked = $graph["stacked"];
$name = $graph["name"]; $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"); db_pandora_audit("ACL Violation","Trying to access to a custom graph not allowed");
include ("general/noaccess.php"); include ("general/noaccess.php");
exit; exit;
@ -119,9 +119,10 @@ if ($view_graph) {
} }
$options['view']['text'] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id=' . $id_graph . '">' . $options['view']['text'] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id=' . $id_graph . '">' .
html_print_image("images/operation.png", true, array ("title" => __('View graph'))) .'</a>'; html_print_image("images/operation.png", true,
array ("title" => __('View graph'))) .'</a>';
$options['view']['active'] = true; $options['view']['active'] = true;
if ($config["pure"] == 0) { if ($config["pure"] == 0) {
$options['screen']['text'] = "<a href='$url&pure=1'>" $options['screen']['text'] = "<a href='$url&pure=1'>"
. html_print_image ("images/full_screen.png", true, array ("title" => __('Full screen mode'))) . html_print_image ("images/full_screen.png", true, array ("title" => __('Full screen mode')))
@ -137,7 +138,9 @@ if ($view_graph) {
} }
// Header // Header
ui_print_page_header (__('Reporting'). " &raquo; ". __('Custom graphs')." - ".$graph['name'], "images/chart.png", false, "", false, $options); ui_print_page_header (__('Reporting') . " &raquo; " .
__('Custom graphs') . " - " . $graph['name'],
"images/chart.png", false, "", false, $options);
echo "<table class='databox_frame' cellpadding='0' cellspacing='0' width='98%'>"; echo "<table class='databox_frame' cellpadding='0' cellspacing='0' width='98%'>";
echo "<tr><td>"; echo "<tr><td>";
@ -148,7 +151,7 @@ if ($view_graph) {
echo "<table class='databox_frame' cellpadding='4' cellspacing='4' style='width: 98%'>"; echo "<table class='databox_frame' cellpadding='4' cellspacing='4' style='width: 98%'>";
echo "<tr>"; echo "<tr>";
echo "<td>"; echo "<td>";
echo "<b>".__('Date')."</b>"." "; echo "<b>" . __('Date') . "</b>" . " ";
echo "</td>"; echo "</td>";
echo "<td>"; echo "<td>";
echo html_print_input_text ('date', $date, '', 12, 10, true). ' '; 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 html_print_input_text ('time', $time, '', 7, 7, true). ' ';
echo "</td>"; echo "</td>";
echo "<td class='datos'>"; echo "<td class='datos'>";
echo "<b>".__('Time range')."</b>"; echo "<b>" . __('Time range') . "</b>";
echo "</td>"; echo "</td>";
echo "<td class='datos'>"; echo "<td class='datos'>";
@ -202,7 +205,7 @@ if ($view_graph) {
$("#loading").slideUp (); $("#loading").slideUp ();
$("#text-time").timepicker({ $("#text-time").timepicker({
showSecond: true, showSecond: true,
timeFormat: 'hh:mm:ss', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>', timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>', timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>', hourText: '<?php echo __('Hour');?>',
@ -213,7 +216,11 @@ if ($view_graph) {
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]); $.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
$("#text-date").datepicker ({changeMonth: true, changeYear: true, showAnim: "slideDown"}); $("#text-date").datepicker({
dateFormat: "<?php echo DATE_FORMAT_JS; ?>",
changeMonth: true,
changeYear: true,
showAnim: "slideDown"});
}); });
</script> </script>

View File

@ -46,16 +46,16 @@ enterprise_include("include/functions_reporting.php");
$pure = get_parameter('pure',0); $pure = get_parameter('pure',0);
// Get different date to search the report. // Get different date to search the report.
$date = (string) get_parameter ('date', date ('Y-m-j')); $date = (string) get_parameter ('date', date(DATE_FORMAT));
$time = (string) get_parameter ('time', date ('h:iA')); $time = (string) get_parameter ('time', date(TIME_FORMAT));
$datetime = strtotime ($date.' '.$time); $datetime = strtotime ($date . ' ' . $time);
$report["datetime"] = $datetime; $report["datetime"] = $datetime;
// Calculations in order to modify init date of the report // Calculations in order to modify init date of the report
$date_init_less = strtotime(date ('Y-m-j')) - 86400; $date_init_less = strtotime(date('Y-m-j')) - 86400;
$date_init = get_parameter('date_init', date ('Y-m-j', $date_init_less)); $date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
$time_init = get_parameter('time_init', date ('h:iA', $date_init_less)); $time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
$datetime_init = strtotime ($date_init.' '.$time_init); $datetime_init = strtotime ($date_init.' '.$time_init);
$enable_init_date = get_parameter('enable_init_date', 0); $enable_init_date = get_parameter('enable_init_date', 0);
@ -194,7 +194,7 @@ $(document).ready (function () {
$("#loading").slideUp (); $("#loading").slideUp ();
$("#text-time").timepicker({ $("#text-time").timepicker({
showSecond: true, showSecond: true,
timeFormat: 'hh:mm:ss', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>', timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>', timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>', hourText: '<?php echo __('Hour');?>',
@ -206,6 +206,7 @@ $(document).ready (function () {
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]); $.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
$("#text-date").datepicker({ $("#text-date").datepicker({
dateFormat: "<?php echo DATE_FORMAT_JS; ?>",
changeMonth: true, changeMonth: true,
changeYear: true, changeYear: true,
showAnim: "slideDown"}); showAnim: "slideDown"});
@ -213,7 +214,7 @@ $(document).ready (function () {
$('[id^=text-time_init]').timepicker({ $('[id^=text-time_init]').timepicker({
showSecond: true, showSecond: true,
timeFormat: 'hh:mm:ss', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>', timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>', timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>', hourText: '<?php echo __('Hour');?>',
@ -223,6 +224,7 @@ $(document).ready (function () {
closeText: '<?php echo __('Close');?>'}); closeText: '<?php echo __('Close');?>'});
$('[id^=text-date_init]').datepicker ({ $('[id^=text-date_init]').datepicker ({
dateFormat: "<?php echo DATE_FORMAT_JS; ?>",
changeMonth: true, changeMonth: true,
changeYear: true, changeYear: true,
showAnim: "slideDown"}); showAnim: "slideDown"});

View File

@ -887,7 +887,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
function datetime_picker_callback() { function datetime_picker_callback() {
$("#text-time_from, #text-time_to").timepicker({ $("#text-time_from, #text-time_to").timepicker({
showSecond: true, showSecond: true,
timeFormat: 'hh:mm:ss', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>', timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>', timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>', hourText: '<?php echo __('Hour');?>',
@ -896,7 +896,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
currentText: '<?php echo __('Now');?>', currentText: '<?php echo __('Now');?>',
closeText: '<?php echo __('Close');?>'}); closeText: '<?php echo __('Close');?>'});
$("#text-date_from, #text-date_to").datepicker (); $("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]); $.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
} }