diff --git a/res/phar-stub.php b/res/phar-stub.php index 8527d88..2a55274 100644 --- a/res/phar-stub.php +++ b/res/phar-stub.php @@ -6,33 +6,28 @@ if (!in_array('phar', stream_get_wrappers()) exit; } -//disallow access to everything except /www/ -$file = basename(__FILE__); -$pos = strpos($_SERVER['REQUEST_URI'], $file); -$following = substr($_SERVER['REQUEST_URI'], $pos + strlen($file), 5); -if ($following != '/www/' - && $following !== false - && $following != '/' -) { - header('403 Forbidden'); - echo << - - Forbidden - - -

403 - Forbidden

- - -HTM; - exit; +function mapUrls($path) +{ + if (substr($path, 0, 5) !== '/www/') { + return false; + } + $arMap = array( + '/www/' => '/www/index.php' + ); + if (isset($arMap[$path])) { + return $arMap[$path]; + } + return $path; } Phar::interceptFileFuncs(); Phar::webPhar( null, - 'www/index.php' + 'www/index.php', + null, + array(), + 'mapUrls' ); __HALT_COMPILER(); ?> \ No newline at end of file