From b088c166cc5cf84a6eb99c0d4553f045df9e1d78 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 9 Mar 2011 15:54:05 +0000 Subject: [PATCH] 2011-03-09 Miguel de Dios * include/functions_reporting.php, include/functions.php, operation/agentes/datos_agente.php, operation/agentes/gis_view.php, operation/servers/view_server_detail.php, operation/reporting/reporting_xml.php, operation/reporting/graph_viewer.php, godmode/db/db_main.php, godmode/db/db_purge.php, godmode/snmpconsole/snmp_alert.php, godmode/users/configure_user.php: cleaned source code, and erased the deprecated function "human_time_description". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4079 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 ++++++++++ pandora_console/godmode/db/db_main.php | 2 +- pandora_console/godmode/db/db_purge.php | 2 +- .../godmode/snmpconsole/snmp_alert.php | 22 +++++++++---------- .../godmode/users/configure_user.php | 2 +- pandora_console/include/functions.php | 7 ------ .../include/functions_reporting.php | 16 +++++++------- .../operation/agentes/datos_agente.php | 2 +- .../operation/agentes/gis_view.php | 2 +- .../operation/reporting/graph_viewer.php | 2 +- .../operation/reporting/reporting_xml.php | 2 +- .../operation/servers/view_server_detail.php | 2 +- 12 files changed, 38 insertions(+), 34 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 98102d3559..4f279e2193 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2011-03-09 Miguel de Dios + + * include/functions_reporting.php, include/functions.php, + operation/agentes/datos_agente.php, operation/agentes/gis_view.php, + operation/servers/view_server_detail.php, + operation/reporting/reporting_xml.php, operation/reporting/graph_viewer.php, + godmode/db/db_main.php, godmode/db/db_purge.php, + godmode/snmpconsole/snmp_alert.php, godmode/users/configure_user.php: + cleaned source code, and erased the deprecated function + "human_time_description". + 2011-03-09 Miguel de Dios * include/functions.php: fixed in the function "get_system_time" copy&paste diff --git a/pandora_console/godmode/db/db_main.php b/pandora_console/godmode/db/db_main.php index e423bdc57e..50ac838ff7 100644 --- a/pandora_console/godmode/db/db_main.php +++ b/pandora_console/godmode/db/db_main.php @@ -179,7 +179,7 @@ if (!isset($config['db_maintance'])){ else echo ""; - echo human_time_description($seconds); + echo human_time_description_raw($seconds); echo " *"; } echo ""; diff --git a/pandora_console/godmode/db/db_purge.php b/pandora_console/godmode/db/db_purge.php index 4101f5be2f..3995f9ddfd 100644 --- a/pandora_console/godmode/db/db_purge.php +++ b/pandora_console/godmode/db/db_purge.php @@ -79,7 +79,7 @@ $data["total"] = 0; if (isset($_POST["purgedb"])) { $from_date = get_parameter_post ("date_purge", 0); if ($id_agent > 0) { - echo __('Purge task launched for agent')." ".get_agent_name ($id_agent)." :: ".__('Data older than')." ".human_time_description ($from_date); + echo __('Purge task launched for agent')." ".get_agent_name ($id_agent)." :: ".__('Data older than')." ".human_time_description_raw ($from_date); echo "

".__('Please be patient. This operation can take a long time depending on the amount of modules.')."

"; $sql = sprintf ("SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = %d", $id_agent); diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 99ecc5057e..da5f5acf24 100644 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -213,17 +213,17 @@ if (isset ($_GET["update_alert"])) { echo ''.__('Time threshold').''; $fields = array (); - $fields[$time_threshold] = human_time_description ($time_threshold); - $fields[300] = human_time_description (300); - $fields[600] = human_time_description (600); - $fields[900] = human_time_description (900); - $fields[1800] = human_time_description (1800); - $fields[3600] = human_time_description (3600); - $fields[7200] = human_time_description (7200); - $fields[18000] = human_time_description (18000); - $fields[43200] = human_time_description (43200); - $fields[86400] = human_time_description (86400); - $fields[604800] = human_time_description (604800); + $fields[$time_threshold] = human_time_description_raw ($time_threshold); + $fields[300] = human_time_description_raw (300); + $fields[600] = human_time_description_raw (600); + $fields[900] = human_time_description_raw (900); + $fields[1800] = human_time_description_raw (1800); + $fields[3600] = human_time_description_raw (3600); + $fields[7200] = human_time_description_raw (7200); + $fields[18000] = human_time_description_raw (18000); + $fields[43200] = human_time_description_raw (43200); + $fields[86400] = human_time_description_raw (86400); + $fields[604800] = human_time_description_raw (604800); $fields[-1] = __('Other value'); print_select ($fields, "time_threshold", $time_threshold, '', '', '0', false, false, false, '" style="margin-right:60px'); diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 3240349956..2cd2030875 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -119,7 +119,7 @@ if ($create_user) { ' Language: ' . $values['language'] . ' Skin: ' . $values['id_skin'] . ' Block size: ' . $values['block_size'] . ' Flash Chats: ' . $values['flash_chart']; - $result = create_user ($id, $password_new, $values); + $result = create_user($id, $password_new, $values); pandora_audit("User management", "Created user ".safe_input($id), false, false, $info); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 29cd86c97d..bdd69cd0bb 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -406,13 +406,6 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large return "+6 " . $monthsString; } -/** - * @deprecated Use print_timestamp for output. - */ -function human_time_description ($period) { - return human_time_description_raw ($period); //human_time_description_raw does the same but by calculating instead of a switch -} - /** * @deprecated Get current time minus some seconds. (Do your calculations yourself on unix timestamps) * diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 8a7ccdcb07..3aa19a0560 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1775,7 +1775,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $data[0] = $sizh.__('Simple graph').$sizhfin; $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; - $data[2] = $sizh.human_time_description ($content['period']).$sizhfin; + $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -1798,7 +1798,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $data[0] = $sizh.__('Simple baseline graph').$sizhfin; $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; - $data[2] = $sizh.human_time_description ($content['period']).$sizhfin; + $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -1822,7 +1822,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $data[0] = $sizh.__('Custom graph').$sizhfin; $data[1] = $sizh.$graph['name'].$sizhfin; - $data[2] = $sizh.human_time_description ($content['period']).$sizhfin; + $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -1936,7 +1936,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $data[0] = $sizh.__('Monitor report').$sizhfin; $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; - $data[2] = $sizh.human_time_description ($content['period']).$sizhfin; + $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -1970,7 +1970,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $data[0] = $sizh.__('Avg. Value').$sizhfin; $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; - $data[2] = $sizh.human_time_description ($content['period']).$sizhfin; + $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -1999,7 +1999,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $data[0] = $sizh.__('Max. Value').$sizhfin; $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; - $data[2] = $sizh.human_time_description ($content['period']).$sizhfin; + $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2023,7 +2023,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $data[0] = $sizh.__('Min. Value').$sizhfin; $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; - $data[2] = $sizh.human_time_description ($content['period']).$sizhfin; + $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) @@ -2052,7 +2052,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) { $data = array (); $data[0] = $sizh.__('Summatory').$sizhfin; $data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin; - $data[2] = $sizh.human_time_description ($content['period']).$sizhfin; + $data[2] = $sizh.human_time_description_raw ($content['period']).$sizhfin; array_push ($table->data, $data); // Put description at the end of the module (if exists) diff --git a/pandora_console/operation/agentes/datos_agente.php b/pandora_console/operation/agentes/datos_agente.php index 53892dcbfc..7e650a4f45 100644 --- a/pandora_console/operation/agentes/datos_agente.php +++ b/pandora_console/operation/agentes/datos_agente.php @@ -106,7 +106,7 @@ if ($result === false) { } $header_title = __('Received data from')." ".get_agentmodule_agent_name ($module_id)." / ".get_agentmodule_name ($module_id); -$header_title .= "

" . __("From the last") . " " . human_time_description ($period); +$header_title .= "

" . __("From the last") . " " . human_time_description_raw ($period); echo "

".$header_title. "

"; diff --git a/pandora_console/operation/agentes/gis_view.php b/pandora_console/operation/agentes/gis_view.php index 8e3387a023..d3d9c39171 100644 --- a/pandora_console/operation/agentes/gis_view.php +++ b/pandora_console/operation/agentes/gis_view.php @@ -92,7 +92,7 @@ echo __(" seconds.") . " "; print_submit_button(__('Refresh path'), 'refresh', false, 'class = "sub upd"'); echo ""; -echo "

" . __("Positional data from the last") . " " . human_time_description ($period) ."

"; +echo "

" . __("Positional data from the last") . " " . human_time_description_raw ($period) ."

"; /* Get the total number of Elements for the pagination */ $sqlCount = sprintf ("SELECT COUNT(*) FROM tgis_data_history WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d) ORDER BY end_timestamp DESC", $agentId, get_system_time () - $period); $countData = get_db_value_sql($sqlCount); diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php index d20b8c2ae9..acd98cebce 100644 --- a/pandora_console/operation/reporting/graph_viewer.php +++ b/pandora_console/operation/reporting/graph_viewer.php @@ -122,7 +122,7 @@ if ($view_graph) { echo ""; print_custom_graph ($id_graph, $height, $width, $period, $stacked, false, $unixdate); echo ""; - $period_label = human_time_description ($period); + $period_label = human_time_description_raw ($period); echo "
"; echo ""; echo ""; diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index d3c0da2a4d..9614654573 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -176,7 +176,7 @@ foreach ($contents as $content) { $data = array (); $data["module"] = safe_output_xml (get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module'])); $data["agent"] = safe_output_xml (get_agentmodule_agent_name ($content['id_agent_module'])); - $data["period"] = human_time_description ($content['period']); + $data["period"] = human_time_description_raw ($content['period']); $data["uperiod"] = $content['period']; $data["type"] = $content["type"]; diff --git a/pandora_console/operation/servers/view_server_detail.php b/pandora_console/operation/servers/view_server_detail.php index c34e8e9668..0150a98bbc 100644 --- a/pandora_console/operation/servers/view_server_detail.php +++ b/pandora_console/operation/servers/view_server_detail.php @@ -101,7 +101,7 @@ foreach ($recon_tasks as $task) { $data[1] = ''. $task["name"].''; - $data[2] = human_time_description ($task["interval_sweep"]); + $data[2] = human_time_description_raw ($task["interval_sweep"]); if ($task["id_recon_script"] == 0){ $data[3] = $task["subnet"];