From ad021cfb667cf7d62fd0ed996a95d7f637446dc6 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Fri, 28 Sep 2012 14:06:20 +0000 Subject: [PATCH] 2012-09-28 Miguel de Dios * install.php, operation/agentes/stat_win.php, general/footer.php, include/config_process.php, include/functions_ui.php, include/functions_graph.php, include/graphs/functions_flot.php, include/functions_visual_map.php: change the $config['home_url'], now it is generated dinamicly. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7009 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 + pandora_console/general/footer.php | 4 +- pandora_console/include/config_process.php | 6 + pandora_console/include/functions_graph.php | 4 +- pandora_console/include/functions_ui.php | 18 ++- .../include/functions_visual_map.php | 8 +- .../include/graphs/functions_flot.php | 54 +++++--- pandora_console/install.php | 128 ++++++++++++------ .../operation/agentes/stat_win.php | 12 +- 9 files changed, 164 insertions(+), 77 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index d13ff1e34a..55da5955f5 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2012-09-28 Miguel de Dios + * install.php, operation/agentes/stat_win.php, general/footer.php, + include/config_process.php, include/functions_ui.php, + include/functions_graph.php, include/graphs/functions_flot.php, + include/functions_visual_map.php: change the $config['home_url'], + now it is generated dinamicly. + 2012-09-27 Miguel de Dios * include/functions_ui.php, operation/agentes/tactical.php: cleaned source code style. diff --git a/pandora_console/general/footer.php b/pandora_console/general/footer.php index 8cc269e1ba..c72ded3702 100644 --- a/pandora_console/general/footer.php +++ b/pandora_console/general/footer.php @@ -21,9 +21,9 @@ else { $time = get_system_time (); } -$license_file = '/general/license/pandora_info_'.$config["language"].'.html'; +$license_file = 'general/license/pandora_info_'.$config["language"].'.html'; if (! file_exists ($config["homedir"] . $license_file)) { - $license_file = '/general/license/pandora_info_en.html'; + $license_file = 'general/license/pandora_info_en.html'; } echo ''; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index ac1d0cf223..b8f1cf1268 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -178,4 +178,10 @@ if (isset($_POST['vc_refr'])){ config_update_value ('vc_refr', get_parameter('vc_refr', $config['vc_refr'])); } + +//====================================================================== +// Update the $config['homeurl'] with the full url with the special +// cases (reverse proxy, others ports...). +//====================================================================== +$config["homeurl"] = ui_get_full_url(false); ?> diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index dc5a7458e8..3176d8e39f 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2506,7 +2506,7 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $only_im } if ($config['homeurl'] != '') { - $homeurl = $config['homeurl'] . '/'; + $homeurl = $config['homeurl']; } else { $homeurl = ''; @@ -2563,7 +2563,7 @@ function graph_netflow_total_area ($data, $period, $width, $height, $only_image) } if ($config['homeurl'] != '') { - $homeurl = $config['homeurl'] . '/'; + $homeurl = $config['homeurl']; } else { $homeurl = ''; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 40ce8b8368..968cd51fd8 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1913,7 +1913,11 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal } else { //Only add the home url - $url = $config['homeurl'] . '/'; + $url = $config['homeurl_static'] . '/'; + } + + if (defined('METACONSOLE')) { + $url .= 'enterprise/meta/'; } } elseif (!strstr($url, ".php")) { @@ -1921,7 +1925,11 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal $fullurl .= '/'; } else { - $fullurl .= $config['homeurl'] . '/'; + $fullurl .= $config['homeurl_static'] . '/'; + } + + if (defined('METACONSOLE')) { + $fullurl .= 'enterprise/meta/'; } } else { @@ -1933,7 +1941,11 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal $fullurl .= $_SERVER['SCRIPT_NAME']; } else { - $fullurl .= $config['homeurl'] . '/'; + $fullurl .= $config['homeurl_static'] . '/'; + + if (defined('METACONSOLE')) { + $fullurl .= 'enterprise/meta/'; + } } } } diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index a38301db49..0584e9b476 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -765,7 +765,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line $mapHeight = $proportion * $layout["height"]; } $backgroundImage = '/include/Image/image_functions.php?getFile=1&thumb=1&thumb_size=' . $mapWidth . 'x' . $mapHeight . '&file=' . - $config['homeurl'] . '/' . 'images/console/background/'.io_safe_input ($layout["background"]); + $config['homeurl'] . 'images/console/background/'.io_safe_input ($layout["background"]); } else { $mapWidth = $layout["width"]; @@ -909,16 +909,16 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line if ($id_service != 0) { //Link to an service page - echo ''; } else { // Link to an agent - echo ''; + echo ''; } } } - elseif ($layout_data['id_layout_linked'] > 0) { + elseif ($layout_data['id_layout_linked'] > 0) { // Link to a map echo ''; diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 07a0d06b4c..6f496f3277 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -26,17 +26,31 @@ function include_javascript_dependencies_flot_graph($return = false) { if (!$is_include_javascript) { $is_include_javascript = true; + $metaconsole_hack = ''; + if (defined('METACONSOLE')) { + $metaconsole_hack = '../../'; + } + // NOTE: jquery.flot.threshold is not te original file. Is patched to allow multiple thresholds and filled area $output = ' - - - - - - - - - + + + + + + + + + '; $output .= " - + +
@@ -739,7 +738,22 @@ function install_step4() { $config["dbpass"]="'.$random_password.'"; // DB Password $config["dbhost"]="'.$dbhost.'"; // DB Host $config["homedir"]="'.$path.'"; // Config homedir + /* + ----------Attention-------------------- + Please note that in certain installations: + - reverse proxy. + - web server in other ports. + - https + + This variable might be dynamically altered. + + But it is save as backup in the + $config["homeurl_static"] + for expecial needs. + ----------Attention-------------------- + */ $config["homeurl"]="'.$url.'"; // Base URL + $config["homeurl_static"]="'.$url.'"; // Don\'t delete // End of automatic config file ?>'; $step7 = fputs ($cfgout, $config_new); @@ -801,7 +815,22 @@ function install_step4() { $config["dbpass"]="' . $dbpassword . '"; // DB Password $config["dbhost"]="' . $dbhost . '"; // DB Host $config["homedir"]="' . $path . '"; // Config homedir + /* + ----------Attention-------------------- + Please note that in certain installations: + - reverse proxy. + - web server in other ports. + - https + + This variable might be dynamically altered. + + But it is save as backup in the + $config["homeurl_static"] + for expecial cases. + ----------Attention-------------------- + */ $config["homeurl"]="' . $url . '"; // Base URL + $config["homeurl_static"]="'.$url.'"; // Don\'t delete // End of automatic config file ?>'; $step4 = fputs ($cfgout, $config_new); @@ -980,7 +1009,22 @@ function install_step4() { $config["dbpass"]="'.$random_password.'"; // DB Password $config["dbhost"]="'.$dbhost.'"; // DB Host $config["homedir"]="'.$path.'"; // Config homedir + /* + ----------Attention-------------------- + Please note that in certain installations: + - reverse proxy. + - web server in other ports. + - https + + This variable might be dynamically altered. + + But it is save as backup in the + $config["homeurl_static"] + for expecial cases. + ----------Attention-------------------- + */ $config["homeurl"]="'.$url.'"; // Base URL + $config["homeurl_static"]="'.$url.'"; // Don\'t delete // End of automatic config file ?>'; $step7 = fputs ($cfgout, $config_new); diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index c444f2444a..c78706e18a 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -240,7 +240,8 @@ $label = base64_decode(get_parameter('label', '')); $label, null, $draw_alerts, $avg_only, false, $date, false, $urlImage, 'adapter_'.$graph_type, $time_compare, $unknown_graph); echo '
'; if ($show_events_graph) - echo graphic_module_events($id, $width, $height, $period, $config['homeurl'] . '/', $zoom, 'adapted_'.$graph_type, $date); + echo graphic_module_events($id, $width, $height, + $period, $config['homeurl'], $zoom, 'adapted_'.$graph_type, $date); break; case 'sparse': echo grafico_modulo_sparse ($id, $period, $draw_events, $width, $height, @@ -248,21 +249,24 @@ $label = base64_decode(get_parameter('label', '')); 0, true, false, $urlImage, 1, false, 'adapter_'.$graph_type, $time_compare, $unknown_graph); echo '
'; if ($show_events_graph) - echo graphic_module_events($id, $width, $height, $period, $config['homeurl'] . '/', $zoom, 'adapted_'.$graph_type, $date); + echo graphic_module_events($id, $width, $height, + $period, $config['homeurl'], $zoom, 'adapted_'.$graph_type, $date); break; case 'string': echo grafico_modulo_string ($id, $period, $draw_events, $width, $height, $label, null, $draw_alerts, 1, false, $date, false, $urlImage, 'adapter_'.$graph_type); echo '
'; if ($show_events_graph) - echo graphic_module_events($id, $width, $height, $period, $config['homeurl'] . '/', $zoom, 'adapted_'.$graph_type, $date); + echo graphic_module_events($id, $width, $height, + $period, $config['homeurl'], $zoom, 'adapted_'.$graph_type, $date); break; case 'log4x': echo grafico_modulo_log4x ($id, $period, $draw_events, $width, $height, $label, $unit_name, $draw_alerts, 1, $pure, $date); echo '
'; if ($show_events_graph) - echo graphic_module_events($id, $width, $height, $period, $config['homeurl'] . '/', $zoom, '', $date); + echo graphic_module_events($id, $width, $height, + $period, $config['homeurl'], $zoom, '', $date); break; default: echo fs_error_image ('../images');