mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
VC Public links pandora_enterprise#12329
This commit is contained in:
parent
e516db1ef1
commit
aaa590b65f
@ -183,7 +183,9 @@ if (isset($config['force_instant_logout']) === true
|
|||||||
$_SESSION = [];
|
$_SESSION = [];
|
||||||
session_destroy();
|
session_destroy();
|
||||||
header_remove('Set-Cookie');
|
header_remove('Set-Cookie');
|
||||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
if (isset($_COOKIE[session_name()]) === true) {
|
||||||
|
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||||
|
}
|
||||||
|
|
||||||
if ($config['auth'] === 'saml' && empty($public_hash) === true) {
|
if ($config['auth'] === 'saml' && empty($public_hash) === true) {
|
||||||
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
|
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
|
||||||
|
@ -808,8 +808,8 @@ function loadVisualConsoleData(
|
|||||||
getVisualConsoleItems: 1,
|
getVisualConsoleItems: 1,
|
||||||
size: size,
|
size: size,
|
||||||
visualConsoleId: vcId,
|
visualConsoleId: vcId,
|
||||||
id_user: typeof id_user == undefined ? id_user : null,
|
id_user: typeof id_user !== undefined ? id_user : null,
|
||||||
auth_hash: typeof hash == undefined ? hash : null,
|
auth_hash: typeof hash !== undefined ? hash : null,
|
||||||
mode: mode,
|
mode: mode,
|
||||||
widthScreen: widthScreen
|
widthScreen: widthScreen
|
||||||
},
|
},
|
||||||
|
@ -1196,7 +1196,7 @@ class Item extends CachedModel
|
|||||||
'operation/visual_console/view',
|
'operation/visual_console/view',
|
||||||
['id' => $vcId],
|
['id' => $vcId],
|
||||||
// No autologin from the public view.
|
// No autologin from the public view.
|
||||||
!$config['public_view'],
|
!$config['public_access'],
|
||||||
$mobile_navigation,
|
$mobile_navigation,
|
||||||
[
|
[
|
||||||
'page' => 'visualmap',
|
'page' => 'visualmap',
|
||||||
@ -1302,7 +1302,7 @@ class Item extends CachedModel
|
|||||||
'enterprise/operation/services/services',
|
'enterprise/operation/services/services',
|
||||||
['id_service' => $serviceId],
|
['id_service' => $serviceId],
|
||||||
// No autologin from the public view.
|
// No autologin from the public view.
|
||||||
!$config['public_view']
|
!$config['public_access']
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// A regular module.
|
// A regular module.
|
||||||
@ -1312,7 +1312,7 @@ class Item extends CachedModel
|
|||||||
'operation/agentes/status_monitor',
|
'operation/agentes/status_monitor',
|
||||||
['id_module' => $moduleId],
|
['id_module' => $moduleId],
|
||||||
// No autologin from the public view.
|
// No autologin from the public view.
|
||||||
!((isset($config['public_view']) === true) ? $config['public_view'] : false),
|
!((isset($config['public_access']) === true) ? $config['public_access'] : false),
|
||||||
$mobile_navigation,
|
$mobile_navigation,
|
||||||
[
|
[
|
||||||
'id' => $moduleId,
|
'id' => $moduleId,
|
||||||
@ -1377,7 +1377,7 @@ class Item extends CachedModel
|
|||||||
'operation/agentes/ver_agente',
|
'operation/agentes/ver_agente',
|
||||||
['id_agente' => $agentId],
|
['id_agente' => $agentId],
|
||||||
// No autologin from the public view.
|
// No autologin from the public view.
|
||||||
!$config['public_view'],
|
!$config['public_access'],
|
||||||
$mobile_navigation,
|
$mobile_navigation,
|
||||||
[
|
[
|
||||||
'id' => $agentId,
|
'id' => $agentId,
|
||||||
|
@ -33,7 +33,7 @@ require_once $config['homedir'].'/vendor/autoload.php';
|
|||||||
ui_require_css_file('register', 'include/styles/', true);
|
ui_require_css_file('register', 'include/styles/', true);
|
||||||
|
|
||||||
// Connection lost alert.
|
// Connection lost alert.
|
||||||
ui_require_javascript_file('connection_check', 'include/javascript/', true);
|
// ui_require_javascript_file('connection_check', 'include/javascript/', true);
|
||||||
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
|
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
|
||||||
$conn_title = __('Connection with console has been lost');
|
$conn_title = __('Connection with console has been lost');
|
||||||
$conn_text = __('Connection to the console has been lost. Please check your internet connection.');
|
$conn_text = __('Connection to the console has been lost. Please check your internet connection.');
|
||||||
@ -47,7 +47,7 @@ global $vc_public_view;
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$vc_public_view = true;
|
$vc_public_view = true;
|
||||||
$config['public_view'] = true;
|
$config['public_access'] = true;
|
||||||
|
|
||||||
// This starts the page head. In the call back function,
|
// This starts the page head. In the call back function,
|
||||||
// things from $page['head'] array will be processed into the head.
|
// things from $page['head'] array will be processed into the head.
|
||||||
@ -62,12 +62,6 @@ require_once 'include/functions_visual_map.php';
|
|||||||
|
|
||||||
$hash = (string) get_parameter('hash');
|
$hash = (string) get_parameter('hash');
|
||||||
|
|
||||||
// For public link issue.
|
|
||||||
$force_instant_logout = true;
|
|
||||||
if (isset($config['id_user']) === true) {
|
|
||||||
$force_instant_logout = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check input hash.
|
// Check input hash.
|
||||||
// DO NOT move it after of get parameter user id.
|
// DO NOT move it after of get parameter user id.
|
||||||
if (User::validatePublicHash($hash) !== true) {
|
if (User::validatePublicHash($hash) !== true) {
|
||||||
@ -256,17 +250,17 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
|
|||||||
if (menuLinks !== null) {
|
if (menuLinks !== null) {
|
||||||
menuLinks.forEach(function (menuLink) {
|
menuLinks.forEach(function (menuLink) {
|
||||||
menuLink.href = menuLink.href.replace(regex, replacement);
|
menuLink.href = menuLink.href.replace(regex, replacement);
|
||||||
menuLink.href = menuLink.href.replace(
|
//menuLink.href = menuLink.href.replace(
|
||||||
regex_hash,
|
// regex_hash,
|
||||||
replacement_hash
|
// replacement_hash
|
||||||
);
|
//);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the URL (if the browser has support).
|
// Change the URL (if the browser has support).
|
||||||
if ("history" in window) {
|
if ("history" in window) {
|
||||||
var href = window.location.href.replace(regex, replacement);
|
var href = window.location.href.replace(regex, replacement);
|
||||||
href = href.replace(regex_hash, replacement_hash);
|
//href = href.replace(regex_hash, replacement_hash);
|
||||||
window.history.replaceState({}, document.title, href);
|
window.history.replaceState({}, document.title, href);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,20 +315,24 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php if ($force_instant_logout === true) { ?>
|
|
||||||
// No click enabled when user not logged.
|
|
||||||
$( "a" ).on( "click", function( event ) {
|
|
||||||
event.preventDefault();
|
|
||||||
$('#visual-console-container').removeClass('is-updating');
|
|
||||||
$('.div-visual-console-spinner').remove();
|
|
||||||
});
|
|
||||||
<?php } ?>
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
if ($force_instant_logout === true) {
|
// Clean session to avoid direct access.
|
||||||
unset($userAccessMaintenance, $config['id_user'], $hash);
|
if ($config['force_instant_logout'] === true) {
|
||||||
|
// Force user logout.
|
||||||
|
$iduser = $_SESSION['id_usuario'];
|
||||||
|
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION = [];
|
||||||
session_destroy();
|
session_destroy();
|
||||||
header_remove('Set-Cookie');
|
header_remove('Set-Cookie');
|
||||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
if (isset($_COOKIE[session_name()]) === true) {
|
||||||
|
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (ob_get_length() > 0) {
|
||||||
|
ob_end_flush();
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user