X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=public%2Findex.php;h=58ec5fe565cec71e20192088a1b0592fbc4b6099;hb=3015c9c29d9b5842a171c3d1bac93172167aef61;hp=6c477eeee40c3f17b1b0e15ee3f0a4f678a494b3;hpb=a0cb332ac5d8e9f297920200d9e8099701051c89;p=mdref%2Fmdref diff --git a/public/index.php b/public/index.php index 6c477ee..58ec5fe 100644 --- a/public/index.php +++ b/public/index.php @@ -1,27 +1,26 @@ add("mdref", ROOT); +define("ROOT", dirname(__DIR__)); +define("REFS", getenv("REFPATH") ?: implode(PATH_SEPARATOR, glob(ROOT."/refs/*"))); -use http\Controller; -use http\Controller\Url; -use http\Controller\Observer\Layout; +ini_set("open_basedir", ROOT.PATH_SEPARATOR.REFS); -use mdref\ExceptionHandler; -use mdref\Action; +spl_autoload_register(function($c) { + if (!strncmp($c, "mdref\\", 6)) { + return require ROOT . "/" . strtr($c, "\\", "/") . ".php"; + } +}); new ExceptionHandler; -$ctl = new Controller; -$ctl->setDependency("baseUrl", new Url) - ->attach(new Action(["refpath" => REFS])) - ->attach(new Layout) - ->notify() - ->getResponse() - ->send(); +$reference = new Reference(explode(PATH_SEPARATOR, REFS)); +$action = new Action($reference, new Request, new Response, new BaseUrl); +$action->handle();