diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-05-11 14:54:51 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-05-29 23:44:08 +0200 |
commit | 58cfdfe14386e48047f3620d1c09218fdbaac5f0 (patch) | |
tree | 44f5cc30f220f0114d136f1dbe0c5908d0dae8de | |
parent | 64f51bd3ddd362d25012edef9af692ddd1fd4fc7 (diff) | |
download | forums-58cfdfe14386e48047f3620d1c09218fdbaac5f0.tar forums-58cfdfe14386e48047f3620d1c09218fdbaac5f0.tar.gz forums-58cfdfe14386e48047f3620d1c09218fdbaac5f0.tar.bz2 forums-58cfdfe14386e48047f3620d1c09218fdbaac5f0.tar.xz forums-58cfdfe14386e48047f3620d1c09218fdbaac5f0.zip |
[ticket/12099] Correctly fix go back to root before prepending the root path
This allows moving app.php outside of phpBB and still work as expected
PHPBB3-12099
-rw-r--r-- | phpBB/phpbb/path_helper.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index eb2cbf7313..b206f491d0 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -184,17 +184,21 @@ class path_helper * Append ../ to the end of the phpbb_root_path as many times * as / exists in path_info */ - return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections); + $this->web_root_path = $this->filesystem->clean_path(str_repeat('../', $corrections) . $this->phpbb_root_path); + } + else + { + /* + * If we're here it means we're at a re-written path, so we must + * correct the relative path for web URLs. We must append ../ + * to the end of the root path as many times as / exists in path_info + * less one time (because the script, e.g. /app.php, doesn't exist in + * the URL) + */ + $this->web_root_path = $this->filesystem->clean_path(str_repeat('../', $corrections - 1) . $this->phpbb_root_path); } - /* - * If we're here it means we're at a re-written path, so we must - * correct the relative path for web URLs. We must append ../ - * to the end of the root path as many times as / exists in path_info - * less one time (because the script, e.g. /app.php, doesn't exist in - * the URL) - */ - return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections - 1); + return $this->web_root_path; } /** |