projects
/
mdref
/
mdref
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
permalinks
[mdref/mdref]
/
public
/
index.php
diff --git
a/public/index.php
b/public/index.php
index d4518cd3a26691a5387aea740d173ea90cc09703..e6d0f75a4ce4a9fe449d1cd92c8f81c97b9c7570 100644
(file)
--- a/
public/index.php
+++ b/
public/index.php
@@
-1,25
+1,30
@@
<?php
<?php
+use mdref\Action;
+use mdref\BaseUrl;
+use mdref\Reference;
+use mdref\ExceptionHandler;
+
+use http\Env\Request;
+use http\Env\Response;
+
define("ROOT", dirname(__DIR__));
define("REFS", getenv("REFPATH") ?: implode(PATH_SEPARATOR, glob(ROOT."/refs/*")));
define("ROOT", dirname(__DIR__));
define("REFS", getenv("REFPATH") ?: implode(PATH_SEPARATOR, glob(ROOT."/refs/*")));
-$loader = require __DIR__ . "/../vendor/autoload.php";
-/* @var $loader \Composer\Autoload\ClassLoader */
-$loader->add("mdref", ROOT);
+ini_set("open_basedir", ROOT.PATH_SEPARATOR.REFS);
-use http\Controller;
-use http\Controller\Url;
-use http\Controller\Observer\Layout;
-
-use mdref\ExceptionHandler;
-use mdref\Action;
+if (!ini_get("date.timezone")) {
+ date_default_timezone_set("UTC");
+}
-new ExceptionHandler;
+spl_autoload_register(function($c) {
+ if (!strncmp($c, "mdref\\", 6)) {
+ return require ROOT . "/" . strtr($c, "\\", "/") . ".php";
+ }
+});
-$ctl = new Controller;
-$ctl->setDependency("baseUrl", new Url)
- ->attach(new Action)
- ->attach(new Layout)
- ->notify()
- ->getResponse()
- ->send();
+$response = new Response;
+$ehandler = new ExceptionHandler($response);
+$reference = new Reference(explode(PATH_SEPARATOR, REFS));
+$action = new Action($reference, new Request, $response, new BaseUrl);
+$action->handle();