diff options
author | Tristan Darricau <github@nicofuma.fr> | 2017-09-08 10:45:22 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2017-09-08 16:26:39 +0200 |
commit | c368d170cf09d06ff63249d4405323e6108d90bb (patch) | |
tree | f264ad23aaa9c3ecacde482caa633a49539e1bcd /phpBB/phpbb | |
parent | 7221a47bb622951c3c81e4537d98357656064b2a (diff) | |
download | forums-c368d170cf09d06ff63249d4405323e6108d90bb.tar forums-c368d170cf09d06ff63249d4405323e6108d90bb.tar.gz forums-c368d170cf09d06ff63249d4405323e6108d90bb.tar.bz2 forums-c368d170cf09d06ff63249d4405323e6108d90bb.tar.xz forums-c368d170cf09d06ff63249d4405323e6108d90bb.zip |
[ticket/15351] Makes confirm_works in a router context (app.php)
PHPBB3-15351
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/path_helper.php | 13 | ||||
-rw-r--r-- | phpBB/phpbb/session.php | 15 |
2 files changed, 25 insertions, 3 deletions
diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index 154361ef64..5b6db35f23 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -496,4 +496,17 @@ class path_helper return $page; } + + /** + * Tells if the router is currently in use (if the current page is a route or not) + * + * @return bool + */ + public function is_router_used() + { + // Script name URI (e.g. phpBB/app.php) + $script_name = $this->symfony_request->getScriptName(); + + return basename($script_name) === 'app.' . $this->php_ext; + } } diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index c5b50c2b07..6b5b8f2625 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -91,9 +91,18 @@ class session $page_name .= str_replace('%2F', '/', urlencode($symfony_request_path)); } - // current directory within the phpBB root (for example: adm) - $root_dirs = explode('/', str_replace('\\', '/', $phpbb_filesystem->realpath($root_path))); - $page_dirs = explode('/', str_replace('\\', '/', $phpbb_filesystem->realpath('./'))); + if (substr($root_path, 0, 2) === './' && strpos($root_path, '..') === false) + { + $root_dirs = explode('/', str_replace('\\', '/', rtrim($root_path, '/'))); + $page_dirs = explode('/', str_replace('\\', '/', '.')); + } + else + { + // current directory within the phpBB root (for example: adm) + $root_dirs = explode('/', str_replace('\\', '/', $phpbb_filesystem->realpath($root_path))); + $page_dirs = explode('/', str_replace('\\', '/', $phpbb_filesystem->realpath('./'))); + } + $intersection = array_intersect_assoc($root_dirs, $page_dirs); $root_dirs = array_diff_assoc($root_dirs, $intersection); |