diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-05-13 00:24:54 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-05-13 00:24:54 +0000 |
commit | 8b88ffe996904f017d483d9da6ffd066e6f7cee1 (patch) | |
tree | 7b44180a21b12d4cccc5d087a461665d39a613a5 /phpBB/includes/functions.php | |
parent | 215693d897a6bc0ccb247da783cd9f8abce9ca94 (diff) | |
download | forums-8b88ffe996904f017d483d9da6ffd066e6f7cee1.tar forums-8b88ffe996904f017d483d9da6ffd066e6f7cee1.tar.gz forums-8b88ffe996904f017d483d9da6ffd066e6f7cee1.tar.bz2 forums-8b88ffe996904f017d483d9da6ffd066e6f7cee1.tar.xz forums-8b88ffe996904f017d483d9da6ffd066e6f7cee1.zip |
using another approach
git-svn-id: file:///svn/phpbb/trunk@5905 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index d46d78a5d0..9e0b7a1b1d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1239,20 +1239,34 @@ function build_url($strip_vars = false) $redirect = (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name'] . $SID . (($user->page['query_string']) ? "&{$user->page['query_string']}" : ''); // Strip vars... - if ($strip_vars !== false) + if ($strip_vars !== false && strpos($redirect, '?') !== false) { if (!is_array($strip_vars)) { $strip_vars = array($strip_vars); } - foreach ($strip_vars as $var) + $query = $_query = array(); + parse_str(substr($redirect, strpos($redirect, '?') + 1), $query); + $redirect = substr($redirect, 0, strpos($redirect, '?')); + + // Strip the vars off + foreach ($strip_vars as $strip) { - if (strpos($redirect, $var) !== false) + if (isset($query[$strip])) { - $redirect = preg_replace('#^(.*?)&?' . preg_quote($var, '#') . '=.*(&?)(.*?)$#', '\1\3', $redirect); + unset($query[$strip]); } } + + // + foreach ($query as $key => $value) + { + $_query[] = $key . '=' . $value; + } + $query = implode('&', $_query); + + $redirect .= ($query) ? '?' . $query : ''; } return $phpbb_root_path . str_replace('&', '&', $redirect); |