ext2ref: check ref
[mdref/mdref] / public / index.php
1 <?php
2
3 namespace mdref;
4
5 use http\Env\Request;
6 use http\Env\Response;
7 use function ini_get;
8 use function ini_set;
9 use const GLOB_ONLYDIR;
10 use const PATH_SEPARATOR;
11 use const REFS;
12 use const ROOT;
13
14 define("ROOT", dirname(__DIR__));
15 define("REFS", getenv("REFPATH") ?: implode(PATH_SEPARATOR, glob(ROOT."/refs/*", GLOB_ONLYDIR)));
16
17 ini_set("open_basedir", ROOT.PATH_SEPARATOR.REFS);
18
19 if (!ini_get("date.timezone")) {
20 date_default_timezone_set("UTC");
21 }
22
23 require_once __DIR__ . "/../vendor/autoload.php";
24
25 $response = new Response;
26 $ehandler = new ExceptionHandler($response);
27 $reference = new Reference(explode(PATH_SEPARATOR, REFS));
28 $action = new Action($reference, new Request, $response, new BaseUrl);
29 $action->handle();