[!!!][TASK] Remove RDCT redirect functionality
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Classes / Hook / PreviewHook.php
index 2a12e79..b06dacc 100644 (file)
@@ -63,7 +63,6 @@ class PreviewHook implements \TYPO3\CMS\Core\SingletonInterface
      *
      * @param array $params (not needed right now)
      * @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj
-     * @return void
      */
     public function checkForPreview($params, &$pObj)
     {
@@ -82,8 +81,7 @@ class PreviewHook implements \TYPO3\CMS\Core\SingletonInterface
                 GeneralUtility::_GP('no_cache'),
                 GeneralUtility::_GP('cHash'),
                 null,
-                GeneralUtility::_GP('MP'),
-                GeneralUtility::_GP('RDCT')
+                GeneralUtility::_GP('MP')
             );
             $GLOBALS['TSFE'] = $this->tsfeObj;
             // Configuration after initialization of TSFE object.
@@ -102,7 +100,6 @@ class PreviewHook implements \TYPO3\CMS\Core\SingletonInterface
      *
      * @param array $params holding the BE_USER object
      * @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj
-     * @return void
      */
     public function initializePreviewUser(&$params, &$pObj)
     {
@@ -242,7 +239,7 @@ class PreviewHook implements \TYPO3\CMS\Core\SingletonInterface
         // If input code is available and shall not be ignored, look up the settings
         if ($inputCode && $inputCode !== 'IGNORE') {
             // "log out"
-            if ($inputCode == 'LOGOUT') {
+            if ($inputCode === 'LOGOUT') {
                 setcookie($this->previewKey, '', 0, GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
                 if ($GLOBALS['TYPO3_CONF_VARS']['FE']['workspacePreviewLogoutTemplate']) {
                     $templateFile = PATH_site . $GLOBALS['TYPO3_CONF_VARS']['FE']['workspacePreviewLogoutTemplate'];
@@ -302,29 +299,27 @@ class PreviewHook implements \TYPO3\CMS\Core\SingletonInterface
                         if (GeneralUtility::_GP($this->previewKey)) {
                             // Lifetime is 1 hour, does it matter much?
                             // Requires the user to click the link from their email again if it expires.
-                            setcookie($this->previewKey, GeneralUtility::_GP($this->previewKey), 0, GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
+                            setcookie($this->previewKey, GeneralUtility::_GP($this->previewKey), 0, GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'), null, null, true);
                         }
                         return $previewConfig;
-                    } elseif (GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?' . $this->previewKey . '=' . $inputCode === GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')) {
+                    }
+                    if (GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?' . $this->previewKey . '=' . $inputCode === GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')) {
                         // Set GET variables
                         $GET_VARS = '';
                         parse_str($previewConfig['getVars'], $GET_VARS);
                         GeneralUtility::_GETset($GET_VARS);
                         // Return preview keyword configuration
                         return $previewConfig;
-                    } else {
-                        // This check is to prevent people from setting additional
-                        // GET vars via realurl or other URL path based ways of passing parameters.
-                        throw new \Exception(htmlspecialchars('Request URL did not match "'
+                    }
+                    // This check is to prevent people from setting additional
+                    // GET vars via realurl or other URL path based ways of passing parameters.
+                    throw new \Exception(htmlspecialchars('Request URL did not match "'
                             . GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?' . $this->previewKey . '='
                             . $inputCode . '"', 1294585190));
-                    }
-                } else {
-                    throw new \Exception('POST requests are incompatible with keyword preview.', 1294585191);
                 }
-            } else {
-                throw new \Exception('ADMCMD command could not be executed! (No keyword configuration found)', 1294585192);
+                throw new \Exception('POST requests are incompatible with keyword preview.', 1294585191);
             }
+            throw new \Exception('ADMCMD command could not be executed! (No keyword configuration found)', 1294585192);
         }
         return false;
     }