2012-09-28 Miguel de Dios <miguel.dedios@artica.es>

* 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
This commit is contained in:
mdtrooper 2012-09-28 14:06:20 +00:00
parent 780a88ea46
commit 04635d711d
9 changed files with 164 additions and 77 deletions

View File

@ -1,3 +1,10 @@
2012-09-28 Miguel de Dios <miguel.dedios@artica.es>
* 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 <miguel.dedios@artica.es>
* include/functions_ui.php, operation/agentes/tactical.php: cleaned
source code style.

View File

@ -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 '<a class="white_bold" target="_blank" href="' . $config["homeurl"] . $license_file. '">';

View File

@ -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);
?>

View File

@ -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 = '';

View File

@ -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/';
}
}
}
}

View File

@ -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 '<a href="'.$config['homeurl'].'/index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
echo '<a href="'.$config['homeurl'].'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
}
else {
// Link to an agent
echo '<a href="'.$config['homeurl'].'/index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
echo '<a href="'.$config['homeurl'].'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
}
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a href="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';

View File

@ -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 = '
<script language="javascript" type="text/javascript" src="'. ui_get_full_url('/include/graphs/flot/jquery.flot.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'. ui_get_full_url('/include/graphs/flot/jquery.flot.pie.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'. ui_get_full_url('/include/graphs/flot/jquery.flot.crosshair.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'. ui_get_full_url('/include/graphs/flot/jquery.flot.stack.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'. ui_get_full_url('/include/graphs/flot/jquery.flot.selection.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'. ui_get_full_url('/include/graphs/flot/jquery.flot.resize.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'. ui_get_full_url('/include/graphs/flot/jquery.flot.threshold.js') .'"></script>
<script language="javascript" type="text/javascript" src="'. ui_get_full_url('/include/graphs/flot/jquery.flot.symbol.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'. ui_get_full_url('/include/graphs/flot/pandora.flot.js') .'"></script>
<script language="javascript" type="text/javascript" src="'.
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'.
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.pie.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'.
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.crosshair.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'.
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.stack.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'.
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.selection.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'.
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.resize.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'.
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.threshold.js') .'"></script>
<script language="javascript" type="text/javascript" src="'.
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.symbol.min.js') .'"></script>
<script language="javascript" type="text/javascript" src="'.
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/pandora.flot.js') .'"></script>
';
$output .= "
<script type='text/javascript'>
@ -79,25 +93,25 @@ function include_javascript_dependencies_flot_graph($return = false) {
///////////////////////////////
function flot_area_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '', $unit = '', $water_mark = '', $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '') {
global $config;
return flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'area_stacked', $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str);
}
function flot_area_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '', $unit = '', $water_mark = '', $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '') {
global $config;
return flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'area_simple', $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str);
}
function flot_line_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '', $unit = '', $water_mark = '', $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '') {
global $config;
return flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'line_stacked', $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str);
}
function flot_line_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '', $unit = '', $water_mark = '', $serie_types = array(), $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key= '', $force_integer = false, $series_suffix_str = '') {
global $config;
return flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'line_simple', $water_mark, $serie_types, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str);
}
@ -105,13 +119,13 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in
global $config;
include_javascript_dependencies_flot_graph();
$menu = true;
$font_size = '7';
// Get a unique identifier to graph
$graph_id = uniqid('graph_');
// Parent layer
$return = "<div>";
// Set some containers to legend, graph, timestamp tooltip, etc.
@ -234,7 +248,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in
$alert_ids = array();
$legend_events = '';
$legend_alerts = '';
foreach ($chart_extra_data as $i => $data) {
switch ($i) {
case 'legend_alerts':
@ -555,12 +569,12 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
// Set a weird separator to serialize and unserialize passing data from php to javascript
$separator = ';;::;;';
$separator2 = ':,:,,,:,:';
// Transform data from our format to library format
$labels = array();
$a = array();
$vars = array();
$datacolor = array();
$max = 0;
@ -577,9 +591,9 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
}
$fontsize = 7;
$extra_height = 15;
$return .= "<div id='extra_$graph_id' style='font-size: ".$fontsize."pt; display:none; position:absolute; overflow: auto; height: ".$extra_height."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
$maxticks = (int) ($width / ($fontsize * $leg_max_length));

View File

@ -17,50 +17,49 @@
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pandora FMS - Installation Wizard</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="author" content="Pandora FMS Development Team">
<meta name="copyright" content="This is GPL software. Created by Sancho Lerena and many others">
<meta name="keywords" content="pandora, fms, monitoring, network, system, GPL, software">
<meta name="robots" content="index, follow">
<link rel="icon" href="images/pandora.ico" type="image/ico">
<link rel="stylesheet" href="include/styles/install.css" type="text/css">
</head>
<script type="text/javascript">
options_text = new Array('An existing Database','A new Database');
options_values = new Array('db_exist','db_new');
function ChangeDBDrop(causer) {
if (causer.value != 'db_exist') {
window.document.step2_form.drop.checked=0;
window.document.step2_form.drop.disabled=1;
<head>
<title>Pandora FMS - Installation Wizard</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="author" content="Pandora FMS Development Team">
<meta name="copyright" content="This is GPL software. Created by Sancho Lerena and many others">
<meta name="keywords" content="pandora, fms, monitoring, network, system, GPL, software">
<meta name="robots" content="index, follow">
<link rel="icon" href="images/pandora.ico" type="image/ico">
<link rel="stylesheet" href="include/styles/install.css" type="text/css">
</head>
<script type="text/javascript">
options_text = new Array('An existing Database','A new Database');
options_values = new Array('db_exist','db_new');
function ChangeDBDrop(causer) {
if (causer.value != 'db_exist') {
window.document.step2_form.drop.checked = 0;
window.document.step2_form.drop.disabled = 1;
}
else {
window.document.step2_form.drop.disabled = 0;
}
}
else {
window.document.step2_form.drop.disabled=0;
function ChangeDBAction(causer) {
var i = 0;
if (causer.value == 'oracle') {
window.document.step2_form.db_action.length = 1;
}
else {
window.document.step2_form.db_action.length = 2;
}
while (i < window.document.step2_form.db_action.length) {
window.document.step2_form.db_action.options[i].value = options_values[i];
window.document.step2_form.db_action.options[i].text = options_text[i];
i++;
}
window.document.step2_form.db_action.options[window.document.step2_form.db_action.length-1].selected=1;
ChangeDBDrop(window.document.step2_form.db_action);
}
}
function ChangeDBAction(causer) {
var i = 0;
if (causer.value == 'oracle') {
window.document.step2_form.db_action.length=1;
}
else {
window.document.step2_form.db_action.length=2;
}
while (i < window.document.step2_form.db_action.length) {
window.document.step2_form.db_action.options[i].value =options_values[i];
window.document.step2_form.db_action.options[i].text =options_text[i];
i++;
}
window.document.step2_form.db_action.options[window.document.step2_form.db_action.length-1].selected=1;
ChangeDBDrop(window.document.step2_form.db_action);
}
</script>
<body>
</script>
<body>
<div style='height: 10px'>
@ -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);

View File

@ -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 '<br>';
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 '<br>';
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 '<br>';
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 '<br>';
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');