144 lines
4.1 KiB
PHP
144 lines
4.1 KiB
PHP
<?php
|
|
// 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 = "The page you requested could not be found.";
|
|
$message = <<<EOT
|
|
Possible reasons:
|
|
- The link is broken or outdated.
|
|
- The page has been moved or deleted.
|
|
- There is a typo in the URL.
|
|
|
|
What you can do:
|
|
- Double-check the URL and try again.
|
|
- Or go to the login page: $urlLogin
|
|
EOT;
|
|
?>
|
|
<!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>404 - Page Not Found</h1>
|
|
<div class="block_exception">
|
|
<h2><?php echo htmlspecialchars($title, 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>
|
|
</div>
|
|
</body>
|
|
</html>
|