2016-07-30 14:09:31 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
Copyright (C) Ad5001 2016 All rights reserved.
|
|
|
|
@link http://ad5001.ga
|
|
|
|
Do not attemped to modify this file if you're not sure on how it works.
|
2016-08-26 14:40:14 +00:00
|
|
|
This file process 404, 403 requests, custom index and some other stuff.
|
2016-07-30 14:09:31 +00:00
|
|
|
*/
|
2016-12-27 14:19:49 +00:00
|
|
|
|
|
|
|
// Definitions
|
|
|
|
$cfg = yaml_parse(file_get_contents(__DIR__ . "/../config.yml"));
|
|
|
|
$args = json_decode(file_get_contents(__DIR__ . "/args"), true);
|
|
|
|
$_POCKETMINE = $args["POCKETMINE"];
|
|
|
|
$_PLUGINS = $args["PLUGINS"];
|
|
|
|
$_PLAYERS = $args["PLAYERS"];
|
|
|
|
$_LEVELS = $args["LEVELS"];
|
|
|
|
|
|
|
|
|
|
|
|
// Calling handlers.
|
|
|
|
foreach($args["HANDLERS"] as $handler) {
|
|
|
|
// echo $handler;
|
|
|
|
if((include $handler) == false) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Domains parsing
|
2016-08-26 14:40:14 +00:00
|
|
|
$host = $_SERVER["HTTP_HOST"];
|
|
|
|
if(isset($cfg["Parked domains"][$host])) {
|
|
|
|
$host = $cfg["Parked domains"][$host];
|
|
|
|
}
|
|
|
|
if(in_array($host, $cfg["Domains"])) {
|
|
|
|
$_SERVER["REQUEST_URI"] = $host . $_SERVER["REQUEST_URI"];
|
2016-07-30 14:09:31 +00:00
|
|
|
} else {
|
2016-08-26 14:40:14 +00:00
|
|
|
unallowedDomain();
|
|
|
|
return true;
|
|
|
|
}
|
2016-12-27 14:19:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Removing GET from the request
|
2016-08-26 14:40:14 +00:00
|
|
|
$uri = $_SERVER["REQUEST_URI"];
|
|
|
|
if(strpos($uri, "?") !== false) {
|
|
|
|
$uri = explode("?", $uri)[0];
|
|
|
|
}
|
2016-12-27 14:19:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Getting the file & output it if possible.
|
|
|
|
if(!file_exists(__DIR__ . "/../" . $uri)) {
|
|
|
|
echo file_get_contents(__DIR__ . "/../" . $host . "/" . $cfg[404]);
|
|
|
|
} elseif(in_array($uri, $cfg["denied-pages"])) {
|
|
|
|
echo file_get_contents(__DIR__ . "/../" . $host . "/" . $cfg[403]);
|
|
|
|
} elseif(is_dir(__DIR__ . "/../" .$uri)) {
|
|
|
|
if(file_exists(__DIR__ . "/../" . $uri . "index.html")) {
|
|
|
|
include(__DIR__ . "/../" . $uri . "index.html");
|
|
|
|
} elseif(file_exists(__DIR__ . "/../" . $uri . "index.php")) {
|
|
|
|
include(__DIR__ . "/../" . $uri . "index.php");
|
|
|
|
} elseif(file_exists(__DIR__ . "/../" . $uri . $cfg["index"])) {
|
|
|
|
include(__DIR__ . "/../" . $uri . $cfg["index"]);
|
2016-08-26 14:40:14 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
include(__DIR__ . "/" . $uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function unallowedDomain() {
|
|
|
|
echo <<<A
|
|
|
|
<html>
|
|
|
|
<head>
|
2016-12-27 14:19:49 +00:00
|
|
|
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:300" rel="stylesheet">
|
2016-08-26 14:40:14 +00:00
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
padding: 60px;
|
|
|
|
}
|
|
|
|
div.container {
|
|
|
|
padding: 40px;
|
2016-12-27 14:19:49 +00:00
|
|
|
border: 3px solid lightgray;
|
2016-08-26 14:40:14 +00:00
|
|
|
border-radius: 8px;
|
2016-12-27 14:19:49 +00:00
|
|
|
background: linear-gradient(45deg, gray, grey);
|
2016-08-26 14:40:14 +00:00
|
|
|
height: 70%;
|
|
|
|
}
|
|
|
|
h1, h2, h3, p {
|
2016-12-27 14:19:49 +00:00
|
|
|
font-family: 'Roboto Condensed', sans-serif;
|
2016-08-26 14:40:14 +00:00
|
|
|
}
|
|
|
|
</style>
|
2016-12-27 14:19:49 +00:00
|
|
|
<link rel="icon" src="http://serveur.cf/Online/icon.ico" href="http://serveur.cf/Online/icon.ico" />
|
2016-08-26 14:40:14 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="container">
|
2016-12-27 14:19:49 +00:00
|
|
|
<h1><img src="http://serveur.cf/Online/icon.png" style="width: 30px; height: 30px;"></img>Unallowed domain</h1><hr>
|
2016-08-26 14:40:14 +00:00
|
|
|
<p>This IP does not have any domain on this machine. Please refer to your server administartor if you think it's an error.</p>
|
2016-12-27 14:19:49 +00:00
|
|
|
<h2 style="float: right;">Online 1.6 - Eclipse edition</a></h2>
|
2016-08-26 14:40:14 +00:00
|
|
|
</body>
|
|
|
|
</style>
|
|
|
|
A;
|
2016-07-30 14:09:31 +00:00
|
|
|
}
|