diff options
| author | Marc Alexander <admin@m-a-styles.de> | 2013-11-17 20:16:02 +0100 |
|---|---|---|
| committer | Marc Alexander <admin@m-a-styles.de> | 2013-11-17 20:16:02 +0100 |
| commit | 68db335468c0395d8500d1e4e54ed28aca875a30 (patch) | |
| tree | 940d9cc229cd17415d25358a4b17726bf979abd5 /phpBB | |
| parent | 27ae58713b8468ce7dce19ea4dda60f924467fc0 (diff) | |
| download | forums-68db335468c0395d8500d1e4e54ed28aca875a30.tar forums-68db335468c0395d8500d1e4e54ed28aca875a30.tar.gz forums-68db335468c0395d8500d1e4e54ed28aca875a30.tar.bz2 forums-68db335468c0395d8500d1e4e54ed28aca875a30.tar.xz forums-68db335468c0395d8500d1e4e54ed28aca875a30.zip | |
[ticket/11997] Remove obsolete failover_flag in function redirect()
This flag is no longer needed as the failover is no longer needed.
PHPBB3-11997
Diffstat (limited to 'phpBB')
| -rw-r--r-- | phpBB/includes/functions.php | 77 |
1 files changed, 36 insertions, 41 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a6c03098c2..0663d0cf85 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2647,8 +2647,6 @@ function redirect($url, $return = false, $disable_cd_check = false) { global $db, $cache, $config, $user, $phpbb_root_path, $phpbb_filesystem, $phpbb_path_helper; - $failover_flag = false; - if (empty($user->lang)) { $user->add_lang('common'); @@ -2698,56 +2696,53 @@ function redirect($url, $return = false, $disable_cd_check = false) // Relative uri $pathinfo = pathinfo($url); - if (!$failover_flag) + // Is the uri pointing to the current directory? + if ($pathinfo['dirname'] == '.') { - // Is the uri pointing to the current directory? - if ($pathinfo['dirname'] == '.') - { - $url = str_replace('./', '', $url); - - // Strip / from the beginning - if ($url && substr($url, 0, 1) == '/') - { - $url = substr($url, 1); - } + $url = str_replace('./', '', $url); - $url = generate_board_url() . '/' . $url; - } - else + // Strip / from the beginning + if ($url && substr($url, 0, 1) == '/') { - // Used ./ before, but $phpbb_root_path is working better with urls within another root path - $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($phpbb_root_path))); - $page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($pathinfo['dirname']))); - $intersection = array_intersect_assoc($root_dirs, $page_dirs); + $url = substr($url, 1); + } - $root_dirs = array_diff_assoc($root_dirs, $intersection); - $page_dirs = array_diff_assoc($page_dirs, $intersection); + $url = generate_board_url() . '/' . $url; + } + else + { + // Used ./ before, but $phpbb_root_path is working better with urls within another root path + $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($phpbb_root_path))); + $page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($pathinfo['dirname']))); + $intersection = array_intersect_assoc($root_dirs, $page_dirs); - $dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs); + $root_dirs = array_diff_assoc($root_dirs, $intersection); + $page_dirs = array_diff_assoc($page_dirs, $intersection); - // Strip / from the end - if ($dir && substr($dir, -1, 1) == '/') - { - $dir = substr($dir, 0, -1); - } + $dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs); - // Strip / from the beginning - if ($dir && substr($dir, 0, 1) == '/') - { - $dir = substr($dir, 1); - } + // Strip / from the end + if ($dir && substr($dir, -1, 1) == '/') + { + $dir = substr($dir, 0, -1); + } - $url = str_replace($pathinfo['dirname'] . '/', '', $url); + // Strip / from the beginning + if ($dir && substr($dir, 0, 1) == '/') + { + $dir = substr($dir, 1); + } - // Strip / from the beginning - if (substr($url, 0, 1) == '/') - { - $url = substr($url, 1); - } + $url = str_replace($pathinfo['dirname'] . '/', '', $url); - $url = (!empty($dir) ? $dir . '/' : '') . $url; - $url = generate_board_url() . '/' . $url; + // Strip / from the beginning + if (substr($url, 0, 1) == '/') + { + $url = substr($url, 1); } + + $url = (!empty($dir) ? $dir . '/' : '') . $url; + $url = generate_board_url() . '/' . $url; } } |
