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

* general/header.php, general/login_page.php,
	godmode/setup/setup.php, include/functions_ui.php,
	include/functions_graph.php, include/functions_html.php,
	include/graphs/fgraph.php, include/graphs/functions_pchart.php,
	include/graphs/functions_flot.php, include/functions_reporting.php,
	include/functions_visual_map.php, include/functions_config.php,
	operation/reporting/reporting_viewer.php,
	operation/visual_console/render_view.php,
	operation/agentes/tactical.php, operation/menu.php,
	operation/events/events.php: added the feature to set a
	public url for inverse proxy or for example mod_proxy of Apache.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6936 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-09-06 17:01:22 +00:00
parent a1da8fb3b0
commit 136772fc84
18 changed files with 637 additions and 561 deletions

View File

@ -1,3 +1,17 @@
2012-09-06 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php, general/login_page.php,
godmode/setup/setup.php, include/functions_ui.php,
include/functions_graph.php, include/functions_html.php,
include/graphs/fgraph.php, include/graphs/functions_pchart.php,
include/graphs/functions_flot.php, include/functions_reporting.php,
include/functions_visual_map.php, include/functions_config.php,
operation/reporting/reporting_viewer.php,
operation/visual_console/render_view.php,
operation/agentes/tactical.php, operation/menu.php,
operation/events/events.php: added the feature to set a
public url for inverse proxy or for example mod_proxy of Apache.
2012-09-05 Vanessa Gil <vanessa.gil@artica.es>
* godmode/agentes/module_manager.php

View File

@ -130,7 +130,6 @@ config_check();
<?php
// Autorefresh
$ignored_params = array ('agent_config' => false, 'code' => false);
if ($config['enable_refr']) {
$ignored_params['refr'] = 0;
echo '<a id="autorefresh" class="white_bold" href="' . ui_get_url_refresh ($ignored_params).'">' . html_print_image("images/page_refresh.png", true, array("class" => 'bot', "alt" => 'lightning')) . '&nbsp;'. __('Autorefresh');
@ -195,7 +194,8 @@ config_check();
echo "value='" . __("Enter keywords to search") . "'";
else if (strlen($config['search_keywords']) == 0)
echo "value='" . __("Enter keywords to search") . "'";
else echo "value='" . $config['search_keywords'] . "'";
else
echo "value='" . $config['search_keywords'] . "'";
?>
onfocus="javascript: if (fieldKeyWordEmpty) $('#keywords').val('');"
size="100" style="background: white url('images/lupa_15x15.png') no-repeat right; padding: 0; padding-left:0px; margin: 0; width: 90%; height: 19px; margin-bottom: 5px; margin-left: 2px;" />
@ -281,7 +281,6 @@ ui_require_jquery_file('jquery-ui-1.8.17.custom.min');
$("select#ref").change (function () {
href = $(a).attr ("href");
$(document).attr ("location", href + this.value);
});
return false;

View File

@ -21,7 +21,7 @@ if (!empty ($page) && !empty ($sec)) {
$url .= '&amp;'.safe_url_extraclean($key).'='.safe_url_extraclean($value);
}
}
echo '<img src="images/login_background.png" id="login_body">';
echo '<img src="' . ui_get_full_url('images/login_background.png') . '" id="login_body">';
echo '<div class="databox_login" id="login">';
@ -30,7 +30,7 @@ echo '<div class="databox_login" id="login">';
//echo '<br /><br /><br />';
echo '
<div id="login_in">
<form method="post" action="index.php'.$url.'">';
<form method="post" action="' . ui_get_full_url('index.php'.$url) . '">';
//TODO: Put branding in variables (external file) or database
/* CUSTOM BRANDING STARTS HERE */
@ -113,11 +113,8 @@ ui_require_jquery_file ('ui.draggable');
<?php
if (!isset ($login_failed)) {
?>
<!--[if lte IE 8]>
<div id="dialog" title="WARNING! You are using an outdated browser.">
<div style="position:absolute; top:20px; text-align: left; font-size: 9.5pt; line-height: 18px; left:0%; right:0%; margin: 0 auto; width:650px; border: 1px solid #FFF; ">
<?php
echo __("Pandora FMS frontend is built on advanced, modern technologies and does not support old browsers.");
@ -126,64 +123,61 @@ if (!isset ($login_failed)) {
</div>
<div style="position: relative; top: 90px; margin: 0 auto; width: 650px; border: 1px solid #FFF;">
<table style="width: 650px;">
<tr>
<td style="width: 20%;">
<a target="_blank" style="text-decoration: none; color: #6495ED;" href="https://www.google.com/chrome">
<img style="width: 60px;" src="images/google_chrome.png">
<img style="width: 60px;" src="images/google_chrome.png" />
<div style="position: relative; top: 11px;">
Google Chrome
<br>
<span style="text-decoration: underline;">Download page</a></span>
<br />
<span style="text-decoration: underline;">Download page</span>
</div>
</a>
</td>
<td style="font-size: 10px; line-height: 15px; width: 20%;">
<a target="_blank" style="text-decoration: none; color: #6495ED;" href="http://www.mozilla.org/en-US/firefox/fx/">
<img style="width: 60px;" src="images/mozilla_firefox.png">
<img style="width: 60px;" src="images/mozilla_firefox.png" />
<div style="position: relative; top: 5px;">
Mozilla Firefox
<br>
<span style="text-decoration: underline;">Download page</a></span>
<br />
<span style="text-decoration: underline;">Download page</span>
</div>
</a>
</td>
<td style="width: 20%;">
<a target="_blank" style="text-decoration: none; color: #6495ED;" href="http://windows.microsoft.com/es-ES/internet-explorer/downloads/ie-9/worldwide-languages">
<img style="width: 63px;" src="images/iexplorer.jpeg">
<img style="width: 63px;" src="images/iexplorer.jpeg" />
<div style="position: relative; top: 10px;">
Internet Explorer
<br>
<span style="text-decoration: underline;">Download page</a></span>
<br />
<span style="text-decoration: underline;">Download page</span>
</div>
</a>
</td>
<td style="width: 20%;">
<a target="_blank" style="text-decoration: none; color: #6495ED;" href="http://www.opera.com/download/">
<img style="width: 50px;" src="images/opera_browser.png">
<img style="width: 50px;" src="images/opera_browser.png" />
<div style="position: relative; top: 16px;">
Opera browser
<br>
<span style="text-decoration: underline;">Download page</a></span>
<br />
<span style="text-decoration: underline;">Download page</span>
</div>
</a>
</td>
<td style="width: 20%;">
<a target="_blank" style="text-decoration: none; color: #6495ED;" href="http://www.apple.com/es/safari/download/">
<img style="width: 60px;" src="images/safari_browser.jpeg">
<img style="width: 60px;" src="images/safari_browser.jpeg" />
<div style="position: relative; top: 11px;">
Apple safari
<br>
<span style="text-decoration: underline;">Download page</a></span>
<br />
<span style="text-decoration: underline;">Download page</span>
</div>
</a>
</td>
</tr>
</table>
</div>
<div style="position: relative; top:120px; width:650px; margin: 0 auto; text-align: left; border: 1px solid #FFF;">
<?php
echo '<span style="font-size: 10pt; color: #2E2E2E; font-weight: bold;">';
@ -191,20 +185,23 @@ if (!isset ($login_failed)) {
echo '</span>';
echo '<span style="font-size: 9.5pt; line-height: 18px;">';
echo '<br><br>' . __('New browsers usually come with support for new technologies, increasing web page speed, better privacy settings and so on. They also resolve security and functional issues.');
echo '<br><br>' .
__('New browsers usually come with support for new technologies, increasing web page speed, better privacy settings and so on. They also resolve security and functional issues.');
echo '</span>';
?>
</div>
<div style="float:right; margin-top:160px; margin-right: 50px; width: 200px;">
<a id="close-dialog-browser" href="#" style="text-decoration: none;">
<span style="color: #6495ED;">
<?php
echo '<a id="close-dialog-browser" href="#" style="text-decoration: none;">' . '<span style="color: #6495ED;">' . __('Continue despite this warning') . ' >>' . '</span></a>';
echo __('Continue despite this warning');
?>
</span>
</a>
</div>
</div>
<![endif]-->
<?php
}
?>
@ -224,8 +221,7 @@ $(document).ready (function () {
width: 700,
overlay: {
opacity: 0.5,
background: "black"
},
background: "black"},
bgiframe: jQuery.browser.msie
});
});
@ -243,8 +239,7 @@ $(document).ready (function () {
width: 350,
overlay: {
opacity: 0.5,
background: "black"
},
background: "black"},
bgiframe: jQuery.browser.msie
});
});
@ -252,10 +247,8 @@ $(document).ready (function () {
$("#submit-hide-login-error").click (function () {
$("#login_failed" ).dialog('close')
});
});
document.getElementById('nick').focus();
/* ]]> */
</script>

View File

@ -321,6 +321,11 @@ $table->data[27][1] = html_print_input_text ('license_info_key', $license_info,
$table->data[27][1] .= '&nbsp;<a id="dialog_license_info" title="'.__("License Info").'" href="#">'.html_print_image('images/lock.png', true, array('class' => 'bot', 'title' => __('License info'))).'</a>';
$table->data[27][1] .= '<div id="dialog_show_license" style="display:none"></div>';
$table->data[28][0] = __('Public URL');
$table->data[28][0] .= ui_print_help_tip(__('Set this value when your PandoraFMS across inverse proxy or for example with mod_proxy of Apache.'), true);
$table->data[28][1] = html_print_input_text ('public_url', $config['public_url'], '', 40, 255, true);
?>
<script type="text/javascript">
function toggleButton(type) {
@ -366,14 +371,16 @@ $(document).ready (function () {
$("#radiobtn0011").click(function() {
flag = $("#radiobtn0011").is(':checked');
if (flag == true) {
<?php echo "if (! confirm ('" . __('If Enterprise ACL System is enabled without rules you will lose access to Pandora FMS Console (even admin). Do you want to continue?') . "')) return false" ?>
message = "<?php
echo __('If Enterprise ACL System is enabled without rules you will lose access to Pandora FMS Console (even admin). Do you want to continue?');
?>";
if (!confirm(message)) return false"
}
});
$("#change_timezone").click(function () {
$("#zone").attr("disabled", false);
$("#timezone").attr("disabled", false);
});
});
</script>

View File

@ -131,6 +131,8 @@ function config_update_config () {
config_update_value ('netflow_interval', get_parameter ('netflow_interval'));
config_update_value ('netflow_daemon', get_parameter ('netflow_daemon'));
config_update_value ('public_url', get_parameter('public_url'));
$enterprise = enterprise_include_once ('godmode/setup/setup.php');
if ($enterprise !== ENTERPRISE_NOT_HOOK) {
config_update_value ('enable_pass_policy', get_parameter('enable_pass_policy'));
@ -720,6 +722,10 @@ function config_process_config () {
config_update_value ('gis_default_icon', "marker");
}
if (!isset($config['public_url'])) {
config_update_value ('public_url', "");
}
/* Finally, check if any value was overwritten in a form */
config_update_config();
}

View File

@ -90,16 +90,16 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
if (!$flash_chart) {
// Set the title and time format
if ($period <= 21600) {
if ($period <= SECONDS_6HOURS) {
$time_format = 'H:i:s';
}
elseif ($period < 86400) {
elseif ($period < SECONDS_1DAY) {
$time_format = 'H:i';
}
elseif ($period < 1296000) {
elseif ($period < SECONDS_15DAYS) {
$time_format = "M \nd H:i";
}
elseif ($period < 2592000) {
elseif ($period < SECONDS_1MONTH) {
$time_format = "M \nd H\h";
}
else {
@ -108,16 +108,16 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
}
else {
// Set the title and time format
if ($period <= 21600) {
if ($period <= SECONDS_6HOURS) {
$time_format = 'H:i:s';
}
elseif ($period < 86400) {
elseif ($period < SECONDS_1DAY) {
$time_format = 'H:i';
}
elseif ($period < 1296000) {
elseif ($period < SECONDS_15DAYS) {
$time_format = "M d H:i";
}
elseif ($period < 2592000) {
elseif ($period < SECONDS_1MONTH) {
$time_format = "M d H\h";
}
else {
@ -487,23 +487,23 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
if ($compare === 'separated') {
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend,
$long_index, "images/image_problem.opaque.png", "", $unit, $homeurl,
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key).
'<br>'.
area_graph($flash_chart, $chart_prev, $width, $height/2, $color, $legend_prev,
$long_index_prev, "images/image_problem.opaque.png", "", $unit, $homeurl,
$long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key);
}
else {
// Color commented not to restrict serie colors
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
$long_index, "images/image_problem.opaque.png", "", $unit, $homeurl,
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key);
}
@ -559,20 +559,20 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
}
// Set the title and time format
if ($temp_range <= 21600) {
if ($temp_range <= SECONDS_6HOURS) {
$time_format = 'H:i:s';
}
elseif ($temp_range < 86400) {
elseif ($temp_range < SECONDS_1DAY) {
$time_format = 'H:i';
}
elseif ($temp_range < 1296000) {
elseif ($temp_range < SECONDS_15DAYS) {
$time_format = 'M d';
$time_format_2 = 'H:i';
if ($projection != false) {
$time_format_2 = 'H\h';
}
}
elseif ($temp_range <= 2592000) {
elseif ($temp_range <= SECONDS_1MONTH) {
$time_format = 'M d';
$time_format_2 = 'H\h';
}
@ -924,7 +924,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
//Work around for fixed the agents name with huge size chars.
@ -934,7 +934,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
case GRAPH_AREA:
$color = null;
return area_graph($flash_charts, $graph_values, $width, $height,
$color, $module_name_list, $long_index, $homeurl."images/image_problem.opaque.png",
$color, $module_name_list, $long_index, ui_get_full_url("images/image_problem.opaque.png"),
"", "", $homeurl, $water_mark,
$config['fontpath'], $fixed_font_size, "", $ttl);
break;
@ -942,21 +942,21 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
case GRAPH_STACKED_AREA:
$color = null;
return stacked_area_graph($flash_charts, $graph_values, $width, $height,
$color, $module_name_list, $long_index, $homeurl."images/image_problem.opaque.png",
$color, $module_name_list, $long_index, ui_get_full_url("images/image_problem.opaque.png"),
"", "", $water_mark,
$config['fontpath'], $fixed_font_size, "", $ttl, $homeurl);
break;
case GRAPH_LINE:
$color = null;
return line_graph($flash_charts, $graph_values, $width, $height,
$color, $module_name_list, $long_index, $homeurl."images/image_problem.opaque.png",
$color, $module_name_list, $long_index, ui_get_full_url("images/image_problem.opaque.png"),
"", "", $water_mark,
$config['fontpath'], $fixed_font_size, "", $ttl, $homeurl);
break;
case GRAPH_STACKED_LINE:
$color = null;
return stacked_line_graph($flash_charts, $graph_values, $width, $height,
$color, $module_name_list, $long_index, $homeurl."images/image_problem.opaque.png",
$color, $module_name_list, $long_index, ui_get_full_url("images/image_problem.opaque.png"),
"", "", $water_mark,
$config['fontpath'], $fixed_font_size, "", $ttl, $homeurl);
break;
@ -991,7 +991,8 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0) {
$bottom = $datelimit + ($periodtime * $i);
if (! $graphic_type) {
$name = date('G:i', $bottom);
} else {
}
else {
$name = $bottom;
}
@ -1020,13 +1021,13 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0) {
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
if ($empty_data)
echo fs_error_image();
else {
echo area_graph($config['flash_charts'], $data, $width, $height,
null, null, null, "images/image_problem.opaque.png", "", "", "",
null, null, null, ui_get_full_url("images/image_problem.opaque.png"), "", "", "",
$water_mark,
$config['fontpath'], $config['font_size'], "");
}
@ -1086,7 +1087,7 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
asort ($data);
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
return pie3d_graph($config['flash_charts'], $data, $width, $height, __("other"),
'', $water_mark,
@ -1123,12 +1124,16 @@ function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value
require_once("include_graph_dependencies.php");
include_graphs_dependencies($config['homedir'].'/');
return "<img title='" . $title . "' alt='" . $title . "'" . $class_tag . $id_tag .
" src='" . $config['homeurl'] . "/include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar" .
$src = ui_get_full_url(
"/include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar" .
"&width=".$width."&height=".$height."&progress=".$progress.
"&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str .
"&title=".$title."&font=".$config['fontpath']."&value_text=". $value_text .
"&colorRGB=". $colorRGB . "' />";
"&colorRGB=". $colorRGB
);
return "<img title='" . $title . "' alt='" . $title . "'" . $class_tag . $id_tag .
" src='" . $src . "' />";
}
function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false) {
@ -1226,7 +1231,7 @@ function grafico_db_agentes_purge ($id_agent, $width = 380, $height = 300) {
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $water_mark,
@ -1257,7 +1262,7 @@ function grafico_db_agentes_paquetes($width = 380, $height = 300) {
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
return hbar_graph($config['flash_charts'], $data, $width, $height, array(),
$legend, "", "", true, "",
@ -1310,7 +1315,7 @@ function graph_db_agentes_modulos($width, $height) {
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
return hbar_graph($config['flash_charts'], $data, $width, $height, array(),
array(), "", "", true, "",
@ -1524,17 +1529,21 @@ function graphic_incident_source($width = 320, $height = 200) {
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen
FROM tincidencia GROUP BY `origen`
FROM tincidencia
GROUP BY `origen`
ORDER BY 1 DESC LIMIT %d', $max_items);
break;
case "postgresql":
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen
FROM tincidencia GROUP BY "origen"
FROM tincidencia
GROUP BY "origen"
ORDER BY 1 DESC LIMIT %d', $max_items);
break;
case "oracle":
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen
FROM tincidencia WHERE rownum <= %d GROUP BY origen
FROM tincidencia
WHERE rownum <= %d
GROUP BY origen
ORDER BY 1 DESC', $max_items);
break;
}
@ -1577,15 +1586,21 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
//is required if both DISTINCT() and COUNT() are in the statement
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count
FROM tevento WHERE 1=1 %s
GROUP BY id_agente ORDER BY count DESC', $url);
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente,
id_grupo, COUNT(id_agente) AS count
FROM tevento
WHERE 1=1 %s
GROUP BY id_agente
ORDER BY count DESC', $url);
break;
case "postgresql":
case "oracle":
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count
FROM tevento WHERE 1=1 %s
GROUP BY id_agente, id_grupo ORDER BY count DESC', $url);
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente,
id_grupo, COUNT(id_agente) AS count
FROM tevento
WHERE 1=1 %s
GROUP BY id_agente, id_grupo
ORDER BY count DESC', $url);
break;
}
@ -1616,7 +1631,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $water_mark,
@ -1670,7 +1685,7 @@ function grafico_eventos_total($filter = "") {
asort ($data);
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $water_mark,
@ -1720,7 +1735,7 @@ function grafico_eventos_usuario ($width, $height) {
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $water_mark,
@ -1777,7 +1792,7 @@ function graph_custom_sql_graph ($id, $width, $height, $type = 'sql_graph_vbar',
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
switch ($type) {
case 'sql_graph_vbar': // vertical bar
@ -2247,33 +2262,28 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
if ($compare === 'separated') {
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend,
$long_index, "images/image_problem.opaque.png", "", $unit, $homeurl,
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark,
$config['fontpath'], $config['font_size'], $unit, 1, array(),
array(), 0, 0, $adapt_key).
'<br>'.
area_graph($flash_chart, $chart_prev, $width, $height/2, $color, $legend_prev,
$long_index_prev, "images/image_problem.opaque.png", "", $unit, $homeurl,
$long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark,
$config['fontpath'], $config['font_size'], $unit, 1, array(),
array(), 0, 0, $adapt_key);
}
else {
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
$long_index, "images/image_problem.opaque.png", "", $unit, $homeurl,
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark,
$config['fontpath'], $config['font_size'], $unit, 1, array(),
array(), 0, 0, $adapt_key);
}
//~ return stacked_area_graph($flash_chart, $chart, $width, $height, $color,
//~ $legend, $long_index, "images/image_problem.opaque.png", "", $unit,
//~ $water_mark = "", $config['fontpath'], $config['font_size'], $unit = '',
//~ 1, $homeurl);
}
@ -2341,10 +2351,10 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $only_im
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
return stacked_area_graph($flash_chart, $chart, $width, $height, null, $sources,
null, "images/image_problem.opaque.png", "", "",
null, ui_get_full_url("images/image_problem.opaque.png"), "", "",
$water_mark,
$config['fontpath'], $config['font_size'], "");
}
@ -2398,10 +2408,10 @@ function graph_netflow_total_area ($data, $period, $width, $height, $only_image)
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
return area_graph($flash_chart, $chart, $width, $height, array (), array (),
array (), "images/image_problem.opaque.png", "", "", $homeurl,
array (), ui_get_full_url("images/image_problem.opaque.png"), "", "", $homeurl,
$water_mark,
$config['fontpath'], $config['font_size'], "");
}
@ -2658,7 +2668,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
$legend = null;
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
return area_graph($flash_chart, $chart, $width, $height, $color,
$legend, array(), '', "", $unit, $homeurl,

View File

@ -666,7 +666,7 @@ function html_print_input_image ($name, $src, $value, $style = '', $return = fal
}
// path to image
$src = $config["homeurl"] . '/' . $src;
$src = ui_get_full_url($src);
$output = '<input id="image-'.$name.$idcounter.'" src="'.$src.'" style="'.$style.'" name="'.$name.'" type="image"';
@ -1226,13 +1226,10 @@ function html_print_image ($src, $return = false, $options = false, $return_src
}
if (!$relative) {
$urlImage = ui_get_full_url(false);
if (defined('METACONSOLE'))
$urlImage .= ENTERPRISE_DIR . '/meta/';
$src .= ENTERPRISE_DIR . '/meta/' . $src;
// path to image
$src = $urlImage . $src;
$src = ui_get_full_url($src);
}
// Only return src field of image

View File

@ -2303,8 +2303,6 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table->colspan[1][0] = 3;
$data = array ();
$urlImage = ui_get_full_url(false);
require_once ($config["homedir"] . '/include/functions_graph.php');
$data[0] = graphic_combined_module(
$modules,
@ -2318,8 +2316,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
0,
$graph["stacked"],
$report["datetime"],
true,
$urlImage);
true);
array_push ($table->data, $data);
break;

View File

@ -1218,7 +1218,8 @@ function ui_process_page_head ($string, $bitfield) {
$output .= '</style>';
}
else {
$output .= '<link rel="stylesheet" href="' . $config['homeurl'] . '/' .$filename.'" type="text/css" />'."\n\t";
$url_css = ui_get_full_url($filename);
$output .= '<link rel="stylesheet" href="' . $url_css . '" type="text/css" />'."\n\t";
}
}
//End load CSS
@ -1245,7 +1246,8 @@ function ui_process_page_head ($string, $bitfield) {
$output .= "\n".'/* ]]> */</script>';
}
else {
$output .= '<script type="text/javascript" src="'. $config['homeurl'] . '/' .$filename.'"></script>'."\n\t";
$url_js = ui_get_full_url($filename);
$output .= '<script type="text/javascript" src="' . $url_js . '"></script>'."\n\t";
}
}
//End load JS
@ -1288,7 +1290,8 @@ function ui_process_page_head ($string, $bitfield) {
$output .= "\n".'/* ]]> */</script>';
}
else {
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . '/' . $filename.'"></script>'."\n\t";
$url_js = ui_get_full_url($filename);
$output .= '<script type="text/javascript" src="' . $url_js . '"></script>'."\n\t";
}
}
@ -1929,14 +1932,19 @@ function ui_get_url_refresh ($params = false, $relative = true, $add_post = true
* An example of full URL is http:/localhost/pandora_console/index.php?sec=gsetup&sec2=godmode/setup/setup
*
* @param mixed $url If provided, it will be added after the index.php, but it is false boolean value, put the homeurl in the url.
* @param boolean $no_proxy To avoid the proxy checks, by default it is false.
*
* @return string A full URL in Pandora.
*/
function ui_get_full_url ($url = '') {
function ui_get_full_url ($url = '', $no_proxy = false) {
global $config;
$port = null; // null means 'use the starndard port'
if (isset ($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === true || $_SERVER['HTTPS'] == 'on')) {
$port = null; // null means 'use the starndard port'
$proxy = false; //By default Pandora FMS doesn't run across proxy.
if (isset ($_SERVER['HTTPS'])
&& ($_SERVER['HTTPS'] === true
|| $_SERVER['HTTPS'] == 'on')) {
$protocol = 'https';
if ( $_SERVER['SERVER_PORT'] != 443) {
$port = $_SERVER['SERVER_PORT'];
@ -1954,7 +1962,22 @@ function ui_get_full_url ($url = '') {
}
}
if (!$no_proxy) {
//Check if the PandoraFMS runs across the proxy like as
//mod_proxy of Apache
//and check if public_url is setted
if (!empty($config['public_url'])
&& (!empty($_SERVER['HTTP_X_FORWARDED_HOST']))) {
$fullurl = $config['public_url'];
$proxy = true;
}
else {
$fullurl = $protocol.'://' . $_SERVER['SERVER_NAME'];
}
}
else {
$fullurl = $protocol.'://' . $_SERVER['SERVER_NAME'];
}
// using a different port than the standard
if ( $port != null ) {
@ -1968,9 +1991,22 @@ function ui_get_full_url ($url = '') {
//Only add the home url
$url = $config['homeurl'] . '/';
}
elseif (!strstr($url, ".php")) {
if ($proxy) {
$fullurl .= '/';
}
else {
$fullurl .= $config['homeurl'] . '/';
}
}
else {
if ($proxy) {
$fullurl .= '/';
}
else {
$fullurl .= $_SERVER['SCRIPT_NAME'];
}
}
return $fullurl.$url;
}

View File

@ -764,18 +764,18 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$proportion = $width / $layout["width"];
$mapHeight = $proportion * $layout["height"];
}
$backgroundImage = $config['homeurl'].'/include/Image/image_functions.php?getFile=1&thumb=1&thumb_size=' . $mapWidth . 'x' . $mapHeight . '&file=' .
$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"]);
}
else {
$mapWidth = $layout["width"];
$mapHeight = $layout["height"];
$backgroundImage = $config['homeurl'].'/images/console/background/'.io_safe_input ($layout["background"]);
$backgroundImage = '/images/console/background/'.io_safe_input ($layout["background"]);
}
echo '<div id="layout_map"
style="margin:0px auto;text-align:center;z-index: 0; position:relative; width:'.$mapWidth.'px; height:'.$mapHeight.'px;">';
echo "<img src='" . $backgroundImage . "' width='100%' height='100%' />";
echo "<img src='" . ui_get_full_url($backgroundImage) . "' width='100%' height='100%' />";
$layout_datas = db_get_all_rows_field_filter ('tlayout_data', 'id_layout', $id_layout);
if (empty($layout_datas))
$layout_datas = array();

View File

@ -155,6 +155,7 @@ function histogram($chart_data, $width, $height, $font, $max, $title, $mode, $tt
function progressbar($progress, $width, $height, $title, $font, $mode = 1,
$out_of_lim_str = false, $out_of_lim_image = false, $ttl = 1) {
$graph = array();
$graph['progress'] = $progress;
@ -174,6 +175,7 @@ function progressbar($progress, $width, $height, $title, $font, $mode = 1,
function slicesbar_graph($chart_data, $period, $width, $height, $colors, $font,
$round_corner, $home_url = '', $ttl = 1) {
$graph = array();
$graph['data'] = $chart_data;
$graph['period'] = $period;

View File

@ -28,15 +28,15 @@ function include_javascript_dependencies_flot_graph($return = false) {
// 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="'. $config['homeurl'] . '/include/graphs/flot/jquery.flot.min.js"></script>
<script language="javascript" type="text/javascript" src="'. $config['homeurl'] . '/include/graphs/flot/jquery.flot.pie.min.js"></script>
<script language="javascript" type="text/javascript" src="'. $config['homeurl'] . '/include/graphs/flot/jquery.flot.crosshair.min.js"></script>
<script language="javascript" type="text/javascript" src="'. $config['homeurl'] . '/include/graphs/flot/jquery.flot.stack.min.js"></script>
<script language="javascript" type="text/javascript" src="'. $config['homeurl'] . '/include/graphs/flot/jquery.flot.selection.min.js"></script>
<script language="javascript" type="text/javascript" src="'. $config['homeurl'] . '/include/graphs/flot/jquery.flot.resize.min.js"></script>
<script language="javascript" type="text/javascript" src="'. $config['homeurl'] . '/include/graphs/flot/jquery.flot.threshold.js"></script>
<script language="javascript" type="text/javascript" src="'. $config['homeurl'] . '/include/graphs/flot/jquery.flot.symbol.min.js"></script>
<script language="javascript" type="text/javascript" src="'. $config['homeurl'] . '/include/graphs/flot/pandora.flot.js"></script>
<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>
';
$output .= "
<script type='text/javascript'>

View File

@ -109,7 +109,8 @@ if (!$force_height) {
$water_mark = '';
if(isset($graph['water_mark'])) {
$water_mark = $graph['water_mark']; //"/var/www/pandora_console/images/logo_vertical_water.png";
//"/var/www/pandora_console/images/logo_vertical_water.png";
$water_mark = $graph['water_mark'];
}
if (isset($graph['force_steps'])) {
@ -338,7 +339,11 @@ function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colo
$color = $colorsrgb[$color];
$ratio = $thinest_slice * $d['utimestamp'];
$myPicture->drawRoundedFilledRectangle ($i, 0, $ratio+$i,
$height, $radius, array('R' => $color['R'], 'G' => $color['G'], 'B' => $color['B']));
$height, $radius,
array('R' => $color['R'],
'G' => $color['G'],
'B' => $color['B'])
);
$i+=$ratio;
}

View File

@ -249,18 +249,30 @@ if ($config["pure"] == 0) {
$manage_events['text'] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&amp;section=filter">' .
html_print_image("images/setup.png", true, array ("title" => __('Manage events'))) . '</a>';
$onheader = array('manage_events' => $manage_events, 'separator' => '', 'fullscreen' => $fullscreen,
'list' => $list, 'rss' => $rss, 'marquee' => $marquee, 'csv' => $csv, 'sound_event' => $sound_event) ;
$onheader = array('manage_events' => $manage_events,
'separator' => '',
'fullscreen' => $fullscreen,
'list' => $list,
'rss' => $rss,
'marquee' => $marquee,
'csv' => $csv,
'sound_event' => $sound_event) ;
}
else {
$onheader = array('fullscreen' => $fullscreen,
'list' => $list, 'rss' => $rss, 'marquee' => $marquee, 'csv' => $csv, 'sound_event' => $sound_event) ;
'list' => $list,
'rss' => $rss,
'marquee' => $marquee,
'csv' => $csv,
'sound_event' => $sound_event) ;
}
switch ($section){
case 'sound_event': $onheader['sound_event']['active'] = true;
case 'sound_event':
$onheader['sound_event']['active'] = true;
break;
default: $onheader['list']['active'] = true;
default:
$onheader['list']['active'] = true;
break;
}
@ -269,10 +281,9 @@ if ($config["pure"] == 0) {
?>
<script type="text/javascript">
function openSoundEventWindow() {
<?php
$url = ui_get_full_url(false);
?>
url = '<?php echo $url . 'operation/events/sound_events.php'; ?>';
url = '<?php
echo ui_get_full_url('operation/events/sound_events.php');
?>';
window.open(url, '<?php __('Sound Alerts'); ?>','width=300, height=300, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=yes');
}

View File

@ -267,10 +267,9 @@ if (check_acl ($config['id_user'], 0, "AR")) {
?>
<script type="text/javascript">
function openSoundEventWindow() {
<?php
$url = ui_get_full_url(false);
?>
url = '<?php echo $url . 'operation/events/sound_events.php'; ?>';
url = '<?php
echo ui_get_full_url('operation/events/sound_events.php');
?>';
window.open(url, '<?php __('Sound Alerts'); ?>','width=475, height=275, resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no');
}

View File

@ -259,5 +259,4 @@ $(document).ready (function () {
}
});
});
</script>

View File

@ -60,7 +60,8 @@ if (check_acl ($config["id_user"], $id_group, "AW")) {
$hash = md5($config["dbpass"]. $id_layout. $config["id_user"]);
$options['public_link']['text'] = '<a href="'.$config["homeurl"].'/operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$id_layout.'&id_user='.$config["id_user"].'">'.
$url = ui_get_full_url('operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$id_layout.'&id_user='.$config["id_user"]);
$options['public_link']['text'] = '<a href="' . $url . '">'.
html_print_image ("images/camera.png", true, array ("title" => __('Show link to public Visual Console'))).'</a>';
$options['public_link']['active'] = false;