Revert "Changed redirectTo to use new link-class"
This reverts commit b88246b112.
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
*
|
*
|
||||||
* @author Florian Lippert <flo@syscp.org>
|
* @author Florian Lippert <flo@syscp.org>
|
||||||
* @author Martin Burchert <eremit@syscp.org>
|
* @author Martin Burchert <eremit@syscp.org>
|
||||||
|
*
|
||||||
* @changes martin@2005-01-29
|
* @changes martin@2005-01-29
|
||||||
* - added isRelative parameter
|
* - added isRelative parameter
|
||||||
* - speed up the url generation
|
* - speed up the url generation
|
||||||
@@ -39,20 +40,19 @@ function redirectTo($destination, $get_variables = array(), $isRelative = false)
|
|||||||
{
|
{
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|
||||||
$linker = new linker();
|
|
||||||
$linker->filename = $destination;
|
|
||||||
|
|
||||||
if(is_array($get_variables))
|
if(is_array($get_variables))
|
||||||
{
|
{
|
||||||
foreach($get_variables as $key => $value)
|
foreach($get_variables as $key => $value)
|
||||||
{
|
{
|
||||||
$linker->add($key, $value);
|
$params[] = urlencode($key) . '=' . urlencode($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$params = '?' . implode($params, '&');
|
||||||
|
|
||||||
if($isRelative)
|
if($isRelative)
|
||||||
{
|
{
|
||||||
$linker->protocol = '';
|
$protocol = '';
|
||||||
$linker->host = '';
|
$host = '';
|
||||||
$path = './';
|
$path = './';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -60,12 +60,15 @@ function redirectTo($destination, $get_variables = array(), $isRelative = false)
|
|||||||
if(isset($_SERVER['HTTPS'])
|
if(isset($_SERVER['HTTPS'])
|
||||||
&& strtolower($_SERVER['HTTPS']) == 'on')
|
&& strtolower($_SERVER['HTTPS']) == 'on')
|
||||||
{
|
{
|
||||||
$linker->protocol = 'https';
|
$protocol = 'https://';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$linker->protocol = 'http';
|
$protocol = 'http://';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$host = $_SERVER['HTTP_HOST'];
|
||||||
|
|
||||||
if(dirname($_SERVER['PHP_SELF']) == '/')
|
if(dirname($_SERVER['PHP_SELF']) == '/')
|
||||||
{
|
{
|
||||||
$path = '/';
|
$path = '/';
|
||||||
@@ -74,15 +77,14 @@ function redirectTo($destination, $get_variables = array(), $isRelative = false)
|
|||||||
{
|
{
|
||||||
$path = dirname($_SERVER['PHP_SELF']) . '/';
|
$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;
|
exit;
|
||||||
}
|
}
|
||||||
elseif($get_variables == null)
|
elseif($get_variables == null)
|
||||||
{
|
{
|
||||||
header('Location: ' . $linker->getLink());
|
header('Location: ' . $destination);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user