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

* general/header.php: fixed the link to logout when the Pandora
	run across inverse proxy.
	
	* include/functions.php: update the function "check_refererer" for
	situations when the Pandora runs across the inverse proxy.
	
	* include/functions_html.php: function "html_print_image" fixed when
	use the metaconsole across the inverse proxy.
	
	* include/functions_reporting.php,
	operation/reporting/reporting_viewer.php: fixed some links for the
	Pandora runs across inverse proxy.
	
	* include/functions_ui.php: fixed the function "ui_get_full_url"
	when pass a empty url in a Pandora into a inverse proxy.
	
	* extensions/dbmanager.php, operation/agentes/ver_agente.php:
	cleaned source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6950 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-09-10 16:30:42 +00:00
parent 744801a63b
commit d2729d64b7
9 changed files with 67 additions and 43 deletions

View File

@ -1,3 +1,24 @@
2012-09-10 Miguel de Dios <miguel.dedios@artica.es>
* general/header.php: fixed the link to logout when the Pandora
run across inverse proxy.
* include/functions.php: update the function "check_refererer" for
situations when the Pandora runs across the inverse proxy.
* include/functions_html.php: function "html_print_image" fixed when
use the metaconsole across the inverse proxy.
* include/functions_reporting.php,
operation/reporting/reporting_viewer.php: fixed some links for the
Pandora runs across inverse proxy.
* include/functions_ui.php: fixed the function "ui_get_full_url"
when pass a empty url in a Pandora into a inverse proxy.
* extensions/dbmanager.php, operation/agentes/ver_agente.php:
cleaned source code style.
2012-09-10 Vanessa Gil <vanessa.gil@artica.es>
* pandoradb.sql
@ -17,7 +38,7 @@
operation/events/events_list.php: Added several fields to modules
and events.
2012-09-07 Miguel de Dios <miguel.dedios@artica.es>
2012-09-10 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/pandora.js, include/functions_ui.php,
include/functions_html.php: cleaned source code style.

View File

@ -16,7 +16,7 @@
function dbmanager_query ($sql, &$error) {
global $config;
switch ($config["dbtype"]) {
case "mysql":
$retval = array();
@ -44,21 +44,21 @@ function dbmanager_query ($sql, &$error) {
if (! empty ($retval))
return $retval;
//Return false, check with === or !==
return "Empty";
break;
case "postgresql":
case "oracle":
$retval = array();
if ($sql == '')
return false;
$sql = html_entity_decode($sql, ENT_QUOTES);
$result = db_process_sql($sql, "affected_rows", '', false, $status);
//$result = mysql_query ($sql);
if ($result === false) {
$backtrace = debug_backtrace();
@ -80,9 +80,9 @@ function dbmanager_query ($sql, &$error) {
function dbmgr_extension_main () {
ui_require_css_file ('dbmanager', 'extensions/dbmanager/');
global $config;
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
@ -91,21 +91,21 @@ function dbmgr_extension_main () {
if (!check_refererer()) {
require ("general/noaccess.php");
return;
}
$sql = (string) get_parameter ('sql');
ui_print_page_header (__('Database interface'), "", false, false, true);
echo '<div class="notify">';
echo "This is an advanced extension to interface with Pandora FMS database directly from WEB console using native SQL sentences. Please note that <b>you can damage</b> your Pandora FMS installation if you don't know </b>exactly</b> what are you are doing, this means that you can severily damage your setup using this extension. This extension is intended to be used <b>only by experienced users</b> with a depth knowledge of Pandora FMS internals.";
echo '</div>';
echo "<br />";
echo "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
echo "<br /><br />";
echo "<form method='post' action=''>";
html_print_textarea ('sql', 5, 40, html_entity_decode($sql, ENT_QUOTES));
@ -114,11 +114,11 @@ function dbmgr_extension_main () {
html_print_submit_button (__('Execute SQL'), '', false, 'class="sub next"');
echo '</div>';
echo "</form>";
// Processing SQL Code
if ($sql == '')
return;
echo "<br />";
echo "<hr />";
echo "<br />";
@ -159,5 +159,4 @@ extensions_add_godmode_menu_option (__('DB interface'), 'PM','gdbman',"dbmanager
/* This sets the function to be called when the extension is selected in the operation menu */
extensions_add_godmode_function ('dbmgr_extension_main');
?>
?>

View File

@ -86,7 +86,7 @@ config_check();
echo "&nbsp;";
}
echo '<a class="white_bold" href="index.php?bye=bye">';
echo '<a class="white_bold" href="' . ui_get_full_url('index.php?bye=bye') . '">';
html_print_image("images/log-out.png", false, array("alt" => __('Logout'), "class" => 'bot', "title" => __('Logout')));
echo '</a>';

View File

@ -48,7 +48,8 @@ function check_refererer() {
$url = $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $config["homeurl"];
}
else {
$url = $_SERVER['SERVER_NAME'] . $config["homeurl"];
$url = ui_get_full_url();
$url = preg_replace('/http(s?):\/\//','',$url);
}
// Remove protocol from referer

View File

@ -1227,9 +1227,9 @@ function html_print_image ($src, $return = false, $options = false, $return_src
if (!$relative) {
if (defined('METACONSOLE'))
$src = ENTERPRISE_DIR . '/meta/' . $src;
$src = ui_get_full_url($src);
$src = ui_get_full_url(ENTERPRISE_DIR . '/meta/' . $src);
else
$src = ui_get_full_url($src);
}
// Only return src field of image

View File

@ -1318,7 +1318,7 @@ function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return =
$data[__('Alerts not fired')] = $not_fired_percentage;
$output .= pie3d_graph(false, $data, 280, 150,
__("other"), $config['homeurl'] . '/', $config['homedir'] . "/images/logo_vertical_water.png",
__("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$output .= '<strong>'.__('Alerts fired').': '.sizeof ($alerts_fired).'</strong><br />';
@ -1394,7 +1394,7 @@ function reporting_monitor_health ($id_group, $period = 0, $date = 0, $return =
$data[__('Monitors BAD')] = $not_down_percentage;
$output .= pie3d_graph(false, $data, 280, 150,
__("other"), $config['homeurl'] . '/', $config['homedir'] . "/images/logo_vertical_water.png",
__("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
if (!$return)
@ -2143,7 +2143,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'],
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
$report["datetime"], '', 0, 0, true, true, $config['homeurl'] . '/');
$report["datetime"], '', 0, 0, true, true);
array_push ($table->data, $data);
break;
@ -2189,7 +2189,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
0,
$report["datetime"],
true,
$config['homedir'] . '/',
'',
1,
// Important parameter, this tell to graphic_combined_module function that is a projection graph
$output_projection,
@ -2250,7 +2250,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array ();
$data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'],
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
$report["datetime"], '', true, 0, true, true, $config['homedir'] . '/');
$report["datetime"], '', true, 0, true, true);
/*$data[0] = graphic_combined_module(
$modules,
@ -2316,8 +2316,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
0,
$graph["stacked"],
$report["datetime"],
true,
$config['homeurl'] . "/");
true);
array_push ($table->data, $data);
break;
@ -2537,7 +2536,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$dataslice[1] = graph_sla_slicebar ($sla['id_agent_module'], $content['period'],
$sla['sla_min'], $sla['sla_max'], $report['datetime'], $content, $content['time_from'],
$content['time_to'], 650, 25, $config['homeurl'] . '/');
$content['time_to'], 650, 25,'');
array_push ($tableslice->data, $dataslice);
}
@ -2560,7 +2559,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data_pie_graph = json_encode ($data_graph);
if ($show_graphs && !empty($slas)) {
$data[0] = pie3d_graph(false, $data_graph,
500, 150, __("other"), $config['homeurl'] . '/', $config['homedir'] . "/images/logo_vertical_water.png",
500, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
@ -2878,7 +2877,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array ();
$data[0] = graph_custom_sql_graph($content["id_rc"], $sizgraph_w, 200, $content["type"], true, $config['homeurl'] . '/');
$data[0] = graph_custom_sql_graph($content["id_rc"], $sizgraph_w, 200, $content["type"], true);
array_push($table->data, $data);
break;
@ -3866,7 +3865,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array();
if ($show_graph == 1 || $show_graph == 2) {
$data[0] = pie3d_graph(false, $data_pie_graph,
$sizgraph_w, $sizgraph_h, __("other"),$config['homeurl'] . "/", $config['homedir'] . "/images/logo_vertical_water.png",
$sizgraph_w, $sizgraph_h, __("other"),"", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
array_push ($table->data, $data);
@ -3875,7 +3874,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table->style[0] .= 'text-align:center';
$height = count($data_pie_graph)*20+35;
$data = array();
$data[0] = hbar_graph(false, $data_hbar, $sizgraph_w, $height, array(), array(), "", "", true, $config['homeurl'] . "/", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], true, 1, true);
$data[0] = hbar_graph(false, $data_hbar, $sizgraph_w, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], true, 1, true);
array_push ($table->data, $data);
}
@ -4162,7 +4161,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array();
if ($show_graph == 1 || $show_graph == 2) {
$data[0] = pie3d_graph(false, $data_pie_graph,
600, 150, __("other"), $config['homeurl'] . "/", $config['homedir'] . "/images/logo_vertical_water.png",
600, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
array_push ($table->data, $data);
//Display bars graph
@ -4170,7 +4169,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$height = count($data_pie_graph)*20+35;
$data = array();
$data[0] = hbar_graph(false, $data_hbar, 600, $height, array(), array(), "", "", true, $config['homeurl'] . "/", $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true);
$data[0] = hbar_graph(false, $data_hbar, 600, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true);
array_push ($table->data, $data);
}

View File

@ -1833,7 +1833,6 @@ function ui_toggle($code, $name, $title = '', $hidde_default = true) {
echo "</div>";
// JQuery Toggle
echo '<script type="text/javascript">';
echo '/* <![CDATA[ */';
echo "$(document).ready (function () {";
@ -1988,7 +1987,12 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal
}
if ($url === '') {
$url = $_SERVER['REQUEST_URI'];
if ($proxy) {
$url = '';
}
else {
$url = $_SERVER['REQUEST_URI'];
}
}
elseif ($url === false) {
//Only add the home url

View File

@ -201,7 +201,7 @@ if (is_ajax ()) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
//Get agent's modules
$temp = agents_get_modules ($id_agent);
@ -291,7 +291,7 @@ if (is_ajax ()) {
$result[$nameModule['nombre'].'$*$'.implode('|', $idAgents)] = io_safe_output($nameModule['nombre']);
}
}
echo json_encode($result);
return;
}

View File

@ -38,8 +38,8 @@ if (! check_acl ($config['id_user'], $report['id_group'], "AR")) {
}
// Include with the functions to calculate each kind of report.
require_once ($config['homedir'] . '/include/functions_reporting.php');
require_once ($config['homedir'] . '/include/functions_groups.php');
require_once ('include/functions_reporting.php');
require_once ('include/functions_groups.php');
enterprise_include("include/functions_reporting.php");