diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index dab3d4b32b..e0dccd4364 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,24 @@ +2012-09-10 Miguel de Dios + + * general/header.php: fixed the link to logout when the Pandora + run across inverse proxy. + + * include/functions.php: update the function "check_refererer" for + situations when the Pandora runs across the inverse proxy. + + * include/functions_html.php: function "html_print_image" fixed when + use the metaconsole across the inverse proxy. + + * include/functions_reporting.php, + operation/reporting/reporting_viewer.php: fixed some links for the + Pandora runs across inverse proxy. + + * include/functions_ui.php: fixed the function "ui_get_full_url" + when pass a empty url in a Pandora into a inverse proxy. + + * extensions/dbmanager.php, operation/agentes/ver_agente.php: + cleaned source code style. + 2012-09-10 Vanessa Gil * pandoradb.sql @@ -17,7 +38,7 @@ operation/events/events_list.php: Added several fields to modules and events. -2012-09-07 Miguel de Dios +2012-09-10 Miguel de Dios * include/javascript/pandora.js, include/functions_ui.php, include/functions_html.php: cleaned source code style. diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 4b73800a60..efb33c0002 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -16,7 +16,7 @@ function dbmanager_query ($sql, &$error) { global $config; - + switch ($config["dbtype"]) { case "mysql": $retval = array(); @@ -44,21 +44,21 @@ function dbmanager_query ($sql, &$error) { if (! empty ($retval)) return $retval; - + //Return false, check with === or !== return "Empty"; break; case "postgresql": case "oracle": $retval = array(); - + if ($sql == '') return false; - + $sql = html_entity_decode($sql, ENT_QUOTES); $result = db_process_sql($sql, "affected_rows", '', false, $status); - + //$result = mysql_query ($sql); if ($result === false) { $backtrace = debug_backtrace(); @@ -80,9 +80,9 @@ function dbmanager_query ($sql, &$error) { function dbmgr_extension_main () { ui_require_css_file ('dbmanager', 'extensions/dbmanager/'); - + global $config; - + if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { db_pandora_audit("ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); @@ -91,21 +91,21 @@ function dbmgr_extension_main () { if (!check_refererer()) { require ("general/noaccess.php"); - + return; } - + $sql = (string) get_parameter ('sql'); - + ui_print_page_header (__('Database interface'), "", false, false, true); - + echo '
'; echo "This is an advanced extension to interface with Pandora FMS database directly from WEB console using native SQL sentences. Please note that you can damage your Pandora FMS installation if you don't know exactly what are you are doing, this means that you can severily damage your setup using this extension. This extension is intended to be used only by experienced users with a depth knowledge of Pandora FMS internals."; echo '
'; - + echo "
"; echo "Some samples of usage:
SHOW STATUS;
DESCRIBE tagente
SELECT * FROM tserver
UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'
"; - + echo "

"; echo "
"; html_print_textarea ('sql', 5, 40, html_entity_decode($sql, ENT_QUOTES)); @@ -114,11 +114,11 @@ function dbmgr_extension_main () { html_print_submit_button (__('Execute SQL'), '', false, 'class="sub next"'); echo ''; echo "
"; - + // Processing SQL Code if ($sql == '') return; - + echo "
"; echo "
"; echo "
"; @@ -159,5 +159,4 @@ extensions_add_godmode_menu_option (__('DB interface'), 'PM','gdbman',"dbmanager /* This sets the function to be called when the extension is selected in the operation menu */ extensions_add_godmode_function ('dbmgr_extension_main'); - -?> +?> \ No newline at end of file diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 2a6117d1a3..9dc1c912ea 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -86,7 +86,7 @@ config_check(); echo " "; } - echo ''; + echo ''; html_print_image("images/log-out.png", false, array("alt" => __('Logout'), "class" => 'bot', "title" => __('Logout'))); echo ''; diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 1e7846ca7a..e7149c45f2 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -48,7 +48,8 @@ function check_refererer() { $url = $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $config["homeurl"]; } else { - $url = $_SERVER['SERVER_NAME'] . $config["homeurl"]; + $url = ui_get_full_url(); + $url = preg_replace('/http(s?):\/\//','',$url); } // Remove protocol from referer diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index cc6c82451f..5640e675e9 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1227,9 +1227,9 @@ function html_print_image ($src, $return = false, $options = false, $return_src if (!$relative) { if (defined('METACONSOLE')) - $src = ENTERPRISE_DIR . '/meta/' . $src; - - $src = ui_get_full_url($src); + $src = ui_get_full_url(ENTERPRISE_DIR . '/meta/' . $src); + else + $src = ui_get_full_url($src); } // Only return src field of image diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index eb8160b386..89860f6f4e 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1318,7 +1318,7 @@ function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return = $data[__('Alerts not fired')] = $not_fired_percentage; $output .= pie3d_graph(false, $data, 280, 150, - __("other"), $config['homeurl'] . '/', $config['homedir'] . "/images/logo_vertical_water.png", + __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size']); $output .= ''.__('Alerts fired').': '.sizeof ($alerts_fired).'
'; @@ -1394,7 +1394,7 @@ function reporting_monitor_health ($id_group, $period = 0, $date = 0, $return = $data[__('Monitors BAD')] = $not_down_percentage; $output .= pie3d_graph(false, $data, 280, 150, - __("other"), $config['homeurl'] . '/', $config['homedir'] . "/images/logo_vertical_water.png", + __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size']); if (!$return) @@ -2143,7 +2143,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'], false, $sizgraph_w, $sizgraph_h, '', '', false, true, true, - $report["datetime"], '', 0, 0, true, true, $config['homeurl'] . '/'); + $report["datetime"], '', 0, 0, true, true); array_push ($table->data, $data); break; @@ -2189,7 +2189,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f 0, $report["datetime"], true, - $config['homedir'] . '/', + '', 1, // Important parameter, this tell to graphic_combined_module function that is a projection graph $output_projection, @@ -2250,7 +2250,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data = array (); $data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'], false, $sizgraph_w, $sizgraph_h, '', '', false, true, true, - $report["datetime"], '', true, 0, true, true, $config['homedir'] . '/'); + $report["datetime"], '', true, 0, true, true); /*$data[0] = graphic_combined_module( $modules, @@ -2316,8 +2316,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f 0, $graph["stacked"], $report["datetime"], - true, - $config['homeurl'] . "/"); + true); array_push ($table->data, $data); break; @@ -2537,7 +2536,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $dataslice[1] = graph_sla_slicebar ($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max'], $report['datetime'], $content, $content['time_from'], - $content['time_to'], 650, 25, $config['homeurl'] . '/'); + $content['time_to'], 650, 25,''); array_push ($tableslice->data, $dataslice); } @@ -2560,7 +2559,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data_pie_graph = json_encode ($data_graph); if ($show_graphs && !empty($slas)) { $data[0] = pie3d_graph(false, $data_graph, - 500, 150, __("other"), $config['homeurl'] . '/', $config['homedir'] . "/images/logo_vertical_water.png", + 500, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size']); @@ -2878,7 +2877,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data = array (); - $data[0] = graph_custom_sql_graph($content["id_rc"], $sizgraph_w, 200, $content["type"], true, $config['homeurl'] . '/'); + $data[0] = graph_custom_sql_graph($content["id_rc"], $sizgraph_w, 200, $content["type"], true); array_push($table->data, $data); break; @@ -3866,7 +3865,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data = array(); if ($show_graph == 1 || $show_graph == 2) { $data[0] = pie3d_graph(false, $data_pie_graph, - $sizgraph_w, $sizgraph_h, __("other"),$config['homeurl'] . "/", $config['homedir'] . "/images/logo_vertical_water.png", + $sizgraph_w, $sizgraph_h, __("other"),"", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size']); array_push ($table->data, $data); @@ -3875,7 +3874,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $table->style[0] .= 'text-align:center'; $height = count($data_pie_graph)*20+35; $data = array(); - $data[0] = hbar_graph(false, $data_hbar, $sizgraph_w, $height, array(), array(), "", "", true, $config['homeurl'] . "/", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], true, 1, true); + $data[0] = hbar_graph(false, $data_hbar, $sizgraph_w, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], true, 1, true); array_push ($table->data, $data); } @@ -4162,7 +4161,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data = array(); if ($show_graph == 1 || $show_graph == 2) { $data[0] = pie3d_graph(false, $data_pie_graph, - 600, 150, __("other"), $config['homeurl'] . "/", $config['homedir'] . "/images/logo_vertical_water.png", + 600, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size']); array_push ($table->data, $data); //Display bars graph @@ -4170,7 +4169,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $height = count($data_pie_graph)*20+35; $data = array(); - $data[0] = hbar_graph(false, $data_hbar, 600, $height, array(), array(), "", "", true, $config['homeurl'] . "/", $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true); + $data[0] = hbar_graph(false, $data_hbar, 600, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true); array_push ($table->data, $data); } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 0709c35b89..b91f21ca3e 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1833,7 +1833,6 @@ function ui_toggle($code, $name, $title = '', $hidde_default = true) { echo ""; // JQuery Toggle - echo '