fix initial value of function parameter as it leads to the first condition to be always true, fixes #1330
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -36,61 +36,47 @@
|
|||||||
* - fixed bug #91
|
* - fixed bug #91
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function redirectTo($destination, $get_variables = array(), $isRelative = false)
|
function redirectTo($destination, $get_variables = null, $isRelative = false) {
|
||||||
{
|
|
||||||
global $s, $theme;
|
|
||||||
|
|
||||||
if(is_array($get_variables))
|
global $s;
|
||||||
{
|
|
||||||
if (isset($get_variables['s']))
|
if (is_array($get_variables)) {
|
||||||
{
|
if (isset($get_variables['s'])) {
|
||||||
$linker = new linker($destination, $get_variables['s']);
|
$linker = new linker($destination, $get_variables['s']);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$linker = new linker($destination, $s);
|
$linker = new linker($destination, $s);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($get_variables as $key => $value)
|
foreach ($get_variables as $key => $value) {
|
||||||
{
|
|
||||||
$linker->add($key, $value);
|
$linker->add($key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($isRelative)
|
if ($isRelative) {
|
||||||
{
|
|
||||||
$linker->protocol = '';
|
$linker->protocol = '';
|
||||||
$linker->hostname = '';
|
$linker->hostname = '';
|
||||||
$path = './';
|
$path = './';
|
||||||
}
|
} else {
|
||||||
else
|
if (isset($_SERVER['HTTPS'])
|
||||||
{
|
&& strtolower($_SERVER['HTTPS']) == 'on'
|
||||||
if(isset($_SERVER['HTTPS'])
|
) {
|
||||||
&& strtolower($_SERVER['HTTPS']) == 'on')
|
|
||||||
{
|
|
||||||
$linker->protocol = 'https';
|
$linker->protocol = 'https';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$linker->protocol = 'http';
|
$linker->protocol = 'http';
|
||||||
}
|
}
|
||||||
|
|
||||||
$linker->hostname = $_SERVER['HTTP_HOST'];
|
$linker->hostname = $_SERVER['HTTP_HOST'];
|
||||||
|
|
||||||
if(dirname($_SERVER['PHP_SELF']) == '/')
|
if (dirname($_SERVER['PHP_SELF']) == '/') {
|
||||||
{
|
|
||||||
$path = '/';
|
$path = '/';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$path = dirname($_SERVER['PHP_SELF']) . '/';
|
$path = dirname($_SERVER['PHP_SELF']) . '/';
|
||||||
}
|
}
|
||||||
$linker->filename = $path . $destination;
|
$linker->filename = $path . $destination;
|
||||||
}
|
}
|
||||||
header('Location: ' . $linker->getLink());
|
header('Location: ' . $linker->getLink());
|
||||||
exit;
|
exit;
|
||||||
}
|
|
||||||
elseif($get_variables == null)
|
} elseif ($get_variables == null) {
|
||||||
{
|
|
||||||
$linker = new linker($destination, $s);
|
$linker = new linker($destination, $s);
|
||||||
header('Location: ' . $linker->getLink());
|
header('Location: ' . $linker->getLink());
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
Reference in New Issue
Block a user