From 42d5f1a011fc961e0b24c4eb0078e42e3276b510 Mon Sep 17 00:00:00 2001 From: Esteban Sanchez Date: Wed, 3 Sep 2008 12:01:46 +0000 Subject: [PATCH] 2008-09-03 Esteban Sanchez * include/config_process.php: Checks in homeurl config variable. Style corrections. * include/help/en/help_date_format.php: Points to oficial PHP manual on php.net. * godmode/agentes/modificar_agente.php: Escape quotes which was causing SQL errors. * godmode/reporting/map_builder.php: Fixed divs and tables widths. * include/functions.php, operation/agentes/datos_agente.php: Style corrections. * include/functions_db.php: Style corrections. Added comments for translators. * operation/extensions.php: Added login checking. * operation/reporting/reporting_viewer.php: Minor bug that was causing javascript failures. * operation/users/user.php: Use print_help_tip() to show contextual help. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1073 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 27 +++++++++ .../godmode/agentes/modificar_agente.php | 6 +- .../godmode/reporting/map_builder.php | 7 +-- pandora_console/include/config_process.php | 7 ++- pandora_console/include/functions.php | 20 ++++--- pandora_console/include/functions_db.php | 15 +++-- .../include/help/en/help_date_format.php | 2 +- .../operation/agentes/datos_agente.php | 2 +- pandora_console/operation/extensions.php | 2 + .../operation/reporting/reporting_viewer.php | 2 +- pandora_console/operation/users/user.php | 60 +++++++++---------- 11 files changed, 94 insertions(+), 56 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 2f6c9295e1..9ba2e2f5b5 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,30 @@ +2008-09-03 Esteban Sanchez + + * include/config_process.php: Checks in homeurl config variable. Style + corrections. + + * include/help/en/help_date_format.php: Points to oficial PHP manual + on php.net. + + * godmode/agentes/modificar_agente.php: Escape quotes which was + causing SQL errors. + + * godmode/reporting/map_builder.php: Fixed divs and tables widths. + + * include/functions.php, operation/agentes/datos_agente.php: Style + corrections. + + * include/functions_db.php: Style corrections. Added comments for + translators. + + * operation/extensions.php: Added login checking. + + * operation/reporting/reporting_viewer.php: Minor bug that was causing + javascript failures. + + * operation/users/user.php: Use print_help_tip() to show contextual + help. + 2008-09-02 Evi Vanoost * reporting/fgraph.php: SQL passed wasn't being processed, so the graph diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 66a4582205..43c9f227d9 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -111,7 +111,7 @@ if (isset($_GET["borrar_agente"])){ // if delete agent } unset ($sql_delete, $del_error); //Clean up process_sql ("SET AUTOCOMMIT=1;"); - audit_db($config["id_user"],$REMOTE_ADDR, "Agent '$agent_name' deleted", "Agent Management"); + audit_db($config["id_user"],$REMOTE_ADDR, "Agent \'$agent_name\' deleted", "Agent Management"); // Delete remote configuration $agent_md5 = md5($agent_name, FALSE); @@ -123,8 +123,8 @@ if (isset($_GET["borrar_agente"])){ // if delete agent unlink ($file_name); } } else { // NO permissions. - audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation", - "Trying to delete agent '$agent_name'"); + audit_db ($config["id_user"],$REMOTE_ADDR, "ACL Violation", + "Trying to delete agent \'$agent_name\'"); require ("general/noaccess.php"); exit; } diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 931db0e1b5..bcb643578f 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -282,7 +282,7 @@ if (! $edit_layout && ! $id_layout) { print_table ($table); } - echo '
'; + echo '
'; echo '
'; print_input_hidden ('edit_layout', 1); print_submit_button (__('Create'), '', false, 'class="sub wand"'); @@ -298,7 +298,7 @@ if (! $edit_layout && ! $id_layout) { $backgrounds_list = array_merge ($backgrounds_list, list_files ('images/console/background/', "png", 1, 0)); $groups = get_user_groups ($config['id_user']); - $table->width = '300px'; + $table->width = '340px'; $table->data = array (); $table->data[0][0] = __('Name'); $table->data[0][1] = print_input_text ('name', $name, '', 15, 50, true); @@ -316,7 +316,7 @@ if (! $edit_layout && ! $id_layout) { echo ''; print_table ($table); - echo '
'; + echo '
'; if ($id_layout) { print_submit_button (__('Update'), 'update_layout', false, 'class="sub upd"'); print_input_hidden ('update_layout', 1); @@ -439,7 +439,6 @@ if (! $edit_layout && ! $id_layout) { - diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 66b56271e9..21ccaec5e6 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -114,9 +114,12 @@ if (file_exists ('./include/languages/'.$config["language"].'.mo')) { $l10n->load_tables(); } -if (!isset($config["date_format"])) { - $config["date_format"] = "F j, Y, g:i a"; +if (! isset ($config['date_format'])) { + $config['date_format'] = 'F j, Y, g:i a'; } +if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') { + $config['homeurl'] = '/'.$config['homeurl']; +} ?> diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index f5bcf33730..90af3808cd 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -47,7 +47,7 @@ function safe_input ($value) { if (is_numeric ($value)) return $value; if (is_array ($value)) { - array_walk ($value,'safe_input'); + array_walk ($value, 'safe_input'); return $value; } return htmlentities (utf8_decode ($value), ENT_QUOTES); @@ -83,7 +83,8 @@ function salida_limpia ($string) { $trans[chr(38)] = '&'; } // after the initial translation, _do_ map standalone "&" into "&" - return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&" , strtr($string, $trans)); + return preg_replace ("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&", + strtr ($string, $trans)); } /** @@ -412,15 +413,18 @@ function format_datetime ($timestamp, $alt_format = "") { * * @param number Number to be rendered * @param decimals Number of decimals to be shown. Default value: 1 - * @param dec_point Decimal separator string. Default value: . - * @param thousands_sep Thousands separator string. Default value: , * * @return */ -function format_numeric ($number, $decimals = 1, $dec_point = ".", $thousands_sep = ",") { +function format_numeric ($number, $decimals = 1) { if ($number == 0) return 0; + // Translators: This is separator of decimal point + $dec_point = __("."); + // Translators: This is separator of decimal point + $thousands_sep = __(","); + /* If has decimals */ if (fmod ($number , 1) > 0) return number_format ($number, $decimals, $dec_point, $thousands_sep); @@ -504,12 +508,12 @@ function human_time_comparation ($timestamp) { function human_time_description_raw ($seconds) { global $lang_label; if ($seconds < 3600) - return format_numeric($seconds/60,2)." ".__('minutes'); + return format_numeric ($seconds / 60, 2)." ".__('minutes'); if ($seconds >= 3600 && $seconds < 86400) - return format_numeric ($seconds/3600,2)." ".__('hours'); + return format_numeric ($seconds / 3600, 2)." ".__('hours'); - return format_numeric ($seconds/86400,2)." ".__('days'); + return format_numeric ($seconds / 86400, 2)." ".__('days'); } /** diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 31fbef8416..b398d99ef6 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -1257,7 +1257,6 @@ $sql_cache = array ('saved' => 0); * @return Value of first column of the first row. False if there were no row. */ function get_db_value ($field, $table, $field_search = 1, $condition = 1) { - if (is_int ($condition)) { $sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = %d LIMIT 1", $field, $table, $field_search, $condition); @@ -1270,7 +1269,7 @@ function get_db_value ($field, $table, $field_search = 1, $condition = 1) { } $result = get_db_all_rows_sql ($sql); - if($result === false) + if ($result === false) return false; return $result[0][$field]; @@ -1370,7 +1369,7 @@ function get_db_all_rows_sql ($sql) { * * @return An array with the rows, columns and values in a multidimensional array */ -function process_sql ($sql,$rettype = "affected_rows") { +function process_sql ($sql, $rettype = "affected_rows") { global $config; global $sql_cache; $retval = array(); @@ -1795,19 +1794,23 @@ function check_server_status () { */ function show_alert_row_mini ($id_combined_alert) { $color=1; - $sql = sprintf("SELECT talerta_agente_modulo.*, tcompound_alert.operation FROM talerta_agente_modulo, tcompound_alert - WHERE tcompound_alert.id_aam = talerta_agente_modulo.id_aam AND tcompound_alert.id = %d",$id_combined_alert); + $sql = sprintf ("SELECT talerta_agente_modulo.*,tcompound_alert.operation + FROM talerta_agente_modulo, tcompound_alert + WHERE tcompound_alert.id_aam = talerta_agente_modulo.id_aam + AND tcompound_alert.id = %d", $id_combined_alert); $result = get_db_all_rows_sql ($sql); - if (!$result) + if ($result === false) return; echo ""; echo ""; echo ""; + /* Translators: Abbrevation for Time threshold */ echo ""; echo ""; echo ""; + /* Translators: Abbrevation for Description */ echo ""; echo ""; echo ""; diff --git a/pandora_console/include/help/en/help_date_format.php b/pandora_console/include/help/en/help_date_format.php index ad9baadcae..8a0428b621 100644 --- a/pandora_console/include/help/en/help_date_format.php +++ b/pandora_console/include/help/en/help_date_format.php @@ -326,7 +326,7 @@ - + diff --git a/pandora_console/operation/agentes/datos_agente.php b/pandora_console/operation/agentes/datos_agente.php index fbe27d7b93..cdeddbc0d1 100644 --- a/pandora_console/operation/agentes/datos_agente.php +++ b/pandora_console/operation/agentes/datos_agente.php @@ -23,7 +23,7 @@ require ("include/config.php"); check_login(); -if (give_acl ($config['id_user'], 0, "AR")!=1) { +if (! give_acl ($config['id_user'], 0, "AR")) { audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access Agent Data view"); require ("general/noaccess.php"); diff --git a/pandora_console/operation/extensions.php b/pandora_console/operation/extensions.php index 79033de373..188db13a8f 100644 --- a/pandora_console/operation/extensions.php +++ b/pandora_console/operation/extensions.php @@ -16,6 +16,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +check_login (); + if (! give_acl ($config['id_user'], 0, "AR")) { audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access extensions list"); diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index 1bd8315c83..0d951f1b4e 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -89,9 +89,9 @@ echo ''; + -
".__('Name')."".__('Oper')."".__('Tt')."".__('Firing')."".__('Time')."".__('Desc')."".__('Recovery')."".__('MinMax.Al')."
U Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)See also time()See also time()