cookie
[mdref/mdref] / index.php
index 1e09d32ae1a2993beaad7aec0547a3829fe1e366..53c652913cae1b0804bbac55e7dd177fb257acfa 100644 (file)
--- a/index.php
+++ b/index.php
@@ -189,7 +189,7 @@ function ml($file) {
        }
 }
 
-function md($file) {
+function md($file, $res) {
        $file = rtrim($file, "/");
        if (is_file($file) || is_file($file .= ".md")) {
                $pi = pathinfo($file);
@@ -209,17 +209,12 @@ function md($file) {
                        break;
                }
        } else {
-               http\Env::setResponseCode(404);
+               $res->setResponseCode(404);
                printf("<h1>Not Found</h1>\n");
                printf("<blockquote><p>Sorry, I could not find <code>%s/%s</code>.</p></blockquote>", dirname($file), basename($file, ".md"));
        }
 }
 
-function index($pn) {
-       ?>
-       <?php
-}
-
 chdir($_SERVER["DOCUMENT_ROOT"]);
 $t = ["css"=>"text/css", "js"=>"application/javascript"];
 $r = new http\Env\Request;
@@ -267,7 +262,7 @@ ob_start($s);
                        ob_end_flush();
                ?></pre>
        <?php else: ?>
-               <?php if (!md($p)): ?>
+               <?php if (!md($p, $s)): ?>
                <?php endif; ?>
        <?php endif; ?>
        <footer>