From: Michael Wallner Date: Mon, 20 Jul 2015 12:46:28 +0000 (+0200) Subject: simplify X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=dc54ba07d9e53d8ca8d49c6132d3d4d2a194e669;p=mdref%2Fmdref simplify --- diff --git a/mdref/Action.php b/mdref/Action.php index e35b3f5..68f64a7 100644 --- a/mdref/Action.php +++ b/mdref/Action.php @@ -38,6 +38,7 @@ class Action { $this->request = $req; $this->response = $res; $this->baseUrl = $baseUrl; + ob_start($res); } function esc($txt) { @@ -72,6 +73,7 @@ class Action { private function serveCanonical($cnn) { $this->response->setHeader("Location", $this->baseUrl->mod(["path" => $cnn])); $this->response->setResponseCode(301); + $this->response->send(); } /** @@ -79,7 +81,8 @@ class Action { */ private function serveStylesheet() { $this->response->setHeader("Content-Type", "text/css"); - $this->esponse->setBody(new \http\Message\Body(fopen(ROOT."/public/index.css", "r"))); + $this->response->setBody(new \http\Message\Body(fopen(ROOT."/public/index.css", "r"))); + $this->response->send(); } /** @@ -88,6 +91,7 @@ class Action { private function serveJavascript() { $this->response->setHeader("Content-Type", "application/javascript"); $this->response->setBody(new \http\Message\Body(fopen(ROOT."/public/index.js", "r"))); + $this->response->send(); } /** @@ -116,6 +120,7 @@ class Action { private function serve() { extract((array) func_get_arg(0)); include ROOT."/views/layout.phtml"; + $this->response->send(); } public function handle() { diff --git a/public/index.php b/public/index.php index 853c091..56cf3a2 100644 --- a/public/index.php +++ b/public/index.php @@ -20,8 +20,4 @@ new ExceptionHandler; $reference = new Reference(($refs = getenv("REFPATH")) ? explode(PATH_SEPARATOR, $refs) : glob(ROOT."/refs/*")); $action = new Action($reference, new Request, new Response, new BaseUrl); - -ob_start($response); $action->handle(); -ob_end_flush(); -$response->send();