X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=public%2Findex.php;h=58ec5fe565cec71e20192088a1b0592fbc4b6099;hb=3015c9c29d9b5842a171c3d1bac93172167aef61;hp=56cf3a27fb6119c75db0cd626237eed489fe6a5d;hpb=dc54ba07d9e53d8ca8d49c6132d3d4d2a194e669;p=mdref%2Fmdref diff --git a/public/index.php b/public/index.php index 56cf3a2..58ec5fe 100644 --- a/public/index.php +++ b/public/index.php @@ -9,15 +9,18 @@ use http\Env\Request; use http\Env\Response; define("ROOT", dirname(__DIR__)); +define("REFS", getenv("REFPATH") ?: implode(PATH_SEPARATOR, glob(ROOT."/refs/*"))); -#ini_set("open_basedir", ROOT.":".REFS); +ini_set("open_basedir", ROOT.PATH_SEPARATOR.REFS); -$loader = require ROOT . "/vendor/autoload.php"; -/* @var $loader \Composer\Autoload\ClassLoader */ -$loader->add("mdref", ROOT); +spl_autoload_register(function($c) { + if (!strncmp($c, "mdref\\", 6)) { + return require ROOT . "/" . strtr($c, "\\", "/") . ".php"; + } +}); new ExceptionHandler; -$reference = new Reference(($refs = getenv("REFPATH")) ? explode(PATH_SEPARATOR, $refs) : glob(ROOT."/refs/*")); +$reference = new Reference(explode(PATH_SEPARATOR, REFS)); $action = new Action($reference, new Request, new Response, new BaseUrl); $action->handle();