provide mapping for /www/

This commit is contained in:
Christian Weiske 2011-08-16 18:10:41 +02:00
parent 64923095e6
commit aed211c5b2

View File

@ -6,33 +6,28 @@ if (!in_array('phar', stream_get_wrappers())
exit; 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/' function mapUrls($path)
&& $following !== false {
&& $following != '/' if (substr($path, 0, 5) !== '/www/') {
) { return false;
header('403 Forbidden'); }
echo <<<HTM $arMap = array(
<html> '/www/' => '/www/index.php'
<head> );
<title>Forbidden</title> if (isset($arMap[$path])) {
</head> return $arMap[$path];
<body> }
<h1>403 - Forbidden</h1> return $path;
</body>
</html>
HTM;
exit;
} }
Phar::interceptFileFuncs(); Phar::interceptFileFuncs();
Phar::webPhar( Phar::webPhar(
null, null,
'www/index.php' 'www/index.php',
null,
array(),
'mapUrls'
); );
__HALT_COMPILER(); ?> __HALT_COMPILER(); ?>