From fb5e20eceda11f4d9b9b34e8be9e1051b26de06d Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 11 Oct 2010 10:37:34 +0000 Subject: [PATCH] 2010-10-11 Miguel de Dios * include/config_process.php: fixed the execution in as script. * include/fgraph.php: fixed in the "graphic_combined_module" when is empty. And cleaned source code style. * include/functions_extensions.php: cleaned source code style. * extensions/pandora_logs.php: cleaned source code style. And set to translation a string. * extras/pandora_diag.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3382 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 14 ++++++++++++++ pandora_console/extensions/pandora_logs.php | 3 +-- pandora_console/extras/pandora_diag.php | 10 +++++----- pandora_console/include/config_process.php | 7 ++++++- pandora_console/include/fgraph.php | 4 +++- pandora_console/include/functions_extensions.php | 2 +- 6 files changed, 30 insertions(+), 10 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index f67f2ec130..87b5b7d154 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,17 @@ +2010-10-11 Miguel de Dios + + * include/config_process.php: fixed the execution in as script. + + * include/fgraph.php: fixed in the "graphic_combined_module" when is empty. + And cleaned source code style. + + * include/functions_extensions.php: cleaned source code style. + + * extensions/pandora_logs.php: cleaned source code style. And set to + translation a string. + + * extras/pandora_diag.php: cleaned source code style. + 2010-10-11 Sancho Lerena * include/functions_reporting.php: Fixed problem with SQL custom reports diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index 1c76a30bed..3d0e402615 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -36,7 +36,6 @@ function view_logfile ($file_name) { function pandoralogs_extension_main () { global $config; - global $config; if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); @@ -46,7 +45,7 @@ function pandoralogs_extension_main () { print_page_header (__("System logfile viewer"), "images/extensions.png", false, "", true, "" ); - echo "

This tool is used just to view your Pandora FMS system logfiles directly from console

"; + echo "

" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "

"; view_logfile ($config["homedir"]."/pandora_console.log"); view_logfile ("/var/log/pandora/pandora_server.log"); diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index 39671fd305..fd2914a752 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -32,7 +32,8 @@ function render_row ($data, $label){ echo "|"; echo $data; echo "\n"; - } else { + } + else { echo ""; echo "" . $label; echo "" . $data; @@ -45,7 +46,7 @@ function render_row ($data, $label){ $console_mode = 1; if (!isset($argc)) $console_mode = 0; - + if ($console_mode == 1) { echo "\nPandora FMS PHP diagnostic tool v3.1 (c) Artica ST 2009-2010 \n"; @@ -68,9 +69,8 @@ full path to Pandora FMS 'config.php' file. exit; } include $argv[1]."/include/config.php"; -} else { - - session_start (); +} +else { if (file_exists("../include/config.php")) include "../include/config.php"; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 2af22b54d0..5419b51c04 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -85,7 +85,12 @@ process_config (); require_once ($ownDir . 'streams.php'); require_once ($ownDir . 'gettext.php'); -$config["remote_addr"] = $_SERVER['REMOTE_ADDR']; +if (isset($_SERVER['REMOTE_ADDR'])) { + $config["remote_addr"] = $_SERVER['REMOTE_ADDR']; +} +else { + $config["remote_addr"] = null; +} $config['user_language'] = $config["language"]; // Set a the system timezone default diff --git a/pandora_console/include/fgraph.php b/pandora_console/include/fgraph.php index 88b568d03a..af9f881359 100644 --- a/pandora_console/include/fgraph.php +++ b/pandora_console/include/fgraph.php @@ -243,6 +243,8 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ // Event iterator $k = 0; + // Set initial conditions + $graph_values[$i] = array(); if ($data[0]['utimestamp'] == $datelimit) { $previous_data = $data[0]['datos']; $j++; @@ -325,7 +327,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); $time_format = 'M j'; } - + if (! $graphic_type) { return fs_combined_chart ($graph_values, $graph, $module_name_list, $width, $height, $stacked, $resolution / 10, $time_format); } diff --git a/pandora_console/include/functions_extensions.php b/pandora_console/include/functions_extensions.php index 8df7277e18..77e559c4b1 100644 --- a/pandora_console/include/functions_extensions.php +++ b/pandora_console/include/functions_extensions.php @@ -173,7 +173,7 @@ function add_operation_menu_option ($name, $fatherId = null, $icon = null) { * @param string fatherId * @param string icon */ -function add_godmode_menu_option ($name, $acl,$fatherId = null, $icon = null) { +function add_godmode_menu_option ($name, $acl, $fatherId = null, $icon = null) { global $config; global $extension_file;