Mercurial > dirlist-php
diff index.php @ 25:69b2c15cadfb
Better(?) way to check DL_DIR variable.
author | edogawaconan <me@myconan.net> |
---|---|
date | Thu, 30 Oct 2014 11:39:11 +0900 |
parents | 949398173ecb |
children | eee7ca924a5e |
line wrap: on
line diff
--- a/index.php Thu Oct 23 21:50:52 2014 +0900 +++ b/index.php Thu Oct 30 11:39:11 2014 +0900 @@ -12,8 +12,7 @@ $uri = urldecode($uri); // $dir: filesystem path - $dir = $_SERVER["DL_DIR"]; - if ($dir === null || $dir === "") { $dir = $_SERVER["DOCUMENT_ROOT"] . $uri; } + $dir = isset($_SERVER["DL_DIR"]) ? $_SERVER["DL_DIR"] : $_SERVER["DOCUMENT_ROOT"] . $uri; if (realpath($dir) === false) { header("HTTP/1.0 404 Not Found");