Bug #21599 ยป t3lib_utility_Http.diff
typo3/wizard_add.php (working copy) | ||
---|---|---|
// Return if new record as parent (not possibly/allowed)
|
||
if (!strcmp($this->pid,'')) {
|
||
t3lib_div::redirect($this->P['returnUrl']);
|
||
t3lib_utility_Http::redirect($this->P['returnUrl']);
|
||
}
|
||
// Else proceed:
|
||
... | ... | |
}
|
||
}
|
||
// Return to the parent alt_doc.php record editing session:
|
||
t3lib_div::redirect($this->P['returnUrl']);
|
||
t3lib_utility_Http::redirect($this->P['returnUrl']);
|
||
} else {
|
||
// Redirecting to alt_doc.php with instructions to create a new record
|
||
// AND when closing to return back with information about that records ID etc.
|
||
$redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '&returnEditConf=1&edit[' . $this->P['params']['table'] . '][' . $this->pid . ']=new';
|
||
t3lib_div::redirect($redirectUrl);
|
||
t3lib_utility_Http::redirect($redirectUrl);
|
||
}
|
||
}
|
||
}
|
typo3/logout.php (working copy) | ||
---|---|---|
$BE_USER->logoff();
|
||
$redirectUrl = (t3lib_div::_GP('redirect') ? t3lib_div::_GP('redirect') : 'index.php');
|
||
t3lib_div::redirect($redirectUrl);
|
||
t3lib_utility_Http::redirect($redirectUrl);
|
||
}
|
||
}
|
||
typo3/index.php (working copy) | ||
---|---|---|
if ($this->L == 'OUT' && is_object($GLOBALS['BE_USER'])) {
|
||
$GLOBALS['BE_USER']->logoff();
|
||
if ($this->redirect_url) {
|
||
t3lib_div::redirect($this->redirect_url);
|
||
t3lib_utility_Http::redirect($this->redirect_url);
|
||
}
|
||
exit;
|
||
}
|
||
... | ... | |
// If there is a redirect URL AND if loginRefresh is not set...
|
||
if (!$this->loginRefresh) {
|
||
t3lib_div::redirect($this->redirectToURL);
|
||
t3lib_utility_Http::redirect($this->redirectToURL);
|
||
} else {
|
||
$TBE_TEMPLATE->JScode.=$TBE_TEMPLATE->wrapScriptTags('
|
||
if (parent.opener && (parent.opener.busy || parent.opener.TYPO3.loginRefresh)) {
|
typo3/wizard_table.php (working copy) | ||
---|---|---|
// If the save/close button was pressed, then redirect the screen:
|
||
if ($_POST['saveandclosedok_x']) {
|
||
t3lib_div::redirect($this->P['returnUrl']);
|
||
t3lib_utility_Http::redirect($this->P['returnUrl']);
|
||
}
|
||
}
|
||
} else { // If nothing has been submitted, load the $bodyText variable from the selected database row:
|
typo3/alt_doc.php (working copy) | ||
---|---|---|
$returnUrl = '&returnUrl='.rawurlencode(t3lib_div::_GP('returnUrl'));
|
||
$location = $GLOBALS['BACK_PATH'].'alt_doc.php?'.$params.$returnUrl;
|
||
t3lib_div::redirect($location);
|
||
t3lib_utility_Http::redirect($location);
|
||
}
|
||
}
|
||
}
|
||
... | ... | |
// If code is NOT set OR set to 1, then make a header location redirect to $this->retUrl
|
||
if (!$code || $code==1) {
|
||
t3lib_div::redirect($this->retUrl);
|
||
t3lib_utility_Http::redirect($this->retUrl);
|
||
} else {
|
||
$this->setDocument('',$this->retUrl);
|
||
}
|
||
... | ... | |
$retUrl = $sParts['path'].'?'.$setupArr[2].'&returnUrl='.rawurlencode($retUrl);
|
||
}
|
||
}
|
||
t3lib_div::redirect($retUrl);
|
||
t3lib_utility_Http::redirect($retUrl);
|
||
}
|
||
}
|
||
typo3/wizard_list.php (working copy) | ||
---|---|---|
} else { // Otherwise, show the list:
|
||
$redirectUrl = 'db_list.php?id=' . $this->pid . '&table=' . $this->P['params']['table'] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
|
||
}
|
||
t3lib_div::redirect($redirectUrl);
|
||
t3lib_utility_Http::redirect($redirectUrl);
|
||
}
|
||
}
|
||
typo3/index_re.php (working copy) | ||
---|---|---|
define('TYPO3_PROCEED_IF_NO_USER', 1);
|
||
require ('init.php');
|
||
t3lib_div::redirect(t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR') . 'index.php');
|
||
t3lib_utility_Http::redirect(t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR') . 'index.php');
|
||
?>
|
typo3/tce_db.php (working copy) | ||
---|---|---|
}
|
||
if ($this->redirect && !$this->tce->debug) {
|
||
t3lib_div::redirect($this->redirect);
|
||
t3lib_utility_Http::redirect($this->redirect);
|
||
}
|
||
}
|
||
}
|
typo3/wizard_edit.php (working copy) | ||
---|---|---|
// Detecting the various allowed field type setups and acting accordingly.
|
||
if (is_array($config) && $config['type']=='select' && !$config['MM'] && $config['maxitems']<=1 && t3lib_div::testInt($this->P['currentValue']) && $this->P['currentValue'] && $fTable) { // SINGLE value:
|
||
$redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . '&edit[' . $fTable . '][' . $this->P['currentValue'] . ']=edit';
|
||
t3lib_div::redirect($redirectUrl);
|
||
t3lib_utility_Http::redirect($redirectUrl);
|
||
} elseif (is_array($config) && $this->P['currentSelectedValues'] && (($config['type']=='select' && $config['foreign_table']) || ($config['type']=='group' && $config['internal_type']=='db'))) { // MULTIPLE VALUES:
|
||
// Init settings:
|
||
... | ... | |
}
|
||
// Redirect to alt_doc.php:
|
||
t3lib_div::redirect('alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . $params);
|
||
t3lib_utility_Http::redirect('alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . $params);
|
||
} else {
|
||
$this->closeWindow();
|
||
}
|
typo3/wizard_forms.php (working copy) | ||
---|---|---|
// If the save/close button was pressed, then redirect the screen:
|
||
if ($_POST['saveandclosedok_x']) {
|
||
t3lib_div::redirect($this->P['returnUrl']);
|
||
t3lib_utility_Http::redirect($this->P['returnUrl']);
|
||
}
|
||
}
|
||
} else { // If nothing has been submitted, load the $bodyText variable from the selected database row:
|
typo3/mod/user/ws/workspaceforms.php (working copy) | ||
---|---|---|
// if 'Save&Close' was pressed, redirect to main module script
|
||
if (t3lib_div::_GP('_saveandclosedok_x')) {
|
||
// `n` below is to prevent caching
|
||
t3lib_div::redirect('index.php?n=' . uniqid(''));
|
||
t3lib_utility_Http::redirect('index.php?n=' . uniqid(''));
|
||
}
|
||
}
|
||
typo3/mod/tools/em/class.em_index.php (working copy) | ||
---|---|---|
$GLOBALS['LANG']->getLL('reqInstExt_imp_inst_ext'), $content, 0, 1
|
||
);
|
||
} else {
|
||
t3lib_div::redirect($returnUrl);
|
||
t3lib_utility_Http::redirect($returnUrl);
|
||
}
|
||
}
|
||
typo3/classes/class.typo3_tcefile.php (working copy) | ||
---|---|---|
$this->fileProcessor->printLogErrorMessages($this->redirect);
|
||
t3lib_BEfunc::getSetUpdateSignal('updateFolderTree');
|
||
if ($this->redirect) {
|
||
t3lib_div::redirect($this->redirect);
|
||
t3lib_utility_Http::redirect($this->redirect);
|
||
}
|
||
}
|
||
typo3/classes/class.typo3ajax.php (working copy) | ||
---|---|---|
* @return void
|
||
*/
|
||
protected function renderAsError() {
|
||
header(t3lib_div::HTTP_STATUS_500 . ' (AJAX)');
|
||
header(t3lib_utility_Http::HTTP_STATUS_500 . ' (AJAX)');
|
||
header('Content-type: text/xml; charset='.$this->charset);
|
||
header('X-JSON: false');
|
||
die('<t3err>'.htmlspecialchars($this->errorMessage).'</t3err>');
|
typo3/sysext/install/mod/class.tx_install.php (working copy) | ||
---|---|---|
*/
|
||
function outputExitBasedOnStep($content) {
|
||
if ($this->step) {
|
||
t3lib_div::redirect($this->action);
|
||
t3lib_utility_Http::redirect($this->action);
|
||
} else {
|
||
$this->output($this->outputWrapper($content));
|
||
}
|
typo3/sysext/viewpage/view/index.php (working copy) | ||
---|---|---|
* @return void
|
||
*/
|
||
function printContent() {
|
||
t3lib_div::redirect($this->url);
|
||
t3lib_utility_Http::redirect($this->url);
|
||
}
|
||
}
|
||
typo3/sysext/openid/class.tx_openid_eid.php (working copy) | ||
---|---|---|
// Redirect to the original location in any case (authenticated or not)
|
||
@ob_end_clean();
|
||
t3lib_div::redirect(t3lib_div::_GP('tx_openid_location'), t3lib_div::HTTP_STATUS_303);
|
||
t3lib_utility_Http::redirect(t3lib_div::_GP('tx_openid_location'), t3lib_utility_Http::HTTP_STATUS_303);
|
||
}
|
||
}
|
||
typo3/sysext/openid/sv1/class.tx_openid_sv1.php (working copy) | ||
---|---|---|
// requests without resending the form. This is exactly what we need here.
|
||
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4
|
||
@ob_end_clean();
|
||
t3lib_div::redirect($redirectURL, t3lib_div::HTTP_STATUS_303);
|
||
t3lib_utility_Http::redirect($redirectURL, t3lib_utility_Http::HTTP_STATUS_303);
|
||
} else {
|
||
$formHtml = $authenticationRequest->htmlMarkup($trustedRoot,
|
||
$returnURL, false, array('id' => 'openid_message'));
|
typo3/sysext/openid/class.tx_openid_return.php (working copy) | ||
---|---|---|
@ob_end_clean();
|
||
}
|
||
$backendURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'backend.php';
|
||
t3lib_div::redirect($backendURL);
|
||
t3lib_utility_Http::redirect($backendURL);
|
||
}
|
||
}
|
||
}
|
typo3/sysext/cms/layout/db_layout.php (working copy) | ||
---|---|---|
}
|
||
$url = $BACK_PATH.'alt_doc.php?edit[tt_content]['.implode(',',$idListA).']=edit&returnUrl='.rawurlencode($this->local_linkThisScript(array('edit_record'=>'')));
|
||
t3lib_div::redirect($url);
|
||
t3lib_utility_Http::redirect($url);
|
||
}
|
||
// If the former record edited was the creation of a NEW record, this will look up the created records uid:
|
typo3/sysext/cms/tslib/class.tslib_fe.php (working copy) | ||
---|---|---|
$this->printError('Configuration Error: 404 page "'.$readFile.'" could not be found.');
|
||
}
|
||
} elseif (t3lib_div::isFirstPartOfStr($code,'REDIRECT:')) {
|
||
t3lib_div::redirect(substr($code, 9));
|
||
t3lib_utility_Http::redirect(substr($code, 9));
|
||
} elseif (strlen($code)) {
|
||
// Check if URL is relative
|
||
$url_parts = parse_url($code);
|
||
... | ... | |
if (false === $res) {
|
||
// Last chance -- redirect
|
||
t3lib_div::redirect($code);
|
||
t3lib_utility_Http::redirect($code);
|
||
} else {
|
||
$forwardHeaders = array( // Forward these response headers to the client
|
||
... | ... | |
if ($TSConf['TSFE.']['jumpURL_HTTPStatusCode']) {
|
||
switch (intval($TSConf['TSFE.']['jumpURL_HTTPStatusCode'])){
|
||
case 301:
|
||
header(t3lib_div::HTTP_STATUS_301);
|
||
header(t3lib_utility_Http::HTTP_STATUS_301);
|
||
break;
|
||
case 302:
|
||
header(t3lib_div::HTTP_STATUS_302);
|
||
header(t3lib_utility_Http::HTTP_STATUS_302);
|
||
break;
|
||
case 303:
|
||
header(t3lib_div::HTTP_STATUS_303);
|
||
header(t3lib_utility_Http::HTTP_STATUS_303);
|
||
break;
|
||
case 307:
|
||
header(t3lib_div::HTTP_STATUS_307);
|
||
header(t3lib_utility_Http::HTTP_STATUS_307);
|
||
break;
|
||
default:
|
||
break;
|
typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php (working copy) | ||
---|---|---|
if (!$GLOBALS['TSFE']->fe_user->cookieId) {
|
||
$content .= '<p style="color:red; font-weight:bold;">' . $this->pi_getLL('cookie_warning', '', 1) . '</p>';
|
||
} else {
|
||
t3lib_div::redirect($this->redirectUrl);
|
||
t3lib_utility_Http::redirect($this->redirectUrl);
|
||
}
|
||
}
|
||
return $this->conf['wrapContentInBaseClass'] ? $this->pi_wrapInBaseClass($content) : $content;
|
typo3/sysext/simulatestatic/class.tx_simulatestatic.php (working copy) | ||
---|---|---|
$parentObject->pageUnavailableAndExit('PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!');
|
||
} else {
|
||
$message = 'PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!';
|
||
header(t3lib_div::HTTP_STATUS_503);
|
||
header(t3lib_utility_Http::HTTP_STATUS_503);
|
||
t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
|
||
$parentObject->printError($message.'<br /><br /><a href="' . htmlspecialchars($redirectUrl) . '">Click here to get to the right page.</a>','Error: PATH_INFO not configured');
|
||
}
|
||
} else {
|
||
t3lib_div::redirect($redirectUrl);
|
||
t3lib_utility_Http::redirect($redirectUrl);
|
||
}
|
||
exit;
|
||
// Set no_cache if PATH_INFO is NOT used as simulateStaticDoc.
|
typo3/sysext/impexp/app/index.php (working copy) | ||
---|---|---|
$import->importData($this->id);
|
||
t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
|
||
} else {
|
||
t3lib_div::redirect($emURL);
|
||
t3lib_utility_Http::redirect($emURL);
|
||
}
|
||
}
|
||
typo3/sysext/beuser/class.tx_beuser_switchbackuser.php (working copy) | ||
---|---|---|
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_sessions', 'ses_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['BE_USER']->id, 'be_sessions').' AND ses_name=\'be_typo_user\' AND ses_userid='.intval($GLOBALS['BE_USER']->user['uid']),$updateData);
|
||
$redirectUrl = $GLOBALS['BACK_PATH'] . 'index.php' . ($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces'] ? '' : '?commandLI=1');
|
||
t3lib_div::redirect($redirectUrl);
|
||
t3lib_utility_Http::redirect($redirectUrl);
|
||
}
|
||
}
|
||
}
|
typo3/sysext/beuser/mod/index.php (working copy) | ||
---|---|---|
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_sessions', 'ses_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['BE_USER']->id, 'be_sessions').' AND ses_name=\'be_typo_user\' AND ses_userid='.intval($GLOBALS['BE_USER']->user['uid']),$updateData);
|
||
$redirectUrl = $GLOBALS['BACK_PATH'] . 'index.php' . ($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces'] ? '' : '?commandLI=1');
|
||
t3lib_div::redirect($redirectUrl);
|
||
t3lib_utility_Http::redirect($redirectUrl);
|
||
}
|
||
}
|
||
t3lib/class.t3lib_beuserauth.php (working copy) | ||
---|---|---|
function backendCheckLogin() {
|
||
if (!$this->user['uid']) {
|
||
if (!defined('TYPO3_PROCEED_IF_NO_USER') || !TYPO3_PROCEED_IF_NO_USER) {
|
||
t3lib_div::redirect($GLOBALS['BACK_PATH']);
|
||
t3lib_utility_Http::redirect($GLOBALS['BACK_PATH']);
|
||
}
|
||
} else { // ...and if that's the case, call these functions
|
||
$this->fetchGroupData(); // The groups are fetched and ready for permission checking in this initialization. Tables.php must be read before this because stuff like the modules has impact in this
|
t3lib/class.t3lib_div.php (working copy) | ||
---|---|---|
const SYSLOG_SEVERITY_ERROR = 3;
|
||
const SYSLOG_SEVERITY_FATAL = 4;
|
||
// HTTP Headers, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for Details
|
||
const HTTP_STATUS_100 = 'HTTP/1.1 100 Continue';
|
||
const HTTP_STATUS_101 = 'HTTP/1.1 101 Switching Protocols';
|
||
const HTTP_STATUS_200 = 'HTTP/1.1 200 OK';
|
||
const HTTP_STATUS_201 = 'HTTP/1.1 201 Created';
|
||
const HTTP_STATUS_202 = 'HTTP/1.1 202 Accepted';
|
||
const HTTP_STATUS_203 = 'HTTP/1.1 203 Non-Authoritative Information';
|
||
const HTTP_STATUS_204 = 'HTTP/1.1 204 No Content';
|
||
const HTTP_STATUS_205 = 'HTTP/1.1 205 Reset Content';
|
||
const HTTP_STATUS_206 = 'HTTP/1.1 206 Partial Content';
|
||
const HTTP_STATUS_300 = 'HTTP/1.1 300 Multiple Choices';
|
||
const HTTP_STATUS_301 = 'HTTP/1.1 301 Moved Permanently';
|
||
const HTTP_STATUS_302 = 'HTTP/1.1 302 Found';
|
||
const HTTP_STATUS_303 = 'HTTP/1.1 303 See Other';
|
||
const HTTP_STATUS_304 = 'HTTP/1.1 304 Not Modified';
|
||
const HTTP_STATUS_305 = 'HTTP/1.1 305 Use Proxy';
|
||
const HTTP_STATUS_307 = 'HTTP/1.1 307 Temporary Redirect';
|
||
const HTTP_STATUS_400 = 'HTTP/1.1 400 Bad Request';
|
||
const HTTP_STATUS_401 = 'HTTP/1.1 401 Unauthorized';
|
||
const HTTP_STATUS_402 = 'HTTP/1.1 402 Payment Required';
|
||
const HTTP_STATUS_403 = 'HTTP/1.1 403 Forbidden';
|
||
const HTTP_STATUS_404 = 'HTTP/1.1 404 Not Found';
|
||
const HTTP_STATUS_405 = 'HTTP/1.1 405 Method Not Allowed';
|
||
const HTTP_STATUS_406 = 'HTTP/1.1 406 Not Acceptable';
|
||
const HTTP_STATUS_407 = 'HTTP/1.1 407 Proxy Authentication Required';
|
||
const HTTP_STATUS_408 = 'HTTP/1.1 408 Request Timeout';
|
||
const HTTP_STATUS_409 = 'HTTP/1.1 409 Conflict';
|
||
const HTTP_STATUS_410 = 'HTTP/1.1 410 Gone';
|
||
const HTTP_STATUS_411 = 'HTTP/1.1 411 Length Required';
|
||
const HTTP_STATUS_412 = 'HTTP/1.1 412 Precondition Failed';
|
||
const HTTP_STATUS_413 = 'HTTP/1.1 413 Request Entity Too Large';
|
||
const HTTP_STATUS_414 = 'HTTP/1.1 414 Request-URI Too Long';
|
||
const HTTP_STATUS_415 = 'HTTP/1.1 415 Unsupported Media Type';
|
||
const HTTP_STATUS_416 = 'HTTP/1.1 416 Requested Range Not Satisfiable';
|
||
const HTTP_STATUS_417 = 'HTTP/1.1 417 Expectation Failed';
|
||
const HTTP_STATUS_500 = 'HTTP/1.1 500 Internal Server Error';
|
||
const HTTP_STATUS_501 = 'HTTP/1.1 501 Not Implemented';
|
||
const HTTP_STATUS_502 = 'HTTP/1.1 502 Bad Gateway';
|
||
const HTTP_STATUS_503 = 'HTTP/1.1 503 Service Unavailable';
|
||
const HTTP_STATUS_504 = 'HTTP/1.1 504 Gateway Timeout';
|
||
const HTTP_STATUS_505 = 'HTTP/1.1 505 Version Not Supported';
|
||
/*************************
|
||
*
|
||
... | ... | |
}
|
||
/**
|
||
* Sends a redirect header response and exits. Additionaly the URL is
|
||
* checked and if needed corrected to match the format required for a
|
||
* Location redirect header. By default the HTTP status code sent is
|
||
* a 'HTTP/1.1 303 See Other'.
|
||
*
|
||
* @param string The target URL to redirect to
|
||
* @param string An optional HTTP status header. Default is 'HTTP/1.1 303 See Other'
|
||
*/
|
||
public static function redirect($url, $httpStatus = t3lib_div::HTTP_STATUS_303) {
|
||
header($httpStatus);
|
||
header('Location: ' . t3lib_div::locationHeaderUrl($url));
|
||
exit;
|
||
}
|
||
/**
|
||
* Abstraction method which returns System Environment Variables regardless of server OS, CGI/MODULE version etc. Basically this is SERVER variables for most of them.
|
||
* This should be used instead of getEnv() and $_SERVER/ENV_VARS to get reliable values for all situations.
|
||
* Usage: 221
|
t3lib/class.t3lib_page.php (working copy) | ||
---|---|---|
}
|
||
$statusCode = intval($row['redirectHttpStatusCode']);
|
||
if ($statusCode && defined('t3lib_div::HTTP_STATUS_' . $statusCode)) {
|
||
t3lib_div::redirect($redirectUrl, constant('t3lib_div::HTTP_STATUS_' . $statusCode));
|
||
if ($statusCode && defined('t3lib_utility_Http::HTTP_STATUS_' . $statusCode)) {
|
||
t3lib_utility_Http::redirect($redirectUrl, constant('t3lib_utility_Http::HTTP_STATUS_' . $statusCode));
|
||
} else {
|
||
t3lib_div::redirect($redirectUrl, 't3lib_div::HTTP_STATUS_301');
|
||
t3lib_utility_Http::redirect($redirectUrl, 't3lib_utility_Http::HTTP_STATUS_301');
|
||
}
|
||
exit;
|
||
} else {
|
t3lib/utility/class.t3lib_utility_http.php (revision 0) | ||
---|---|---|
<?php
|
||
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2009 Ingo Renner <ingo@typo3.org>
|
||
* All rights reserved
|
||
*
|
||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||
* free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* The GNU General Public License can be found at
|
||
* http://www.gnu.org/copyleft/gpl.html.
|
||
*
|
||
* This script is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
/**
|
||
* HTTP Utility class
|
||
*
|
||
* @author Ingo Renner <ingo@typo3.org>
|
||
* @package TYPO3
|
||
* @subpackage t3lib
|
||
*/
|
||
class t3lib_utility_Http {
|
||
// HTTP Headers, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for Details
|
||
const HTTP_STATUS_100 = 'HTTP/1.1 100 Continue';
|
||
const HTTP_STATUS_101 = 'HTTP/1.1 101 Switching Protocols';
|
||
const HTTP_STATUS_200 = 'HTTP/1.1 200 OK';
|
||
const HTTP_STATUS_201 = 'HTTP/1.1 201 Created';
|
||
const HTTP_STATUS_202 = 'HTTP/1.1 202 Accepted';
|
||
const HTTP_STATUS_203 = 'HTTP/1.1 203 Non-Authoritative Information';
|
||
const HTTP_STATUS_204 = 'HTTP/1.1 204 No Content';
|
||
const HTTP_STATUS_205 = 'HTTP/1.1 205 Reset Content';
|
||
const HTTP_STATUS_206 = 'HTTP/1.1 206 Partial Content';
|
||
const HTTP_STATUS_300 = 'HTTP/1.1 300 Multiple Choices';
|
||
const HTTP_STATUS_301 = 'HTTP/1.1 301 Moved Permanently';
|
||
const HTTP_STATUS_302 = 'HTTP/1.1 302 Found';
|
||
const HTTP_STATUS_303 = 'HTTP/1.1 303 See Other';
|
||
const HTTP_STATUS_304 = 'HTTP/1.1 304 Not Modified';
|
||
const HTTP_STATUS_305 = 'HTTP/1.1 305 Use Proxy';
|
||
const HTTP_STATUS_307 = 'HTTP/1.1 307 Temporary Redirect';
|
||
const HTTP_STATUS_400 = 'HTTP/1.1 400 Bad Request';
|
||
const HTTP_STATUS_401 = 'HTTP/1.1 401 Unauthorized';
|
||
const HTTP_STATUS_402 = 'HTTP/1.1 402 Payment Required';
|
||
const HTTP_STATUS_403 = 'HTTP/1.1 403 Forbidden';
|
||
const HTTP_STATUS_404 = 'HTTP/1.1 404 Not Found';
|
||
const HTTP_STATUS_405 = 'HTTP/1.1 405 Method Not Allowed';
|
||
const HTTP_STATUS_406 = 'HTTP/1.1 406 Not Acceptable';
|
||
const HTTP_STATUS_407 = 'HTTP/1.1 407 Proxy Authentication Required';
|
||
const HTTP_STATUS_408 = 'HTTP/1.1 408 Request Timeout';
|
||
const HTTP_STATUS_409 = 'HTTP/1.1 409 Conflict';
|
||
const HTTP_STATUS_410 = 'HTTP/1.1 410 Gone';
|
||
const HTTP_STATUS_411 = 'HTTP/1.1 411 Length Required';
|
||
const HTTP_STATUS_412 = 'HTTP/1.1 412 Precondition Failed';
|
||
const HTTP_STATUS_413 = 'HTTP/1.1 413 Request Entity Too Large';
|
||
const HTTP_STATUS_414 = 'HTTP/1.1 414 Request-URI Too Long';
|
||
const HTTP_STATUS_415 = 'HTTP/1.1 415 Unsupported Media Type';
|
||
const HTTP_STATUS_416 = 'HTTP/1.1 416 Requested Range Not Satisfiable';
|
||
const HTTP_STATUS_417 = 'HTTP/1.1 417 Expectation Failed';
|
||
const HTTP_STATUS_500 = 'HTTP/1.1 500 Internal Server Error';
|
||
const HTTP_STATUS_501 = 'HTTP/1.1 501 Not Implemented';
|
||
const HTTP_STATUS_502 = 'HTTP/1.1 502 Bad Gateway';
|
||
const HTTP_STATUS_503 = 'HTTP/1.1 503 Service Unavailable';
|
||
const HTTP_STATUS_504 = 'HTTP/1.1 504 Gateway Timeout';
|
||
const HTTP_STATUS_505 = 'HTTP/1.1 505 Version Not Supported';
|
||
/**
|
||
* Sends a redirect header response and exits. Additionaly the URL is
|
||
* checked and if needed corrected to match the format required for a
|
||
* Location redirect header. By default the HTTP status code sent is
|
||
* a 'HTTP/1.1 303 See Other'.
|
||
*
|
||
* @param string The target URL to redirect to
|
||
* @param string An optional HTTP status header. Default is 'HTTP/1.1 303 See Other'
|
||
*/
|
||
public static function redirect($url, $httpStatus = t3lib_utility_Http::HTTP_STATUS_303) {
|
||
header($httpStatus);
|
||
header('Location: ' . t3lib_div::locationHeaderUrl($url));
|
||
exit;
|
||
}
|
||
}
|
||
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/utility/class.t3lib_utility_http.php']) {
|
||
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/utility/class.t3lib_utility_http.php']);
|
||
}
|
||
?>
|