chimera-mark2-core-release/error.php

82 lines
1.8 KiB
PHP
Raw Normal View History

2022-04-26 19:48:03 +00:00
<?php
$codes=[
"400"=>"Bad request",
"401"=>"Unauthorized",
"403"=>"Forbidden",
"404"=>"Not found",
"405"=>"Method Not Allowed",
"500"=>"Internal server error",
"501"=>"Not Implemented",
];
$jsons=[
"api"
];
$code=$_GET["code"];
if (array_key_exists("FOX_REWRITE", $_SERVER) && $_SERVER["FOX_REWRITE"] != "yes")
{
$prefix = ($_SERVER["CONTEXT_PREFIX"]."index.php/");
} else {
$prefix = ($_SERVER["CONTEXT_PREFIX"]);
}
$prefix = preg_replace(["![/]+!","![\.]+!"], ["\/","\."], $prefix);
$req=(preg_replace("/".$prefix."/", '', $_SERVER["REQUEST_URI"]));
$req = explode("/",explode("?", $req, 2)[0]);
if (array_search($req[1], $jsons)!==false) {
print '{"error":{"code":'.$code.',"message":"'.(array_key_exists($code, $codes)?$codes[$code]:"Server error").'"}}';
exit;
}
?>
2022-05-12 13:59:48 +00:00
<!DOCTYPE>
<html lang="en" class=login>
<head><title>Error <?php print $code; ?></title></head>
2022-04-26 19:48:03 +00:00
2022-05-12 13:59:48 +00:00
<body class=login style="
2022-04-26 19:48:03 +00:00
background-image: url(/static/theme/chimera/img/chimera_logo.svg);
min-width: inherit;
min-height: 100%;
background-repeat: no-repeat;
background-size: contain;
background-position-x: center;
background-position-y: center;
background-color: #150007;">
2022-05-12 13:59:48 +00:00
<div style=' text-align: center; width: 100%; height: 100%;'>
2022-04-26 19:48:03 +00:00
</div>
<div style="
border: 2px solid red;
background-color: rgba(0, 0, 0, 0.85);
padding: 70 0 0 0;
position: absolute;
left: calc(50% - 250px);
display: block;
top: calc(50% - 75px);
text-align: center;
width: 500px;
height: 150px;
vertical-align: center;
font-family: 'Fira Mono', monospace;
font-weight: 200;
2022-05-12 13:59:48 +00:00
font-size: 32px;
color: #FF3500;
margin: 1%">
2022-04-26 19:48:03 +00:00
<?php
print "ERROR: $code<br/>";
if (array_key_exists($code, $codes)) {
print $codes[$code];
}
?></div>
</body>
</html>