From 3ff475bcbba49cf55e7f4e803f7d16f7b0c93759 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 22 Mar 2007 15:15:20 +0000 Subject: some fixes... hopefully not breaking something. :o git-svn-id: file:///svn/phpbb/trunk@7216 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 31667358f3..b281ced615 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1693,19 +1693,20 @@ function redirect($url, $return = false) // 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); + } + if ($user->page['page_dir']) { - $url = generate_board_url() . '/' . $user->page['page_dir'] . '/' . str_replace('./', '', $url); + $url = generate_board_url() . '/' . $user->page['page_dir'] . '/' . $url; } else { - $url = str_replace('./', '', $url); - - if ($url && substr($url, -1, 1) == '/') - { - $url = substr($url, 0, -1); - } - $url = generate_board_url() . '/' . $url; } } @@ -1721,12 +1722,27 @@ function redirect($url, $return = false) $dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs); + // Strip / from the end if ($dir && substr($dir, -1, 1) == '/') { $dir = substr($dir, 0, -1); } - $url = $dir . '/' . str_replace($pathinfo['dirname'] . '/', '', $url); + // Strip / from the beginning + if ($dir && substr($dir, 0, 1) == '/') + { + $dir = substr($dir, 1); + } + + $url = str_replace($pathinfo['dirname'] . '/', '', $url); + + // Strip / from the beginning + if (substr($url, 0, 1) == '/') + { + $url = substr($url, 1); + } + + $url = $dir . '/' . $url; $url = generate_board_url() . '/' . $url; } } @@ -3592,6 +3608,10 @@ function msg_handler($errno, $msg_text, $errfile, $errline) exit; break; + + case E_RECOVERABLE_ERROR: + return false; + break; } } -- cgit v1.2.1