-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
40 lines (34 loc) · 898 Bytes
/
index.php
File metadata and controls
40 lines (34 loc) · 898 Bytes
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
<?php
namespace shgysk8zer0\DOMValidator;
use \shgysk8zer0\Core\Console as Console;
error_reporting(\E_ALL);
spl_autoload_register('spl_autoload');
set_include_path(dirname(dirname(__DIR__)));
set_error_handler(function(...$args)
{
header('Content-Type: application/json');
echo json_encode($args);
exit();
});
set_exception_handler(function($e) {
header('Content-Type: application/json');
echo json_encode([
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'trace' => $e->getTrace(),
]);
});
if (empty($_REQUEST)) {
header('Content-Type: text/html');
readfile('./forms/test.html');
} else {
$form = Form::loadFromFile('forms/test.html');
header('Content-Type: application/json');
$filtered = $form($_REQUEST);
Console::log([
'$_REQUEST' => $_REQUEST,
'$_FILES' => $_FILES,
])->sendLogHeader();
echo json_encode($filtered);
}