diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-11-02 12:01:42 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2015-01-04 17:41:02 +0100 |
commit | 281cc5353208258e7f4a9032f720c5f1ae0fb8dc (patch) | |
tree | 96710285efbac1d26ae606437674cf26429ddaae /phpBB | |
parent | a623868f20574e19d6840af11bce8836ad436e95 (diff) | |
download | forums-281cc5353208258e7f4a9032f720c5f1ae0fb8dc.tar forums-281cc5353208258e7f4a9032f720c5f1ae0fb8dc.tar.gz forums-281cc5353208258e7f4a9032f720c5f1ae0fb8dc.tar.bz2 forums-281cc5353208258e7f4a9032f720c5f1ae0fb8dc.tar.xz forums-281cc5353208258e7f4a9032f720c5f1ae0fb8dc.zip |
[ticket/13192] Remove app.php on mod rewrite even if app.php is outside root
PHPBB3-13192
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/phpbb/path_helper.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index 0a41efc128..b2ec9d98e0 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -465,13 +465,16 @@ class path_helper // URL if ($url_parts === false || empty($url_parts['scheme']) || empty($url_parts['host'])) { - // Remove 'app.php/' from the page, when rewrite is enabled - if ($mod_rewrite && strpos($page, 'app.' . $this->php_ext . '/') === 0) + // Remove 'app.php/' from the page, when rewrite is enabled. + // 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; |