Mercurial > dirlist-php
comparison index.php @ 30:c482f0db5c28
Turns out "CONTEXT_DOCUMENT_ROOT" isn't enough.
author | edogawaconan <me@myconan.net> |
---|---|
date | Thu, 30 Oct 2014 13:03:28 +0900 |
parents | ce92f4d41714 |
children | 986aec12eb7f |
comparison
equal
deleted
inserted
replaced
29:e4f534198385 | 30:c482f0db5c28 |
---|---|
11 } | 11 } |
12 $uri = urldecode($uri); | 12 $uri = urldecode($uri); |
13 | 13 |
14 // $dir: filesystem path | 14 // $dir: filesystem path |
15 if (isset($_SERVER["DL_DIR"])) { $dir = $_SERVER["DL_DIR"]; } | 15 if (isset($_SERVER["DL_DIR"])) { $dir = $_SERVER["DL_DIR"]; } |
16 elseif (isset($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $dir = $_SERVER["CONTEXT_DOCUMENT_ROOT"]; } | 16 elseif (isset($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { |
17 $dir = $_SERVER["CONTEXT_DOCUMENT_ROOT"]; | |
18 $dir .= substr($uri, strlen($_SERVER["CONTEXT_PREFIX"])); | |
19 } | |
17 else { $dir = $_SERVER["DOCUMENT_ROOT"] . $uri; } | 20 else { $dir = $_SERVER["DOCUMENT_ROOT"] . $uri; } |
18 | 21 |
19 if (realpath($dir) === false) { | 22 if (realpath($dir) === false) { |
20 header("HTTP/1.0 404 Not Found"); | 23 header("HTTP/1.0 404 Not Found"); |
21 } elseif (substr($uri, -1) !== "/") { | 24 } elseif (substr($uri, -1) !== "/") { |