diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-11-12 00:46:43 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-11-12 00:46:43 +0100 |
commit | d43542a434c6a214c7533f76f3b1dc7afe84e5cf (patch) | |
tree | 4bee04986d876a9ad72ea4651935e4a1352a29a1 /phpBB/includes/functions.php | |
parent | 2d0fb4d166d0f6371b6c9c6a9e1dce2b34992c9e (diff) | |
download | forums-d43542a434c6a214c7533f76f3b1dc7afe84e5cf.tar forums-d43542a434c6a214c7533f76f3b1dc7afe84e5cf.tar.gz forums-d43542a434c6a214c7533f76f3b1dc7afe84e5cf.tar.bz2 forums-d43542a434c6a214c7533f76f3b1dc7afe84e5cf.tar.xz forums-d43542a434c6a214c7533f76f3b1dc7afe84e5cf.zip |
[ticket/11997] Use $phpbb_filesystem->clean_path() for proper redirect paths
PHPBB3-11997
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index da90dfea10..0a10a9604c 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2645,7 +2645,7 @@ function generate_board_url($without_script_path = false) */ function redirect($url, $return = false, $disable_cd_check = false) { - global $db, $cache, $config, $user, $phpbb_root_path; + global $db, $cache, $config, $user, $phpbb_root_path, $phpbb_filesystem; $failover_flag = false; @@ -2713,16 +2713,7 @@ 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); - // 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); + $dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs); // Strip / from the end if ($dir && substr($dir, -1, 1) == '/') @@ -2765,6 +2756,8 @@ function redirect($url, $return = false, $disable_cd_check = false) trigger_error('INSECURE_REDIRECT', E_USER_ERROR); } + $url = $phpbb_filesystem->clean_path($url); + if ($return) { return $url; |