2019-04-09 17:45:21 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2019 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; 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.
|
|
|
|
require_once '../../include/config.php';
|
|
|
|
|
|
|
|
// Set root on homedir, as defined in setup.
|
|
|
|
chdir($config['homedir']);
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
// Enterprise support.
|
|
|
|
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
|
|
|
include_once ENTERPRISE_DIR.'/load_enterprise.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (file_exists(ENTERPRISE_DIR.'/include/functions_login.php')) {
|
|
|
|
include_once ENTERPRISE_DIR.'/include/functions_login.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once $config['homedir'].'/vendor/autoload.php';
|
|
|
|
|
|
|
|
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
|
|
|
|
echo '<html xmlns="http://www.w3.org/1999/xhtml">'."\n";
|
|
|
|
echo '<head>';
|
|
|
|
|
|
|
|
global $vc_public_view;
|
|
|
|
$vc_public_view = true;
|
2019-04-11 10:05:28 +02:00
|
|
|
$config['public_view'] = true;
|
|
|
|
|
2019-04-09 17:45:21 +02:00
|
|
|
// This starts the page head. In the call back function,
|
|
|
|
// things from $page['head'] array will be processed into the head.
|
|
|
|
ob_start('ui_process_page_head');
|
|
|
|
// Enterprise main.
|
|
|
|
enterprise_include('index.php');
|
|
|
|
|
|
|
|
require_once 'include/functions_visual_map.php';
|
|
|
|
|
2019-04-11 10:05:28 +02:00
|
|
|
$hash = (string) get_parameter('hash');
|
|
|
|
$visualConsoleId = (int) get_parameter('id_layout');
|
|
|
|
$config['id_user'] = (string) get_parameter('id_user');
|
2019-04-12 10:06:53 +02:00
|
|
|
$refr = (int) get_parameter('refr', $config['refr']);
|
2019-04-11 10:05:28 +02:00
|
|
|
|
|
|
|
if (!isset($config['pure'])) {
|
|
|
|
$config['pure'] = 0;
|
|
|
|
}
|
2019-04-09 17:45:21 +02:00
|
|
|
|
2019-04-11 10:05:28 +02:00
|
|
|
$myhash = md5($config['dbpass'].$visualConsoleId.$config['id_user']);
|
2019-04-09 17:45:21 +02:00
|
|
|
|
|
|
|
// Check input hash.
|
|
|
|
if ($myhash != $hash) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2019-04-12 10:06:53 +02:00
|
|
|
// Load Visual Console.
|
|
|
|
use Models\VisualConsole\Container as VisualConsole;
|
|
|
|
$visualConsole = null;
|
|
|
|
try {
|
|
|
|
$visualConsole = VisualConsole::fromDB(['id' => $visualConsoleId]);
|
|
|
|
} catch (Throwable $e) {
|
2019-04-11 10:05:28 +02:00
|
|
|
db_pandora_audit(
|
|
|
|
'ACL Violation',
|
2019-04-12 10:06:53 +02:00
|
|
|
'Trying to access visual console without Id'
|
2019-04-11 10:05:28 +02:00
|
|
|
);
|
2019-04-09 17:45:21 +02:00
|
|
|
include $config['homedir'].'/general/noaccess.php';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2019-04-12 10:06:53 +02:00
|
|
|
$visualConsoleData = $visualConsole->toArray();
|
|
|
|
$visualConsoleName = $visualConsoleData['name'];
|
2019-04-11 10:05:28 +02:00
|
|
|
|
|
|
|
echo '<div id="visual-console-container" style="margin:0px auto;position:relative;"></div>';
|
|
|
|
|
2019-04-09 17:45:21 +02:00
|
|
|
// Floating menu - Start.
|
|
|
|
echo '<div id="vc-controls" style="z-index:300;">';
|
|
|
|
|
|
|
|
echo '<div id="menu_tab">';
|
|
|
|
echo '<ul class="mn">';
|
|
|
|
|
|
|
|
// QR code.
|
|
|
|
echo '<li class="nomn">';
|
|
|
|
echo '<a href="javascript: show_dialog_qrcode();">';
|
|
|
|
echo '<img class="vc-qr" src="../../images/qrcode_icon_2.jpg"/>';
|
|
|
|
echo '</a>';
|
|
|
|
echo '</li>';
|
|
|
|
|
|
|
|
// Console name.
|
|
|
|
echo '<li class="nomn">';
|
2019-04-11 10:05:28 +02:00
|
|
|
echo '<div class="vc-title">'.$visualConsoleName.'</div>';
|
2019-04-09 17:45:21 +02:00
|
|
|
echo '</li>';
|
|
|
|
|
|
|
|
echo '</ul>';
|
|
|
|
echo '</div>';
|
|
|
|
|
|
|
|
echo '</div>';
|
2019-04-11 10:05:28 +02:00
|
|
|
|
2019-04-09 17:45:21 +02:00
|
|
|
// QR code dialog.
|
|
|
|
echo '<div style="display: none;" id="qrcode_container" title="'.__('QR code of the page').'">';
|
|
|
|
echo '<div id="qrcode_container_image"></div>';
|
|
|
|
echo '</div>';
|
|
|
|
|
2019-04-12 10:06:53 +02:00
|
|
|
// Load Visual Console Items.
|
|
|
|
$visualConsoleItems = VisualConsole::getItemsFromDB($visualConsoleId);
|
|
|
|
|
2019-04-11 10:05:28 +02:00
|
|
|
ui_require_javascript_file('pandora_visual_console');
|
2019-04-12 13:03:10 +02:00
|
|
|
visual_map_load_client_resources();
|
2019-04-09 17:45:21 +02:00
|
|
|
?>
|
2019-04-12 10:06:53 +02:00
|
|
|
|
2019-04-09 17:45:21 +02:00
|
|
|
<script type="text/javascript">
|
|
|
|
var container = document.getElementById("visual-console-container");
|
|
|
|
var props = <?php echo (string) $visualConsole; ?>;
|
|
|
|
var items = <?php echo '['.implode($visualConsoleItems, ',').']'; ?>;
|
2019-04-11 10:05:28 +02:00
|
|
|
var baseUrl = "<?php echo $config['homeurl']; ?>";
|
|
|
|
var handleUpdate = function (prevProps, newProps) {
|
|
|
|
// TODO: Change the view header and links to display id or name changes.
|
2019-04-09 17:45:21 +02:00
|
|
|
}
|
2019-04-11 10:05:28 +02:00
|
|
|
var visualConsole = createVisualConsole(
|
|
|
|
container,
|
|
|
|
props,
|
|
|
|
items,
|
|
|
|
baseUrl,
|
2019-04-12 10:06:53 +02:00
|
|
|
<?php echo ($refr * 1000); ?>,
|
2019-04-11 10:05:28 +02:00
|
|
|
handleUpdate
|
|
|
|
);
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
var controls = document.getElementById('vc-controls');
|
|
|
|
if (controls) autoHideElement(controls, 1000);
|
|
|
|
});
|
2019-04-09 17:45:21 +02:00
|
|
|
</script>
|