Vanilla 1.1.5 is a product of Lussumo. More Information: Documentation, Community Support.
/**
* Redirect to an other page
*
* @todo Should $Location be encoded?
* @param string $Location Absolute URL
* @param string $Code Status code
* @param string $Name Name of the page
* @param bool $Die Should the script terminate
* @return void
*/
function Redirect($Location, $Code = '302', $Name = null, $Die = true) {
// Set status
$CodeList = array(
'301' => 'Moved Permanently',
'302' => 'Found',
'303' => 'See Other'
);
if ($Code) {
if (!array_key_exists($Code, $CodeList)) {
$Code = '302';
}
Header( 'HTTP/1.1 ' . $Code . ' ' . $CodeList[$Code] );
}
//$Location should be well encoded (should it be done here?)
header('Location: ' . $Location);
if ($Die) {
@ob_end_clean();
if (!$Name) {
$Name = $Location;
}
// display a lick in case the redirect fails
echo '<a href="' . $Location . '">' . FormatStringForDisplay($Name) . '</a>';
die();
}
}function Redirect($Context, $Location, $Code = '302', $Name = '', $Die = 1) {
// Set status
$CodeList = array(
'301' => 'Moved Permanently',
'303' => 'See Other'
);
if (array_key_exists($Code, $CodeList)) {
header( 'HTTP/1.1 ' . $Code . ' ' . $CodeList[$Code] );
}
header('Location: ' . $Location);
if ($Die) {
@ob_end_clean();
if (!$Name) {
$Name = $Location;
}
// display a link in case the redirect fails
echo '<a href="' . $Location . '">' . FormatStringForDisplay($Name) . '</a>';
$Context->Unload();
die();
}
}
function Redirect($Location, $Code = '302', $Name = '', $Die = 1) {
// Set status
$CodeList = array(
'301' => 'Moved Permanently',
'303' => 'See Other'
);
if ($Code && array_key_exists($Code, $CodeList)) {
Header( 'HTTP/1.1 ' . $Code . ' ' . $CodeList[$Code] );
}
//$Location should be escape
header('Location: ' . $Location);
if ($Die) {
@ob_end_clean();
if (isset($_SERVER['REQUEST_METHOD']) &&
$_SERVER['REQUEST_METHOD'] != 'HEAD')
{
if (!$Name) {
$Name = $Location;
}
// display a link in case the redirect fails
echo '<a href="' . $Location . '">' . FormatStringForDisplay($Name) . '</a>';
}
global $Context;
$Context->Unload();
die();
}
}function Redirect(&$Context, ...
include('Framework.Functions.php');
$Configuration['BaseUrl'] = 'http://your.base.url/to/vanilla/';
$Location = 'http://wallphone.com/test.html?boo=1&far=2
set-cookie: Header-poison'; // Test absolute URL with header injection
// $Location = 'test.html'; // test relative URL
// Strip CRLFs and replace & with & (case insensitive)
$Location = preg_replace(array('/\r\n/', '/&/i'), array('', '&'), $Location);
// Make sure the URL is absolute TODO: Must global $Configuration first when in the core!
$Location = ConcatenatePath($Configuration['BaseUrl'], $Location);
1 to 13 of 13