mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 19:38:53 +00:00
[ticket/13192] Remove app.php on mod rewrite even if app.php is outside root
PHPBB3-13192
This commit is contained in:
parent
a623868f20
commit
281cc53532
2 changed files with 9 additions and 4 deletions
|
@ -465,13 +465,16 @@ class path_helper
|
||||||
// URL
|
// URL
|
||||||
if ($url_parts === false || empty($url_parts['scheme']) || empty($url_parts['host']))
|
if ($url_parts === false || empty($url_parts['scheme']) || empty($url_parts['host']))
|
||||||
{
|
{
|
||||||
// Remove 'app.php/' from the page, when rewrite is enabled
|
// Remove 'app.php/' from the page, when rewrite is enabled.
|
||||||
if ($mod_rewrite && strpos($page, 'app.' . $this->php_ext . '/') === 0)
|
// Treat app.php as a reserved file name and remove on mod rewrite
|
||||||
|
// even if it might not be in the phpBB root.
|
||||||
|
if ($mod_rewrite && ($app_position = strpos($page, 'app.' . $this->php_ext . '/')) !== false)
|
||||||
{
|
{
|
||||||
$page = substr($page, strlen('app.' . $this->php_ext . '/'));
|
$page = substr($page, 0, $app_position) . substr($page, $app_position + strlen('app.' . $this->php_ext . '/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = $this->get_phpbb_root_path() . $page;
|
// Remove preceding slashes from page name and prepend root path
|
||||||
|
$page = $this->get_phpbb_root_path() . preg_replace('@^(?:([\\/\\\])?)@', '', $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $page;
|
return $page;
|
||||||
|
|
|
@ -432,6 +432,8 @@ class phpbb_path_helper_test extends phpbb_test_case
|
||||||
array('foo/index', false, 'foo/index'),
|
array('foo/index', false, 'foo/index'),
|
||||||
array('app.php/foo', false, 'app.php/foo'),
|
array('app.php/foo', false, 'app.php/foo'),
|
||||||
array('app.php/foo', true, 'foo'),
|
array('app.php/foo', true, 'foo'),
|
||||||
|
array('/../app.php/foo', false, '../app.php/foo'),
|
||||||
|
array('/../app.php/foo', true, '../foo'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue