diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-11-11 21:55:21 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-11-11 21:55:21 +0100 |
commit | 2d0fb4d166d0f6371b6c9c6a9e1dce2b34992c9e (patch) | |
tree | a1ad30e1851bb94f990207edf6c3fc6dd1e3dfed /phpBB/includes | |
parent | 6bb9bce40e0831e449d1843901a485eef66206d6 (diff) | |
download | forums-2d0fb4d166d0f6371b6c9c6a9e1dce2b34992c9e.tar forums-2d0fb4d166d0f6371b6c9c6a9e1dce2b34992c9e.tar.gz forums-2d0fb4d166d0f6371b6c9c6a9e1dce2b34992c9e.tar.bz2 forums-2d0fb4d166d0f6371b6c9c6a9e1dce2b34992c9e.tar.xz forums-2d0fb4d166d0f6371b6c9c6a9e1dce2b34992c9e.zip |
[ticket/11997] Rename root_dirs_size to superordinate_dirs_count
This variable name better fits what is done with it. A comment explaining
why 2 has to be subtracted from the size of root_dirs has also been added
PHPBB3-11997
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 229e856d05..da90dfea10 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2712,9 +2712,17 @@ function redirect($url, $return = false, $disable_cd_check = false) $root_dirs = array_diff_assoc($root_dirs, $intersection); $page_dirs = array_diff_assoc($page_dirs, $intersection); - $root_dirs_size = sizeof($root_dirs) - 2; - $dir = (($root_dirs_size > 0) ? str_repeat('../', $root_dirs_size) : '') . implode('/', $page_dirs); + // Due to the dirname returned by pathinfo, the + // realpath for the $page_dirs array will be 2 + // superordinate folders up from the phpBB root + // path even if the supplied path is in the + // phpBB root path. We need to subtract these 2 + // folders in order to be able to correctly + // prepend '../' to the supplied path. + $superordinate_dirs_count = sizeof($root_dirs) - 2; + + $dir = (($superordinate_dirs_count > 0) ? str_repeat('../', $superordinate_dirs_count) : '') . implode('/', $page_dirs); // Strip / from the end if ($dir && substr($dir, -1, 1) == '/') |