From 0b3e788b86ee7c00b34022db882b642856b6a0d0 Mon Sep 17 00:00:00 2001 From: "Florian Aders (EleRas)" Date: Mon, 13 Jun 2011 22:08:38 +0200 Subject: [PATCH] Revert "Changed redirectTo to use new link-class" This reverts commit b88246b112993d722f440f9eb395f88248fadb72. --- lib/functions/output/function.redirectTo.php | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/functions/output/function.redirectTo.php b/lib/functions/output/function.redirectTo.php index 7bcd62a9..3dd35e52 100644 --- a/lib/functions/output/function.redirectTo.php +++ b/lib/functions/output/function.redirectTo.php @@ -29,6 +29,7 @@ * * @author Florian Lippert * @author Martin Burchert + * * @changes martin@2005-01-29 * - added isRelative parameter * - speed up the url generation @@ -39,20 +40,19 @@ function redirectTo($destination, $get_variables = array(), $isRelative = false) { $params = array(); - $linker = new linker(); - $linker->filename = $destination; - if(is_array($get_variables)) { foreach($get_variables as $key => $value) { - $linker->add($key, $value); + $params[] = urlencode($key) . '=' . urlencode($value); } + $params = '?' . implode($params, '&'); + if($isRelative) { - $linker->protocol = ''; - $linker->host = ''; + $protocol = ''; + $host = ''; $path = './'; } else @@ -60,12 +60,15 @@ function redirectTo($destination, $get_variables = array(), $isRelative = false) if(isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { - $linker->protocol = 'https'; + $protocol = 'https://'; } else { - $linker->protocol = 'http'; + $protocol = 'http://'; } + + $host = $_SERVER['HTTP_HOST']; + if(dirname($_SERVER['PHP_SELF']) == '/') { $path = '/'; @@ -74,15 +77,14 @@ function redirectTo($destination, $get_variables = array(), $isRelative = false) { $path = dirname($_SERVER['PHP_SELF']) . '/'; } - $linker->host = $_SERVER['HTTP_HOST']; } - $linker->filename = $path . $destination; - header('Location: ' . $linker->getLink()); + + header('Location: ' . $protocol . $host . $path . $destination . $params); exit; } elseif($get_variables == null) { - header('Location: ' . $linker->getLink()); + header('Location: ' . $destination); exit; }