From 0a7db81426e966f9c44fcc85338615e1bb3c6f34 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 12 Nov 2013 22:25:23 +0100 Subject: [ticket/11997] Fix redirects from inside controllers The redirect url currently uses the web root path. However as we prepend the full board url later, we need to remove the relative web root path and prepend the normal root path again. Otherwise redirects from inside routes will not work as intended. PHPBB3-11997 --- phpBB/phpbb/path_helper.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'phpBB/phpbb/path_helper.php') diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index 8cd8808261..71252ac05b 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -101,6 +101,27 @@ class path_helper return $path; } + /** + * Strips away the web root path and prepends the normal root path + * + * This replaces get_web_root_path() . some_url with + * $phpbb_root_path . some_url + * + * @param string $path The path to be updated + * @return string + */ + public function remove_web_root_path($path) + { + if (strpos($path, $this->get_web_root_path()) === 0) + { + $path = substr($path, strlen($this->get_web_root_path())); + + return $this->phpbb_root_path . $path; + } + + return $path; + } + /** * Get a relative root path from the current URL * -- cgit v1.2.1