2020-06-03 15:31:18 +00:00
|
|
|
<?php
|
|
|
|
date_default_timezone_set("Europe/Berlin");
|
|
|
|
header('Strict-Transport-Security: max-age=657000');
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
include_once 'classen/MAIL/PHPMailer.php';
|
|
|
|
include_once 'classen/MAIL/SMTP.php';
|
|
|
|
|
|
|
|
include_once("classen/utils.php");
|
|
|
|
include_once("classen/HTML.php");
|
|
|
|
include_once("classen/GoogleAuthenticator.php");
|
|
|
|
include_once("classen/OpenSim.php");
|
2021-01-20 23:29:57 +00:00
|
|
|
include_once("classen/discord.php");
|
2020-06-03 15:31:18 +00:00
|
|
|
|
|
|
|
$RUNTIME = array();
|
|
|
|
$RUNTIME['OPENSIM'] = new OpenSim();
|
|
|
|
|
|
|
|
include_once("config.php");
|
|
|
|
|
2023-08-23 16:16:34 +00:00
|
|
|
function isValidEndpoint(string $pageName, string $dirPrefix) {
|
|
|
|
return preg_match("[a-zA-Z0-9\.]{1,100}", $pageName) && file_exists("./".$dirPrefix."/".$pageName.".php");
|
|
|
|
}
|
|
|
|
|
2023-08-23 16:16:34 +00:00
|
|
|
//TODO: add API keys and/or rate limiting
|
2023-08-23 16:16:34 +00:00
|
|
|
if(isset($_REQUEST['api'])) {
|
|
|
|
if(isValidEndpoint($_REQUEST['api'], 'api')) {
|
2023-08-23 16:16:34 +00:00
|
|
|
include "./api/".$_REQUEST['api'].".php";
|
|
|
|
} else {
|
2020-06-03 15:31:18 +00:00
|
|
|
die("ERROR; ENDPOINT NOT EXIST");
|
|
|
|
}
|
|
|
|
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
2023-08-23 16:16:34 +00:00
|
|
|
if ($handle = opendir('./plugins/')) {
|
|
|
|
while (false !== ($entry = readdir($handle))) {
|
|
|
|
if ($entry != "." && $entry != "..") {
|
2020-08-04 09:44:59 +00:00
|
|
|
include_once "./plugins/".$entry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
closedir($handle);
|
|
|
|
}
|
|
|
|
|
2023-08-23 16:16:34 +00:00
|
|
|
if(isset($_REQUEST['logout']) && $_REQUEST['logout'] == '1') {
|
|
|
|
$_SESSION = array();
|
|
|
|
}
|
2020-06-03 15:31:18 +00:00
|
|
|
|
2023-08-23 16:16:34 +00:00
|
|
|
if(isset($_SESSION['LOGIN']) && $_SESSION['LOGIN'] == 'true') {
|
|
|
|
if(!isset($_REQUEST['page'])) {
|
|
|
|
include './pages/dashboard.php';
|
|
|
|
} else if(isValidEndpoint($_REQUEST['page'], 'pages')) {
|
|
|
|
include "./pages/".$_REQUEST['page'].".php";
|
|
|
|
} else {
|
|
|
|
include "./pages/error.php";
|
2020-06-03 15:31:18 +00:00
|
|
|
}
|
2023-08-23 16:16:34 +00:00
|
|
|
|
|
|
|
die();
|
|
|
|
}
|
2020-06-03 15:31:18 +00:00
|
|
|
|
2023-08-23 16:16:34 +00:00
|
|
|
if(isset($_REQUEST['page']) && $_REQUEST['page'] == "register") {
|
2020-06-03 15:31:18 +00:00
|
|
|
include "./pages/register.php";
|
2023-08-23 16:16:34 +00:00
|
|
|
} else {
|
2020-06-03 15:31:18 +00:00
|
|
|
include "./pages/login.php";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|