redirectTo now uses the new linker class
Signed-off-by: Florian Aders (EleRas) <eleras@froxlor.org>
This commit is contained in:
@@ -150,7 +150,7 @@ class linker
|
|||||||
# For all but the first argument, prepend "&"
|
# For all but the first argument, prepend "&"
|
||||||
if (substr($link, -1) != "?")
|
if (substr($link, -1) != "?")
|
||||||
{
|
{
|
||||||
$link .= "&";
|
$link .= "&";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Encode parameters and add them to the link
|
# Encode parameters and add them to the link
|
||||||
|
|||||||
@@ -38,21 +38,28 @@
|
|||||||
|
|
||||||
function redirectTo($destination, $get_variables = array(), $isRelative = false)
|
function redirectTo($destination, $get_variables = array(), $isRelative = false)
|
||||||
{
|
{
|
||||||
$params = array();
|
global $s;
|
||||||
|
|
||||||
if(is_array($get_variables))
|
if(is_array($get_variables))
|
||||||
{
|
{
|
||||||
foreach($get_variables as $key => $value)
|
if (isset($get_variables['s']))
|
||||||
{
|
{
|
||||||
$params[] = urlencode($key) . '=' . urlencode($value);
|
$linker = new linker($destination, $get_variables['s']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$linker = new linker($destination, $s);
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = '?' . implode($params, '&');
|
foreach($get_variables as $key => $value)
|
||||||
|
{
|
||||||
|
$linker->add($key, $value);
|
||||||
|
}
|
||||||
|
|
||||||
if($isRelative)
|
if($isRelative)
|
||||||
{
|
{
|
||||||
$protocol = '';
|
$linker->protocol = '';
|
||||||
$host = '';
|
$linker->host = '';
|
||||||
$path = './';
|
$path = './';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -60,14 +67,14 @@ function redirectTo($destination, $get_variables = array(), $isRelative = false)
|
|||||||
if(isset($_SERVER['HTTPS'])
|
if(isset($_SERVER['HTTPS'])
|
||||||
&& strtolower($_SERVER['HTTPS']) == 'on')
|
&& strtolower($_SERVER['HTTPS']) == 'on')
|
||||||
{
|
{
|
||||||
$protocol = 'https://';
|
$linker->protocol = 'https';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$protocol = 'http://';
|
$linker->protocol = 'http';
|
||||||
}
|
}
|
||||||
|
|
||||||
$host = $_SERVER['HTTP_HOST'];
|
$linker->host = $_SERVER['HTTP_HOST'];
|
||||||
|
|
||||||
if(dirname($_SERVER['PHP_SELF']) == '/')
|
if(dirname($_SERVER['PHP_SELF']) == '/')
|
||||||
{
|
{
|
||||||
@@ -77,14 +84,15 @@ function redirectTo($destination, $get_variables = array(), $isRelative = false)
|
|||||||
{
|
{
|
||||||
$path = dirname($_SERVER['PHP_SELF']) . '/';
|
$path = dirname($_SERVER['PHP_SELF']) . '/';
|
||||||
}
|
}
|
||||||
|
$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: ' . $destination);
|
$linker = new linker($destination, $s);
|
||||||
|
header('Location: ' . $linker->getLink());
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user