[TASK] Move FEworkspace code into versioning / part 2
authorBenjamin Mack <benni@typo3.org>
Sun, 9 Oct 2011 12:03:04 +0000 (14:03 +0200)
committerSteffen Ritter <info@rs-websystems.de>
Fri, 10 Feb 2012 15:12:02 +0000 (16:12 +0100)
As there is a hook after initializing the BE user,
the code that initializes the BE user when using
a previewlink can now be moved out of the core.

Also the same hook can now be used to do the generic
workspace initialization.

Additionally, the remaining functions in TSFE
should be cleaned up.

Change-Id: I1674c89bc195f2f1b154574fefa57c16bd8b2385
Resolves: #30682
Releases: 4.7
Reviewed-on: http://review.typo3.org/5644
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
Reviewed-by: Stefan Neufeind
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Wouter Wolters
Tested-by: Stefan Neufeind
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/index_ts.php

index 70cd66f..3e6bd5b 100644 (file)
@@ -83,7 +83,7 @@
        var $loginUser='';                                      // Global flag indicating that a front-end user is logged in. This is set only if a user really IS logged in. The group-list may show other groups (like added by IP filter or so) even though there is no user.
        var $gr_list='';                                        // (RO=readonly) The group list, sorted numerically. Group '0,-1' is the default group, but other groups may be added by other means than a user being logged in though...
        var $beUserLogin='';                            // Flag that indicates if a Backend user is logged in!
-       var $workspacePreview='';                       // Integer, that indicates which workspace is being previewed.
+       var $workspacePreview = 0;                      // Integer, that indicates which workspace is being previewed.
        var $loginAllowedInBranch = TRUE;       // Shows whether logins are allowed in branch
        var $loginAllowedInBranch_mode = '';    // Shows specific mode (all or groups)
        var $ADMCMD_preview_BEUSER_uid = 0;     // Integer, set to backend user ID to initialize when keyword-based preview is used.
                        $GLOBALS['TT']->pull();
                        $GLOBALS['TYPO3_MISC']['microtime_BE_USER_end'] = microtime(TRUE);
 
-               } elseif ($this->ADMCMD_preview_BEUSER_uid) {
-                               // TODO: validate the comment below: is this necessary? if so,
-                               // formfield_status should be set to "" in t3lib_tsfeBeUserAuth
-                               // which is a subclass of t3lib_beUserAuth
-                               // ----
-                               // the value this->formfield_status is set to empty in order to
-                               // disable login-attempts to the backend account through this script
-
-                               // New backend user object
-                       $BE_USER = t3lib_div::makeInstance('t3lib_tsfeBeUserAuth');
-                       $BE_USER->userTS_dontGetCached = 1;
-                       $BE_USER->OS = TYPO3_OS;
-                       $BE_USER->setBeUserByUid($this->ADMCMD_preview_BEUSER_uid);
-                       $BE_USER->unpack_uc('');
-                       if ($BE_USER->user['uid']) {
-                               $BE_USER->fetchGroupData();
-                               $this->beUserLogin = 1;
-                       } else {
-                               $BE_USER = NULL;
-                               $this->beUserLogin = 0;
-                               $_SESSION['TYPO3-TT-start'] = FALSE;
-                       }
                }
 
                // *****************
@@ -4334,12 +4312,19 @@ if (version == "n3") {
                }
        }
 
+
+       /********************************************
+        * PUBLIC ACCESSIBLE WORKSPACES FUNCTIONS
+        *******************************************/
+
        /**
         * Initialize workspace preview
         *
         * @return      void
+        * @deprecated since TYPO3 4.7, will be removed in TYPO3 4.9 as this is part of Tx_Version now
         */
-       function workspacePreviewInit() {
+       public function workspacePreviewInit()  {
+               t3lib_div::logDeprecatedFunction();
                $previewWS = t3lib_div::_GP('ADMCMD_previewWS');
                if ($this->beUserLogin && is_object($GLOBALS['BE_USER']) && t3lib_utility_Math::canBeInterpretedAsInteger($previewWS))  {
                        if ($previewWS==0 || ($previewWS>=-1 && $GLOBALS['BE_USER']->checkWorkspace($previewWS))) {     // Check Access to workspace. Live (0) is OK to preview for all.
@@ -4355,8 +4340,8 @@ if (version == "n3") {
         *
         * @return      boolean         Returns TRUE if workspace preview is enabled
         */
-       function doWorkspacePreview()   {
-               return (string)$this->workspacePreview!=='';
+       public function doWorkspacePreview() {
+               return ($this->workspacePreview !== 0 ? TRUE : FALSE);
        }
 
        /**
index 416a5ca..0431bbf 100644 (file)
@@ -242,12 +242,6 @@ $TT->pull();
 $BE_USER = $TSFE->initializeBackendUser();
 
 
-// ********************
-// Workspace preview:
-// ********************
-$TSFE->workspacePreviewInit();
-
-
 // *****************************************
 // Process the ID, type and other parameters
 // After this point we have an array, $page in TSFE, which is the page-record of the current page, $id