fixup
[mdref/mdref] / public / index.php
1 <?php
2
3 use mdref\Action;
4 use mdref\BaseUrl;
5 use mdref\Reference;
6 use mdref\ExceptionHandler;
7
8 use http\Env\Request;
9 use http\Env\Response;
10
11 define("ROOT", dirname(__DIR__));
12 define("REFS", getenv("REFPATH") ?: implode(PATH_SEPARATOR, glob(ROOT."/refs/*")));
13
14 ini_set("open_basedir", ROOT.PATH_SEPARATOR.REFS);
15
16 spl_autoload_register(function($c) {
17 if (!strncmp($c, "mdref\\", 6)) {
18 return require ROOT . "/" . strtr($c, "\\", "/") . ".php";
19 }
20 });
21
22 new ExceptionHandler;
23
24 $reference = new Reference(explode(PATH_SEPARATOR, REFS));
25 $action = new Action($reference, new Request, new Response, new BaseUrl);
26 $action->handle();