mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 15:33:23 +01:00
fixing proxy url
This commit is contained in:
parent
7cd4169768
commit
9f32f8115d
73
redirect.php
73
redirect.php
@ -1,62 +1,60 @@
|
|||||||
<?php
|
<?php
|
||||||
/**************************************************************************\
|
/**
|
||||||
* eGroupWare - save redirect script *
|
* EGroupware save redirect script
|
||||||
* idea by: Jason Wies <jason@xc.net> *
|
*
|
||||||
* doing and adding to cvs: Lars Kneschke <lkneschke@linux-at-work.de> *
|
* idea by: Jason Wies
|
||||||
* http://www.egroupware.org *
|
* doing and adding to cvs: Lars Kneschke
|
||||||
* -------------------------------------------- *
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* @link http://www.egroupware.org
|
||||||
* under the terms of the GNU General Public License as published by the *
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
*/
|
||||||
* option) any later version. *
|
|
||||||
\**************************************************************************/
|
|
||||||
|
|
||||||
/* $Id$ */
|
use EGroupware\Api;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Use this script when you want to link to a external url.
|
Use this script when you want to link to a external url.
|
||||||
This way you don't send something like sessionid as referer
|
This way you don't send something like sessionid as referer
|
||||||
|
|
||||||
Use this in your app:
|
Use this in your app:
|
||||||
|
|
||||||
"<a href=\"$webserverURL/redirect.php?go=".htmlentities(urlencode('http://www.egroupware.org')).'">'
|
"<a href=\"$webserverURL/redirect.php?go=".htmlentities(urlencode('http://www.egroupware.org')).'">'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!function_exists('html_entity_decode'))
|
if(!function_exists('html_entity_decode'))
|
||||||
{
|
{
|
||||||
function html_entity_decode($given_html, $quote_style = ENT_QUOTES)
|
function html_entity_decode($given_html, $quote_style = ENT_QUOTES)
|
||||||
{
|
{
|
||||||
$trans_table = array_flip(get_html_translation_table( HTML_SPECIALCHARS, $quote_style));
|
$trans_table = array_flip(get_html_translation_table( HTML_SPECIALCHARS, $quote_style));
|
||||||
$trans_table['''] = "'";
|
$trans_table['''] = "'";
|
||||||
return(strtr($given_html, $trans_table));
|
return(strtr($given_html, $trans_table));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only allow redirects with a valid session */
|
/* Only allow redirects with a valid session */
|
||||||
$GLOBALS['egw_info'] = array(
|
$GLOBALS['egw_info'] = array(
|
||||||
'flags' => array(
|
'flags' => array(
|
||||||
'noheader' => True,
|
'noheader' => True,
|
||||||
'nonavbar' => True,
|
'nonavbar' => True,
|
||||||
'currentapp' => 'home'
|
'currentapp' => 'home'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
include('./header.inc.php');
|
include('./header.inc.php');
|
||||||
|
|
||||||
|
|
||||||
/* Only allow redirects from inside this eGroupware installation. */
|
/* Only allow redirects from inside this eGroupware installation. */
|
||||||
$valid_referer = array();
|
$valid_referer = array();
|
||||||
$path = preg_replace('/\/[^\/]*$/','',$_SERVER['PHP_SELF']) . '/';
|
$path = preg_replace('/\/[^\/]*$/','',$_SERVER['PHP_SELF']) . '/';
|
||||||
array_push($valid_referer, $path);
|
array_push($valid_referer, $path);
|
||||||
array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_ADDR'] . $path);
|
array_push($valid_referer, Api\Header\Http::schema() . '//' . $_SERVER['SERVER_ADDR'] . $path);
|
||||||
array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $path);
|
array_push($valid_referer, Api\Framework::getUrl($path));
|
||||||
|
|
||||||
$referrer = trim($_SERVER['HTTP_REFERER']);
|
$referrer = trim($_SERVER['HTTP_REFERER']);
|
||||||
if ((!isset($_SERVER['HTTP_REFERER'])) || (empty($referrer)))
|
if ((!isset($_SERVER['HTTP_REFERER'])) || (empty($referrer)))
|
||||||
{
|
{
|
||||||
echo "Only usable from within eGroupware.\n";
|
echo "Only usable from within eGroupware.\n";
|
||||||
}
|
}
|
||||||
else if($_GET['go'])
|
else if($_GET['go'])
|
||||||
{
|
{
|
||||||
$allow = false;
|
$allow = false;
|
||||||
foreach ($valid_referer as $urlRoot)
|
foreach ($valid_referer as $urlRoot)
|
||||||
{
|
{
|
||||||
@ -87,9 +85,8 @@
|
|||||||
print_r($valid_referer);
|
print_r($valid_referer);
|
||||||
echo "<pre>\n";
|
echo "<pre>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "Error redirecting.";
|
echo "Error redirecting.";
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user