-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
48 lines (36 loc) · 1.08 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require_once __DIR__ . '/src/Autoload.php';
define('debug', false);
if(debug) {
error_reporting(E_ALL);
ini_set('display_errors', 1);
}
if (version_compare(phpversion(), '7.1', '<')) {
echo 'PHP 7.1 or up is required to use ezXSS';
exit();
}
$requestUrl = explode('?', $_SERVER['REQUEST_URI'])[0];
if(strpos($requestUrl, '/manage/') === 0 || strpos($requestUrl, '/manage') === 0) {
$path = str_replace('/manage/', '', explode('?', $_SERVER['REQUEST_URI'])[0]);
if(explode('/', $path)[0] == 'report') {
$path = explode('/', $path)[0];
}
if($path == 'request') {
$request = new Request();
echo $request->json();
} else {
$route = new Route();
echo $route->template($path);
}
} else {
$route = new Route();
if($requestUrl == '/callback') {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
echo $route->callback(file_get_contents('php://input'));
}
}
if($requestUrl == '/') {
header('Content-Type: application/x-javascript');
echo $route->jsPayload();
}
}