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> 2012-09-05 Vanessa Gil <vanessa.gil@artica.es>
* godmode/agentes/module_manager.php * godmode/agentes/module_manager.php

View File

@ -53,7 +53,7 @@ config_check();
<a href="index.php?sec=workspace&amp;sec2=operation/users/user_edit" class="white"> [<b><?php echo $config["id_user"];?></b>]</a> <a href="index.php?sec=workspace&amp;sec2=operation/users/user_edit" class="white"> [<b><?php echo $config["id_user"];?></b>]</a>
<?php <?php
if ($config["metaconsole"] == 0){ if ($config["metaconsole"] == 0) {
$msg_cnt = messages_get_count ($config["id_user"]); $msg_cnt = messages_get_count ($config["id_user"]);
if ($msg_cnt > 0) { if ($msg_cnt > 0) {
echo '<div id="dialog_messages" style="display: none"></div>'; echo '<div id="dialog_messages" style="display: none"></div>';
@ -130,7 +130,6 @@ config_check();
<?php <?php
// Autorefresh // Autorefresh
$ignored_params = array ('agent_config' => false, 'code' => false); $ignored_params = array ('agent_config' => false, 'code' => false);
if ($config['enable_refr']) { if ($config['enable_refr']) {
$ignored_params['refr'] = 0; $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'); 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');
@ -150,22 +149,22 @@ config_check();
echo '</a>'; echo '</a>';
} else { } else {
$ignored_params['refr'] = ''; $ignored_params['refr'] = '';
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').'</a>'; 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').'</a>';
$values = array ( $values = array (
'5' => __('5 seconds'), '5' => __('5 seconds'),
'10' => __('10 seconds'), '10' => __('10 seconds'),
'15' => __('15 seconds'), '15' => __('15 seconds'),
'30' => __('30 seconds'), '30' => __('30 seconds'),
(string)SECONDS_1MINUTE => __('1 minute'), (string)SECONDS_1MINUTE => __('1 minute'),
(string)SECONDS_2MINUTES => __('2 minutes'), (string)SECONDS_2MINUTES => __('2 minutes'),
(string)SECONDS_5MINUTES => __('5 minutes'), (string)SECONDS_5MINUTES => __('5 minutes'),
(string)SECONDS_15MINUTES => __('15 minutes'), (string)SECONDS_15MINUTES => __('15 minutes'),
(string)SECONDS_30MINUTES => __('30 minutes'), (string)SECONDS_30MINUTES => __('30 minutes'),
(string)SECONDS_1HOUR => __('1 hour')); (string)SECONDS_1HOUR => __('1 hour'));
echo '<span id="combo_refr" style="display: none">'; echo '<span id="combo_refr" style="display: none">';
html_print_select ($values, 'ref', '', '', __('Select'), '0', false, false, false); html_print_select ($values, 'ref', '', '', __('Select'), '0', false, false, false);
unset ($values); unset ($values);
echo '</span>'; echo '</span>';
} }
} }
@ -177,7 +176,7 @@ config_check();
if (isset($config["custom_logo"])) if (isset($config["custom_logo"]))
echo html_print_image("images/custom_logo/" . $config["custom_logo"], true,array("height" => '60', "width" => '139', "alt" => 'Logo')); echo html_print_image("images/custom_logo/" . $config["custom_logo"], true,array("height" => '60', "width" => '139', "alt" => 'Logo'));
echo "</a>"; echo "</a>";
?> ?>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -195,7 +194,8 @@ config_check();
echo "value='" . __("Enter keywords to search") . "'"; echo "value='" . __("Enter keywords to search") . "'";
else if (strlen($config['search_keywords']) == 0) else if (strlen($config['search_keywords']) == 0)
echo "value='" . __("Enter keywords to search") . "'"; echo "value='" . __("Enter keywords to search") . "'";
else echo "value='" . $config['search_keywords'] . "'"; else
echo "value='" . $config['search_keywords'] . "'";
?> ?>
onfocus="javascript: if (fieldKeyWordEmpty) $('#keywords').val('');" 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;" /> 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;" />
@ -211,7 +211,7 @@ config_check();
</td> </td>
<td> <td>
<?php <?php
if ($config["metaconsole"] == 0){ if ($config["metaconsole"] == 0) {
echo '<a class="white_bold" href="index.php?sec=eventos&amp;sec2=operation/events/events">' . html_print_image("images/lightning_go.png", true, array("alt" => 'lightning_go', "class" => 'bot')) . '&nbsp;'.__('Events').'</a>'; echo '<a class="white_bold" href="index.php?sec=eventos&amp;sec2=operation/events/events">' . html_print_image("images/lightning_go.png", true, array("alt" => 'lightning_go', "class" => 'bot')) . '&nbsp;'.__('Events').'</a>';
} }
?> ?>
@ -281,7 +281,6 @@ ui_require_jquery_file('jquery-ui-1.8.17.custom.min');
$("select#ref").change (function () { $("select#ref").change (function () {
href = $(a).attr ("href"); href = $(a).attr ("href");
$(document).attr ("location", href + this.value); $(document).attr ("location", href + this.value);
}); });
return false; return false;
@ -291,4 +290,4 @@ ui_require_jquery_file('jquery-ui-1.8.17.custom.min');
?> ?>
}); });
/* ]]> */ /* ]]> */
</script> </script>

View File

@ -21,7 +21,7 @@ if (!empty ($page) && !empty ($sec)) {
$url .= '&amp;'.safe_url_extraclean($key).'='.safe_url_extraclean($value); $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">'; echo '<div class="databox_login" id="login">';
@ -30,7 +30,7 @@ echo '<div class="databox_login" id="login">';
//echo '<br /><br /><br />'; //echo '<br /><br /><br />';
echo ' echo '
<div id="login_in"> <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 //TODO: Put branding in variables (external file) or database
/* CUSTOM BRANDING STARTS HERE */ /* CUSTOM BRANDING STARTS HERE */
@ -110,152 +110,145 @@ ui_require_jquery_file ('ui.draggable');
?> ?>
<?php <?php
if (!isset ($login_failed)) { if (!isset ($login_failed)) {
?> ?>
<!--[if lte IE 8]> <!--[if lte IE 8]>
<div id="dialog" title="WARNING! You are using an outdated browser.">
<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
<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; "> echo __("Pandora FMS frontend is built on advanced, modern technologies and does not support old browsers.");
<?php echo "<br>" . __("It is highly recommended that you choose and install a modern browser. It is free of charge and only takes a couple of minutes.");
echo __("Pandora FMS frontend is built on advanced, modern technologies and does not support old browsers."); ?>
echo "<br>" . __("It is highly recommended that you choose and install a modern browser. It is free of charge and only takes a couple of minutes."); </div>
?>
</div> <div style="position: relative; top: 90px; margin: 0 auto; width: 650px; border: 1px solid #FFF;">
<table style="width: 650px;">
<div style="position: relative; top: 90px; margin: 0 auto; width: 650px; border: 1px solid #FFF;">
<table style="width: 650px;">
<tr> <tr>
<td style="width: 20%;"> <td style="width: 20%;">
<a target="_blank" style="text-decoration: none; color: #6495ED;" href="https://www.google.com/chrome"> <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;">
<div style="position: relative; top: 11px;"> Google Chrome
Google Chrome <br />
<br> <span style="text-decoration: underline;">Download page</span>
<span style="text-decoration: underline;">Download page</a></span> </div>
</div> </a>
</td> </td>
<td style="font-size: 10px; line-height: 15px; width: 20%;"> <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/"> <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;">
<div style="position: relative; top: 5px;"> Mozilla Firefox
Mozilla Firefox <br />
<br> <span style="text-decoration: underline;">Download page</span>
<span style="text-decoration: underline;">Download page</a></span> </div>
</div> </a>
</td> </td>
<td style="width: 20%;"> <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"> <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;">
<div style="position: relative; top: 10px;"> Internet Explorer
Internet Explorer <br />
<br> <span style="text-decoration: underline;">Download page</span>
<span style="text-decoration: underline;">Download page</a></span> </div>
</div> </a>
</td> </td>
<td style="width: 20%;"> <td style="width: 20%;">
<a target="_blank" style="text-decoration: none; color: #6495ED;" href="http://www.opera.com/download/"> <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;">
<div style="position: relative; top: 16px;"> Opera browser
Opera browser <br />
<br> <span style="text-decoration: underline;">Download page</span>
<span style="text-decoration: underline;">Download page</a></span> </div>
</div> </a>
</td> </td>
<td style="width: 20%;"> <td style="width: 20%;">
<a target="_blank" style="text-decoration: none; color: #6495ED;" href="http://www.apple.com/es/safari/download/"> <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;">
<div style="position: relative; top: 11px;"> Apple safari
Apple safari <br />
<br> <span style="text-decoration: underline;">Download page</span>
<span style="text-decoration: underline;">Download page</a></span> </div>
</div> </a>
</td> </td>
</tr> </tr>
</table> </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;">';
echo __('Why is it recommended to upgrade the web browser?');
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 '</span>';
?>
</div>
<div style="float:right; margin-top:160px; margin-right: 50px; width: 200px;">
<?php
echo '<a id="close-dialog-browser" href="#" style="text-decoration: none;">' . '<span style="color: #6495ED;">' . __('Continue despite this warning') . ' >>' . '</span></a>';
?>
</div>
</div> </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;">';
echo __('Why is it recommended to upgrade the web browser?');
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 '</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 __('Continue despite this warning');
?>
</span>
</a>
</div>
</div>
<![endif]--> <![endif]-->
<?php <?php
} }
?> ?>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
/* <![CDATA[ */ /* <![CDATA[ */
$(document).ready (function () { $(document).ready (function () {
// IE9- modal warning window // IE9- modal warning window
$(function() { $(function() {
$( "#dialog" ).dialog({ $( "#dialog" ).dialog({
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
height: 400, height: 400,
width: 700, width: 700,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
background: "black" background: "black"},
},
bgiframe: jQuery.browser.msie bgiframe: jQuery.browser.msie
});
}); });
});
$("#close-dialog-browser").click (function () {
$("#close-dialog-browser").click (function () { $("#dialog" ).dialog('close')
$("#dialog" ).dialog('close') });
});
$(function() {
$(function() { $( "#login_failed" ).dialog({
$( "#login_failed" ).dialog({
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
height: 150, height: 150,
width: 350, width: 350,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
background: "black" background: "black"},
},
bgiframe: jQuery.browser.msie bgiframe: jQuery.browser.msie
}); });
}); });
$("#submit-hide-login-error").click (function () {
$("#login_failed" ).dialog('close')
});
});
$("#submit-hide-login-error").click (function () { document.getElementById('nick').focus();
$("#login_failed" ).dialog('close') /* ]]> */
}); </script>
});
document.getElementById('nick').focus();
/* ]]> */
</script>

View File

@ -116,7 +116,7 @@ switch ($config["dbtype"]) {
break; break;
} }
if ($current_system_lang == ""){ if ($current_system_lang == "") {
$current_system_lang = "en"; $current_system_lang = "en";
} }
@ -213,7 +213,7 @@ if ($config["integria_enabled"]) {
if ($bad_input){ if ($bad_input){
$table->data[20][1] .= html_print_image('images/error.png', true, array('title' => __('URL and/or Integria password are incorrect'))); $table->data[20][1] .= html_print_image('images/error.png', true, array('title' => __('URL and/or Integria password are incorrect')));
} }
$table->data[21][0] = __('Integria API password'); $table->data[21][0] = __('Integria API password');
$table->data[21][1] = html_print_input_text ('integria_api_password', $config["integria_api_password"], '', 25, 25, true); $table->data[21][1] = html_print_input_text ('integria_api_password', $config["integria_api_password"], '', 25, 25, true);
@ -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] .= '&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[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"> <script type="text/javascript">
function toggleButton(type) { function toggleButton(type) {
@ -356,24 +361,26 @@ function show_timezone () {
}); });
} }
}); });
} }
$(document).ready (function () { $(document).ready (function () {
$("#zone").attr("disabled", true); $("#zone").attr("disabled", true);
$("#timezone").attr("disabled", true); $("#timezone").attr("disabled", true);
$("#radiobtn0011").click(function(){ $("#radiobtn0011").click(function() {
flag = $("#radiobtn0011").is(':checked'); flag = $("#radiobtn0011").is(':checked');
if (flag == true){ 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 () { $("#change_timezone").click(function () {
$("#zone").attr("disabled", false); $("#zone").attr("disabled", false);
$("#timezone").attr("disabled", false); $("#timezone").attr("disabled", false);
}); });
}); });
</script> </script>
@ -406,4 +413,4 @@ function get_sounds() {
return $return; return $return;
} }
?> ?>

View File

@ -131,6 +131,8 @@ function config_update_config () {
config_update_value ('netflow_interval', get_parameter ('netflow_interval')); config_update_value ('netflow_interval', get_parameter ('netflow_interval'));
config_update_value ('netflow_daemon', get_parameter ('netflow_daemon')); 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'); $enterprise = enterprise_include_once ('godmode/setup/setup.php');
if ($enterprise !== ENTERPRISE_NOT_HOOK) { if ($enterprise !== ENTERPRISE_NOT_HOOK) {
config_update_value ('enable_pass_policy', get_parameter('enable_pass_policy')); config_update_value ('enable_pass_policy', get_parameter('enable_pass_policy'));
@ -711,7 +713,7 @@ function config_process_config () {
if (!isset($config['item_title_size_text'])) { if (!isset($config['item_title_size_text'])) {
config_update_value ('item_title_size_text', 45); config_update_value ('item_title_size_text', 45);
} }
if (!isset($config['gis_label'])) { if (!isset($config['gis_label'])) {
config_update_value ('gis_label', 0); config_update_value ('gis_label', 0);
} }
@ -719,7 +721,11 @@ function config_process_config () {
if (!isset($config['gis_default_icon'])) { if (!isset($config['gis_default_icon'])) {
config_update_value ('gis_default_icon', "marker"); 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 */ /* Finally, check if any value was overwritten in a form */
config_update_config(); config_update_config();
} }

View File

@ -90,16 +90,16 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
if (!$flash_chart) { if (!$flash_chart) {
// Set the title and time format // Set the title and time format
if ($period <= 21600) { if ($period <= SECONDS_6HOURS) {
$time_format = 'H:i:s'; $time_format = 'H:i:s';
} }
elseif ($period < 86400) { elseif ($period < SECONDS_1DAY) {
$time_format = 'H:i'; $time_format = 'H:i';
} }
elseif ($period < 1296000) { elseif ($period < SECONDS_15DAYS) {
$time_format = "M \nd H:i"; $time_format = "M \nd H:i";
} }
elseif ($period < 2592000) { elseif ($period < SECONDS_1MONTH) {
$time_format = "M \nd H\h"; $time_format = "M \nd H\h";
} }
else { else {
@ -108,21 +108,21 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
} }
else { else {
// Set the title and time format // Set the title and time format
if ($period <= 21600) { if ($period <= SECONDS_6HOURS) {
$time_format = 'H:i:s'; $time_format = 'H:i:s';
} }
elseif ($period < 86400) { elseif ($period < SECONDS_1DAY) {
$time_format = 'H:i'; $time_format = 'H:i';
} }
elseif ($period < 1296000) { elseif ($period < SECONDS_15DAYS) {
$time_format = "M d H:i"; $time_format = "M d H:i";
} }
elseif ($period < 2592000) { elseif ($period < SECONDS_1MONTH) {
$time_format = "M d H\h"; $time_format = "M d H\h";
} }
else { else {
$time_format = "M d H\h"; $time_format = "M d H\h";
} }
} }
$timestamp_short = date($time_format, $timestamp); $timestamp_short = date($time_format, $timestamp);
@ -306,7 +306,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
// Check available data // Check available data
if (count ($data) < $min_necessary) { if (count ($data) < $min_necessary) {
if (!$graphic_type) { if (!$graphic_type) {
if (!$projection){ if (!$projection) {
return fs_error_image (); return fs_error_image ();
} }
else{ else{
@ -315,10 +315,10 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
} }
graphic_error (); graphic_error ();
} }
// Data iterator // Data iterator
$data_i = 0; $data_i = 0;
// Set initial conditions // Set initial conditions
if ($data[0]['utimestamp'] == $datelimit) { if ($data[0]['utimestamp'] == $datelimit) {
$previous_data = $data[0]['datos']; $previous_data = $data[0]['datos'];
@ -327,7 +327,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
else { else {
$previous_data = 0; $previous_data = 0;
} }
// Get baseline data // Get baseline data
$baseline_data = array(); $baseline_data = array();
if ($baseline) { if ($baseline) {
@ -339,28 +339,28 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
} }
} }
} }
if (empty($unit)){ if (empty($unit)){
$unit = modules_get_unit($agent_module_id); $unit = modules_get_unit($agent_module_id);
} }
// Calculate chart data // Calculate chart data
grafico_modulo_sparse_data_chart ($chart, $chart_data_extra, $long_index, grafico_modulo_sparse_data_chart ($chart, $chart_data_extra, $long_index,
$data, $data_i, $resolution, $interval, $period, $datelimit, $data, $data_i, $resolution, $interval, $period, $datelimit,
$projection, $avg_only, $uncompressed_module, $projection, $avg_only, $uncompressed_module,
$show_events, $show_alerts, $baseline, $show_events, $show_alerts, $baseline,
$baseline_data, $events, $series_suffix); $baseline_data, $events, $series_suffix);
// Return chart data and don't draw // Return chart data and don't draw
if ($return_data == 1) { if ($return_data == 1) {
return $chart; return $chart;
} }
// Get min, max and avg (less efficient but centralized for all modules and reports) // Get min, max and avg (less efficient but centralized for all modules and reports)
$min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2); $min_value = round(reporting_get_agentmodule_data_min ($agent_module_id, $period, $date), 2);
$max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2); $max_value = round(reporting_get_agentmodule_data_max ($agent_module_id, $period, $date), 2);
$avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2);
// Fix event and alert scale // Fix event and alert scale
$event_max = $max_value * 1.15; $event_max = $max_value * 1.15;
foreach ($chart as $timestamp => $chart_data) { foreach ($chart as $timestamp => $chart_data) {
@ -371,12 +371,12 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$chart[$timestamp]['alert'.$series_suffix] = $event_max; $chart[$timestamp]['alert'.$series_suffix] = $event_max;
} }
} }
// Only show caption if graph is not small // Only show caption if graph is not small
if ($width > MIN_WIDTH_CAPTION && $height > MIN_HEIGHT) if ($width > MIN_WIDTH_CAPTION && $height > MIN_HEIGHT)
//Flash chart //Flash chart
$caption = __('Max. Value').$series_suffix_str . ': ' . $max_value . ' ' . __('Avg. Value').$series_suffix_str . ': ' . $avg_value . ' ' . __('Min. Value').$series_suffix_str . ': ' . $min_value . ' ' . __('Units. Value').$series_suffix_str . ': ' . $unit; $caption = __('Max. Value').$series_suffix_str . ': ' . $max_value . ' ' . __('Avg. Value').$series_suffix_str . ': ' . $avg_value . ' ' . __('Min. Value').$series_suffix_str . ': ' . $min_value . ' ' . __('Units. Value').$series_suffix_str . ': ' . $unit;
else else
$caption = array(); $caption = array();
/////// ///////
@ -401,7 +401,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$legend['alert'.$series_suffix] = __('Alerts'); $legend['alert'.$series_suffix] = __('Alerts');
$chart_extra_data['legend_alerts'] = $legend['alert']; $chart_extra_data['legend_alerts'] = $legend['alert'];
} }
if (!$avg_only){ if (!$avg_only){
$legend['max'.$series_suffix] = __('Max').$series_suffix_str . ' (' .format_for_graph($max_value) . ') ' . $unit; $legend['max'.$series_suffix] = __('Max').$series_suffix_str . ' (' .format_for_graph($max_value) . ') ' . $unit;
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str . ' (' . $avg_value . ') ' . $unit; $legend['sum'.$series_suffix] = __('Avg').$series_suffix_str . ' (' . $avg_value . ') ' . $unit;
@ -413,13 +413,13 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$legend['baseline'.$series_suffix] = __('Baseline'); $legend['baseline'.$series_suffix] = __('Baseline');
} }
} }
function grafico_modulo_sparse ($agent_module_id, $period, $show_events, function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$width, $height , $title = '', $unit_name = null, $width, $height , $title = '', $unit_name = null,
$show_alerts = false, $avg_only = 0, $pure = false, $show_alerts = false, $avg_only = 0, $pure = false,
$date = 0, $unit = '', $baseline = 0, $return_data = 0, $date = 0, $unit = '', $baseline = 0, $return_data = 0,
$show_title = true, $only_image = false, $homeurl = '', $ttl = 1, $show_title = true, $only_image = false, $homeurl = '', $ttl = 1,
$projection = false, $adapt_key = '', $compare = false) { $projection = false, $adapt_key = '', $compare = false) {
global $config; global $config;
global $graphic_type; global $graphic_type;
@ -427,7 +427,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$flash_chart = $config['flash_charts']; $flash_chart = $config['flash_charts'];
enterprise_include_once("include/functions_reporting.php"); enterprise_include_once("include/functions_reporting.php");
global $chart; global $chart;
global $color; global $color;
global $legend; global $legend;
@ -442,10 +442,10 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$series_suffix_str = ' ('.__('Previous').')'; $series_suffix_str = ' ('.__('Previous').')';
// Build the data of the previous period // Build the data of the previous period
grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$width, $height , $title, $unit_name, $width, $height , $title, $unit_name,
$show_alerts, $avg_only, $date-$period, $unit, $baseline, $return_data, $show_alerts, $avg_only, $date-$period, $unit, $baseline, $return_data,
$show_title, $projection, $adapt_key, $compare, $show_title, $projection, $adapt_key, $compare,
$series_suffix, $series_suffix_str); $series_suffix, $series_suffix_str);
switch($compare) { switch($compare) {
case 'separated': case 'separated':
@ -464,10 +464,10 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
// Build the data of the current period // Build the data of the current period
$data_returned = grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $data_returned = grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$width, $height , $title, $unit_name, $width, $height , $title, $unit_name,
$show_alerts, $avg_only, $date, $unit, $baseline, $show_alerts, $avg_only, $date, $unit, $baseline,
$return_data, $show_title, $projection, $adapt_key, $compare); $return_data, $show_title, $projection, $adapt_key, $compare);
if ($return_data) { if ($return_data) {
return $data_returned; return $data_returned;
} }
@ -485,25 +485,25 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
if ($only_image) { if ($only_image) {
$flash_chart = false; $flash_chart = false;
} }
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", $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') { if ($compare === 'separated') {
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend, 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, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key). $series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key).
'<br>'. '<br>'.
area_graph($flash_chart, $chart_prev, $width, $height/2, $color, $legend_prev, 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, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key); $series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key);
} }
else { else {
// Color commented not to restrict serie colors // Color commented not to restrict serie colors
return area_graph($flash_chart, $chart, $width, $height, $color, $legend, 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, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key); $series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key);
} }
@ -512,16 +512,16 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
function graph_get_formatted_date($timestamp, $format1, $format2) { function graph_get_formatted_date($timestamp, $format1, $format2) {
global $config; global $config;
if($config['flash_charts']) { if ($config['flash_charts']) {
$date = date("$format1 $format2", $timestamp); $date = date("$format1 $format2", $timestamp);
} }
else { else {
$date = date($format1, $timestamp); $date = date($format1, $timestamp);
if($format2 != '') { if ($format2 != '') {
$date .= "\n".date($format2, $timestamp); $date .= "\n".date($format2, $timestamp);
} }
} }
return $date; return $date;
} }
@ -553,26 +553,26 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$time_format_2 = ''; $time_format_2 = '';
$temp_range = $period; $temp_range = $period;
if ($projection != false){ if ($projection != false) {
if ($period < $prediction_period) if ($period < $prediction_period)
$temp_range = $prediction_period; $temp_range = $prediction_period;
} }
// Set the title and time format // Set the title and time format
if ($temp_range <= 21600) { if ($temp_range <= SECONDS_6HOURS) {
$time_format = 'H:i:s'; $time_format = 'H:i:s';
} }
elseif ($temp_range < 86400) { elseif ($temp_range < SECONDS_1DAY) {
$time_format = 'H:i'; $time_format = 'H:i';
} }
elseif ($temp_range < 1296000) { elseif ($temp_range < SECONDS_15DAYS) {
$time_format = 'M d'; $time_format = 'M d';
$time_format_2 = 'H:i'; $time_format_2 = 'H:i';
if ($projection != false){ if ($projection != false) {
$time_format_2 = 'H\h'; $time_format_2 = 'H\h';
} }
} }
elseif ($temp_range <= 2592000) { elseif ($temp_range <= SECONDS_1MONTH) {
$time_format = 'M d'; $time_format = 'M d';
$time_format_2 = 'H\h'; $time_format_2 = 'H\h';
} }
@ -924,17 +924,17 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
} }
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", $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. //Work around for fixed the agents name with huge size chars.
$fixed_font_size = $config['font_size'] - 1; $fixed_font_size = $config['font_size'] - 1;
switch ($stacked) { switch ($stacked) {
case GRAPH_AREA: case GRAPH_AREA:
$color = null; $color = null;
return area_graph($flash_charts, $graph_values, $width, $height, 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, "", "", $homeurl, $water_mark,
$config['fontpath'], $fixed_font_size, "", $ttl); $config['fontpath'], $fixed_font_size, "", $ttl);
break; break;
@ -942,21 +942,21 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
case GRAPH_STACKED_AREA: case GRAPH_STACKED_AREA:
$color = null; $color = null;
return stacked_area_graph($flash_charts, $graph_values, $width, $height, 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, "", "", $water_mark,
$config['fontpath'], $fixed_font_size, "", $ttl, $homeurl); $config['fontpath'], $fixed_font_size, "", $ttl, $homeurl);
break; break;
case GRAPH_LINE: case GRAPH_LINE:
$color = null; $color = null;
return line_graph($flash_charts, $graph_values, $width, $height, 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, "", "", $water_mark,
$config['fontpath'], $fixed_font_size, "", $ttl, $homeurl); $config['fontpath'], $fixed_font_size, "", $ttl, $homeurl);
break; break;
case GRAPH_STACKED_LINE: case GRAPH_STACKED_LINE:
$color = null; $color = null;
return stacked_line_graph($flash_charts, $graph_values, $width, $height, 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, "", "", $water_mark,
$config['fontpath'], $fixed_font_size, "", $ttl, $homeurl); $config['fontpath'], $fixed_font_size, "", $ttl, $homeurl);
break; break;
@ -976,7 +976,7 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0) {
global $graphic_type; global $graphic_type;
$data = array (); $data = array ();
$resolution = $config["graph_res"] * ($period * 2 / $width); // Number of "slices" we want in graph $resolution = $config["graph_res"] * ($period * 2 / $width); // Number of "slices" we want in graph
$interval = (int) ($period / $resolution); $interval = (int) ($period / $resolution);
@ -991,10 +991,11 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0) {
$bottom = $datelimit + ($periodtime * $i); $bottom = $datelimit + ($periodtime * $i);
if (! $graphic_type) { if (! $graphic_type) {
$name = date('G:i', $bottom); $name = date('G:i', $bottom);
} else { }
else {
$name = $bottom; $name = $bottom;
} }
$top = $datelimit + ($periodtime * ($i + 1)); $top = $datelimit + ($periodtime * ($i + 1));
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
@ -1020,15 +1021,15 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0) {
} }
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", $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) if ($empty_data)
echo fs_error_image(); echo fs_error_image();
else { else {
echo area_graph($config['flash_charts'], $data, $width, $height, 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, $water_mark,
$config['fontpath'], $config['font_size'], ""); $config['fontpath'], $config['font_size'], "");
} }
} }
@ -1042,7 +1043,7 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0) {
function graph_event_module ($width = 300, $height = 200, $id_agent) { function graph_event_module ($width = 300, $height = 200, $id_agent) {
global $config; global $config;
global $graphic_type; global $graphic_type;
$data = array (); $data = array ();
$max_items = 6; $max_items = 6;
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
@ -1062,7 +1063,7 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
GROUP BY id_agentmodule, dbms_lob.substr(nombre,4000,1)', $id_agent, $max_items); GROUP BY id_agentmodule, dbms_lob.substr(nombre,4000,1)', $id_agent, $max_items);
break; break;
} }
$events = db_get_all_rows_sql ($sql); $events = db_get_all_rows_sql ($sql);
if ($events === false) { if ($events === false) {
if (! $graphic_type) { if (! $graphic_type) {
@ -1071,8 +1072,8 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
graphic_error (); graphic_error ();
return; return;
} }
foreach ($events as $event) { foreach ($events as $event) {
$data[$event['nombre'].' ('.$event['count_number'].')'] = $event["count_number"]; $data[$event['nombre'].' ('.$event['count_number'].')'] = $event["count_number"];
} }
@ -1086,7 +1087,7 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
asort ($data); asort ($data);
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", $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"), return pie3d_graph($config['flash_charts'], $data, $width, $height, __("other"),
'', $water_mark, '', $water_mark,
@ -1123,12 +1124,16 @@ function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value
require_once("include_graph_dependencies.php"); require_once("include_graph_dependencies.php");
include_graphs_dependencies($config['homedir'].'/'); include_graphs_dependencies($config['homedir'].'/');
return "<img title='" . $title . "' alt='" . $title . "'" . $class_tag . $id_tag . $src = ui_get_full_url(
" src='" . $config['homeurl'] . "/include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar" . "/include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar" .
"&width=".$width."&height=".$height."&progress=".$progress. "&width=".$width."&height=".$height."&progress=".$progress.
"&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str . "&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str .
"&title=".$title."&font=".$config['fontpath']."&value_text=". $value_text . "&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) { 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", $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, return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $water_mark, __('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", $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(), return hbar_graph($config['flash_charts'], $data, $width, $height, array(),
$legend, "", "", true, "", $legend, "", "", true, "",
@ -1310,7 +1315,7 @@ function graph_db_agentes_modulos($width, $height) {
} }
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", $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(), return hbar_graph($config['flash_charts'], $data, $width, $height, array(),
array(), "", "", true, "", array(), "", "", true, "",
@ -1328,7 +1333,7 @@ function graph_db_agentes_modulos($width, $height) {
function graphic_user_activity ($width = 350, $height = 230) { function graphic_user_activity ($width = 350, $height = 230) {
global $config; global $config;
global $graphic_type; global $graphic_type;
$data = array (); $data = array ();
$max_items = 5; $max_items = 5;
switch ($config['dbtype']) { switch ($config['dbtype']) {
@ -1456,7 +1461,7 @@ function graphic_incident_group () {
if($incidents == false) { if($incidents == false) {
$incidents = array(); $incidents = array();
} }
foreach ($incidents as $incident) { foreach ($incidents as $incident) {
$data[$incident['nombre']] = $incident['n_incidents']; $data[$incident['nombre']] = $incident['n_incidents'];
} }
@ -1517,24 +1522,28 @@ function graphic_incident_user () {
function graphic_incident_source($width = 320, $height = 200) { function graphic_incident_source($width = 320, $height = 200) {
global $config; global $config;
global $graphic_type; global $graphic_type;
$data = array (); $data = array ();
$max_items = 5; $max_items = 5;
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen $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); ORDER BY 1 DESC LIMIT %d', $max_items);
break; break;
case "postgresql": case "postgresql":
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen $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); ORDER BY 1 DESC LIMIT %d', $max_items);
break; break;
case "oracle": case "oracle":
$sql = sprintf ('SELECT COUNT(id_incidencia) n_incident, origen $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); ORDER BY 1 DESC', $max_items);
break; 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 //is required if both DISTINCT() and COUNT() are in the statement
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count $sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente,
FROM tevento WHERE 1=1 %s id_grupo, COUNT(id_agente) AS count
GROUP BY id_agente ORDER BY count DESC', $url); FROM tevento
WHERE 1=1 %s
GROUP BY id_agente
ORDER BY count DESC', $url);
break; break;
case "postgresql": case "postgresql":
case "oracle": case "oracle":
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count $sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente,
FROM tevento WHERE 1=1 %s id_grupo, COUNT(id_agente) AS count
GROUP BY id_agente, id_grupo ORDER BY count DESC', $url); FROM tevento
WHERE 1=1 %s
GROUP BY id_agente, id_grupo
ORDER BY count DESC', $url);
break; break;
} }
@ -1614,9 +1629,9 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
} }
$loop++; $loop++;
} }
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", $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, return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $water_mark, __('Other'), '', $water_mark,
@ -1670,7 +1685,7 @@ function grafico_eventos_total($filter = "") {
asort ($data); asort ($data);
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", $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, return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $water_mark, __('Other'), '', $water_mark,
@ -1686,7 +1701,7 @@ function grafico_eventos_total($filter = "") {
function grafico_eventos_usuario ($width, $height) { function grafico_eventos_usuario ($width, $height) {
global $config; global $config;
global $graphic_type; global $graphic_type;
$data = array (); $data = array ();
$max_items = 5; $max_items = 5;
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
@ -1720,7 +1735,7 @@ function grafico_eventos_usuario ($width, $height) {
} }
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", $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, return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $water_mark, __('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", $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) { switch ($type) {
case 'sql_graph_vbar': // vertical bar case 'sql_graph_vbar': // vertical bar
@ -1896,7 +1911,7 @@ function fs_error_image () {
function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$unit_name, $show_alerts, $avg_only = 0, $date = 0, $series_suffix = '', $unit_name, $show_alerts, $avg_only = 0, $date = 0, $series_suffix = '',
$series_suffix_str = '') { $series_suffix_str = '') {
global $config; global $config;
global $chart; global $chart;
global $color; global $color;
@ -2191,8 +2206,8 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$color['min'.$series_suffix] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 50); $color['min'.$series_suffix] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 50);
//$color['baseline'.$series_suffix] = array('border' => null, 'color' => '#0097BD', 'alpha' => 10); //$color['baseline'.$series_suffix] = array('border' => null, 'color' => '#0097BD', 'alpha' => 10);
} }
function grafico_modulo_boolean ($agent_module_id, $period, $show_events, function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
$width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0, $width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0,
$date = 0, $only_image = false, $homeurl = '', $adapt_key = '', $compare = false) { $date = 0, $only_image = false, $homeurl = '', $adapt_key = '', $compare = false) {
@ -2201,13 +2216,13 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
global $graphic_type; global $graphic_type;
$flash_chart = $config['flash_charts']; $flash_chart = $config['flash_charts'];
global $chart; global $chart;
global $color; global $color;
global $legend; global $legend;
global $long_index; global $long_index;
if($compare !== false) { if ($compare !== false) {
$series_suffix = '2'; $series_suffix = '2';
$series_suffix_str = ' ('.__('Previous').')'; $series_suffix_str = ' ('.__('Previous').')';
// Build the data of the previous period // Build the data of the previous period
@ -2232,7 +2247,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$unit_name, $show_alerts, $avg_only, $date); $unit_name, $show_alerts, $avg_only, $date);
if($compare === 'overlapped') { if ($compare === 'overlapped') {
$i = 0; $i = 0;
foreach($chart as $k=>$v) { foreach($chart as $k=>$v) {
$chart[$k] = array_merge($v,$chart_prev[$i]); $chart[$k] = array_merge($v,$chart_prev[$i]);
@ -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", $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') { if ($compare === 'separated') {
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend, 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, $water_mark,
$config['fontpath'], $config['font_size'], $unit, 1, array(), $config['fontpath'], $config['font_size'], $unit, 1, array(),
array(), 0, 0, $adapt_key). array(), 0, 0, $adapt_key).
'<br>'. '<br>'.
area_graph($flash_chart, $chart_prev, $width, $height/2, $color, $legend_prev, 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, $water_mark,
$config['fontpath'], $config['font_size'], $unit, 1, array(), $config['fontpath'], $config['font_size'], $unit, 1, array(),
array(), 0, 0, $adapt_key); array(), 0, 0, $adapt_key);
} }
else { else {
return area_graph($flash_chart, $chart, $width, $height, $color, $legend, 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, $water_mark,
$config['fontpath'], $config['font_size'], $unit, 1, array(), $config['fontpath'], $config['font_size'], $unit, 1, array(),
array(), 0, 0, $adapt_key); 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", $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, 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, $water_mark,
$config['fontpath'], $config['font_size'], ""); $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", $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 (), 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, $water_mark,
$config['fontpath'], $config['font_size'], ""); $config['fontpath'], $config['font_size'], "");
} }
@ -2423,7 +2433,7 @@ function graph_netflow_aggregate_pie ($data, $aggregate) {
$agg = ''; $agg = '';
while (isset ($data[$i])) { while (isset ($data[$i])) {
$agg = $data[$i]['agg']; $agg = $data[$i]['agg'];
if (!isset($values[$agg])){ if (!isset($values[$agg])) {
$values[$agg] = $data[$i]['data']; $values[$agg] = $data[$i]['data'];
} }
else { else {
@ -2486,7 +2496,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
$events = array (); $events = array ();
} }
} }
// Get module data // Get module data
$data = db_get_all_rows_filter ('tagente_datos_string', $data = db_get_all_rows_filter ('tagente_datos_string',
array ('id_agente_modulo' => $agent_module_id, array ('id_agente_modulo' => $agent_module_id,
@ -2658,7 +2668,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
$legend = null; $legend = null;
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", $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, return area_graph($flash_chart, $chart, $width, $height, $color,
$legend, array(), '', "", $unit, $homeurl, $legend, array(), '', "", $unit, $homeurl,
@ -3123,4 +3133,4 @@ function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=
return ""; return "";
} }
} }
?> ?>

View File

@ -666,7 +666,7 @@ function html_print_input_image ($name, $src, $value, $style = '', $return = fal
} }
// path to image // 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"'; $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) { if (!$relative) {
$urlImage = ui_get_full_url(false);
if (defined('METACONSOLE')) if (defined('METACONSOLE'))
$urlImage .= ENTERPRISE_DIR . '/meta/'; $src .= ENTERPRISE_DIR . '/meta/' . $src;
// path to image $src = ui_get_full_url($src);
$src = $urlImage . $src;
} }
// Only return src field of image // 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; $table->colspan[1][0] = 3;
$data = array (); $data = array ();
$urlImage = ui_get_full_url(false);
require_once ($config["homedir"] . '/include/functions_graph.php'); require_once ($config["homedir"] . '/include/functions_graph.php');
$data[0] = graphic_combined_module( $data[0] = graphic_combined_module(
$modules, $modules,
@ -2318,8 +2316,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
0, 0,
$graph["stacked"], $graph["stacked"],
$report["datetime"], $report["datetime"],
true, true);
$urlImage);
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;

View File

@ -824,7 +824,7 @@ function ui_print_string_substr ($string, $cutoff = 16, $return = false, $fontsi
} }
$string2 = io_safe_output ($string); $string2 = io_safe_output ($string);
if (mb_strlen($string2, "UTF-8") > $cutoff){ if (mb_strlen($string2, "UTF-8") > $cutoff) {
$string3 = "..."; $string3 = "...";
} }
else { else {
@ -1099,7 +1099,7 @@ function ui_require_jquery_file ($name, $path = 'include/javascript/') {
function ui_process_page_head ($string, $bitfield) { function ui_process_page_head ($string, $bitfield) {
global $config; global $config;
global $vc_public_view; global $vc_public_view;
if (isset ($config['ignore_callback']) && $config['ignore_callback'] == true) { if (isset ($config['ignore_callback']) && $config['ignore_callback'] == true) {
return; return;
} }
@ -1210,7 +1210,7 @@ function ui_process_page_head ($string, $bitfield) {
array_push ($loaded, $name); array_push ($loaded, $name);
if (!empty ($config["compact_header"])) { if (!empty ($config["compact_header"])) {
$output .= '<style type="text/css">'; $output .= '<style type="text/css">';
$style = file_get_contents ($config["homedir"]."/".$filename); $style = file_get_contents ($config["homedir"] . "/" . $filename);
//Replace paths //Replace paths
$style = str_replace (array ("@import url(", "../../images"), array ("@import url(include/styles/", "images"), $style); $style = str_replace (array ("@import url(", "../../images"), array ("@import url(include/styles/", "images"), $style);
//Remove comments //Remove comments
@ -1218,7 +1218,8 @@ function ui_process_page_head ($string, $bitfield) {
$output .= '</style>'; $output .= '</style>';
} }
else { 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 //End load CSS
@ -1230,7 +1231,7 @@ function ui_process_page_head ($string, $bitfield) {
//Pandora specific JavaScript should go first //Pandora specific JavaScript should go first
$config['js'] = array_merge (array ("pandora" => "include/javascript/pandora.js"), $config['js']); $config['js'] = array_merge (array ("pandora" => "include/javascript/pandora.js"), $config['js']);
//Load other javascript //Load other javascript
//We can't load empty //We can't load empty
$loaded = array (''); $loaded = array ('');
@ -1245,7 +1246,8 @@ function ui_process_page_head ($string, $bitfield) {
$output .= "\n".'/* ]]> */</script>'; $output .= "\n".'/* ]]> */</script>';
} }
else { 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 //End load JS
@ -1259,10 +1261,10 @@ function ui_process_page_head ($string, $bitfield) {
$black_list_pages_old_jquery = array('operation/gis_maps/index'); $black_list_pages_old_jquery = array('operation/gis_maps/index');
if (in_array(get_parameter('sec2'), $black_list_pages_old_jquery)) { if (in_array(get_parameter('sec2'), $black_list_pages_old_jquery)) {
$config['jquery'] = array_merge (array ("jquery" => "include/javascript/jquery.js", $config['jquery'] = array_merge (array ("jquery" => "include/javascript/jquery.js",
"ui" => "include/javascript/jquery.ui.core.js", "ui" => "include/javascript/jquery.ui.core.js",
"dialog" => "include/javascript/jquery.ui.dialog.js", "dialog" => "include/javascript/jquery.ui.dialog.js",
"pandora" => "include/javascript/jquery.pandora.js"), "pandora" => "include/javascript/jquery.pandora.js"),
$config['jquery']); $config['jquery']);
} }
else { else {
$config['jquery'] = array_merge (array ("jquery" => "include/javascript/jquery-1.7.1.js", $config['jquery'] = array_merge (array ("jquery" => "include/javascript/jquery-1.7.1.js",
@ -1288,7 +1290,8 @@ function ui_process_page_head ($string, $bitfield) {
$output .= "\n".'/* ]]> */</script>'; $output .= "\n".'/* ]]> */</script>';
} }
else { 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";
} }
} }
@ -1301,8 +1304,8 @@ function ui_process_page_head ($string, $bitfield) {
$output .= '<!--[if gte IE 6]> $output .= '<!--[if gte IE 6]>
<link rel="stylesheet" href="include/styles/ie.css" type="text/css"/> <link rel="stylesheet" href="include/styles/ie.css" type="text/css"/>
<![endif]-->'; <![endif]-->';
$output .= $string; $output .= $string;
@ -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 * 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 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. * @return string A full URL in Pandora.
*/ */
function ui_get_full_url ($url = '') { function ui_get_full_url ($url = '', $no_proxy = false) {
global $config; 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'; $protocol = 'https';
if ( $_SERVER['SERVER_PORT'] != 443) { if ( $_SERVER['SERVER_PORT'] != 443) {
$port = $_SERVER['SERVER_PORT']; $port = $_SERVER['SERVER_PORT'];
@ -1948,17 +1956,32 @@ function ui_get_full_url ($url = '') {
} }
else { else {
$protocol = 'http'; $protocol = 'http';
if ( $_SERVER['SERVER_PORT'] != 80) { if ( $_SERVER['SERVER_PORT'] != 80) {
$port = $_SERVER['SERVER_PORT']; $port = $_SERVER['SERVER_PORT'];
} }
} }
$fullurl = $protocol.'://' . $_SERVER['SERVER_NAME']; 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 // using a different port than the standard
if ( $port != null ) { if ( $port != null ) {
$fullurl .= ":".$port; $fullurl .= ":" . $port;
} }
if ($url === '') { if ($url === '') {
@ -1968,8 +1991,21 @@ function ui_get_full_url ($url = '') {
//Only add the home url //Only add the home url
$url = $config['homeurl'] . '/'; $url = $config['homeurl'] . '/';
} }
elseif (!strstr($url, ".php")) {
if ($proxy) {
$fullurl .= '/';
}
else {
$fullurl .= $config['homeurl'] . '/';
}
}
else { else {
$fullurl .= $_SERVER['SCRIPT_NAME']; if ($proxy) {
$fullurl .= '/';
}
else {
$fullurl .= $_SERVER['SCRIPT_NAME'];
}
} }
return $fullurl.$url; 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"]; $proportion = $width / $layout["width"];
$mapHeight = $proportion * $layout["height"]; $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"]); $config['homeurl'] . '/' . 'images/console/background/'.io_safe_input ($layout["background"]);
} }
else { else {
$mapWidth = $layout["width"]; $mapWidth = $layout["width"];
$mapHeight = $layout["height"]; $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" echo '<div id="layout_map"
style="margin:0px auto;text-align:center;z-index: 0; position:relative; width:'.$mapWidth.'px; height:'.$mapHeight.'px;">'; 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); $layout_datas = db_get_all_rows_field_filter ('tlayout_data', 'id_layout', $id_layout);
if (empty($layout_datas)) if (empty($layout_datas))
$layout_datas = array(); $layout_datas = array();

View File

@ -154,7 +154,8 @@ function histogram($chart_data, $width, $height, $font, $max, $title, $mode, $tt
} }
function progressbar($progress, $width, $height, $title, $font, $mode = 1, function progressbar($progress, $width, $height, $title, $font, $mode = 1,
$out_of_lim_str = false, $out_of_lim_image = false, $ttl = 1) { $out_of_lim_str = false, $out_of_lim_image = false, $ttl = 1) {
$graph = array(); $graph = array();
$graph['progress'] = $progress; $graph['progress'] = $progress;
@ -173,7 +174,8 @@ function progressbar($progress, $width, $height, $title, $font, $mode = 1,
function slicesbar_graph($chart_data, $period, $width, $height, $colors, $font, function slicesbar_graph($chart_data, $period, $width, $height, $colors, $font,
$round_corner, $home_url = '', $ttl = 1) { $round_corner, $home_url = '', $ttl = 1) {
$graph = array(); $graph = array();
$graph['data'] = $chart_data; $graph['data'] = $chart_data;
$graph['period'] = $period; $graph['period'] = $period;
@ -192,9 +194,9 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
$legend = array(), $xaxisname = "", $yaxisname = "", $homedir="", $legend = array(), $xaxisname = "", $yaxisname = "", $homedir="",
$water_mark = '', $font = '', $font_size = '', $force_steps = true, $ttl = 1, $reduce_data_columns = false, $water_mark = '', $font = '', $font_size = '', $force_steps = true, $ttl = 1, $reduce_data_columns = false,
$adapt_key = '') { $adapt_key = '') {
setup_watermark($water_mark, $water_mark_file, $water_mark_url); setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if($flash_chart) { if($flash_chart) {
return flot_vcolumn_chart ($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url, $homedir, $reduce_data_columns, $adapt_key); return flot_vcolumn_chart ($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url, $homedir, $reduce_data_columns, $adapt_key);
} }
@ -220,7 +222,7 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
// NOT USED ACTUALLY // NOT USED ACTUALLY
function threshold_graph($flash_chart, $chart_data, $width, $height, $ttl = 1) { function threshold_graph($flash_chart, $chart_data, $width, $height, $ttl = 1) {
if($flash_chart) { if ($flash_chart) {
return flot_area_simple_graph($chart_data, $width, $height); return flot_area_simple_graph($chart_data, $width, $height);
} }
else { else {
@ -232,15 +234,15 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homeurl="", $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homeurl="",
$water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $series_type = array(), $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $series_type = array(),
$chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key = '', $force_integer = false) { $chart_extra_data = array(), $yellow_threshold = 0, $red_threshold = 0, $adapt_key = '', $force_integer = false) {
setup_watermark($water_mark, $water_mark_file, $water_mark_url); setup_watermark($water_mark, $water_mark_file, $water_mark_url);
// ATTENTION: The min size is 130x150 // ATTENTION: The min size is 130x150
// It's not the same minsize for all graphs, but we are choosed a prudent minsize for all // It's not the same minsize for all graphs, but we are choosed a prudent minsize for all
if($height <= 130) { if ($height <= 130) {
$height = 130; $height = 130;
} }
if($width < 150) { if ($width < 150) {
$width = 150; $width = 150;
} }
@ -248,7 +250,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
return html_print_image($no_data_image, true, array("border" => '0')); return html_print_image($no_data_image, true, array("border" => '0'));
} }
if($flash_chart) { if ($flash_chart) {
return flot_area_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url, $series_type, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer); return flot_area_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url, $series_type, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer);
} }
else { else {
@ -275,7 +277,7 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
$water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '') { $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '') {
setup_watermark($water_mark, $water_mark_file, $water_mark_url); setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) { if (empty($chart_data)) {
return html_print_image($no_data_image, true, array("border" => '0')); return html_print_image($no_data_image, true, array("border" => '0'));
} }
@ -310,7 +312,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
$water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '') { $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '') {
setup_watermark($water_mark, $water_mark_file, $water_mark_url); setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) { if (empty($chart_data)) {
return html_print_image($no_data_image, true, array("border" => '0')); return html_print_image($no_data_image, true, array("border" => '0'));
} }

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 // NOTE: jquery.flot.threshold is not te original file. Is patched to allow multiple thresholds and filled area
$output = ' $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="'. ui_get_full_url('/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="'. ui_get_full_url('/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="'. ui_get_full_url('/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="'. ui_get_full_url('/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="'. ui_get_full_url('/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="'. ui_get_full_url('/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="'. ui_get_full_url('/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="'. ui_get_full_url('/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/pandora.flot.js') .'"></script>
'; ';
$output .= " $output .= "
<script type='text/javascript'> <script type='text/javascript'>

View File

@ -109,7 +109,8 @@ if (!$force_height) {
$water_mark = ''; $water_mark = '';
if(isset($graph['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'])) { if (isset($graph['force_steps'])) {
@ -144,40 +145,40 @@ $c = 1;
switch($graph_type) { switch($graph_type) {
case 'hbar': case 'hbar':
case 'vbar': case 'vbar':
foreach($data as $i => $values) { foreach($data as $i => $values) {
foreach($values as $name => $val) { foreach($values as $name => $val) {
$data_values[$name][] = $val; $data_values[$name][] = $val;
}
if (($c % $step) == 0) {
$data_keys[] = $i;
}
else {
$data_keys[] = "";
}
$c++;
}
$fine_colors = array();
// If is set fine colors we store it or set default
if(isset($colors[reset(array_keys($data_values))]['fine'])) {
$fine = $colors[reset(array_keys($data_values))]['fine'];
if($fine === true) {
$fine = $default_fine_colors;
}
foreach($fine as $i => $fine_color) {
$rgb_fine = html_html2rgb($fine_color);
$fine_colors[$i]['R'] = $rgb_fine[0];
$fine_colors[$i]['G'] = $rgb_fine[1];
$fine_colors[$i]['B'] = $rgb_fine[2];
$fine_colors[$i]['Alpha'] = 100;
}
$colors = array();
} }
break; if (($c % $step) == 0) {
$data_keys[] = $i;
}
else {
$data_keys[] = "";
}
$c++;
}
$fine_colors = array();
// If is set fine colors we store it or set default
if(isset($colors[reset(array_keys($data_values))]['fine'])) {
$fine = $colors[reset(array_keys($data_values))]['fine'];
if($fine === true) {
$fine = $default_fine_colors;
}
foreach($fine as $i => $fine_color) {
$rgb_fine = html_html2rgb($fine_color);
$fine_colors[$i]['R'] = $rgb_fine[0];
$fine_colors[$i]['G'] = $rgb_fine[1];
$fine_colors[$i]['B'] = $rgb_fine[2];
$fine_colors[$i]['Alpha'] = 100;
}
$colors = array();
}
break;
case 'progress': case 'progress':
case 'area': case 'area':
case 'stacked_area': case 'stacked_area':
@ -185,27 +186,27 @@ switch($graph_type) {
case 'line': case 'line':
case 'threshold': case 'threshold':
case 'scatter': case 'scatter':
foreach($data as $i => $d) { foreach($data as $i => $d) {
$data_values[] = $d; $data_values[] = $d;
if (($c % $step) == 0) { if (($c % $step) == 0) {
$data_keys[] = $i; $data_keys[] = $i;
} }
else { else {
$data_keys[] = ""; $data_keys[] = "";
}
$c++;
} }
break; $c++;
}
break;
case 'slicebar': case 'slicebar':
case 'polar': case 'polar':
case 'radar': case 'radar':
case 'pie3d': case 'pie3d':
case 'pie2d': case 'pie2d':
break; break;
} }
switch($graph_type) { switch($graph_type) {
@ -214,15 +215,15 @@ switch($graph_type) {
case 'radar': case 'radar':
case 'pie3d': case 'pie3d':
case 'pie2d': case 'pie2d':
break; break;
default: default:
if(!is_array(reset($data_values))) { if(!is_array(reset($data_values))) {
$data_values = array($data_values); $data_values = array($data_values);
if(is_array($colors) && !empty($colors)) { if(is_array($colors) && !empty($colors)) {
$colors = array($colors); $colors = array($colors);
}
} }
break; }
break;
} }
$rgb_color = array(); $rgb_color = array();
@ -271,40 +272,40 @@ foreach($colors as $i => $color) {
switch($graph_type) { switch($graph_type) {
case 'pie3d': case 'pie3d':
case 'pie2d': case 'pie2d':
pch_pie_graph($graph_type, array_values($data), array_keys($data), pch_pie_graph($graph_type, array_values($data), array_keys($data),
$width, $height, $font, $water_mark, $font_size); $width, $height, $font, $water_mark, $font_size);
break; break;
case 'slicebar': case 'slicebar':
pch_slicebar_graph($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size); pch_slicebar_graph($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size);
break; break;
case 'polar': case 'polar':
case 'radar': case 'radar':
pch_kiviat_graph($graph_type, array_values($data), array_keys($data), pch_kiviat_graph($graph_type, array_values($data), array_keys($data),
$width, $height, $font, $font_size); $width, $height, $font, $font_size);
break; break;
case 'hbar': case 'hbar':
case 'vbar': case 'vbar':
pch_bar_graph($graph_type, $data_keys, $data_values, $width, $height, pch_bar_graph($graph_type, $data_keys, $data_values, $width, $height,
$font, $antialiasing, $rgb_color, $xaxisname, $yaxisname, false, $font, $antialiasing, $rgb_color, $xaxisname, $yaxisname, false,
$legend, $fine_colors, $water_mark, $font_size); $legend, $fine_colors, $water_mark, $font_size);
break; break;
case 'stacked_area': case 'stacked_area':
case 'area': case 'area':
case 'line': case 'line':
pch_vertical_graph($graph_type, $data_keys, $data_values, $width, pch_vertical_graph($graph_type, $data_keys, $data_values, $width,
$height, $rgb_color, $xaxisname, $yaxisname, false, $legend, $height, $rgb_color, $xaxisname, $yaxisname, false, $legend,
$font, $antialiasing, $water_mark, $font_size); $font, $antialiasing, $water_mark, $font_size);
break; break;
case 'threshold': case 'threshold':
pch_threshold_graph($graph_type, $data_keys, $data_values, $width, pch_threshold_graph($graph_type, $data_keys, $data_values, $width,
$height, $font, $antialiasing, $xaxisname, $yaxisname, $title, $height, $font, $antialiasing, $xaxisname, $yaxisname, $title,
$font_size); $font_size);
break; break;
} }
function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size) { function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size) {
/* CAT:Slicebar charts */ /* CAT:Slicebar charts */
set_time_limit (0); set_time_limit (0);
// Dataset definition // Dataset definition
@ -314,7 +315,7 @@ function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colo
$myPicture->Antialias = 0; $myPicture->Antialias = 0;
$myPicture->setFontProperties(array("FontName"=> $font, "FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80)); $myPicture->setFontProperties(array("FontName"=> $font, "FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
// Round corners defined in global setup // Round corners defined in global setup
if ($round_corner != 0) if ($round_corner != 0)
$radius = ($height > 18) ? 8 : 0; $radius = ($height > 18) ? 8 : 0;
@ -338,7 +339,11 @@ function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colo
$color = $colorsrgb[$color]; $color = $colorsrgb[$color];
$ratio = $thinest_slice * $d['utimestamp']; $ratio = $thinest_slice * $d['utimestamp'];
$myPicture->drawRoundedFilledRectangle ($i, 0, $ratio+$i, $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; $i+=$ratio;
} }
@ -355,7 +360,7 @@ function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colo
} }
} }
} }
$myPicture->drawRoundedRectangle (0, 0, $width, $myPicture->drawRoundedRectangle (0, 0, $width,
$height - 1, $radius, array('R' => 157, 'G' => 157, 'B' => 157)); $height - 1, $radius, array('R' => 157, 'G' => 157, 'B' => 157));
@ -365,12 +370,12 @@ function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colo
function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
$height, $font, $water_mark, $font_size) { $height, $font, $water_mark, $font_size) {
/* CAT:Pie charts */ /* CAT:Pie charts */
/* Create and populate the pData object */ /* Create and populate the pData object */
$MyData = new pData(); $MyData = new pData();
$MyData->addPoints($data_values,"ScoreA"); $MyData->addPoints($data_values,"ScoreA");
$MyData->setSerieDescription("ScoreA","Application A"); $MyData->setSerieDescription("ScoreA","Application A");
/* Define the absissa serie */ /* Define the absissa serie */
$MyData->addPoints($legend_values,"Labels"); $MyData->addPoints($legend_values,"Labels");
$MyData->setAbscissa("Labels"); $MyData->setAbscissa("Labels");
@ -380,7 +385,7 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
/* Set the default font properties */ /* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80)); $myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
$water_mark_height = 0; $water_mark_height = 0;
@ -397,24 +402,24 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
/* Create the pPie object */ /* Create the pPie object */
$PieChart = new pPie($myPicture,$MyData); $PieChart = new pPie($myPicture,$MyData);
/* Draw an AA pie chart */ /* Draw an AA pie chart */
switch($graph_type) { switch($graph_type) {
case "pie2d": case "pie2d":
$PieChart->draw2DPie($width/4,$height/2,array("DataGapAngle"=>0,"DataGapRadius"=>0, "Border"=>FALSE, "BorderR"=>200, "BorderG"=>200, "BorderB"=>200, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE)); $PieChart->draw2DPie($width/4,$height/2,array("DataGapAngle"=>0,"DataGapRadius"=>0, "Border"=>FALSE, "BorderR"=>200, "BorderG"=>200, "BorderB"=>200, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
break; break;
case "pie3d": case "pie3d":
$PieChart->draw3DPie($width/4, $height/2,array("DataGapAngle"=>5,"DataGapRadius"=>6, "Border"=>TRUE, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE)); $PieChart->draw3DPie($width/4, $height/2,array("DataGapAngle"=>5,"DataGapRadius"=>6, "Border"=>TRUE, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
break; break;
} }
/* Write down the legend next to the 2nd chart*/ /* Write down the legend next to the 2nd chart*/
//Calculate the bottom margin from the size of string in each index //Calculate the bottom margin from the size of string in each index
$max_chars = graph_get_max_index($legend_values); $max_chars = graph_get_max_index($legend_values);
$legend_with_aprox = 32 + (7 * $max_chars); $legend_with_aprox = 32 + (7 * $max_chars);
$PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10)); $PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10));
/* Enable shadow computing */ /* Enable shadow computing */
$myPicture->setShadow(TRUE,array("X"=>3,"Y"=>3,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); $myPicture->setShadow(TRUE,array("X"=>3,"Y"=>3,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
@ -425,45 +430,45 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width, function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width,
$height, $font, $font_size) { $height, $font, $font_size) {
/* CAT:Radar/Polar charts */ /* CAT:Radar/Polar charts */
/* Create and populate the pData object */ /* Create and populate the pData object */
$MyData = new pData(); $MyData = new pData();
$MyData->addPoints($data_values,"ScoreA"); $MyData->addPoints($data_values,"ScoreA");
$MyData->setSerieDescription("ScoreA","Application A"); $MyData->setSerieDescription("ScoreA","Application A");
/* Define the absissa serie */ /* Define the absissa serie */
$MyData->addPoints($legend_values,"Labels"); $MyData->addPoints($legend_values,"Labels");
$MyData->setAbscissa("Labels"); $MyData->setAbscissa("Labels");
/* Create the pChart object */ /* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData,TRUE); $myPicture = new pImage($width,$height,$MyData,TRUE);
/* Set the default font properties */ /* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80)); $myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
/* Create the pRadar object */ /* Create the pRadar object */
$SplitChart = new pRadar(); $SplitChart = new pRadar();
/* Draw a radar chart */ /* Draw a radar chart */
$myPicture->setGraphArea(20,25,$width-10,$height-10); $myPicture->setGraphArea(20,25,$width-10,$height-10);
/* Draw an AA pie chart */ /* Draw an AA pie chart */
switch($graph_type) { switch($graph_type) {
case "radar": case "radar":
$Options = array("SkipLabels"=>0,"LabelPos"=>RADAR_LABELS_HORIZONTAL, $Options = array("SkipLabels"=>0,"LabelPos"=>RADAR_LABELS_HORIZONTAL,
"LabelMiddle"=>FALSE,"Layout"=>RADAR_LAYOUT_STAR, "LabelMiddle"=>FALSE,"Layout"=>RADAR_LAYOUT_STAR,
"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255, "BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,
"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50), "StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
"FontName"=>$font,"FontSize"=>$font_size); "FontName"=>$font,"FontSize"=>$font_size);
$SplitChart->drawRadar($myPicture,$MyData,$Options); $SplitChart->drawRadar($myPicture,$MyData,$Options);
break; break;
case "polar": case "polar":
$Options = array("Layout"=>RADAR_LAYOUT_CIRCLE,"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50), $Options = array("Layout"=>RADAR_LAYOUT_CIRCLE,"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
"FontName"=>$font,"FontSize"=>$font_size); "FontName"=>$font,"FontSize"=>$font_size);
$SplitChart->drawRadar($myPicture,$MyData,$Options); $SplitChart->drawRadar($myPicture,$MyData,$Options);
break; break;
} }
/* Render the picture */ /* Render the picture */
$myPicture->stroke(); $myPicture->stroke();
} }
@ -472,63 +477,63 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
$antialiasing, $rgb_color = false, $xaxisname = "", $yaxisname = "", $antialiasing, $rgb_color = false, $xaxisname = "", $yaxisname = "",
$show_values = false, $legend = array(), $fine_colors = array(), $water_mark = '', $font_size) { $show_values = false, $legend = array(), $fine_colors = array(), $water_mark = '', $font_size) {
/* CAT: Vertical Bar Chart */ /* CAT: Vertical Bar Chart */
if(!is_array($legend) || empty($legend)) { if (!is_array($legend) || empty($legend)) {
unset($legend); unset($legend);
} }
/* Create and populate the pData object */ /* Create and populate the pData object */
$MyData = new pData(); $MyData = new pData();
$overridePalette = array(); $overridePalette = array();
foreach($data as $i => $values) { foreach ($data as $i => $values) {
$MyData->addPoints($values,$i); $MyData->addPoints($values,$i);
if(!empty($rgb_color)) { if (!empty($rgb_color)) {
$MyData->setPalette($i, $MyData->setPalette($i,
array("R" => $rgb_color[$i]['color']["R"], array("R" => $rgb_color[$i]['color']["R"],
"G" => $rgb_color[$i]['color']["G"], "G" => $rgb_color[$i]['color']["G"],
"B" => $rgb_color[$i]['color']["B"], "B" => $rgb_color[$i]['color']["B"],
"BorderR" => $rgb_color[$i]['border']["R"], "BorderR" => $rgb_color[$i]['border']["R"],
"BorderG" => $rgb_color[$i]['border']["G"], "BorderG" => $rgb_color[$i]['border']["G"],
"BorderB" => $rgb_color[$i]['border']["B"], "BorderB" => $rgb_color[$i]['border']["B"],
"Alpha" => $rgb_color[$i]['alpha'])); "Alpha" => $rgb_color[$i]['alpha']));
} }
// Assign cyclic colors to bars if are setted // Assign cyclic colors to bars if are setted
if($fine_colors) { if($fine_colors) {
$c = 0; $c = 0;
foreach($values as $ii => $vv) { foreach($values as $ii => $vv) {
if(!isset($fine_colors[$c])) { if(!isset($fine_colors[$c])) {
$c = 0; $c = 0;
} }
$overridePalette[$ii] = $fine_colors[$c]; $overridePalette[$ii] = $fine_colors[$c];
$c++; $c++;
} }
} }
else { else {
$overridePalette = false; $overridePalette = false;
} }
} }
$MyData->setAxisName(0,$yaxisname); $MyData->setAxisName(0,$yaxisname);
$MyData->addPoints($index,"Xaxis"); $MyData->addPoints($index,"Xaxis");
$MyData->setSerieDescription("Xaxis", $xaxisname); $MyData->setSerieDescription("Xaxis", $xaxisname);
$MyData->setAbscissa("Xaxis"); $MyData->setAbscissa("Xaxis");
/* Create the pChart object */ /* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData); $myPicture = new pImage($width,$height,$MyData);
/* Turn of Antialiasing */ /* Turn of Antialiasing */
$myPicture->Antialias = $antialiasing; $myPicture->Antialias = $antialiasing;
/* Add a border to the picture */ /* Add a border to the picture */
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0)); //$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
/* Turn on shadow computing */ /* Turn on shadow computing */
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size)); $myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
/* Draw the scale */ /* Draw the scale */
// TODO: AvoidTickWhenEmpty = FALSE When the distance between two ticks will be less than 50 px // TODO: AvoidTickWhenEmpty = FALSE When the distance between two ticks will be less than 50 px
// TODO: AvoidTickWhenEmpty = TRUE When the distance between two ticks will be greater than 50 px // TODO: AvoidTickWhenEmpty = TRUE When the distance between two ticks will be greater than 50 px
@ -539,21 +544,21 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
switch($graph_type) { switch($graph_type) {
case "vbar": case "vbar":
$scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE, $scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE,
"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, "GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE,
"Mode"=>SCALE_MODE_START0, "LabelRotation" => 60); "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60);
$margin_left = 40; $margin_left = 40;
$margin_top = 10; $margin_top = 10;
$margin_bottom = 10 * $max_chars; $margin_bottom = 10 * $max_chars;
break; break;
case "hbar": case "hbar":
$scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE, $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,
"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM, "CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM,
"LabelValuesRotation" => 30); "LabelValuesRotation" => 30);
$margin_left = $font_size * $max_chars; $margin_left = $font_size * $max_chars;
$margin_top = 40; $margin_top = 40;
$margin_bottom = 10; $margin_bottom = 10;
break; break;
} }
$water_mark_height = 0; $water_mark_height = 0;
@ -569,9 +574,9 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
/* Define the chart area */ /* Define the chart area */
$myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom); $myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom);
$myPicture->drawScale($scaleSettings); $myPicture->drawScale($scaleSettings);
if(isset($legend)) { if(isset($legend)) {
/* Write the chart legend */ /* Write the chart legend */
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); $size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
@ -580,12 +585,12 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
/* Turn on shadow computing */ /* Turn on shadow computing */
$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); $myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Draw the chart */ /* Draw the chart */
$settings = array("ForceTransparency"=>"-1", "Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE, "OverrideColors"=>$overridePalette); $settings = array("ForceTransparency"=>"-1", "Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE, "OverrideColors"=>$overridePalette);
$myPicture->drawBarChart($settings); $myPicture->drawBarChart($settings);
/* Render the picture */ /* Render the picture */
$myPicture->stroke(); $myPicture->stroke();
} }
@ -664,20 +669,20 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$MyData->addPoints($index,"Xaxis"); $MyData->addPoints($index,"Xaxis");
$MyData->setSerieDescription("Xaxis", $xaxisname); $MyData->setSerieDescription("Xaxis", $xaxisname);
$MyData->setAbscissa("Xaxis"); $MyData->setAbscissa("Xaxis");
/* Create the pChart object */ /* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData); $myPicture = new pImage($width,$height,$MyData);
/* Turn of Antialiasing */ /* Turn of Antialiasing */
$myPicture->Antialias = $antialiasing; $myPicture->Antialias = $antialiasing;
/* Add a border to the picture */ /* Add a border to the picture */
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0)); //$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
/* Set the default font */ /* Set the default font */
$myPicture->setFontProperties(array("FontName"=>$font, "FontSize"=>$font_size)); $myPicture->setFontProperties(array("FontName"=>$font, "FontSize"=>$font_size));
if(isset($legend)) { if (isset($legend)) {
/* Set horizontal legend if is posible */ /* Set horizontal legend if is posible */
$legend_mode = LEGEND_HORIZONTAL; $legend_mode = LEGEND_HORIZONTAL;
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode)); $size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
@ -685,7 +690,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$legend_mode = LEGEND_VERTICAL; $legend_mode = LEGEND_VERTICAL;
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode)); $size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
} }
/* Write the chart legend */ /* Write the chart legend */
$myPicture->drawLegend($width-$size['Width'], 8,array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode)); $myPicture->drawLegend($width-$size['Width'], 8,array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
} }
@ -704,14 +709,14 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$myPicture->drawFromPNG(($width - $water_mark_width), $myPicture->drawFromPNG(($width - $water_mark_width),
($height - $water_mark_height) - $margin_bottom, $water_mark); ($height - $water_mark_height) - $margin_bottom, $water_mark);
} }
// Get the max number of scale // Get the max number of scale
$max_all = 0; $max_all = 0;
$serie_ne_zero = false; $serie_ne_zero = false;
foreach($data as $serie) { foreach ($data as $serie) {
$max_this_serie = max($serie); $max_this_serie = max($serie);
if($max_this_serie > $max_all) { if ($max_this_serie > $max_all) {
$max_all = $max_this_serie; $max_all = $max_this_serie;
} }
// Detect if all serie is equal to zero or not // Detect if all serie is equal to zero or not
@ -721,14 +726,14 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
// Get the number of digits of the scale // Get the number of digits of the scale
$digits_left = 0; $digits_left = 0;
while($max_all > 1) { while ($max_all > 1) {
$digits_left ++; $digits_left ++;
$max_all /= 10; $max_all /= 10;
} }
// If the number is less than 1 we count the decimals // If the number is less than 1 we count the decimals
// Also check if the serie is not all equal to zero (!$serie_ne_zero) // Also check if the serie is not all equal to zero (!$serie_ne_zero)
if($digits_left == 0 and !$serie_ne_zero) { if ($digits_left == 0 and !$serie_ne_zero) {
while($max_all < 1) { while($max_all < 1) {
$digits_left ++; $digits_left ++;
$max_all *= 10; $max_all *= 10;
@ -738,12 +743,12 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$chart_size = ($digits_left * $font_size) + 20; $chart_size = ($digits_left * $font_size) + 20;
/* Area depends on yaxisname */ /* Area depends on yaxisname */
if ($yaxisname != ''){ if ($yaxisname != '') {
$chart_size += 40; $chart_size += 40;
} }
else{ else {
$chart_size = 40; $chart_size = 40;
} }
if (isset($size['Height'])) { if (isset($size['Height'])) {
/* Define the chart area */ /* Define the chart area */
@ -799,7 +804,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
"DisplayZeros"=> FALSE, "DisplayZeros"=> FALSE,
"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>TRUE); "DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>TRUE);
switch($graph_type) { switch($graph_type) {
case "stacked_area": case "stacked_area":
case "area": case "area":
@ -847,13 +852,13 @@ function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font
$settings = array("Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE); $settings = array("Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE);
$myPicture->drawSplineChart($settings); $myPicture->drawSplineChart($settings);
$myPicture->setShadow(FALSE); $myPicture->setShadow(FALSE);
if($show_legend) { if($show_legend) {
/* Write the chart legend */ /* Write the chart legend */
$myPicture->drawLegend(643,210,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); $myPicture->drawLegend(643,210,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
} }
/* Render the picture */ /* Render the picture */
$myPicture->stroke(); $myPicture->stroke();
} }
?> ?>

View File

@ -48,12 +48,12 @@ function print_cells_temp ($cells) {
if ($row[1] === 0) { if ($row[1] === 0) {
$row[1] = "-"; $row[1] = "-";
} }
// Prevents error for empty color // Prevents error for empty color
$color = ''; $color = '';
if (isset($row["color"])) if (isset($row["color"]))
$color = 'style="color: ' . $row["color"] . ';"'; $color = 'style="color: ' . $row["color"] . ';"';
if (isset($row["href"]) and !empty($row["href"])) if (isset($row["href"]) and !empty($row["href"]))
echo '<td class="'.$class.'" style="text-align:right;"><a class="big_data" href="'.io_safe_input ($row["href"]).'" ' . $color . '>'.$row[1].'</a></td></tr>'; echo '<td class="'.$class.'" style="text-align:right;"><a class="big_data" href="'.io_safe_input ($row["href"]).'" ' . $color . '>'.$row[1].'</a></td></tr>';
else else
@ -61,7 +61,7 @@ function print_cells_temp ($cells) {
} }
} }
if ($config["realtimestats"] == 0){ if ($config["realtimestats"] == 0) {
$updated_time ="<a href='index.php?sec=estado&sec2=operation/agentes/tactical&force_refresh=1'>"; $updated_time ="<a href='index.php?sec=estado&sec2=operation/agentes/tactical&force_refresh=1'>";
$updated_time .= __('Last update'). " : ". ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true); $updated_time .= __('Last update'). " : ". ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true);
$updated_time .= "</a>"; $updated_time .= "</a>";
@ -113,13 +113,13 @@ $table->data[6][0] = '<b>'.__('Alert level').'</b>';
$table->style[7] = "padding-top:4px; padding-bottom:4px;"; $table->style[7] = "padding-top:4px; padding-bottom:4px;";
$table->data[7][0] = $table->data[7][0] =
progress_bar($data["alert_level"], 140, 20, $data["alert_level"].'% '.__('of defined alerts not fired'), 0); progress_bar($data["alert_level"], 140, 20, $data["alert_level"].'% '.__('of defined alerts not fired'), 0);
html_print_table ($table); html_print_table ($table);
unset ($table); unset ($table);
echo '<table class="databox" cellpadding="4" cellspacing="4" width="100%">'; echo '<table class="databox" cellpadding="4" cellspacing="4" width="100%">';
echo '<tr><th colspan="2">'.__('Monitor checks').'</th></tr>'; echo '<tr><th colspan="2">'.__('Monitor checks').'</th></tr>';
$cells = array (); $cells = array ();
$cells[0][0] = __('Monitor checks'); $cells[0][0] = __('Monitor checks');
$cells[0][1] = $data["monitor_checks"]; $cells[0][1] = $data["monitor_checks"];
@ -166,37 +166,37 @@ print_cells_temp ($cells);
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Server performance // Server performance
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
if($is_admin) { if ($is_admin) {
$server_performance = servers_get_performance(); $server_performance = servers_get_performance();
echo '<tr><th colspan="2">'.__('Server performance').'</th></tr>'; echo '<tr><th colspan="2">'.__('Server performance').'</th></tr>';
$cells = array (); $cells = array ();
$cells[0][0] = __('Local modules rate'); $cells[0][0] = __('Local modules rate');
$cells[0][1] = format_numeric($server_performance ["local_modules_rate"]); $cells[0][1] = format_numeric($server_performance ["local_modules_rate"]);
$cells[0]["color"] = "#729fcf"; $cells[0]["color"] = "#729fcf";
$cells[0]["href"] = ""; $cells[0]["href"] = "";
$cells[1][0] = __('Remote modules rate'); $cells[1][0] = __('Remote modules rate');
$cells[1][1] = format_numeric($server_performance ["remote_modules_rate"]); $cells[1][1] = format_numeric($server_performance ["remote_modules_rate"]);
$cells[1]["color"] = "#729fcf"; $cells[1]["color"] = "#729fcf";
$cells[1]["href"] = ""; $cells[1]["href"] = "";
$cells[2][0] = __('Local modules'); $cells[2][0] = __('Local modules');
$cells[2][1] = format_numeric($server_performance ["total_local_modules"]); $cells[2][1] = format_numeric($server_performance ["total_local_modules"]);
$cells[2]["color"] = "#3465a4"; $cells[2]["color"] = "#3465a4";
$cells[2]["href"] = ""; $cells[2]["href"] = "";
$cells[3][0] = __('Remote modules'); $cells[3][0] = __('Remote modules');
$cells[3][1] = format_numeric($server_performance ["total_remote_modules"]); $cells[3][1] = format_numeric($server_performance ["total_remote_modules"]);
$cells[3]["color"] = "#3465a4"; $cells[3]["color"] = "#3465a4";
$cells[3]["href"] = ""; $cells[3]["href"] = "";
$cells[4][0] = __('Total running modules'); $cells[4][0] = __('Total running modules');
$cells[4][1] = format_numeric($server_performance ["total_modules"]); $cells[4][1] = format_numeric($server_performance ["total_modules"]);
$cells[4]["color"] = "#000"; $cells[4]["color"] = "#000";
$cells[4]["href"] = ""; $cells[4]["href"] = "";
print_cells_temp ($cells); print_cells_temp ($cells);
} }
@ -237,22 +237,22 @@ events_print_event_table ("WHERE estado<>1 ", 10, "100%");
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Server information // Server information
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
if($is_admin) { if ($is_admin) {
$serverinfo = servers_get_info (); $serverinfo = servers_get_info ();
$cells = array (); $cells = array ();
if ($serverinfo === false) { if ($serverinfo === false) {
$serverinfo = array (); $serverinfo = array ();
} }
$table->class = "databox"; $table->class = "databox";
$table->cellpadding = 4; $table->cellpadding = 4;
$table->cellspacing = 4; $table->cellspacing = 4;
$table->width = "100%"; $table->width = "100%";
$table->title = __('Tactical server information'); $table->title = __('Tactical server information');
$table->titlestyle = "background-color:#799E48;"; $table->titlestyle = "background-color:#799E48;";
$table->head = array (); $table->head = array ();
$table->head[0] = __('Name'); $table->head[0] = __('Name');
$table->head[1] = __('Type'); $table->head[1] = __('Type');
@ -262,9 +262,9 @@ if($is_admin) {
$table->align[2] = 'center'; $table->align[2] = 'center';
$table->align[3] = 'center'; $table->align[3] = 'center';
$table->align[4] = 'right'; $table->align[4] = 'right';
$table->data = array (); $table->data = array ();
foreach ($serverinfo as $server) { foreach ($serverinfo as $server) {
$data = array (); $data = array ();
$data[0] = $server["name"]; $data[0] = $server["name"];

View File

@ -216,52 +216,64 @@ if ($config["pure"] == 0) {
$hashup = md5($config['id_user'] . $pss['password']); $hashup = md5($config['id_user'] . $pss['password']);
// Fullscreen // Fullscreen
$fullscreen['active'] = false; $fullscreen['active'] = false;
$fullscreen['text'] = '<a href="'.$url.'&amp;pure=1">' . $fullscreen['text'] = '<a href="'.$url.'&amp;pure=1">' .
html_print_image("images/fullscreen.png", true, array ("title" => __('Full screen'))) .'</a>'; html_print_image("images/fullscreen.png", true, array ("title" => __('Full screen'))) .'</a>';
// Event list // Event list
$list['active'] = false; $list['active'] = false;
$list['text'] = '<a href="index.php?sec=eventos&sec2=operation/events/events">' . $list['text'] = '<a href="index.php?sec=eventos&sec2=operation/events/events">' .
html_print_image("images/god6.png", true, array("title" => __('Event list'))) . '</a>'; html_print_image("images/god6.png", true, array("title" => __('Event list'))) . '</a>';
$rss['active'] = false; $rss['active'] = false;
$rss['text'] = '<a href="operation/events/events_rss.php?user=' . $config['id_user'] . '&hashup=' . $hashup . $rss['text'] = '<a href="operation/events/events_rss.php?user=' . $config['id_user'] . '&hashup=' . $hashup .
'&text_agent=' . $text_agent . '&ev_group='.$ev_group.'&amp;event_type='.$event_type.'&amp;search='.io_safe_input($search).'&amp;severity='.$severity.'&amp;status='.$status.'&amp;event_view_hr='.$event_view_hr.'&amp;id_agent='.$id_agent.'">' . '&text_agent=' . $text_agent . '&ev_group='.$ev_group.'&amp;event_type='.$event_type.'&amp;search='.io_safe_input($search).'&amp;severity='.$severity.'&amp;status='.$status.'&amp;event_view_hr='.$event_view_hr.'&amp;id_agent='.$id_agent.'">' .
html_print_image("images/rss.png", true, array ("title" => __('RSS Events'))) .'</a>'; html_print_image("images/rss.png", true, array ("title" => __('RSS Events'))) .'</a>';
// Marquee // Marquee
$marquee['active'] = false; $marquee['active'] = false;
$marquee['text'] = '<a href="operation/events/events_marquee.php">' . $marquee['text'] = '<a href="operation/events/events_marquee.php">' .
html_print_image("images/heart.png", true, array ("title" => __('Marquee display'))) .'</a>'; html_print_image("images/heart.png", true, array ("title" => __('Marquee display'))) .'</a>';
$csv['active'] = false; $csv['active'] = false;
$csv['text'] = '<a href="operation/events/export_csv.php?ev_group=' . $ev_group . $csv['text'] = '<a href="operation/events/export_csv.php?ev_group=' . $ev_group .
'&text_agent=' . $text_agent . '&amp;event_type='.$event_type.'&amp;search='.io_safe_input($search).'&amp;severity='.$severity.'&amp;status='.$status.'&amp;event_view_hr='.$event_view_hr.'&amp;id_agent='.$id_agent.'">' . '&text_agent=' . $text_agent . '&amp;event_type='.$event_type.'&amp;search='.io_safe_input($search).'&amp;severity='.$severity.'&amp;status='.$status.'&amp;event_view_hr='.$event_view_hr.'&amp;id_agent='.$id_agent.'">' .
html_print_image("images/disk.png", true, array ("title" => __('Export to CSV file'))) .'</a>'; html_print_image("images/disk.png", true, array ("title" => __('Export to CSV file'))) .'</a>';
// Sound events // Sound events
$sound_event['active'] = false; $sound_event['active'] = false;
$sound_event['text'] = '<a href="javascript: openSoundEventWindow();">' . html_print_image('images/music_note.png', true, array('title' => __('Sound events'))) . '</a>'; $sound_event['text'] = '<a href="javascript: openSoundEventWindow();">' . html_print_image('images/music_note.png', true, array('title' => __('Sound events'))) . '</a>';
// If the user has administrator permission display manage tab // If the user has administrator permission display manage tab
if (check_acl ($config["id_user"], 0, "IW")) { if (check_acl ($config["id_user"], 0, "IW")) {
// Manage events // Manage events
$manage_events['active'] = false; $manage_events['active'] = false;
$manage_events['text'] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&amp;section=filter">' . $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>'; html_print_image("images/setup.png", true, array ("title" => __('Manage events'))) . '</a>';
$onheader = array('manage_events' => $manage_events, 'separator' => '', 'fullscreen' => $fullscreen, $onheader = array('manage_events' => $manage_events,
'list' => $list, 'rss' => $rss, 'marquee' => $marquee, 'csv' => $csv, 'sound_event' => $sound_event) ; 'separator' => '',
'fullscreen' => $fullscreen,
'list' => $list,
'rss' => $rss,
'marquee' => $marquee,
'csv' => $csv,
'sound_event' => $sound_event) ;
} }
else { else {
$onheader = array('fullscreen' => $fullscreen, $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){ switch ($section){
case 'sound_event': $onheader['sound_event']['active'] = true; case 'sound_event':
break; $onheader['sound_event']['active'] = true;
default: $onheader['list']['active'] = true; break;
break; default:
$onheader['list']['active'] = true;
break;
} }
ui_print_page_header (__("Events"), "images/lightning_go.png", false, "eventview", false, $onheader); ui_print_page_header (__("Events"), "images/lightning_go.png", false, "eventview", false, $onheader);
@ -269,10 +281,9 @@ if ($config["pure"] == 0) {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function openSoundEventWindow() { function openSoundEventWindow() {
<?php url = '<?php
$url = ui_get_full_url(false); echo ui_get_full_url('operation/events/sound_events.php');
?> ?>';
url = '<?php echo $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'); window.open(url, '<?php __('Sound Alerts'); ?>','width=300, height=300, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=yes');
} }
@ -289,7 +300,7 @@ else {
echo "<h2>".__('Events')." &raquo; ".__('Main event view'). "&nbsp;"; echo "<h2>".__('Events')." &raquo; ".__('Main event view'). "&nbsp;";
echo ui_print_help_icon ("eventview", true); echo ui_print_help_icon ("eventview", true);
echo "&nbsp;"; echo "&nbsp;";
echo '<a target="_top" href="'.$url.'&amp;pure=0">'; echo '<a target="_top" href="'.$url.'&amp;pure=0">';
html_print_image ("images/normalscreen.png", false, array ("title" => __('Back to normal mode'))); html_print_image ("images/normalscreen.png", false, array ("title" => __('Back to normal mode')));
echo '</a>'; echo '</a>';

View File

@ -81,7 +81,7 @@ if (check_acl ($config['id_user'], 0, "AR")) {
$sub2['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters'); $sub2['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters');
enterprise_hook ('snmpconsole_submenu'); enterprise_hook ('snmpconsole_submenu');
$sub2['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator'); $sub2['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator');
$sub["operation/snmpconsole/snmp_view"]["sub2"] = $sub2; $sub["operation/snmpconsole/snmp_view"]["sub2"] = $sub2;
$menu_operation["estado"]["sub"] = $sub; $menu_operation["estado"]["sub"] = $sub;
@ -267,10 +267,9 @@ if (check_acl ($config['id_user'], 0, "AR")) {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function openSoundEventWindow() { function openSoundEventWindow() {
<?php url = '<?php
$url = ui_get_full_url(false); echo ui_get_full_url('operation/events/sound_events.php');
?> ?>';
url = '<?php echo $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'); window.open(url, '<?php __('Sound Alerts'); ?>','width=475, height=275, resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no');
} }
@ -344,16 +343,16 @@ if (check_acl ($config['id_user'], 0, "IR")) {
$sub["operation/netflow/nf_live_view"]["text"] = __('Live view'); $sub["operation/netflow/nf_live_view"]["text"] = __('Live view');
$menu_operation["netf"]["sub"] = $sub; $menu_operation["netf"]["sub"] = $sub;
} }
} }
// Rest of options, all with AR privilege (or should events be with incidents?) // Rest of options, all with AR privilege (or should events be with incidents?)
if (check_acl ($config['id_user'], 0, "AR")) { if (check_acl ($config['id_user'], 0, "AR")) {
//SNMP Console //SNMP Console
$menu_operation["snmpconsole"]["text"] = __('SNMP console'); $menu_operation["snmpconsole"]["text"] = __('SNMP console');
$menu_operation["snmpconsole"]["refr"] = 0; $menu_operation["snmpconsole"]["refr"] = 0;
$menu_operation["snmpconsole"]["sec2"] = "operation/snmpconsole/snmp_view"; $menu_operation["snmpconsole"]["sec2"] = "operation/snmpconsole/snmp_view";
$menu_operation["snmpconsole"]["id"] = "oper-snmpc"; $menu_operation["snmpconsole"]["id"] = "oper-snmpc";
// Extensions menu additions // Extensions menu additions
if (is_array ($config['extensions'])) { if (is_array ($config['extensions'])) {
$menu_operation["extensions"]["text"] = __('Extensions'); $menu_operation["extensions"]["text"] = __('Extensions');
@ -399,4 +398,4 @@ if (check_acl ($config['id_user'], 0, "AR")) {
$operation_menu_array = $menu_operation; $operation_menu_array = $menu_operation;
menu_print_menu ($menu_operation, true); menu_print_menu ($menu_operation, true);
?> ?>

View File

@ -212,10 +212,10 @@ foreach ($contents as $content) {
} }
$new_interval = $report['datetime'] - $datetime_init; $new_interval = $report['datetime'] - $datetime_init;
$content['period'] = $new_interval; $content['period'] = $new_interval;
} }
reporting_render_report_html_item ($content, $table, $report); reporting_render_report_html_item ($content, $table, $report);
if ($content['type'] == 'agent_module') if ($content['type'] == 'agent_module')
echo '<div style="width: 99%; overflow: auto;">'; echo '<div style="width: 99%; overflow: auto;">';
@ -236,10 +236,10 @@ $(document).ready (function () {
$("#loading").slideUp (); $("#loading").slideUp ();
$("#text-time").timeEntry ({spinnerImage: 'images/time-entry.png', spinnerSize: [20, 20, 0]}); $("#text-time").timeEntry ({spinnerImage: 'images/time-entry.png', spinnerSize: [20, 20, 0]});
$("#text-date").datepicker (); $("#text-date").datepicker ();
$('[id^=text-date_init]').datepicker (); $('[id^=text-date_init]').datepicker ();
$('[id^=text-time_init]').timeEntry ({spinnerImage: 'images/time-entry.png', spinnerSize: [20, 20, 0]}); $('[id^=text-time_init]').timeEntry ({spinnerImage: 'images/time-entry.png', spinnerSize: [20, 20, 0]});
$.datepicker.regional["<?php echo $config['language']; ?>"]; $.datepicker.regional["<?php echo $config['language']; ?>"];
/* Show/hide begin date reports controls */ /* Show/hide begin date reports controls */
@ -259,5 +259,4 @@ $(document).ready (function () {
} }
}); });
}); });
</script>
</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"]); $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>'; html_print_image ("images/camera.png", true, array ("title" => __('Show link to public Visual Console'))).'</a>';
$options['public_link']['active'] = false; $options['public_link']['active'] = false;