USER_HISTORY-236 Fix the session block funcionality
This commit is contained in:
148
workflow/engine/methods/login/sessionBlock.php
Normal file
148
workflow/engine/methods/login/sessionBlock.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
// Tell the browser (and search‑engines) that the page is missing
|
||||
// – use the protocol that the client sent (HTTP/1.1, HTTP/2, …)
|
||||
|
||||
$protocol = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
|
||||
header($protocol . ' 404 Not Found');
|
||||
header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
// Determine if HTTPS is used
|
||||
$http = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? "https" : "http";
|
||||
|
||||
// Determine host (prefer HTTP_HOST, fallback to SERVER_NAME and SERVER_PORT)
|
||||
$host = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] . (isset($_SERVER['SERVER_PORT']) ? ':' . $_SERVER['SERVER_PORT'] : ''));
|
||||
|
||||
// Default URLs
|
||||
$urlLogin = $http . "://" . $host . "/sys/en/lurana/login/login";
|
||||
$urlHome = $urlLogin;
|
||||
|
||||
// Check if 'url' parameter is set and not empty
|
||||
if (!empty($_GET['url'])) {
|
||||
$urlParts = explode('/', urldecode($_GET['url']));
|
||||
|
||||
$sysSys = '';
|
||||
$sysLang = '';
|
||||
$sysSkin = '';
|
||||
|
||||
if (isset($urlParts[1]) && preg_match('/^sys(.+)$/', $urlParts[1], $matches)) {
|
||||
$sysSys = $matches[1];
|
||||
$checkDir = PATH_DATA . "sites/" . $sysSys;
|
||||
if (!is_dir($checkDir)) {
|
||||
$sysSys = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($urlParts[2])) {
|
||||
$sysLang = $urlParts[2];
|
||||
}
|
||||
|
||||
if (isset($urlParts[3])) {
|
||||
$sysSkin = $urlParts[3];
|
||||
$checkDir = PATH_SKIN_ENGINE . $sysSkin;
|
||||
if (!is_dir($checkDir)) {
|
||||
$checkDir = PATH_CUSTOM_SKINS . $sysSkin;
|
||||
if (!is_dir($checkDir)) {
|
||||
$sysSkin = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($sysSys !== '' && $sysLang !== '' && $sysSkin !== '') {
|
||||
$urlLogin = sprintf('%s://%s/sys%s/%s/%s/login/login', $http, $host, $sysSys, $sysLang, $sysSkin);
|
||||
$urlHome = sprintf('%s://%s/sys%s/%s/%s/cases/main', $http, $host, $sysSys, $sysLang, $sysSkin);
|
||||
}
|
||||
}
|
||||
|
||||
$title = G::LoadTranslation('ID_SESSION_BLOCKED_TITLE');
|
||||
$subTitle = G::LoadTranslation('ID_SESSION_BLOCKED_SUBTITLE');
|
||||
$message = G::LoadTranslation('ID_SESSION_BLOCKED_MESSAGE');
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="robots" content="noindex,nofollow"/>
|
||||
<title><?php echo htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); ?></title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Verdana, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
color: #222;
|
||||
background: #eee;
|
||||
padding: 10px;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
height: 100vh;
|
||||
}
|
||||
#content {
|
||||
max-width: 800px;
|
||||
width: 100%;
|
||||
}
|
||||
h1 {
|
||||
font-size: 19px;
|
||||
background-color: #fff;
|
||||
padding: 15px 28px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 12px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
h2 {
|
||||
margin: 0 0 0 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
.block {
|
||||
background-color: #fff;
|
||||
padding: 15px 28px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 0 0 12px 12px;
|
||||
white-space: pre-line;
|
||||
font-size: 14px;
|
||||
color: #444;
|
||||
}
|
||||
.block_exception {
|
||||
background-color: #ddd;
|
||||
color: #333;
|
||||
padding: 15px 28px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 12px 12px 0 0;
|
||||
}
|
||||
a {
|
||||
color: #6c6159;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1><?php echo htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); ?></h1>
|
||||
<div class="block_exception">
|
||||
<h2><?php echo htmlspecialchars($subTitle, ENT_QUOTES, 'UTF-8'); ?></h2>
|
||||
</div>
|
||||
<div class="block">
|
||||
<?php
|
||||
$escapedMessage = nl2br(htmlspecialchars($message, ENT_QUOTES, 'UTF-8'));
|
||||
$escapedMessage = preg_replace_callback(
|
||||
'#(https?://[^\s]+)#',
|
||||
function ($matches) {
|
||||
$url = htmlspecialchars($matches[0], ENT_QUOTES, 'UTF-8');
|
||||
return "<a href=\"$url\" target=\"_blank\" rel=\"noopener noreferrer\">$url</a>";
|
||||
},
|
||||
$escapedMessage
|
||||
);
|
||||
echo $escapedMessage;
|
||||
?>
|
||||
<div style="text-align: right;">
|
||||
<hr/>
|
||||
<img src="/images/lurana.logo.png" class="img-responsive" alt="Conxole Admin">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user