Cleanup #11357: Make use of new t3lib_div::redirect function throughout the core
authorBenni Mack <benni.mack@typo3.org>
Fri, 25 Sep 2009 13:36:38 +0000 (13:36 +0000)
committerBenni Mack <benni.mack@typo3.org>
Fri, 25 Sep 2009 13:36:38 +0000 (13:36 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6053 709f56b5-9817-0410-a4d7-c38de5d9e867

27 files changed:
ChangeLog
typo3/alt_doc.php
typo3/class.db_list.inc
typo3/class.show_rechis.inc
typo3/classes/class.typo3_tcefile.php
typo3/index.php
typo3/index_re.php
typo3/logout.php
typo3/mod/tools/em/class.em_index.php
typo3/mod/user/ws/workspaceforms.php
typo3/sysext/beuser/class.tx_beuser_switchbackuser.php
typo3/sysext/beuser/mod/index.php
typo3/sysext/cms/layout/db_layout.php
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php
typo3/sysext/impexp/app/index.php
typo3/sysext/install/mod/class.tx_install.php
typo3/sysext/openid/class.tx_openid_eid.php
typo3/sysext/openid/sv1/class.tx_openid_sv1.php
typo3/sysext/simulatestatic/class.tx_simulatestatic.php
typo3/sysext/viewpage/view/index.php
typo3/tce_db.php
typo3/wizard_add.php
typo3/wizard_edit.php
typo3/wizard_forms.php
typo3/wizard_list.php
typo3/wizard_table.php

index 89d3fb6..648e88c 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-09-25  Benjamin Mack  <benni@typo3.org>
+
+       * Cleanup #11357: Make use of new t3lib_div::redirect function throughout the core
+
 2009-09-25  Oliver Hader  <oliver@typo3.org>
 
        * Fixed bug #12046: Skinning possibilities are not available with frontend editing
index 1dcf16e..2254ea2 100644 (file)
@@ -1162,8 +1162,7 @@ class SC_alt_doc {
                                $returnUrl = '&returnUrl='.rawurlencode(t3lib_div::_GP('returnUrl'));
                                $location = $GLOBALS['BACK_PATH'].'alt_doc.php?'.$params.$returnUrl;
 
-                               header('Location: '.t3lib_div::locationHeaderUrl($location));
-                               exit;
+                               t3lib_div::redirect($location);
                        }
                }
        }
@@ -1413,8 +1412,7 @@ class SC_alt_doc {
 
                        // If code is NOT set OR set to 1, then make a header location redirect to $this->retUrl
                if (!$code || $code==1) {
-                       Header('Location: '.t3lib_div::locationHeaderUrl($this->retUrl));
-                       exit;
+                       t3lib_div::redirect($this->retUrl);
                } else {
                        $this->setDocument('',$this->retUrl);
                }
@@ -1443,8 +1441,7 @@ class SC_alt_doc {
                                $retUrl = $sParts['path'].'?'.$setupArr[2].'&returnUrl='.rawurlencode($retUrl);
                        }
                }
-               Header('Location: '.t3lib_div::locationHeaderUrl($retUrl));
-               exit;
+               t3lib_div::redirect($retUrl);
        }
 }
 
index ad5c78c..aa61d19 100644 (file)
@@ -819,8 +819,7 @@ class recordList extends t3lib_recordList {
                                $returnUrl = '&returnUrl='.rawurlencode($this->listURL());
                                $location = $GLOBALS['BACK_PATH'].'alt_doc.php?'.$params.$returnUrl;
 
-                               header('Location: '.t3lib_div::locationHeaderUrl($location));
-                               exit;
+                               t3lib_div::redirect($location);
                        }
                }
        }
index 390f6a8..f5d0c86 100644 (file)
@@ -95,8 +95,7 @@ class recordHistory {
                        $this->createChangeLog();
                        $completeDiff = $this->createMultipleDiff();
                        $this->performRollback($completeDiff);
-                       Header ('Location: '.t3lib_div::locationHeaderUrl($this->returnUrl));
-                       exit;
+                       t3lib_div::redirect($this->returnUrl);
                }
 
                        // save snapshot
index 1d0cb66..af0b79a 100644 (file)
@@ -147,7 +147,7 @@ class TYPO3_tcefile {
                $this->fileProcessor->printLogErrorMessages($this->redirect);
                t3lib_BEfunc::getSetUpdateSignal('updateFolderTree');
                if ($this->redirect) {
-                       header('Location: ' . t3lib_div::locationHeaderUrl($this->redirect));
+                       t3lib_div::redirect($this->redirect);
                }
        }
 
index 9e116e7..c2eb8c9 100644 (file)
@@ -384,8 +384,7 @@ class SC_index {
 
                                // If there is a redirect URL AND if loginRefresh is not set...
                        if (!$this->loginRefresh)       {
-                               header('Location: '.t3lib_div::locationHeaderUrl($this->redirectToURL));
-                               exit;
+                               t3lib_div::redirect($this->redirectToURL);
                        } else {
                                $TBE_TEMPLATE->JScode.=$TBE_TEMPLATE->wrapScriptTags('
                                        if (parent.opener && parent.opener.busy)        {
index 3e28627..a2e07a1 100644 (file)
@@ -42,5 +42,5 @@
 
 define('TYPO3_PROCEED_IF_NO_USER', 1);
 require ('init.php');
-header('Location: '.t3lib_div::locationHeaderUrl(t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR').'index.php'));
+t3lib_div::redirect(t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR') . 'index.php'));
 ?>
\ No newline at end of file
index 7bcf341..de810f0 100644 (file)
@@ -72,7 +72,8 @@ class SC_logout {
                $BE_USER->writelog(255,2,0,1,'User %s logged out from TYPO3 Backend',Array($BE_USER->user['username']));        // Logout written to log
                $BE_USER->logoff();
 
-               header('Location: '.t3lib_div::locationHeaderUrl(t3lib_div::_GP('redirect')?t3lib_div::_GP('redirect'):'index.php'));
+               $redirectUrl = (t3lib_div::_GP('redirect') ? t3lib_div::_GP('redirect') : 'index.php');
+               t3lib_div::redirect($redirectUrl);
        }
 }
 
index dab60d5..080d948 100644 (file)
@@ -2589,7 +2589,7 @@ EXTENSION KEYS:
                                $GLOBALS['LANG']->getLL('reqInstExt_imp_inst_ext'), $content, 0, 1
                        );
                } else {
-                       header('Location: '.t3lib_div::locationHeaderUrl($returnUrl));
+                       t3lib_div::redirect($returnUrl);
                }
        }
 
index ea56f4a..a690423 100644 (file)
@@ -193,8 +193,7 @@ class SC_mod_user_ws_workspaceForms extends t3lib_SCbase {
                        // if 'Save&Close' was pressed, redirect to main module script
                        if (t3lib_div::_GP('_saveandclosedok_x')) {
                                // `n` below is to prevent caching
-                               header('Location: ' . t3lib_div::locationHeaderUrl('index.php?n=' . uniqid('')));
-                               exit();
+                               t3lib_div::redirect('index.php?n=' . uniqid(''));
                        }
                }
 
index 0144a05..ce68de0 100644 (file)
@@ -37,9 +37,8 @@ class tx_beuser_switchbackuser {
                                );
                        $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);
 
-                       header('Location: '.t3lib_div::locationHeaderUrl($GLOBALS['BACK_PATH'].'index.php'.($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces']?'':'?commandLI=1')));
-                       exit;
-                       //$GLOBALS['TYPO4
+                       $redirectUrl = $GLOBALS['BACK_PATH'] . 'index.php' . ($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces'] ? '' : '?commandLI=1');
+                       t3lib_div::redirect($redirectUrl);
                }
        }
 }
index cf84e6f..56b0013 100755 (executable)
@@ -1527,8 +1527,8 @@ class SC_mod_tools_be_user_index {
                        }
                        $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);
 
-                       header('Location: '.t3lib_div::locationHeaderUrl($GLOBALS['BACK_PATH'].'index.php'.($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces']?'':'?commandLI=1')));
-                       exit;
+                       $redirectUrl = $GLOBALS['BACK_PATH'] . 'index.php' . ($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces'] ? '' : '?commandLI=1');
+                       t3lib_div::redirect($redirectUrl);
                }
        }
 
index 49a26c9..1106f11 100755 (executable)
@@ -622,8 +622,7 @@ class SC_db_layout {
                        }
 
                        $url = $BACK_PATH.'alt_doc.php?edit[tt_content]['.implode(',',$idListA).']=edit&returnUrl='.rawurlencode($this->local_linkThisScript(array('edit_record'=>'')));
-                       header('Location: '.t3lib_div::locationHeaderUrl($url));
-                       exit;
+                       t3lib_div::redirect($url);
                }
 
                        // If the former record edited was the creation of a NEW record, this will look up the created records uid:
index 9dec5c1..d4cd9a9 100644 (file)
                                $this->printError('Configuration Error: 404 page "'.$readFile.'" could not be found.');
                        }
                } elseif (t3lib_div::isFirstPartOfStr($code,'REDIRECT:')) {
-                       header('Location: '.t3lib_div::locationHeaderUrl(substr($code,9)));
-                       exit;
+                       t3lib_div::redirect(substr($code, 9));
                } elseif (strlen($code))        {
                                // Check if URL is relative
                        $url_parts = parse_url($code);
 
                        if (false === $res) {
                                        // Last chance -- redirect
-                               header('Location: '.t3lib_div::locationHeaderUrl($code));
+                               t3lib_div::redirect($code);
                        } else {
 
                                $forwardHeaders = array(        // Forward these response headers to the client
index 4557d6f..32b2e2c 100644 (file)
@@ -126,8 +126,7 @@ class tx_felogin_pi1 extends tslib_pibase {
                        if (!$GLOBALS['TSFE']->fe_user->cookieId) {
                                $content .= '<p style="color:red; font-weight:bold;">' . $this->pi_getLL('cookie_warning', '', 1) . '</p>';
                        } else {
-                               header('Location: '.t3lib_div::locationHeaderUrl($this->redirectUrl));
-                               exit;
+                               t3lib_div::redirect($this->redirectUrl);
                        }
                }
                return $this->conf['wrapContentInBaseClass'] ? $this->pi_wrapInBaseClass($content) : $content;
index 04b9cf7..59348f2 100755 (executable)
@@ -1298,8 +1298,7 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                                                        $import->importData($this->id);
                                                        t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
                                                } else {
-                                                       header('Location: '.t3lib_div::locationHeaderUrl($emURL));
-                                                       exit;
+                                                       t3lib_div::redirect($emURL);
                                                }
                                        }
 
index b6e4104..8d90d21 100755 (executable)
@@ -2261,8 +2261,8 @@ From sub-directory:
         * @return      [type]          ...
         */
        function outputExitBasedOnStep($content)        {
-               if ($this->step)        {
-                       Header('Location: '.t3lib_div::locationHeaderUrl($this->action));
+               if ($this->step) {
+                       t3lib_div::redirect($this->action);
                } else {
                        $this->output($this->outputWrapper($content));
                }
index 3ddd424..5683c5d 100644 (file)
@@ -61,9 +61,7 @@ class tx_openid_eID {
 
                // Redirect to the original location in any case (authenticated or not)
                @ob_end_clean();
-               header(t3lib_div::HTTP_STATUS_303);
-               header('Location: ' . t3lib_div::locationHeaderUrl(t3lib_div::_GP('tx_openid_location')));
-               exit;
+               t3lib_div::redirect(t3lib_div::_GP('tx_openid_location'), t3lib_div::HTTP_STATUS_303);
        }
 }
 
index 8273894..53ae2fa 100644 (file)
@@ -371,8 +371,7 @@ class tx_openid_sv1 extends t3lib_svbase {
                        // 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();
-                       header(t3lib_div::HTTP_STATUS_303);
-                       header('Location: ' . $redirectURL);
+                       t3lib_div::redirect($redirectURL, t3lib_div::HTTP_STATUS_303);
                } else {
                        $formHtml = $authenticationRequest->htmlMarkup($trustedRoot,
                                                        $returnURL, false, array('id' => 'openid_message'));
index 0a4c28c..20fb602 100644 (file)
@@ -110,7 +110,7 @@ class tx_simulatestatic {
                                        $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(t3lib_div::locationHeaderUrl($redirectUrl));
+                               t3lib_div::redirect($redirectUrl);
                        }
                        exit;
                        // Set no_cache if PATH_INFO is NOT used as simulateStaticDoc.
index 500b264..6526584 100755 (executable)
@@ -124,7 +124,7 @@ class SC_mod_web_view_index {
         * @return      void
         */
        function printContent() {
-               Header('Location: '.t3lib_div::locationHeaderUrl($this->url));
+               t3lib_div::redirect($this->url);
        }
 }
 
index fcd8061..f8266a1 100644 (file)
@@ -227,7 +227,7 @@ class SC_tce_db {
                }
 
                if ($this->redirect && !$this->tce->debug) {
-                       Header('Location: '.t3lib_div::locationHeaderUrl($this->redirect));
+                       t3lib_div::redirect($this->redirect);
                }
        }
 }
index 93e6305..d8525cc 100644 (file)
@@ -122,8 +122,7 @@ class SC_wizard_add {
 
                        // Return if new record as parent (not possibly/allowed)
                if (!strcmp($this->pid,''))     {
-                       header('Location: '.t3lib_div::locationHeaderUrl($this->P['returnUrl']));
-                       exit;
+                       t3lib_div::redirect($this->P['returnUrl']);
                }
 
                        // Else proceed:
@@ -215,10 +214,12 @@ class SC_wizard_add {
                                }
                        }
                                // Return to the parent alt_doc.php record editing session:
-                       header('Location: '.t3lib_div::locationHeaderUrl($this->P['returnUrl']));
+                       t3lib_div::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.
-                       header('Location: '.t3lib_div::locationHeaderUrl('alt_doc.php?returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')).'&returnEditConf=1&edit['.$this->P['params']['table'].']['.$this->pid.']=new'));
+                               // 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);
                }
        }
 }
index 6950e70..83bc9d0 100644 (file)
@@ -103,7 +103,8 @@ class SC_wizard_edit {
 
                                // 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:
-                               header('Location: '.t3lib_div::locationHeaderUrl('alt_doc.php?returnUrl='.rawurlencode('wizard_edit.php?doClose=1').'&edit['.$fTable.']['.$this->P['currentValue'].']=edit'));
+                               $redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . '&edit[' . $fTable . '][' . $this->P['currentValue'] . ']=edit';
+                               t3lib_div::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:
@@ -123,7 +124,7 @@ class SC_wizard_edit {
                                }
 
                                        // Redirect to alt_doc.php:
-                               header('Location: '.t3lib_div::locationHeaderUrl('alt_doc.php?returnUrl='.rawurlencode('wizard_edit.php?doClose=1').$params));
+                               t3lib_div::redirect('alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . $params);
                        } else {
                                $this->closeWindow();
                        }
index 7090cd0..f94ecc6 100644 (file)
@@ -400,9 +400,8 @@ class SC_wizard_forms {
                                $row = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
 
                                        // If the save/close button was pressed, then redirect the screen:
-                               if ($_POST['saveandclosedok_x'])        {
-                                       header('Location: '.t3lib_div::locationHeaderUrl($this->P['returnUrl']));
-                                       exit;
+                               if ($_POST['saveandclosedok_x']) {
+                                       t3lib_div::redirect($this->P['returnUrl']);
                                }
                        }
                } else {        // If nothing has been submitted, load the $bodyText variable from the selected database row:
index 49486ce..f629b0f 100644 (file)
@@ -117,10 +117,11 @@ class SC_wizard_list {
 
                        // Make redirect:
                if (!strcmp($this->pid,'') || strcmp($this->id,''))     {       // If pid is blank OR if id is set, then return...
-                       header('Location: '.t3lib_div::locationHeaderUrl($this->P['returnUrl']));
+                       $redirectUrl = $this->P['returnUrl'];
                } else {        // Otherwise, show the list:
-                       header('Location: '.t3lib_div::locationHeaderUrl('db_list.php?id='.$this->pid.'&table='.$this->P['params']['table'].'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))));
+                       $redirectUrl = 'db_list.php?id=' . $this->pid . '&table=' . $this->P['params']['table'] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
                }
+               t3lib_div::redirect($redirectUrl);
        }
 }
 
index 35b7ae2..4185a58 100644 (file)
@@ -318,9 +318,8 @@ class SC_wizard_table {
                                $tce->process_datamap();
 
                                        // If the save/close button was pressed, then redirect the screen:
-                               if ($_POST['saveandclosedok_x'])        {
-                                       header('Location: '.t3lib_div::locationHeaderUrl($this->P['returnUrl']));
-                                       exit;
+                               if ($_POST['saveandclosedok_x']) {
+                                       t3lib_div::redirect($this->P['returnUrl']);
                                }
                        }
                } else {        // If nothing has been submitted, load the $bodyText variable from the selected database row: