Fixed public access and added PublicLogin interface, including code style fixex
This commit is contained in:
parent
4b114e63a4
commit
09ccaf254e
|
@ -31,18 +31,18 @@ require 'vendor/autoload.php';
|
|||
|
||||
define('AJAX', true);
|
||||
|
||||
if (!defined('__PAN_XHPROF__')) {
|
||||
if (defined('__PAN_XHPROF__') === false) {
|
||||
define('__PAN_XHPROF__', 0);
|
||||
}
|
||||
|
||||
if (__PAN_XHPROF__ === 1) {
|
||||
if (function_exists('tideways_xhprof_enable')) {
|
||||
if (function_exists('tideways_xhprof_enable') === true) {
|
||||
tideways_xhprof_enable();
|
||||
}
|
||||
}
|
||||
|
||||
if ((! file_exists('include/config.php'))
|
||||
|| (! is_readable('include/config.php'))
|
||||
if (file_exists('include/config.php') === false
|
||||
|| is_readable('include/config.php') === false
|
||||
) {
|
||||
exit;
|
||||
}
|
||||
|
@ -57,11 +57,11 @@ require_once 'include/auth/mysql.php';
|
|||
if (isset($config['console_log_enabled']) === true
|
||||
&& $config['console_log_enabled'] == 1
|
||||
) {
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('log_errors', true);
|
||||
ini_set('error_log', $config['homedir'].'/log/console.log');
|
||||
} else {
|
||||
ini_set('log_errors', 0);
|
||||
ini_set('error_log', null);
|
||||
ini_set('log_errors', false);
|
||||
ini_set('error_log', '');
|
||||
}
|
||||
|
||||
// Sometimes input is badly retrieved from caller...
|
||||
|
@ -98,9 +98,11 @@ if (isset($_GET['loginhash']) === true) {
|
|||
}
|
||||
}
|
||||
|
||||
// Another auth class example: PandoraFMS\Dashboard\Manager.
|
||||
$auth_class = io_safe_output(
|
||||
get_parameter('auth_class', 'PandoraFMS\Dashboard\Manager')
|
||||
get_parameter('auth_class', 'PandoraFMS\User')
|
||||
);
|
||||
|
||||
$public_hash = get_parameter('auth_hash', false);
|
||||
$public_login = false;
|
||||
// Check user.
|
||||
|
@ -124,7 +126,7 @@ if (class_exists($auth_class) === false || $public_hash === false) {
|
|||
ob_start();
|
||||
|
||||
// Enterprise support.
|
||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php') === true) {
|
||||
include_once ENTERPRISE_DIR.'/load_enterprise.php';
|
||||
}
|
||||
|
||||
|
@ -142,12 +144,12 @@ if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
|||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
// Backward compatibility.
|
||||
define('METACONSOLE', true);
|
||||
}
|
||||
|
||||
if (file_exists($page)) {
|
||||
if (file_exists($page) === true) {
|
||||
include_once $page;
|
||||
} else {
|
||||
echo '<br /><b class="error">Sorry! I can\'t find the page '.$page.'!</b>';
|
||||
|
@ -172,7 +174,7 @@ if (isset($config['force_instant_logout']) === true
|
|||
header_remove('Set-Cookie');
|
||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||
|
||||
if ($config['auth'] == 'saml') {
|
||||
if ($config['auth'] === 'saml') {
|
||||
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
|
||||
$as = new SimpleSAML_Auth_Simple('PandoraFMS');
|
||||
$as->logout();
|
||||
|
|
|
@ -82,3 +82,4 @@ include/lib/WSManager.php
|
|||
include/lib/WebSocketServer.php
|
||||
include/lib/WebSocketUser.php
|
||||
operation/network/network_explorer.php
|
||||
operation/vsual_console/pure_ajax.php
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
global $config;
|
||||
global $statusProcessInDB;
|
||||
|
||||
use PandoraFMS\User;
|
||||
|
||||
check_login();
|
||||
|
||||
require_once $config['homedir'].'/include/functions_visual_map.php';
|
||||
|
@ -753,8 +755,8 @@ if (!defined('METACONSOLE')) {
|
|||
$url_view = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap='.$idVisualConsole.'&refr='.$view_refresh;
|
||||
}
|
||||
|
||||
// Hash for auto-auth in public link
|
||||
$hash = md5($config['dbpass'].$idVisualConsole.$config['id_user']);
|
||||
// Hash for auto-auth in public link.
|
||||
$hash = User::generatePublicHash();
|
||||
|
||||
$buttons = [];
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// TODO: Add Artica ST header.
|
||||
/* globals jQuery, VisualConsole, AsyncTaskManager */
|
||||
/* globals jQuery, VisualConsole, AsyncTaskManager, hash, id_user */
|
||||
|
||||
/*
|
||||
* *********************
|
||||
|
@ -720,7 +720,9 @@ function loadVisualConsoleData(baseUrl, vcId, size, callback) {
|
|||
{
|
||||
page: "include/rest-api/index",
|
||||
getVisualConsole: 1,
|
||||
visualConsoleId: vcId
|
||||
visualConsoleId: vcId,
|
||||
id_user: id_user,
|
||||
auth_hash: hash
|
||||
},
|
||||
"json"
|
||||
)
|
||||
|
@ -735,7 +737,9 @@ function loadVisualConsoleData(baseUrl, vcId, size, callback) {
|
|||
page: "include/rest-api/index",
|
||||
getVisualConsoleItems: 1,
|
||||
size: size,
|
||||
visualConsoleId: vcId
|
||||
visualConsoleId: vcId,
|
||||
id_user: id_user,
|
||||
auth_hash: hash
|
||||
},
|
||||
"json"
|
||||
)
|
||||
|
|
|
@ -5,11 +5,12 @@ namespace PandoraFMS\Dashboard;
|
|||
|
||||
use PandoraFMS\View;
|
||||
use PandoraFMS\Dashboard\Cell;
|
||||
use PandoraFMS\PublicLogin;
|
||||
|
||||
/**
|
||||
* Dashboard manager.
|
||||
*/
|
||||
class Manager
|
||||
class Manager implements PublicLogin
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/**
|
||||
* Public access interface to provide access using hash and id_user.
|
||||
*
|
||||
* @category Interfaces
|
||||
* @package Pandora FMS
|
||||
* @subpackage Login
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
namespace PandoraFMS;
|
||||
|
||||
interface PublicLogin
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Generates a hash to authenticate in public views.
|
||||
*
|
||||
* @param string|null $other_secret If you need to authenticate using a
|
||||
* varable string, use this 'other_secret' to customize the hash.
|
||||
*
|
||||
* @return string Returns a hash with the authenticaction.
|
||||
*/
|
||||
public static function generatePublicHash(?string $other_secret=''):string;
|
||||
|
||||
|
||||
/**
|
||||
* Validates a hash to authenticate in public view.
|
||||
*
|
||||
* @param string $hash Hash to be checked.
|
||||
* @param string $other_secret Any custom string needed for you.
|
||||
*
|
||||
* @return boolean Returns true if hash is valid.
|
||||
*/
|
||||
public static function validatePublicHash(
|
||||
string $hash,
|
||||
string $other_secret=''
|
||||
):bool;
|
||||
|
||||
|
||||
}
|
|
@ -32,7 +32,7 @@ namespace PandoraFMS;
|
|||
/**
|
||||
* Object user.
|
||||
*/
|
||||
class User
|
||||
class User implements PublicLogin
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -53,11 +53,11 @@ class User
|
|||
/**
|
||||
* Initializes a user object.
|
||||
*
|
||||
* @param array $data User information
|
||||
* @param array|null $data User information.
|
||||
* - Username
|
||||
* - PHP session ID.
|
||||
*/
|
||||
public function __construct($data)
|
||||
public function __construct(?array $data)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -88,17 +88,20 @@ class User
|
|||
if (isset($data['id_usuario']) === true
|
||||
&& isset($data['password']) === true
|
||||
) {
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
$user_in_db = process_user_login(
|
||||
$data['id_usuario'],
|
||||
$data['password'],
|
||||
true
|
||||
);
|
||||
if ($user_in_db !== false) {
|
||||
$config['id_usuario'] = $user_in_db;
|
||||
$correctLogin = true;
|
||||
|
||||
// Originally at api.php.
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$_SESSION['id_usuario'] = $user;
|
||||
$_SESSION['id_usuario'] = $data['id_usuario'];
|
||||
session_write_close();
|
||||
|
||||
$this->idUser = $data['id_usuario'];
|
||||
|
@ -113,4 +116,81 @@ class User
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates a hash to authenticate in public views.
|
||||
*
|
||||
* @param string|null $other_secret If you need to authenticate using a
|
||||
* varable string, use this 'other_secret' to customize the hash.
|
||||
*
|
||||
* @return string Returns a hash with the authenticaction.
|
||||
*/
|
||||
public static function generatePublicHash(?string $other_secret=''):string
|
||||
{
|
||||
global $config;
|
||||
|
||||
$str = $config['dbpass'];
|
||||
$str .= $config['id_user'];
|
||||
$str .= $other_secret;
|
||||
return hash('sha256', $str);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates a hash to authenticate in public view.
|
||||
*
|
||||
* @param string $hash Hash to be checked.
|
||||
* @param string $other_secret Any custom string needed for you.
|
||||
*
|
||||
* @return boolean Returns true if hash is valid.
|
||||
*/
|
||||
public static function validatePublicHash(
|
||||
string $hash,
|
||||
string $other_secret=''
|
||||
):bool {
|
||||
global $config;
|
||||
|
||||
if (isset($config['id_user']) === true) {
|
||||
// Already logged in.
|
||||
return true;
|
||||
}
|
||||
|
||||
$userFromParams = false;
|
||||
// Try to get id_user from parameters if it is missing.
|
||||
if (isset($config['id_user']) === false) {
|
||||
$userFromParams = true;
|
||||
$config['id_user'] = get_parameter('id_user', false);
|
||||
// It is impossible to authenticate without an id user.
|
||||
if ($config['id_user'] === false) {
|
||||
unset($config['id_user']);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$config['public_access'] = false;
|
||||
}
|
||||
|
||||
// Build a hash to check.
|
||||
$hashCheck = self::generatePublicHash($other_secret);
|
||||
if ($hashCheck === $hash) {
|
||||
// "Log" user in.
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$_SESSION['id_usuario'] = $config['id_user'];
|
||||
session_write_close();
|
||||
|
||||
$config['public_access'] = true;
|
||||
$config['force_instant_logout'] = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Remove id user from config array if authentication has failed.
|
||||
if ($userFromParams === true) {
|
||||
unset($config['id_user']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -147,8 +147,8 @@ class WebSocketUser
|
|||
/**
|
||||
* Initializes a websocket user.
|
||||
*
|
||||
* @param string $id Id of the new user.
|
||||
* @param Socket $socket Socket where communication is stablished.
|
||||
* @param string $id Id of the new user.
|
||||
* @param \Socket $socket Socket where communication is stablished.
|
||||
*/
|
||||
public function __construct($id, $socket)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
use PandoraFMS\User;
|
||||
|
||||
// Login check
|
||||
require_once $config['homedir'].'/include/functions_visual_map.php';
|
||||
ui_require_css_file('visual_maps');
|
||||
|
@ -122,7 +124,9 @@ $options['consoles_list']['text'] = '<a href="index.php?sec=network&sec2=godmode
|
|||
if ($vconsole_write || $vconsole_manage) {
|
||||
$url_base = 'index.php?sec=network&sec2=godmode/reporting/visual_console_builder&action=';
|
||||
|
||||
$hash = md5($config['dbpass'].$id_layout.$config['id_user']);
|
||||
// Hash for auto-auth in public link.
|
||||
$hash = User::generatePublicHash();
|
||||
|
||||
|
||||
$options['public_link']['text'] = '<a href="'.ui_get_full_url(
|
||||
'operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$id_layout.'&id_user='.$config['id_user']
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
// GNU General Public License for more details.
|
||||
require_once '../../include/config.php';
|
||||
|
||||
use PandoraFMS\User;
|
||||
|
||||
// Set root on homedir, as defined in setup.
|
||||
chdir($config['homedir']);
|
||||
|
||||
|
@ -67,10 +69,13 @@ if (!isset($config['pure'])) {
|
|||
$config['pure'] = 0;
|
||||
}
|
||||
|
||||
$myhash = md5($config['dbpass'].$visualConsoleId.$config['id_user']);
|
||||
|
||||
// Check input hash.
|
||||
if ($myhash != $hash) {
|
||||
if (User::validatePublicHash($hash) !== true) {
|
||||
db_pandora_audit(
|
||||
'Invalid public visual console',
|
||||
'Trying to access public visual console'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -177,6 +182,8 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
|
|||
var props = <?php echo (string) $visualConsole; ?>;
|
||||
var items = <?php echo '['.implode($visualConsoleItems, ',').']'; ?>;
|
||||
var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>";
|
||||
var hash = "<?php echo get_parameter('hash', ''); ?>";
|
||||
var id_user = "<?php echo get_parameter('id_user', ''); ?>";
|
||||
|
||||
var controls = document.getElementById('vc-controls');
|
||||
autoHideElement(controls, 1000);
|
||||
|
|
|
@ -1,314 +0,0 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
// Login check
|
||||
require_once $config['homedir'].'/include/functions_visual_map.php';
|
||||
|
||||
check_login();
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
$id_layout = (int) get_parameter('id');
|
||||
} else {
|
||||
$id_layout = (int) get_parameter('id_visualmap');
|
||||
}
|
||||
|
||||
if ($id_layout) {
|
||||
$default_action = 'edit';
|
||||
} else {
|
||||
$default_action = 'new';
|
||||
}
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
$action = get_parameterBetweenListValues(
|
||||
'action',
|
||||
[
|
||||
'new',
|
||||
'save',
|
||||
'edit',
|
||||
'update',
|
||||
'delete',
|
||||
],
|
||||
$default_action
|
||||
);
|
||||
} else {
|
||||
$action = get_parameterBetweenListValues(
|
||||
'action2',
|
||||
[
|
||||
'new',
|
||||
'save',
|
||||
'edit',
|
||||
'update',
|
||||
'delete',
|
||||
],
|
||||
$default_action
|
||||
);
|
||||
}
|
||||
|
||||
$refr = (int) get_parameter('refr', $config['vc_refr']);
|
||||
$graph_javascript = (bool) get_parameter('graph_javascript', false);
|
||||
$vc_refr = false;
|
||||
|
||||
if (isset($config['vc_refr']) and $config['vc_refr'] != 0) {
|
||||
$view_refresh = $config['vc_refr'];
|
||||
} else {
|
||||
$view_refresh = '300';
|
||||
}
|
||||
|
||||
// Get input parameter for layout id
|
||||
if (! $id_layout) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access visual console without id layout'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$layout = db_get_row('tlayout', 'id', $id_layout);
|
||||
|
||||
if (! $layout) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access visual console without id layout'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$id_group = $layout['id_group'];
|
||||
$layout_name = $layout['name'];
|
||||
$background = $layout['background'];
|
||||
$bwidth = $layout['width'];
|
||||
$bheight = $layout['height'];
|
||||
|
||||
$pure_url = '&pure='.$config['pure'];
|
||||
|
||||
// ACL
|
||||
$vconsole_read = check_acl($config['id_user'], $id_group, 'VR');
|
||||
$vconsole_write = check_acl($config['id_user'], $id_group, 'VW');
|
||||
$vconsole_manage = check_acl($config['id_user'], $id_group, 'VM');
|
||||
|
||||
if (! $vconsole_read && !$vconsole_write && !$vconsole_manage) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access visual console without group access'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Render map
|
||||
$options = [];
|
||||
|
||||
$options['consoles_list']['text'] = '<a href="index.php?sec=network&sec2=godmode/reporting/map_builder&refr='.$refr.'">'.html_print_image(
|
||||
'images/visual_console.png',
|
||||
true,
|
||||
['title' => __('Visual consoles list')]
|
||||
).'</a>';
|
||||
|
||||
if ($vconsole_write || $vconsole_manage) {
|
||||
$url_base = 'index.php?sec=network&sec2=godmode/reporting/visual_console_builder&action=';
|
||||
|
||||
$hash = md5($config['dbpass'].$id_layout.$config['id_user']);
|
||||
|
||||
$options['public_link']['text'] = '<a href="'.ui_get_full_url('operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$id_layout.'&id_user='.$config['id_user']).'" target="_blank">'.html_print_image(
|
||||
'images/camera_mc.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Show link to public Visual Console'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
$options['public_link']['active'] = false;
|
||||
|
||||
$options['data']['text'] = '<a href="'.$url_base.$action.'&tab=data&id_visual_console='.$id_layout.'">'.html_print_image(
|
||||
'images/op_reporting.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Main data'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
$options['list_elements']['text'] = '<a href="'.$url_base.$action.'&tab=list_elements&id_visual_console='.$id_layout.'">'.html_print_image(
|
||||
'images/list.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('List elements'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$options['wizard_services']['text'] = '<a href="'.$url_base.$action.'&tab=wizard_services&id_visual_console='.$id_layout.'">'.html_print_image(
|
||||
'images/wand_services.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Services wizard'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
$options['wizard']['text'] = '<a href="'.$url_base.$action.'&tab=wizard&id_visual_console='.$id_layout.'">'.html_print_image(
|
||||
'images/wand.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Wizard'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
$options['editor']['text'] = '<a href="'.$url_base.$action.'&tab=editor&id_visual_console='.$id_layout.'">'.html_print_image(
|
||||
'images/builder.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Builder'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
$options['view']['text'] = '<a href="index.php?sec=network&sec2=operation/visual_console/render_view&id='.$id_layout.'&refr='.$view_refresh.'">'.html_print_image(
|
||||
'images/eye.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('View'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
$options['view']['active'] = true;
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
if (!$config['pure']) {
|
||||
$options['pure']['text'] = '<a href="index.php?sec=network&sec2=operation/visual_console/render_view&id='.$id_layout.'&refr='.$refr.'&pure=1">'.html_print_image(
|
||||
'images/full_screen.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Full screen mode'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>';
|
||||
ui_print_page_header($layout_name, 'images/visual_console.png', false, '', false, $options);
|
||||
}
|
||||
|
||||
// Set the hidden value for the javascript
|
||||
html_print_input_hidden('metaconsole', 0);
|
||||
} else {
|
||||
// Set the hidden value for the javascript
|
||||
html_print_input_hidden('metaconsole', 1);
|
||||
}
|
||||
|
||||
visual_map_print_visual_map(
|
||||
$id_layout,
|
||||
true,
|
||||
true,
|
||||
null,
|
||||
null,
|
||||
'',
|
||||
false,
|
||||
$graph_javascript
|
||||
);
|
||||
|
||||
?>
|
||||
<style type="text/css">
|
||||
/* Avoid the main_pure container 1000px height */
|
||||
body.pure {
|
||||
min-height: 100px;
|
||||
}
|
||||
div#main_pure {
|
||||
height: 100%;
|
||||
margin: 0px;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
ui_require_javascript_file('wz_jsgraphics');
|
||||
ui_require_javascript_file('pandora_visual_console');
|
||||
$ignored_params['refr'] = '';
|
||||
?>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
var refr = <?php echo (int) $refr; ?>;
|
||||
var pure = <?php echo (int) $config['pure']; ?>;
|
||||
var href = "<?php echo ui_get_url_refresh($ignored_params); ?>";
|
||||
|
||||
$(".module_graph .menu_graph").css('display','none');
|
||||
|
||||
$(".parent_graph").each(function(){
|
||||
|
||||
if($(this).css('background-color') != 'rgb(255, 255, 255)'){
|
||||
$(this).css('color', '#999');
|
||||
}
|
||||
});
|
||||
|
||||
$(".overlay").removeClass("overlay").addClass("overlaydisabled");
|
||||
|
||||
});
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('.item:not(.icon) img').each(function(){
|
||||
|
||||
|
||||
if($(this).css('float')=='left' || $(this).css('float')=='right'){
|
||||
|
||||
|
||||
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
|
||||
$(this).css('margin-left','');
|
||||
|
||||
}
|
||||
else{
|
||||
$(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
|
||||
$(this).css('margin-top','');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('.item > div').each( function() {
|
||||
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
|
||||
if($(this).attr('id').indexOf('clock') || $(this).attr('id').indexOf('overlay')){
|
||||
$(this).css('margin-top',(parseInt($(this).parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
|
||||
}
|
||||
else{
|
||||
$(this).css('margin-top',(parseInt($(this).parent().css('height'))/2-parseInt($(this).css('height'))/2-15)+'px');
|
||||
}
|
||||
$(this).css('margin-left','');
|
||||
}
|
||||
else {
|
||||
$(this).css('margin-left',(parseInt($(this).parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
|
||||
$(this).css('margin-top','');
|
||||
}
|
||||
});
|
||||
|
||||
$('.item > a > div').each(function(){
|
||||
if($(this).css('float')=='left' || $(this).css('float')=='right'){
|
||||
|
||||
|
||||
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2-5)+'px');
|
||||
$(this).css('margin-left','');
|
||||
|
||||
}
|
||||
else{
|
||||
$(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
|
||||
$(this).css('margin-top','');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(".graph:not([class~='noresizevc'])").each(function(){
|
||||
height = parseInt($(this).css("height")) - 30;
|
||||
$(this).css('height', height);
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
|
@ -42,6 +42,8 @@ namespace Composer\Autoload;
|
|||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
private $vendorDir;
|
||||
|
||||
// PSR-4
|
||||
private $prefixLengthsPsr4 = array();
|
||||
private $prefixDirsPsr4 = array();
|
||||
|
@ -57,6 +59,13 @@ class ClassLoader
|
|||
private $missingClasses = array();
|
||||
private $apcuPrefix;
|
||||
|
||||
private static $registeredLoaders = array();
|
||||
|
||||
public function __construct($vendorDir = null)
|
||||
{
|
||||
$this->vendorDir = $vendorDir;
|
||||
}
|
||||
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
|
@ -300,6 +309,17 @@ class ClassLoader
|
|||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
|
||||
if (null === $this->vendorDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($prepend) {
|
||||
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||
} else {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -308,6 +328,10 @@ class ClassLoader
|
|||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
|
||||
if (null !== $this->vendorDir) {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -367,6 +391,16 @@ class ClassLoader
|
|||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
||||
*
|
||||
* @return self[]
|
||||
*/
|
||||
public static function getRegisteredLoaders()
|
||||
{
|
||||
return self::$registeredLoaders;
|
||||
}
|
||||
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
|
|
|
@ -113,6 +113,7 @@ return array(
|
|||
'Models\\VisualConsole\\Items\\Label' => $baseDir . '/include/rest-api/models/VisualConsole/Items/Label.php',
|
||||
'Models\\VisualConsole\\Items\\Line' => $baseDir . '/include/rest-api/models/VisualConsole/Items/Line.php',
|
||||
'Models\\VisualConsole\\Items\\ModuleGraph' => $baseDir . '/include/rest-api/models/VisualConsole/Items/ModuleGraph.php',
|
||||
'Models\\VisualConsole\\Items\\NetworkLink' => $baseDir . '/include/rest-api/models/VisualConsole/Items/NetworkLink.php',
|
||||
'Models\\VisualConsole\\Items\\Percentile' => $baseDir . '/include/rest-api/models/VisualConsole/Items/Percentile.php',
|
||||
'Models\\VisualConsole\\Items\\SimpleValue' => $baseDir . '/include/rest-api/models/VisualConsole/Items/SimpleValue.php',
|
||||
'Models\\VisualConsole\\Items\\StaticGraph' => $baseDir . '/include/rest-api/models/VisualConsole/Items/StaticGraph.php',
|
||||
|
@ -320,6 +321,7 @@ return array(
|
|||
'PandoraFMS\\Module' => $baseDir . '/include/lib/Module.php',
|
||||
'PandoraFMS\\ModuleStatus' => $baseDir . '/include/lib/ModuleStatus.php',
|
||||
'PandoraFMS\\ModuleType' => $baseDir . '/include/lib/ModuleType.php',
|
||||
'PandoraFMS\\PublicLogin' => $baseDir . '/include/lib/PublicLogin.php',
|
||||
'PandoraFMS\\User' => $baseDir . '/include/lib/User.php',
|
||||
'PandoraFMS\\View' => $baseDir . '/include/lib/View.php',
|
||||
'PandoraFMS\\Websockets\\WSManager' => $baseDir . '/include/lib/Websockets/WSManager.php',
|
||||
|
|
|
@ -25,7 +25,7 @@ class ComposerAutoloaderInitfdecadadce22e6dde51e9535fe4ad7aa
|
|||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitfdecadadce22e6dde51e9535fe4ad7aa', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitfdecadadce22e6dde51e9535fe4ad7aa', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
|
|
|
@ -195,6 +195,7 @@ class ComposerStaticInitfdecadadce22e6dde51e9535fe4ad7aa
|
|||
'Models\\VisualConsole\\Items\\Label' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/Label.php',
|
||||
'Models\\VisualConsole\\Items\\Line' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/Line.php',
|
||||
'Models\\VisualConsole\\Items\\ModuleGraph' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/ModuleGraph.php',
|
||||
'Models\\VisualConsole\\Items\\NetworkLink' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/NetworkLink.php',
|
||||
'Models\\VisualConsole\\Items\\Percentile' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/Percentile.php',
|
||||
'Models\\VisualConsole\\Items\\SimpleValue' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/SimpleValue.php',
|
||||
'Models\\VisualConsole\\Items\\StaticGraph' => __DIR__ . '/../..' . '/include/rest-api/models/VisualConsole/Items/StaticGraph.php',
|
||||
|
@ -402,6 +403,7 @@ class ComposerStaticInitfdecadadce22e6dde51e9535fe4ad7aa
|
|||
'PandoraFMS\\Module' => __DIR__ . '/../..' . '/include/lib/Module.php',
|
||||
'PandoraFMS\\ModuleStatus' => __DIR__ . '/../..' . '/include/lib/ModuleStatus.php',
|
||||
'PandoraFMS\\ModuleType' => __DIR__ . '/../..' . '/include/lib/ModuleType.php',
|
||||
'PandoraFMS\\PublicLogin' => __DIR__ . '/../..' . '/include/lib/PublicLogin.php',
|
||||
'PandoraFMS\\User' => __DIR__ . '/../..' . '/include/lib/User.php',
|
||||
'PandoraFMS\\View' => __DIR__ . '/../..' . '/include/lib/View.php',
|
||||
'PandoraFMS\\Websockets\\WSManager' => __DIR__ . '/../..' . '/include/lib/Websockets/WSManager.php',
|
||||
|
|
Loading…
Reference in New Issue