From 050c78a13be8f5f334d2346395a10a1abfe4f61f Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Wed, 18 Mar 2015 20:30:32 +0100 Subject: [PATCH] Now the metaconsole can show the graphs of their nodes --- .../operation/agentes/stat_win.php | 118 +++++++----------- 1 file changed, 43 insertions(+), 75 deletions(-) diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index 206678bf92..498c37036b 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -21,32 +21,32 @@ if (! isset($_SESSION['id_usuario'])) { // Global & session management require_once ('../../include/config.php'); -require_once ('../../include/auth/mysql.php'); +require_once ($config['homedir'] . '/include/auth/mysql.php'); require_once ($config['homedir'] . '/include/functions.php'); require_once ($config['homedir'] . '/include/functions_db.php'); require_once ($config['homedir'] . '/include/functions_reporting.php'); require_once ($config['homedir'] . '/include/functions_graph.php'); require_once ($config['homedir'] . '/include/functions_modules.php'); - -// Hash login process -if (! isset ($config['id_user']) && get_parameter("loginhash", 0)) { - $loginhash_data = get_parameter("loginhash_data", ""); - $loginhash_user = str_rot13(get_parameter("loginhash_user", "")); - - if ($config["loginhash_pwd"] != "" - && $loginhash_data == md5($loginhash_user.$config["loginhash_pwd"])) { - - db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']); - $_SESSION['id_usuario'] = $loginhash_user; - $config["id_user"] = $loginhash_user; - - $hash_connection_data = true; - } - -} +require_once ($config['homedir'] . '/include/functions_agents.php'); check_login (); +// Metaconsole connection to the node +$server_id = (int) get_parameter("server"); +if (!empty($server_id) && function_exists("metaconsole_get_connection_by_id")) { + $server = metaconsole_get_connection_by_id($server_id); + + // Error connecting + if (metaconsole_connect($server) !== NOERR) { + echo ""; + echo ""; + ui_print_error_message(__('There was a problem connecting with the node')); + echo ""; + echo ""; + exit; + } +} + $user_language = get_user_language ($config['id_user']); if (file_exists ('../../include/languages/'.$user_language.'.mo')) { $l10n = new gettext_reader (new CachedFileReader ('../../include/languages/'.$user_language.'.mo')); @@ -101,22 +101,36 @@ $label = base64_decode(get_parameter('label', '')); '; - $params['body_text'] .= html_print_input_hidden ("id", $id, true); - $params['body_text'] .= html_print_input_hidden ("label", $label); - - if (isset($hash_connection_data)) { - $params['body_text'] .= - html_print_input_hidden("loginhash", "auto", true); - $params['body_text'] .= - html_print_input_hidden("loginhash_data", $loginhash_data, true); - $params['body_text'] .= - html_print_input_hidden("loginhash_user", - str_rot13($loginhash_user), true); - } - $params['body_text'] .= html_print_input_hidden ("id", $id, true); $params['body_text'] .= html_print_input_hidden ("label", $label, true); + if (!empty($server_id)) + $params['body_text'] .= html_print_input_hidden ("server", $server_id, true); + if (isset($_GET["type"])) { $type = get_parameter_get ("type"); $params['body_text'] .= html_print_input_hidden ("type", $type, true); @@ -401,39 +405,3 @@ $label = base64_decode(get_parameter('label', '')); }); $('#checkbox-time_compare_overlapped').click(function() { $('#checkbox-time_compare_separated').removeAttr('checked'); - }); - - - - var show_overview = false; - var height_window; - var width_window; - $(document).ready(function() { - height_window = $(window).height(); - width_window = $(window).width(); - }); - - $("*").filter(function() { - if (typeof(this.id) == "string") - return this.id.match(/menu_overview_graph.*/); - else - return false; - }).click(function() { - if (show_overview) { - window.resizeTo(width_window + 20, height_window + 50); - } - else { - window.resizeTo(width_window + 20, height_window + 200); - } - show_overview = !show_overview; - - }); - - - forced_title_callback(); -