Bug #16640 ยป bug_4379_v2.diff
typo3_src-4.0.2-rc1/typo3/sysext/cms/tslib/class.tslib_fe.php 2006-10-12 15:04:10.000000000 +0200 | ||
---|---|---|
* @return void (The function exits!)
|
||
*/
|
||
function pageNotFoundHandler($code, $header='', $reason='') {
|
||
// Issue header in any case:
|
||
if ($header) {header($header);}
|
||
if ($header) {
|
||
$headerArr = preg_split('/\r|\n/',$header,-1,PREG_SPLIT_NO_EMPTY);
|
||
foreach ($headerArr as $header) {
|
||
header ($header);
|
||
}
|
||
}
|
||
// Convert $code in case it was written as a string (e.g. if edited in Install Tool)
|
||
// TODO: Once the Install Tool handles such data types correctly, this workaround should be removed again...
|
||
... | ... | |
}
|
||
// Prepare headers
|
||
$headers = array(
|
||
$headerArr = array(
|
||
'User-agent: ' . t3lib_div::getIndpEnv('HTTP_USER_AGENT'),
|
||
'Referer: ' . t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')
|
||
);
|
||
$content = t3lib_div::getURL($code, 0, $headers);
|
||
$content = t3lib_div::getURL($code, 0, $headerArr);
|
||
$header = t3lib_div::getURL($code, 2, $headerArr);
|
||
$headerArr = preg_split('/\r|\n/',$header,-1,PREG_SPLIT_NO_EMPTY);
|
||
if (false === $content) {
|
||
// Last chance -- redirect
|
||
header('Location: '.t3lib_div::locationHeaderUrl($code));
|
||
} else {
|
||
$forwardHeaders = array( // Forward these response headers to the client
|
||
'Content-Type:',
|
||
);
|
||
foreach ($headerArr as $header) {
|
||
foreach ($forwardHeaders as $h) {
|
||
$h = preg_quote($h,'/');
|
||
if (preg_match('/^'.$h.'/', $header)) {
|
||
header ($header);
|
||
}
|
||
}
|
||
}
|
||
// Put <base> if necesary
|
||
if ($checkBaseTag) {
|
||