[CLEANUP] EXT:backend/Classes/Controller/*.php 49/37849/13
authorMichael Oehlhof <typo3@oehlhof.de>
Sun, 15 Mar 2015 01:55:38 +0000 (02:55 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 18 Jun 2015 20:38:52 +0000 (22:38 +0200)
Refactor the code to go green in PHPStorm.

- declare missing class variables
- add getter for LanguageService
- add getter for BackendUser
- add getter for TimeTracker
- add getter for DocumentTemplate
- add getter for DatabaseConnection
- fix code style issues "Unnecessary fully qualified name"

Resolves: #65738
Releases: master
Change-Id: I5a870c2760d73da9a17062165be977ae253ab81d
Reviewed-on: http://review.typo3.org/37849
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
17 files changed:
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Controller/BackendLayoutWizardController.php
typo3/sysext/backend/Classes/Controller/ClickMenuController.php
typo3/sysext/backend/Classes/Controller/DummyController.php
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php
typo3/sysext/backend/Classes/Controller/ListFrameLoaderController.php
typo3/sysext/backend/Classes/Controller/LoginController.php
typo3/sysext/backend/Classes/Controller/LoginFramesetController.php
typo3/sysext/backend/Classes/Controller/LogoutController.php
typo3/sysext/backend/Classes/Controller/NewRecordController.php
typo3/sysext/backend/Classes/Controller/PageLayoutController.php
typo3/sysext/backend/Classes/Controller/PageTreeNavigationController.php
typo3/sysext/backend/Classes/Controller/SimpleDataHandlerController.php
typo3/sysext/backend/Classes/Controller/UserSettingsController.php
typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php
typo3/sysext/version/Classes/Hook/DataHandlerHook.php

index c2c2843..130fa72 100644 (file)
@@ -17,6 +17,11 @@ namespace TYPO3\CMS\Backend\Controller;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Domain\Repository\Module\BackendModuleRepository;
+use TYPO3\CMS\Backend\Module\ModuleLoader;
+use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
+use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Fluid\View\StandaloneView;
 
 /**
  * Class for rendering the TYPO3 backend
@@ -96,14 +101,14 @@ class BackendController {
         * Constructor
         */
        public function __construct() {
-               $this->backendModuleRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Domain\Repository\Module\BackendModuleRepository::class);
+               $this->backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class);
 
                // Set debug flag for BE development only
                $this->debug = (int)$GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] === 1;
                // Initializes the backend modules structure for use later.
-               $this->moduleLoader = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Module\ModuleLoader::class);
+               $this->moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class);
                $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
-               $this->pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
+               $this->pageRenderer = $this->getDocumentTemplate()->getPageRenderer();
                $this->pageRenderer->loadExtJS();
                // included for the module menu JavaScript, please note that this is subject to change
                $this->pageRenderer->loadJquery();
@@ -142,7 +147,7 @@ class BackendController {
 
                // load the storage API and fill the UC into the PersistentStorage, so no additional AJAX call is needed
                $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Storage', 'function(Storage) {
-                       Storage.Persistent.load(' . json_encode($GLOBALS['BE_USER']->uc) . ');
+                       Storage.Persistent.load(' . json_encode($this->getBackendUser()->uc) . ');
                }');
 
                // load debug console
@@ -170,10 +175,10 @@ class BackendController {
                $classNameRegistry = $GLOBALS['TYPO3_CONF_VARS']['BE']['toolbarItems'];
                foreach ($classNameRegistry as $className) {
                        $toolbarItemInstance = GeneralUtility::makeInstance($className);
-                       if (!$toolbarItemInstance instanceof \TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface) {
+                       if (!$toolbarItemInstance instanceof ToolbarItemInterface) {
                                throw new \RuntimeException(
                                        'class ' . $className . ' is registered as toolbar item but does not implement'
-                                               . \TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface::class,
+                                               . ToolbarItemInterface::class,
                                        1415958218
                                );
                        }
@@ -215,15 +220,15 @@ class BackendController {
                        foreach ($GLOBALS['TBE_MODULES']['_configuration'] as $moduleConfig) {
                                if (is_array($moduleConfig['cssFiles'])) {
                                        foreach ($moduleConfig['cssFiles'] as $cssFileName => $cssFile) {
-                                               $files = array(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($cssFile));
-                                               $files = \TYPO3\CMS\Core\Utility\GeneralUtility::removePrefixPathFromList($files, PATH_site);
+                                               $files = array(GeneralUtility::getFileAbsFileName($cssFile));
+                                               $files = GeneralUtility::removePrefixPathFromList($files, PATH_site);
                                                $this->addCssFile($cssFileName, '../' . $files[0]);
                                        }
                                }
                                if (is_array($moduleConfig['jsFiles'])) {
                                        foreach ($moduleConfig['jsFiles'] as $jsFile) {
-                                               $files = array(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($jsFile));
-                                               $files = \TYPO3\CMS\Core\Utility\GeneralUtility::removePrefixPathFromList($files, PATH_site);
+                                               $files = array(GeneralUtility::getFileAbsFileName($jsFile));
+                                               $files = GeneralUtility::removePrefixPathFromList($files, PATH_site);
                                                $this->addJavascriptFile('../' . $files[0]);
                                        }
                                }
@@ -236,7 +241,7 @@ class BackendController {
 
                // Render the TYPO3 logo in the left corner
                $logoUrl = $GLOBALS['TBE_STYLES']['logo'] ?: 'gfx/typo3-topbar@2x.png';
-               $logoPath = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath(PATH_typo3 . $logoUrl);
+               $logoPath = GeneralUtility::resolveBackPath(PATH_typo3 . $logoUrl);
                list($logoWidth, $logoHeight) = @getimagesize($logoPath);
 
                // High-resolution?
@@ -275,8 +280,8 @@ class BackendController {
                $this->loadResourcesForRegisteredNavigationComponents();
 
                // Add state provider
-               $GLOBALS['TBE_TEMPLATE']->setExtDirectStateProvider();
-               $states = $GLOBALS['BE_USER']->uc['BackendComponents']['States'];
+               $this->getDocumentTemplate()->setExtDirectStateProvider();
+               $states = $this->getBackendUser()->uc['BackendComponents']['States'];
                // Save states in BE_USER->uc
                $extOnReadyCode = '
                        Ext.state.Manager.setProvider(new TYPO3.state.ExtDirectProvider({
@@ -298,7 +303,7 @@ class BackendController {
                // Set document title:
                $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' [TYPO3 CMS ' . TYPO3_version . ']' : 'TYPO3 CMS ' . TYPO3_version;
                // Renders the module page
-               $this->content = $GLOBALS['TBE_TEMPLATE']->render($title, $view->render());
+               $this->content = $this->getDocumentTemplate()->render($title, $view->render());
                $hookConfiguration = array('content' => &$this->content);
                $this->executeHook('renderPostProcess', $hookConfiguration);
                echo $this->content;
@@ -415,6 +420,7 @@ class BackendController {
         * which can be used in JavaScript code.
         *
         * @return string File name of the JS file, relative to TYPO3_mainDir
+        * @throws \RuntimeException
         */
        protected function getLocalLangFileName() {
                $code = $this->generateLocalLang();
@@ -435,31 +441,32 @@ class BackendController {
         * @return string JavaScript code containing the LLL labels in TYPO3.LLL
         */
        protected function generateLocalLang() {
+               $lang = $this->getLanguageService();
                $coreLabels = array(
-                       'waitTitle' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_logging_in'),
-                       'refresh_login_failed' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_failed'),
-                       'refresh_login_failed_message' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_failed_message'),
-                       'refresh_login_title' => sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_title'), htmlspecialchars($GLOBALS['BE_USER']->user['username'])),
-                       'login_expired' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.login_expired'),
-                       'refresh_login_username' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_username'),
-                       'refresh_login_password' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_password'),
-                       'refresh_login_emptyPassword' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_emptyPassword'),
-                       'refresh_login_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_button'),
-                       'refresh_logout_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_logout_button'),
-                       'please_wait' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.please_wait'),
-                       'loadingIndicator' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:loadingIndicator'),
-                       'be_locked' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.be_locked'),
-                       'refresh_login_countdown_singular' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_countdown_singular'),
-                       'refresh_login_countdown' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_countdown'),
-                       'login_about_to_expire' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.login_about_to_expire'),
-                       'login_about_to_expire_title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.login_about_to_expire_title'),
-                       'refresh_login_refresh_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_refresh_button'),
-                       'refresh_direct_logout_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_direct_logout_button'),
-                       'tabs_closeAll' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:tabs.closeAll'),
-                       'tabs_closeOther' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:tabs.closeOther'),
-                       'tabs_close' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:tabs.close'),
-                       'tabs_openInBrowserWindow' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:tabs.openInBrowserWindow'),
-                       'csh_tooltip_loading' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:csh_tooltip_loading')
+                       'waitTitle' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_logging_in'),
+                       'refresh_login_failed' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_failed'),
+                       'refresh_login_failed_message' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_failed_message'),
+                       'refresh_login_title' => sprintf($lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_title'), htmlspecialchars($this->getBackendUser()->user['username'])),
+                       'login_expired' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.login_expired'),
+                       'refresh_login_username' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_username'),
+                       'refresh_login_password' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_password'),
+                       'refresh_login_emptyPassword' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_emptyPassword'),
+                       'refresh_login_button' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_button'),
+                       'refresh_logout_button' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_logout_button'),
+                       'please_wait' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.please_wait'),
+                       'loadingIndicator' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:loadingIndicator'),
+                       'be_locked' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.be_locked'),
+                       'refresh_login_countdown_singular' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_countdown_singular'),
+                       'refresh_login_countdown' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_countdown'),
+                       'login_about_to_expire' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.login_about_to_expire'),
+                       'login_about_to_expire_title' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.login_about_to_expire_title'),
+                       'refresh_login_refresh_button' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_login_refresh_button'),
+                       'refresh_direct_logout_button' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:mess.refresh_direct_logout_button'),
+                       'tabs_closeAll' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:tabs.closeAll'),
+                       'tabs_closeOther' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:tabs.closeOther'),
+                       'tabs_close' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:tabs.close'),
+                       'tabs_openInBrowserWindow' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:tabs.openInBrowserWindow'),
+                       'csh_tooltip_loading' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:csh_tooltip_loading')
                );
                $labels = array(
                        'fileUpload' => array(
@@ -519,7 +526,7 @@ class BackendController {
                        // Then loop over every single label
                        foreach ($categoryLabels as $label) {
                                // LLL identifier must be called $categoryName_$label, e.g. liveSearch_loadingText
-                               $generatedLabels[$categoryName][$label] = $GLOBALS['LANG']->getLL($categoryName . '_' . $label);
+                               $generatedLabels[$categoryName][$label] = $this->getLanguageService()->getLL($categoryName . '_' . $label);
                        }
                }
                return 'TYPO3.LLL = ' . json_encode($generatedLabels) . ';';
@@ -532,19 +539,20 @@ class BackendController {
         */
        protected function generateJavascript() {
 
+               $beUser = $this->getBackendUser();
                // Needed for FormEngine manipulation (date picker)
                $dateFormat = ($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? array('MM-DD-YYYY', 'HH:mm MM-DD-YYYY') : array('DD-MM-YYYY', 'HH:mm DD-MM-YYYY'));
                $this->pageRenderer->addInlineSetting('DateTimePicker', 'DateFormat', $dateFormat);
                // define the window size of the element browser etc.
                $popupWindowWidth  = 700;
                $popupWindowHeight = 750;
-               $popupWindowSize = trim($GLOBALS['BE_USER']->getTSConfigVal('options.popupWindowSize'));
+               $popupWindowSize = trim($beUser->getTSConfigVal('options.popupWindowSize'));
                if (!empty($popupWindowSize)) {
                        list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::intExplode('x', $popupWindowSize);
                }
 
                // define the window size of the popups within the RTE
-               $rtePopupWindowSize = trim($GLOBALS['BE_USER']->getTSConfigVal('options.rte.popupWindowSize'));
+               $rtePopupWindowSize = trim($beUser->getTSConfigVal('options.rte.popupWindowSize'));
                if (!empty($rtePopupWindowSize)) {
                        list($rtePopupWindowWidth, $rtePopupWindowHeight) = GeneralUtility::trimExplode('x', $rtePopupWindowSize);
                }
@@ -553,29 +561,29 @@ class BackendController {
 
                $pathTYPO3 = GeneralUtility::dirname(GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/';
                // If another page module was specified, replace the default Page module with the new one
-               $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
+               $newPageModule = trim($beUser->getTSConfigVal('options.overridePageModule'));
                $pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
-               if (!$GLOBALS['BE_USER']->check('modules', $pageModule)) {
+               if (!$beUser->check('modules', $pageModule)) {
                        $pageModule = '';
                }
                $t3Configuration = array(
                        'siteUrl' => GeneralUtility::getIndpEnv('TYPO3_SITE_URL'),
                        'PATH_typo3' => $pathTYPO3,
                        'PATH_typo3_enc' => rawurlencode($pathTYPO3),
-                       'username' => htmlspecialchars($GLOBALS['BE_USER']->user['username']),
+                       'username' => htmlspecialchars($beUser->user['username']),
                        'uniqueID' => GeneralUtility::shortMD5(uniqid('', TRUE)),
                        'securityLevel' => trim($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']) ?: 'normal',
                        'TYPO3_mainDir' => TYPO3_mainDir,
                        'pageModule' => $pageModule,
-                       'inWorkspace' => $GLOBALS['BE_USER']->workspace !== 0,
-                       'workspaceFrontendPreviewEnabled' => $GLOBALS['BE_USER']->user['workspace_preview'] ? 1 : 0,
-                       'veriCode' => $GLOBALS['BE_USER']->veriCode(),
+                       'inWorkspace' => $beUser->workspace !== 0,
+                       'workspaceFrontendPreviewEnabled' => $beUser->user['workspace_preview'] ? 1 : 0,
+                       'veriCode' => $beUser->veriCode(),
                        'denyFileTypes' => PHP_EXTENSIONS_DEFAULT,
                        'moduleMenuWidth' => $this->menuWidth - 1,
                        'topBarHeight' => isset($GLOBALS['TBE_STYLES']['dims']['topFrameH']) ? (int)$GLOBALS['TBE_STYLES']['dims']['topFrameH'] : 30,
                        'showRefreshLoginPopup' => isset($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) ? (int)$GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup'] : FALSE,
                        'listModulePath' => ExtensionManagementUtility::extRelPath('recordlist') . 'mod1/',
-                       'debugInWindow' => $GLOBALS['BE_USER']->uc['debugInWindow'] ? 1 : 0,
+                       'debugInWindow' => $beUser->uc['debugInWindow'] ? 1 : 0,
                        'ContextHelpWindows' => array(
                                'width' => 600,
                                'height' => 400
@@ -636,13 +644,14 @@ class BackendController {
         * @return void
         */
        protected function handlePageEditing() {
+               $beUser = $this->getBackendUser();
                // EDIT page:
                $editId = preg_replace('/[^[:alnum:]_]/', '', GeneralUtility::_GET('edit'));
                $editRecord = '';
                if ($editId) {
                        // Looking up the page to edit, checking permissions:
-                       $where = ' AND (' . $GLOBALS['BE_USER']->getPagePermsClause(2) . ' OR ' . $GLOBALS['BE_USER']->getPagePermsClause(16) . ')';
-                       if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($editId)) {
+                       $where = ' AND (' . $beUser->getPagePermsClause(2) . ' OR ' . $beUser->getPagePermsClause(16) . ')';
+                       if (MathUtility::canBeInterpretedAsInteger($editId)) {
                                $editRecord = BackendUtility::getRecordWSOL('pages', $editId, '*', $where);
                        } else {
                                $records = BackendUtility::getRecordsByField('pages', 'alias', $editId, $where);
@@ -652,22 +661,22 @@ class BackendController {
                                }
                        }
                        // If the page was accessible, then let the user edit it.
-                       if (is_array($editRecord) && $GLOBALS['BE_USER']->isInWebMount($editRecord['uid'])) {
+                       if (is_array($editRecord) && $beUser->isInWebMount($editRecord['uid'])) {
                                // Setting JS code to open editing:
                                $this->js .= '
                // Load page to edit:
        window.setTimeout("top.loadEditId(' . (int)$editRecord['uid'] . ');", 500);
                        ';
                                // Checking page edit parameter:
-                               if (!$GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_dontSetPageTree')) {
-                                       $bookmarkKeepExpanded = $GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_keepExistingExpanded');
+                               if (!$beUser->getTSConfigVal('options.bookmark_onEditId_dontSetPageTree')) {
+                                       $bookmarkKeepExpanded = $beUser->getTSConfigVal('options.bookmark_onEditId_keepExistingExpanded');
                                        // Expanding page tree:
                                        BackendUtility::openPageTree((int)$editRecord['pid'], !$bookmarkKeepExpanded);
                                }
                        } else {
                                $this->js .= '
                // Warning about page editing:
-       alert(' . GeneralUtility::quoteJSvalue(sprintf($GLOBALS['LANG']->getLL('noEditPage'), $editId)) . ');
+       alert(' . GeneralUtility::quoteJSvalue(sprintf($this->getLanguageService()->getLL('noEditPage'), $editId)) . ');
                        ';
                        }
                }
@@ -680,15 +689,17 @@ class BackendController {
         */
        protected function setStartupModule() {
                $startModule = preg_replace('/[^[:alnum:]_]/', '', GeneralUtility::_GET('module'));
+               $startModuleParameters = '';
                if (!$startModule) {
+                       $beUser = $this->getBackendUser();
                        // start module on first login, will be removed once used the first time
-                       if (isset($GLOBALS['BE_USER']->uc['startModuleOnFirstLogin'])) {
-                               $startModule = $GLOBALS['BE_USER']->uc['startModuleOnFirstLogin'];
-                               unset($GLOBALS['BE_USER']->uc['startModuleOnFirstLogin']);
-                               $GLOBALS['BE_USER']->writeUC();
-                       } elseif ($GLOBALS['BE_USER']->uc['startModule']) {
-                               $startModule = $GLOBALS['BE_USER']->uc['startModule'];
-                       } elseif ($GLOBALS['BE_USER']->uc['startInTaskCenter']) {
+                       if (isset($beUser->uc['startModuleOnFirstLogin'])) {
+                               $startModule = $beUser->uc['startModuleOnFirstLogin'];
+                               unset($beUser->uc['startModuleOnFirstLogin']);
+                               $beUser->writeUC();
+                       } elseif ($beUser->uc['startModule']) {
+                               $startModule = $beUser->uc['startModule'];
+                       } elseif ($beUser->uc['startInTaskCenter']) {
                                $startModule = 'user_task';
                        }
 
@@ -751,6 +762,7 @@ class BackendController {
         *
         * @param string $css Css snippet
         * @return void
+        * @throws \InvalidArgumentException
         */
        public function addCss($css) {
                if (!is_string($css)) {
@@ -844,11 +856,38 @@ class BackendController {
         * @return \TYPO3\CMS\Fluid\View\StandaloneView
         */
        protected function getFluidTemplateObject($templatePathAndFileName = NULL) {
-               $view = GeneralUtility::makeInstance(\TYPO3\CMS\Fluid\View\StandaloneView::class);
+               $view = GeneralUtility::makeInstance(StandaloneView::class);
                if ($templatePathAndFileName) {
                        $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templatePathAndFileName));
                }
                return $view;
        }
 
+       /**
+        * Returns LanguageService
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
+
+       /**
+        * Returns the current BE user.
+        *
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
+       /**
+        * Returns an instance of DocumentTemplate
+        *
+        * @return \TYPO3\CMS\Backend\Template\DocumentTemplate
+        */
+       protected function getDocumentTemplate() {
+               return $GLOBALS['TBE_TEMPLATE'];
+       }
+
 }
index 3127f61..3d1ca76 100644 (file)
@@ -77,7 +77,6 @@ class BackendLayoutWizardController {
                if (!$this->P['hmac'] || ($this->P['hmac'] !== $hmac_validate)) {
                        throw new \InvalidArgumentException('Hmac Validation failed for backend_layout wizard', 1385811397);
                }
-               $this->md5ID = $this->P['md5ID'];
                $uid = (int)$this->P['uid'];
                // Initialize document object:
                $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
@@ -244,7 +243,6 @@ class BackendLayoutWizardController {
                echo $this->doc->render('Grid wizard', $this->content);
        }
 
-
        /**
         * Returns LanguageService
         *
index fe67129..249cbf4 100644 (file)
@@ -15,6 +15,10 @@ namespace TYPO3\CMS\Backend\Controller;
  */
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Template\DocumentTemplate;
+use TYPO3\CMS\Backend\Clipboard\Clipboard;
+use TYPO3\CMS\Backend\ClickMenu\ClickMenu;
+use TYPO3\CMS\Core\Http\AjaxRequestHandler;
 
 /**
  * Script Class for the Context Sensitive Menu in TYPO3 (rendered in top frame, normally writing content dynamically to list frames).
@@ -55,7 +59,7 @@ class ClickMenuController {
         * Constructor
         */
        public function __construct() {
-               $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xlf');
+               $this->getLanguageService()->includeLLFile('EXT:lang/locallang_misc.xlf');
                $GLOBALS['SOBE'] = $this;
 
                // Setting GPvars:
@@ -67,7 +71,7 @@ class ClickMenuController {
                $this->extClassArray = $GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']['extendCMclasses'];
 
                // Initialize template object
-               $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
+               $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
        }
 
        /**
@@ -89,7 +93,7 @@ class ClickMenuController {
        public function main() {
                GeneralUtility::logDeprecatedFunction();
                // Initialize Clipboard object:
-               $clipObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Clipboard\Clipboard::class);
+               $clipObj = GeneralUtility::makeInstance(Clipboard::class);
                $clipObj->initializeClipboard();
                // This locks the clipboard to the Normal for this request.
                $clipObj->lockToNormal();
@@ -100,11 +104,10 @@ class ClickMenuController {
                // Saves
                $clipObj->endClipboard();
                // Create clickmenu object
-               $clickMenu = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\ClickMenu\ClickMenu::class);
+               $clickMenu = GeneralUtility::makeInstance(ClickMenu::class);
                // Set internal vars in clickmenu object:
                $clickMenu->clipObj = $clipObj;
                $clickMenu->extClassArray = $this->extClassArray;
-               $clickMenu->backPath = $this->backPath;
                // Set content of the clickmenu with the incoming var, "item"
                $this->content .= $clickMenu->init();
        }
@@ -127,12 +130,12 @@ class ClickMenuController {
         * @param array $parameters
         * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler
         */
-       public function printContentForAjaxRequest($parameters, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler) {
+       public function printContentForAjaxRequest($parameters, AjaxRequestHandler $ajaxRequestHandler) {
 
                // XML has to be parsed, no parse errors allowed
                @ini_set('display_errors', 0);
 
-               $clipObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Clipboard\Clipboard::class);
+               $clipObj = GeneralUtility::makeInstance(Clipboard::class);
                $clipObj->initializeClipboard();
                // This locks the clipboard to the Normal for this request.
                $clipObj->lockToNormal();
@@ -143,7 +146,7 @@ class ClickMenuController {
                // Saves
                $clipObj->endClipboard();
                // Create clickmenu object
-               $clickMenu = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\ClickMenu\ClickMenu::class);
+               $clickMenu = GeneralUtility::makeInstance(ClickMenu::class);
                // Set internal vars in clickmenu object:
                $clickMenu->clipObj = $clipObj;
                $clickMenu->extClassArray = $this->extClassArray;
@@ -157,4 +160,13 @@ class ClickMenuController {
                $ajaxRequestHandler->setContentFormat('xml');
        }
 
+       /**
+        * Returns LanguageService
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
+
 }
index 4da7f88..ea9cdaa 100644 (file)
@@ -33,9 +33,9 @@ class DummyController {
         */
        public function main() {
                // Start page
-               $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage('Dummy document');
+               $this->content .= $this->getDocumentTemplate()->startPage('Dummy document');
                // End page:
-               $this->content .= $GLOBALS['TBE_TEMPLATE']->endPage();
+               $this->content .= $this->getDocumentTemplate()->endPage();
        }
 
        /**
@@ -47,4 +47,13 @@ class DummyController {
                echo $this->content;
        }
 
+       /**
+        * Returns an instance of DocumentTemplate
+        *
+        * @return \TYPO3\CMS\Backend\Template\DocumentTemplate
+        */
+       protected function getDocumentTemplate() {
+               return $GLOBALS['TBE_TEMPLATE'];
+       }
+
 }
index 55eefc2..2f5be46 100644 (file)
@@ -25,6 +25,11 @@ use TYPO3\CMS\Core\Utility\HttpUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Frontend\Page\PageRepository;
 use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
+use TYPO3\CMS\Core\DataHandling\DataHandler;
+use TYPO3\CMS\Backend\Form\DataPreprocessor;
+use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
 
 /**
  * Script Class: Drawing the editing form for editing records in TYPO3.
@@ -100,6 +105,11 @@ class EditDocumentController {
        public $data;
 
        /**
+        * @var string
+        */
+       public $cmd;
+
+       /**
         * @var array
         */
        public $mirror;
@@ -183,6 +193,11 @@ class EditDocumentController {
        public $noView;
 
        /**
+        * @var string
+        */
+       public $perms_clause;
+
+       /**
         * If set, the $this->editconf array is returned to the calling script
         * (used by wizard_add.php for instance)
         *
@@ -259,6 +274,26 @@ class EditDocumentController {
        public $R_URI;
 
        /**
+        * @var array
+        */
+       public $MOD_MENU;
+
+       /**
+        * @var array
+        */
+       public $MCONF;
+
+       /**
+        * @var array
+        */
+       public $MOD_SETTINGS;
+
+       /**
+        * @var array
+        */
+       public $pageinfo;
+
+       /**
         * Is loaded with the "title" of the currently "open document" - this is used in the
         * Document Selector box. (see makeDocSel())
         *
@@ -393,7 +428,7 @@ class EditDocumentController {
         */
        public function __construct() {
                $GLOBALS['SOBE'] = $this;
-               $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_alt_doc.xml');
+               $this->getLanguageService()->includeLLFile('EXT:lang/locallang_alt_doc.xml');
        }
 
        /**
@@ -403,7 +438,7 @@ class EditDocumentController {
         */
        protected function getSignalSlotDispatcher() {
                if (!isset($this->signalSlotDispatcher)) {
-                       $this->signalSlotDispatcher = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
+                       $this->signalSlotDispatcher = GeneralUtility::makeInstance(Dispatcher::class);
                }
                return $this->signalSlotDispatcher;
        }
@@ -456,7 +491,7 @@ class EditDocumentController {
                $this->dontStoreDocumentRef = 0;
                $this->storeTitle = '';
                // Get session data for the module:
-               $this->docDat = $GLOBALS['BE_USER']->getModuleData('FormEngine', 'ses');
+               $this->docDat = $this->getBackendUser()->getModuleData('FormEngine', 'ses');
                $this->docHandler = $this->docDat[0];
                // If a request for closing the document has been sent, act accordingly:
                if ($this->closeDoc > 0) {
@@ -493,6 +528,7 @@ class EditDocumentController {
         * @return void
         */
        public function processData() {
+               $beUser = $this->getBackendUser();
                // GPvars specifically for processing:
                $control = GeneralUtility::_GP('control');
                $this->data = GeneralUtility::_GP('data');
@@ -505,8 +541,8 @@ class EditDocumentController {
                // See tce_db.php for relevate options here:
                // Only options related to $this->data submission are included here.
                /** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */
-               $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
-               $tce->stripslashes_values = 0;
+               $tce = GeneralUtility::makeInstance(DataHandler::class);
+               $tce->stripslashes_values = FALSE;
 
                if (!empty($control)) {
                        $tce->setControl($control);
@@ -519,15 +555,14 @@ class EditDocumentController {
                        $tce->updateModeL10NdiffDataClear = TRUE;
                }
                // Setting default values specific for the user:
-               $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
+               $TCAdefaultOverride = $beUser->getTSConfigProp('TCAdefaults');
                if (is_array($TCAdefaultOverride)) {
                        $tce->setDefaultsFromUserTS($TCAdefaultOverride);
                }
                // Setting internal vars:
-               if ($GLOBALS['BE_USER']->uc['neverHideAtCopy']) {
+               if ($beUser->uc['neverHideAtCopy']) {
                        $tce->neverHideAtCopy = 1;
                }
-               $tce->debug = 0;
                // Loading TCEmain with data:
                $tce->start($this->data, $this->cmd);
                if (is_array($this->mirror)) {
@@ -536,7 +571,7 @@ class EditDocumentController {
                // Checking referer / executing
                $refInfo = parse_url(GeneralUtility::getIndpEnv('HTTP_REFERER'));
                $httpHost = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY');
-               if ($httpHost != $refInfo['host'] && $this->vC != $GLOBALS['BE_USER']->veriCode() && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer']) {
+               if ($httpHost != $refInfo['host'] && $this->vC != $beUser->veriCode() && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer']) {
                        $tce->log('', 0, 0, 0, 1, 'Referer host \'%s\' and server host \'%s\' did not match and veriCode was not valid either!', 1, array($refInfo['host'], $httpHost));
                        debug('Error: Referer host did not match with server host.');
                } else {
@@ -545,7 +580,7 @@ class EditDocumentController {
                        $tce->process_datamap();
                        $tce->process_cmdmap();
                        // If pages are being edited, we set an instruction about updating the page tree after this operation.
-                       if ($tce->pagetreeNeedsRefresh && (isset($this->data['pages']) || $GLOBALS['BE_USER']->workspace != 0 && count($this->data))) {
+                       if ($tce->pagetreeNeedsRefresh && (isset($this->data['pages']) || $beUser->workspace != 0 && count($this->data))) {
                                BackendUtility::setUpdateSignal('updatePageTree');
                        }
                        // If there was saved any new items, load them:
@@ -561,7 +596,7 @@ class EditDocumentController {
                                                        // Check if the $editId isn't a child record of an IRRE action
                                                        if (!(is_array($tce->newRelatedIDs[$tableName]) && in_array($editId, $tce->newRelatedIDs[$tableName]))) {
                                                                // Translate new id to the workspace version:
-                                                               if ($versionRec = BackendUtility::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $tableName, $editId, 'uid')) {
+                                                               if ($versionRec = BackendUtility::getWorkspaceVersionOfRecord($beUser->workspace, $tableName, $editId, 'uid')) {
                                                                        $editId = $versionRec['uid'];
                                                                }
                                                                $newEditConf[$tableName][$editId] = 'edit';
@@ -638,6 +673,7 @@ class EditDocumentController {
         * @return void
         */
        public function init() {
+               $beUser = $this->getBackendUser();
                // Setting more GPvars:
                $this->popViewId = GeneralUtility::_GP('popViewId');
                $this->popViewId_addParams = GeneralUtility::_GP('popViewId_addParams');
@@ -645,7 +681,7 @@ class EditDocumentController {
                $this->editRegularContentFromId = GeneralUtility::_GP('editRegularContentFromId');
                $this->recTitle = GeneralUtility::_GP('recTitle');
                $this->noView = GeneralUtility::_GP('noView');
-               $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
+               $this->perms_clause = $beUser->getPagePermsClause(1);
                // Set other internal variables:
                $this->R_URL_getvars['returnUrl'] = $this->retUrl;
                $this->R_URI = $this->R_URL_parts['path'] . '?' . ltrim(GeneralUtility::implodeArrayForUrl('', $this->R_URL_getvars), '&');
@@ -680,7 +716,7 @@ class EditDocumentController {
                // define the window size of the element browser
                $popupWindowWidth  = 700;
                $popupWindowHeight = 750;
-               $popupWindowSize = trim($GLOBALS['BE_USER']->getTSConfigVal('options.popupWindowSize'));
+               $popupWindowSize = trim($beUser->getTSConfigVal('options.popupWindowSize'));
                if (!empty($popupWindowSize)) {
                        list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::intExplode('x', $popupWindowSize);
                }
@@ -714,9 +750,9 @@ class EditDocumentController {
                        }
                        function deleteRecord(table,id,url) {   //
                                if (
-                                       ' . ($GLOBALS['BE_USER']->jsConfirmation(JsConfirmation::DELETE) ? 'confirm(' . GeneralUtility::quoteJSvalue($GLOBALS['LANG']->getLL('deleteWarning')) . ')' : '1==1') . '
+                                       ' . ($beUser->jsConfirmation(JsConfirmation::DELETE) ? 'confirm(' . GeneralUtility::quoteJSvalue($this->getLanguageService()->getLL('deleteWarning')) . ')' : '1==1') . '
                                )       {
-                                       window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1' . BackendUtility::getUrlToken('tceAction') . '&redirect="+escape(url)+"&vC=' . $GLOBALS['BE_USER']->veriCode() . '&prErr=1&uPT=1";
+                                       window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1' . BackendUtility::getUrlToken('tceAction') . '&redirect="+escape(url)+"&vC=' . $beUser->veriCode() . '&prErr=1&uPT=1";
                                }
                                return false;
                        }
@@ -835,10 +871,11 @@ class EditDocumentController {
         * @return void
         */
        public function main() {
+               $body = '';
                // Begin edit:
                if (is_array($this->editconf)) {
                        // Initialize TCEforms (rendering the forms)
-                       $this->tceforms = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\FormEngine::class);
+                       $this->tceforms = GeneralUtility::makeInstance(FormEngine::class);
                        $this->tceforms->doSaveFieldName = 'doSave';
                        $this->tceforms->localizationMode = GeneralUtility::inList('text,media', $this->localizationMode) ? $this->localizationMode : '';
                        // text,media is keywords defined in TYPO3 Core API..., see "l10n_cat"
@@ -854,7 +891,7 @@ class EditDocumentController {
                                // Checking if the currently open document is stored in the list of "open documents" - if not, then add it:
                                if (($this->docDat[1] !== $this->storeUrlMd5 || !isset($this->docHandler[$this->storeUrlMd5])) && !$this->dontStoreDocumentRef) {
                                        $this->docHandler[$this->storeUrlMd5] = array($this->storeTitle, $this->storeArray, $this->storeUrl, $this->firstEl);
-                                       $GLOBALS['BE_USER']->pushModuleData('FormEngine', array($this->docHandler, $this->storeUrlMd5));
+                                       $this->getBackendUser()->pushModuleData('FormEngine', array($this->docHandler, $this->storeUrlMd5));
                                        BackendUtility::setUpdateSignal('OpendocsController::updateNumber', count($this->docHandler));
                                }
                                // Module configuration
@@ -910,10 +947,11 @@ class EditDocumentController {
                $thePrevUid = '';
                $editForm = '';
                $trData = NULL;
+               $beUser = $this->getBackendUser();
                // Traverse the GPvar edit array
                // Tables:
                foreach ($this->editconf as $table => $conf) {
-                       if (is_array($conf) && $GLOBALS['TCA'][$table] && $GLOBALS['BE_USER']->check('tables_modify', $table)) {
+                       if (is_array($conf) && $GLOBALS['TCA'][$table] && $beUser->check('tables_modify', $table)) {
                                // Traverse the keys/comments of each table (keys can be a commalist of uids)
                                foreach ($conf as $cKey => $cmd) {
                                        if ($cmd == 'edit' || $cmd == 'new') {
@@ -947,7 +985,7 @@ class EditDocumentController {
                                                                        // Now, calculate whether the user has access to creating new records on this position:
                                                                        if (is_array($calcPRec)) {
                                                                                // Permissions for the parent page
-                                                                               $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec);
+                                                                               $CALC_PERMS = $beUser->calcPerms($calcPRec);
                                                                                if ($table == 'pages') {
                                                                                        // If pages:
                                                                                        $hasAccess = $CALC_PERMS & Permission::PAGE_NEW ? 1 : 0;
@@ -966,13 +1004,13 @@ class EditDocumentController {
                                                                BackendUtility::fixVersioningPid($table, $calcPRec);
                                                                if (is_array($calcPRec)) {
                                                                        if ($table == 'pages') { // If pages:
-                                                                               $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec);
+                                                                               $CALC_PERMS = $beUser->calcPerms($calcPRec);
                                                                                $hasAccess = $CALC_PERMS & Permission::PAGE_EDIT ? 1 : 0;
                                                                                $deleteAccess = $CALC_PERMS & Permission::PAGE_DELETE ? 1 : 0;
                                                                                $this->viewId = $calcPRec['uid'];
                                                                        } else {
                                                                                // Fetching pid-record first
-                                                                               $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $calcPRec['pid']));
+                                                                               $CALC_PERMS = $beUser->calcPerms(BackendUtility::getRecord('pages', $calcPRec['pid']));
                                                                                $hasAccess = $CALC_PERMS & Permission::CONTENT_EDIT ? 1 : 0;
                                                                                $deleteAccess = $CALC_PERMS & Permission::CONTENT_EDIT ? 1 : 0;
                                                                                $this->viewId = $calcPRec['pid'];
@@ -984,8 +1022,8 @@ class EditDocumentController {
                                                                        // Check internals regarding access:
                                                                        $isRootLevelRestrictionIgnored = BackendUtility::isRootLevelRestrictionIgnored($table);
                                                                        if ($hasAccess || (int)$calcPRec['pid'] === 0 && $isRootLevelRestrictionIgnored) {
-                                                                               $hasAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($table, $calcPRec);
-                                                                               $deniedAccessReason = $GLOBALS['BE_USER']->errorMsg;
+                                                                               $hasAccess = $beUser->recordEditAccessInternals($table, $calcPRec);
+                                                                               $deniedAccessReason = $beUser->errorMsg;
                                                                        }
                                                                } else {
                                                                        $hasAccess = 0;
@@ -1005,8 +1043,9 @@ class EditDocumentController {
                                                        // AT THIS POINT we have checked the access status of the editing/creation of
                                                        // records and we can now proceed with creating the form elements:
                                                        if ($hasAccess) {
+                                                               /** @var DataPreprocessor $trData */
                                                                $prevPageID = is_object($trData) ? $trData->prevPageID : '';
-                                                               $trData = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\DataPreprocessor::class);
+                                                               $trData = GeneralUtility::makeInstance(DataPreprocessor::class);
                                                                $trData->addRawData = TRUE;
                                                                $trData->defVals = $this->defVals;
                                                                $trData->lockRecords = 1;
@@ -1033,7 +1072,6 @@ class EditDocumentController {
                                                                                $this->storeTitle = $this->recTitle ? htmlspecialchars($this->recTitle) : BackendUtility::getRecordTitle($table, $rec, TRUE);
                                                                        }
                                                                        // Setting variables in TCEforms object:
-                                                                       $this->tceforms->hiddenFieldList = '';
                                                                        if (is_array($this->overrideVals) && is_array($this->overrideVals[$table])) {
                                                                                $this->tceforms->hiddenFieldListArr = array_keys($this->overrideVals[$table]);
                                                                        }
@@ -1056,9 +1094,10 @@ class EditDocumentController {
                                                                        }
                                                                        // Display "is-locked" message:
                                                                        if ($lockInfo = BackendUtility::isRecordLocked($table, $rec['uid'])) {
-                                                                               $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, htmlspecialchars($lockInfo['msg']), '', \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
+                                                                               /** @var $flashMessage \TYPO3\CMS\Core\Messaging\FlashMessage */
+                                                                               $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, htmlspecialchars($lockInfo['msg']), '', FlashMessage::WARNING);
                                                                                /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
-                                                                               $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
+                                                                               $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
                                                                                /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
                                                                                $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
                                                                                $defaultFlashMessageQueue->enqueue($flashMessage);
@@ -1069,7 +1108,7 @@ class EditDocumentController {
                                                                $thePrevUid = $rec['uid'];
                                                        } else {
                                                                $this->errorC++;
-                                                               $editForm .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.noEditPermission', TRUE) . '<br /><br />' . ($deniedAccessReason ? 'Reason: ' . htmlspecialchars($deniedAccessReason) . '<br /><br />' : '');
+                                                               $editForm .= $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noEditPermission', TRUE) . '<br /><br />' . ($deniedAccessReason ? 'Reason: ' . htmlspecialchars($deniedAccessReason) . '<br /><br />' : '');
                                                        }
                                                }
                                        }
@@ -1085,6 +1124,7 @@ class EditDocumentController {
         * @return array All available buttons as an assoc. array
         */
        protected function getButtons() {
+               $lang = $this->getLanguageService();
                $buttons = array(
                        'save' => '',
                        'save_view' => '',
@@ -1103,36 +1143,36 @@ class EditDocumentController {
                // The action of each button is decided by its name attribute. (See doProcessData())
                if (!$this->errorC && !$GLOBALS['TCA'][$this->firstEl['table']]['ctrl']['readOnly']) {
                        // SAVE button:
-                       $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" name="_savedok" class="c-inputButton" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" />'));
+                       $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" name="_savedok" class="c-inputButton" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" />'));
                        // SAVE / VIEW button:
                        if ($this->viewId && !$this->noView && $this->getNewIconMode($this->firstEl['table'], 'saveDocView')) {
-                               $buttons['save_view'] = IconUtility::getSpriteIcon('actions-document-save-view', array('html' => '<input onclick="window.open(\'\', \'newTYPO3frontendWindow\');" type="image" class="c-inputButton" name="_savedokview" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '" />'));
+                               $buttons['save_view'] = IconUtility::getSpriteIcon('actions-document-save-view', array('html' => '<input onclick="window.open(\'\', \'newTYPO3frontendWindow\');" type="image" class="c-inputButton" name="_savedokview" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '" />'));
                        }
                        // SAVE / NEW button:
                        if (count($this->elementsData) == 1 && $this->getNewIconMode($this->firstEl['table'])) {
-                               $buttons['save_new'] = IconUtility::getSpriteIcon('actions-document-save-new', array('html' => '<input type="image" class="c-inputButton" name="_savedoknew" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveNewDoc', TRUE) . '" />'));
+                               $buttons['save_new'] = IconUtility::getSpriteIcon('actions-document-save-new', array('html' => '<input type="image" class="c-inputButton" name="_savedoknew" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveNewDoc', TRUE) . '" />'));
                        }
                        // SAVE / CLOSE
-                       $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" class="c-inputButton" name="_saveandclosedok" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" />'));
+                       $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" class="c-inputButton" name="_saveandclosedok" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" />'));
                        // FINISH TRANSLATION / SAVE / CLOSE
                        if ($GLOBALS['TYPO3_CONF_VARS']['BE']['explicitConfirmationOfTranslation']) {
-                               $buttons['translation_save'] = '<input type="image" class="c-inputButton" name="_translation_savedok" src="' . IconUtility::skinImg($this->doc->backPath, 'sysext/t3skin/images/icons/actions/document-save-translation.png', '', 1) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.translationSaveDoc', TRUE) . '" /> ';
-                               $buttons['translation_saveclear'] = '<input type="image" class="c-inputButton" name="_translation_savedokclear" src="' . IconUtility::skinImg($this->doc->backPath, 'sysext/t3skin/images/icons/actions/document-save-cleartranslationcache.png', '', 1) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.translationSaveDocClear', TRUE) . '" />';
+                               $buttons['translation_save'] = '<input type="image" class="c-inputButton" name="_translation_savedok" src="' . IconUtility::skinImg($this->doc->backPath, 'sysext/t3skin/images/icons/actions/document-save-translation.png', '', 1) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.translationSaveDoc', TRUE) . '" /> ';
+                               $buttons['translation_saveclear'] = '<input type="image" class="c-inputButton" name="_translation_savedokclear" src="' . IconUtility::skinImg($this->doc->backPath, 'sysext/t3skin/images/icons/actions/document-save-cleartranslationcache.png', '', 1) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.translationSaveDocClear', TRUE) . '" />';
                        }
                }
                // CLOSE button:
-               $buttons['close'] = '<a href="#" class="t3js-editform-close" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-close') . '</a>';
+               $buttons['close'] = '<a href="#" class="t3js-editform-close" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-close') . '</a>';
                // DELETE + UNDO buttons:
                if (!$this->errorC && !$GLOBALS['TCA'][$this->firstEl['table']]['ctrl']['readOnly'] && count($this->elementsData) == 1) {
                        if ($this->firstEl['cmd'] != 'new' && MathUtility::canBeInterpretedAsInteger($this->firstEl['uid'])) {
                                // Delete:
                                if ($this->firstEl['deleteAccess'] && !$GLOBALS['TCA'][$this->firstEl['table']]['ctrl']['readOnly'] && !$this->getNewIconMode($this->firstEl['table'], 'disableDelete')) {
                                        $aOnClick = 'return deleteRecord(' . GeneralUtility::quoteJSvalue($this->firstEl['table']) . ',' . GeneralUtility::quoteJSvalue($this->firstEl['uid']) . ', ' . GeneralUtility::quoteJSvalue($this->retUrl) . ');';
-                                       $buttons['delete'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $GLOBALS['LANG']->getLL('deleteItem', TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
+                                       $buttons['delete'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $lang->getLL('deleteItem', TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
                                }
                                // Undo:
-                               $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->firstEl['table'], 'sys_history') . ' AND recuid=' . (int)$this->firstEl['uid'], '', 'tstamp DESC', '1');
-                               if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
+                               $undoRes = $this->getDatabaseConnection()->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $this->getDatabaseConnection()->fullQuoteStr($this->firstEl['table'], 'sys_history') . ' AND recuid=' . (int)$this->firstEl['uid'], '', 'tstamp DESC', '1');
+                               if ($undoButtonR = $this->getDatabaseConnection()->sql_fetch_assoc($undoRes)) {
                                        $aOnClick = 'window.location.href=' .
                                                GeneralUtility::quoteJSvalue(
                                                        BackendUtility::getModuleUrl(
@@ -1145,7 +1185,7 @@ class EditDocumentController {
                                                                )
                                                        )
                                                ) . '; return false;';
-                                       $buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"' . ' title="' . htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('undoLastChange'), BackendUtility::calcAge(($GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp']), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')))) . '">' . IconUtility::getSpriteIcon('actions-edit-undo') . '</a>';
+                                       $buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"' . ' title="' . htmlspecialchars(sprintf($lang->getLL('undoLastChange'), BackendUtility::calcAge(($GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp']), $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')))) . '">' . IconUtility::getSpriteIcon('actions-edit-undo') . '</a>';
                                }
                                if ($this->getNewIconMode($this->firstEl['table'], 'showHistory')) {
                                        $aOnClick = 'window.location.href=' .
@@ -1162,7 +1202,7 @@ class EditDocumentController {
                                }
                                // If only SOME fields are shown in the form, this will link the user to the FULL form:
                                if ($this->columnsOnly) {
-                                       $buttons['columns_only'] = '<a href="' . htmlspecialchars(($this->R_URI . '&columnsOnly=')) . '" title="' . $GLOBALS['LANG']->getLL('editWholeRecord', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
+                                       $buttons['columns_only'] = '<a href="' . htmlspecialchars(($this->R_URI . '&columnsOnly=')) . '" title="' . $lang->getLL('editWholeRecord', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                                }
                        }
                }
@@ -1236,13 +1276,13 @@ class EditDocumentController {
         * @return string HTML for function menus.
         */
        public function functionMenus() {
-               if ($GLOBALS['BE_USER']->getTSConfigVal('options.enableShowPalettes')) {
+               if ($this->getBackendUser()->getTSConfigVal('options.enableShowPalettes')) {
                        // Show palettes
 
                        return '<div class="checkbox">' .
                                '<label for="checkShowPalettes">' .
                                        BackendUtility::getFuncCheck('', 'SET[showPalettes]', $this->MOD_SETTINGS['showPalettes'], BackendUtility::getModuleUrl('record_edit'), (GeneralUtility::implodeArrayForUrl('', array_merge($this->R_URL_getvars, array('SET' => ''))) . BackendUtility::getUrlToken('editRecord')), 'id="checkShowPalettes"') .
-                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPalettes', TRUE) .
+                                       $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPalettes', TRUE) .
                                '</label>'.
                        '</div>';
                } else {
@@ -1256,7 +1296,7 @@ class EditDocumentController {
         * @return string
         */
        public function shortCutLink() {
-               if ($this->returnUrl == 'close.html' || !$GLOBALS['BE_USER']->mayMakeShortcut()) {
+               if ($this->returnUrl == 'close.html' || !$this->getBackendUser()->mayMakeShortcut()) {
                        return '';
                }
                return $this->doc->makeShortcutIcon('returnUrl,edit,defVals,overrideVals,columnsOnly,returnNewPageId,editRegularContentFromId,noView', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name'], 1);
@@ -1272,7 +1312,7 @@ class EditDocumentController {
                        return '';
                }
                $aOnClick = 'vHWin=window.open(' . GeneralUtility::quoteJSvalue(GeneralUtility::linkThisScript(array('returnUrl' => 'close.html'))) . ',' . GeneralUtility::quoteJSvalue(md5($this->R_URI)) . ',\'width=670,height=500,status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;';
-               return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.openInNewWindow', TRUE) . '">' . IconUtility::getSpriteIcon('actions-window-open') . '</a>';
+               return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.openInNewWindow', TRUE) . '">' . IconUtility::getSpriteIcon('actions-window-open') . '</a>';
        }
 
        /***************************
@@ -1294,7 +1334,7 @@ class EditDocumentController {
                $languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
                $transOrigPointerField = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
                // Table editable and activated for languages?
-               if ($GLOBALS['BE_USER']->check('tables_modify', $table) && $languageField && $transOrigPointerField && !$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable']) {
+               if ($this->getBackendUser()->check('tables_modify', $table) && $languageField && $transOrigPointerField && !$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable']) {
                        if (is_null($pid)) {
                                $row = BackendUtility::getRecord($table, $uid, 'pid');
                                $pid = $row['pid'];
@@ -1324,15 +1364,15 @@ class EditDocumentController {
                                        }
                                        if ($rowCurrent[$transOrigPointerField] || $currentLanguage === '0') {
                                                // Get record in other languages to see what's already available
-                                               $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fetchFields, $table, 'pid=' . (int)$pid . ' AND ' . $languageField . '>0' . ' AND ' . $transOrigPointerField . '=' . (int)$rowsByLang[0]['uid'] . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table));
+                                               $translations = $this->getDatabaseConnection()->exec_SELECTgetRows($fetchFields, $table, 'pid=' . (int)$pid . ' AND ' . $languageField . '>0' . ' AND ' . $transOrigPointerField . '=' . (int)$rowsByLang[0]['uid'] . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table));
                                                foreach ($translations as $row) {
                                                        $rowsByLang[$row[$languageField]] = $row;
                                                }
                                        }
                                        $langSelItems = array();
                                        foreach ($langRows as $lang) {
-                                               if ($GLOBALS['BE_USER']->checkLanguageAccess($lang['uid'])) {
-                                                       $newTranslation = isset($rowsByLang[$lang['uid']]) ? '' : ' [' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.new', TRUE) . ']';
+                                               if ($this->getBackendUser()->checkLanguageAccess($lang['uid'])) {
+                                                       $newTranslation = isset($rowsByLang[$lang['uid']]) ? '' : ' [' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.new', TRUE) . ']';
                                                        // Create url for creating a localized record
                                                        if ($newTranslation) {
                                                                $redirectUrl = BackendUtility::getModuleUrl('record_edit', array(
@@ -1353,7 +1393,7 @@ class EditDocumentController {
                                        // If any languages are left, make selector:
                                        if (count($langSelItems) > 1) {
                                                $onChange = 'if(this.options[this.selectedIndex].value){window.location.href=(this.options[this.selectedIndex].value);}';
-                                               $content = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.language', TRUE) . ' <select name="_langSelector" onchange="' . htmlspecialchars($onChange) . '">
+                                               $content = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_general.xlf:LGL.language', TRUE) . ' <select name="_langSelector" onchange="' . htmlspecialchars($onChange) . '">
                                                        ' . implode('', $langSelItems) . '
                                                        </select>';
                                        }
@@ -1372,7 +1412,7 @@ class EditDocumentController {
        public function localizationRedirect($justLocalized) {
                list($table, $orig_uid, $language) = explode(':', $justLocalized);
                if ($GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) {
-                       $localizedRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid', $table, $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '=' . (int)$language . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . (int)$orig_uid . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table));
+                       $localizedRecord = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid', $table, $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '=' . (int)$language . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . (int)$orig_uid . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table));
                        if (is_array($localizedRecord)) {
                                // Create parameters and finally run the classic page module for creating a new page translation
                                $location = BackendUtility::getModuleUrl('record_edit', array(
@@ -1402,16 +1442,16 @@ class EditDocumentController {
                                'pid' => 0,
                                'hidden' => 0,
                                'title' => $modSharedTSconfig['properties']['defaultLanguageLabel'] !== ''
-                                               ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage') . ')'
-                                               : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage'),
+                                               ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $this->getLanguageService()->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage') . ')'
+                                               : $this->getLanguageService()->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage'),
                                'flag' => $modSharedTSconfig['properties']['defaultLanguageFlag']
                        )
                );
-               $exQ = $GLOBALS['BE_USER']->isAdmin() ? '' : ' AND sys_language.hidden=0';
+               $exQ = $this->getBackendUser()->isAdmin() ? '' : ' AND sys_language.hidden=0';
                if ($id) {
-                       $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('sys_language.*', 'pages_language_overlay,sys_language', 'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid=' . (int)$id . BackendUtility::deleteClause('pages_language_overlay') . $exQ, 'pages_language_overlay.sys_language_uid,sys_language.uid,sys_language.pid,sys_language.tstamp,sys_language.hidden,sys_language.title,sys_language.language_isocode,sys_language.static_lang_isocode,sys_language.flag', 'sys_language.title');
+                       $rows = $this->getDatabaseConnection()->exec_SELECTgetRows('sys_language.*', 'pages_language_overlay,sys_language', 'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid=' . (int)$id . BackendUtility::deleteClause('pages_language_overlay') . $exQ, 'pages_language_overlay.sys_language_uid,sys_language.uid,sys_language.pid,sys_language.tstamp,sys_language.hidden,sys_language.title,sys_language.language_isocode,sys_language.static_lang_isocode,sys_language.flag', 'sys_language.title');
                } else {
-                       $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('sys_language.*', 'sys_language', 'sys_language.hidden=0', '', 'sys_language.title');
+                       $rows = $this->getDatabaseConnection()->exec_SELECTgetRows('sys_language.*', 'sys_language', 'sys_language.hidden=0', '', 'sys_language.title');
                }
                if ($rows) {
                        foreach ($rows as $row) {
@@ -1429,7 +1469,7 @@ class EditDocumentController {
        /**
         * Fix $this->editconf if versioning applies to any of the records
         *
-        * @param array $mapArray Mapping between old and new ids if auto-versioning has been performed.
+        * @param array|bool $mapArray Mapping between old and new ids if auto-versioning has been performed.
         * @return void
         */
        public function fixWSversioningInEditConf($mapArray = FALSE) {
@@ -1483,7 +1523,7 @@ class EditDocumentController {
                $reqRecord = BackendUtility::getRecord($table, $theUid, 'uid,pid');
                if (is_array($reqRecord)) {
                        // If workspace is OFFLINE:
-                       if ($GLOBALS['BE_USER']->workspace != 0) {
+                       if ($this->getBackendUser()->workspace != 0) {
                                // Check for versioning support of the table:
                                if ($GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
                                        // If the record is already a version of "something" pass it by.
@@ -1493,7 +1533,7 @@ class EditDocumentController {
                                        } else {
                                                // The input record was online and an offline version must be found or made:
                                                // Look for version of this workspace:
-                                               $versionRec = BackendUtility::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $table, $reqRecord['uid'], 'uid,pid,t3ver_oid');
+                                               $versionRec = BackendUtility::getWorkspaceVersionOfRecord($this->getBackendUser()->workspace, $table, $reqRecord['uid'], 'uid,pid,t3ver_oid');
                                                return is_array($versionRec) ? $versionRec : $reqRecord;
                                        }
                                } else {
@@ -1518,15 +1558,16 @@ class EditDocumentController {
         */
        public function editRegularContentFromId() {
                GeneralUtility::logDeprecatedFunction();
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tt_content', 'pid=' . (int)$this->editRegularContentFromId . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content') . ' AND colPos=0 AND sys_language_uid=0', '', 'sorting');
-               if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
+               $dbConnection = $this->getDatabaseConnection();
+               $res = $dbConnection->exec_SELECTquery('uid', 'tt_content', 'pid=' . (int)$this->editRegularContentFromId . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content') . ' AND colPos=0 AND sys_language_uid=0', '', 'sorting');
+               if ($dbConnection->sql_num_rows($res)) {
                        $ecUids = array();
-                       while ($ecRec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                       while ($ecRec = $dbConnection->sql_fetch_assoc($res)) {
                                $ecUids[] = $ecRec['uid'];
                        }
                        $this->editconf['tt_content'][implode(',', $ecUids)] = 'edit';
                }
-               $GLOBALS['TYPO3_DB']->sql_free_result($res);
+               $dbConnection->sql_free_result($res);
        }
 
        /**
@@ -1549,7 +1590,7 @@ class EditDocumentController {
         * @return string Return value fetched from USER TSconfig
         */
        public function getNewIconMode($table, $key = 'saveDocNew') {
-               $TSconfig = $GLOBALS['BE_USER']->getTSConfig('options.' . $key);
+               $TSconfig = $this->getBackendUser()->getTSConfig('options.' . $key);
                $output = trim(isset($TSconfig['properties'][$table]) ? $TSconfig['properties'][$table] : $TSconfig['value']);
                return $output;
        }
@@ -1565,7 +1606,7 @@ class EditDocumentController {
                // then unset it, possibly unset it ALL and finally, write it to the session data
                if (isset($this->docHandler[$this->storeUrlMd5])) {
                        // add the closing document to the recent documents
-                       $recentDocs = $GLOBALS['BE_USER']->getModuleData('opendocs::recent');
+                       $recentDocs = $this->getBackendUser()->getModuleData('opendocs::recent');
                        if (!is_array($recentDocs)) {
                                $recentDocs = array();
                        }
@@ -1580,8 +1621,8 @@ class EditDocumentController {
                                $recentDocs = array_merge($this->docHandler, $recentDocs);
                                $this->docHandler = array();
                        }
-                       $GLOBALS['BE_USER']->pushModuleData('opendocs::recent', $recentDocs);
-                       $GLOBALS['BE_USER']->pushModuleData('FormEngine', array($this->docHandler, $this->docDat[1]));
+                       $this->getBackendUser()->pushModuleData('opendocs::recent', $recentDocs);
+                       $this->getBackendUser()->pushModuleData('FormEngine', array($this->docHandler, $this->docDat[1]));
                        BackendUtility::setUpdateSignal('OpendocsController::updateNumber', count($this->docHandler));
                }
                // If ->returnEditConf is set, then add the current content of editconf to the ->retUrl variable: (used by other scripts, like wizard_add, to know which records was created or so...)
@@ -1629,4 +1670,22 @@ class EditDocumentController {
                return $GLOBALS['BE_USER'];
        }
 
+       /**
+        * Returns LanguageService
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
+
+       /**
+        * Returns the database connection
+        *
+        * @return \TYPO3\CMS\Core\Database\DatabaseConnection
+        */
+       protected function getDatabaseConnection() {
+               return $GLOBALS['TYPO3_DB'];
+       }
+
 }
index 0522369..05e0b6a 100644 (file)
@@ -16,6 +16,9 @@ namespace TYPO3\CMS\Backend\Controller;
 
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Filelist\FileListFolderTree;
+use TYPO3\CMS\Backend\Template\DocumentTemplate;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
 
 /**
  * Main script class for rendering of the folder tree
@@ -32,7 +35,7 @@ class FileSystemNavigationFrameController {
        public $content;
 
        /**
-        * @var \TYPO3\CMS\Filelist\FileListFolderTree $foldertree the folder tree object
+        * @var \TYPO3\CMS\Filelist\FileListFolderTree
         */
        public $foldertree;
 
@@ -65,6 +68,11 @@ class FileSystemNavigationFrameController {
        protected $scopeData;
 
        /**
+        * @var bool
+        */
+       public $doHighlight;
+
+       /**
         * Constructor
         */
        public function __construct() {
@@ -101,11 +109,11 @@ class FileSystemNavigationFrameController {
                        $GLOBALS['SOBE']->browser->mode = $this->scopeData['browser']['mode'];
                        $GLOBALS['SOBE']->browser->act = $this->scopeData['browser']['act'];
                } else {
-                       $this->foldertree = GeneralUtility::makeInstance(\TYPO3\CMS\Filelist\FileListFolderTree::class);
-                       $this->foldertree->thisScript = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('file_navframe');
+                       $this->foldertree = GeneralUtility::makeInstance(FileListFolderTree::class);
+                       $this->foldertree->thisScript = BackendUtility::getModuleUrl('file_navframe');
                }
 
-               $this->foldertree->ext_IconMode = $GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.disableIconLinkToContextmenu');
+               $this->foldertree->ext_IconMode = $this->getBackendUser()->getTSConfigVal('options.folderTree.disableIconLinkToContextmenu');
        }
 
        /**
@@ -116,9 +124,9 @@ class FileSystemNavigationFrameController {
         */
        public function initPage() {
                // Setting highlight mode:
-               $this->doHighlight = !$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableTitleHighlight');
+               $this->doHighlight = !$this->getBackendUser()->getTSConfigVal('options.pageTree.disableTitleHighlight');
                // Create template object:
-               $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
+               $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_file_navframe.html');
                $this->doc->showFlashMessages = FALSE;
@@ -127,7 +135,7 @@ class FileSystemNavigationFrameController {
                        Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
                        Tree.registerDragDropHandlers()';
                if ($this->doHighlight) {
-                       $hlClass = $GLOBALS['BE_USER']->workspace === 0 ? 'active' : 'active active-ws wsver' . $GLOBALS['BE_USER']->workspace;
+                       $hlClass = $this->getBackendUser()->workspace === 0 ? 'active' : 'active active-ws wsver' . $GLOBALS['BE_USER']->workspace;
                        $dragDropCode .= '
                        Tree.highlightClass = "' . $hlClass . '";
                        Tree.highlightActiveItem("", top.fsMod.navFrameHighlightedID["file"]);
@@ -175,7 +183,7 @@ class FileSystemNavigationFrameController {
                $subparts = array();
                // Build the <body> for the module
                $this->content = $this->doc->startPage('TYPO3 Folder Tree');
-               $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers, $subparts);
+               $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers, $subparts);
                $this->content .= $this->doc->endPage();
                $this->content = $this->doc->insertStylesAndJS($this->content);
        }
@@ -202,7 +210,7 @@ class FileSystemNavigationFrameController {
                // Refresh
                $buttons['refresh'] = '<a href="' . htmlspecialchars(GeneralUtility::getIndpEnv('REQUEST_URI')) . '">' . IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
                // CSH
-               $buttons['csh'] = str_replace('typo3-csh-inline', 'typo3-csh-inline show-right', \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'filetree'));
+               $buttons['csh'] = str_replace('typo3-csh-inline', 'typo3-csh-inline show-right', BackendUtility::cshItem('xMOD_csh_corebe', 'filetree'));
                return $buttons;
        }
 
@@ -229,4 +237,11 @@ class FileSystemNavigationFrameController {
                }
        }
 
+       /**
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
 }
index 034ff1b..ddefc50 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Backend\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Script Class for redirecting shortcut actions to the correct script
  *
@@ -23,23 +25,37 @@ namespace TYPO3\CMS\Backend\Controller;
 class ListFrameLoaderController {
 
        /**
+        * @var string
+        */
+       protected $content;
+
+       /**
         * Main content generated
         *
         * @return void
         * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function main() {
-               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
+               GeneralUtility::logDeprecatedFunction();
                $GLOBALS['TBE_TEMPLATE']->divClass = '';
-               $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage('List Frame Loader');
-               $this->content .= $GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
+               $this->content .= $this->getDocumentTemplate()->startPage('List Frame Loader');
+               $this->content .= $this->getDocumentTemplate()->wrapScriptTags('
                        var theUrl = top.getModuleUrl("");
                        if (theUrl)     window.location.href=theUrl;
                ');
                // End page:
-               $this->content .= $GLOBALS['TBE_TEMPLATE']->endPage();
+               $this->content .= $this->getDocumentTemplate()->endPage();
                // Output:
                echo $this->content;
        }
 
+       /**
+        * Returns an instance of DocumentTemplate
+        *
+        * @return \TYPO3\CMS\Backend\Template\DocumentTemplate
+        */
+       protected function getDocumentTemplate() {
+               return $GLOBALS['TBE_TEMPLATE'];
+       }
+
 }
index 9b7bf6c..fd8881d 100644 (file)
@@ -18,14 +18,12 @@ use TYPO3\CMS\Backend\Exception;
 use TYPO3\CMS\Backend\LoginProvider\LoginProviderInterface;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
-use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\FormProtection\BackendFormProtection;
 use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\HttpUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Fluid\View\StandaloneView;
-use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * Script Class for rendering the login form
@@ -482,7 +480,9 @@ class LoginController {
        }
 
        /**
-        * @return LanguageService
+        * Returns LanguageService
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
         */
        protected function getLanguageService() {
                return $GLOBALS['LANG'];
@@ -496,16 +496,21 @@ class LoginController {
        }
 
        /**
-        * @return DatabaseConnection
+        * Returns the database connection
+        *
+        * @return \TYPO3\CMS\Core\Database\DatabaseConnection
         */
        protected function getDatabaseConnection() {
                return $GLOBALS['TYPO3_DB'];
        }
 
        /**
+        * Returns an instance of DocumentTemplate
+        *
         * @return \TYPO3\CMS\Backend\Template\DocumentTemplate
         */
        protected function getDocumentTemplate() {
                return $GLOBALS['TBE_TEMPLATE'];
        }
+
 }
index 2837a43..2442f1a 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Backend\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Page\PageRenderer;
+
 /**
  * Script Class, putting the frameset together.
  *
@@ -34,13 +37,13 @@ class LoginFramesetController {
         */
        public function main() {
                $title = 'TYPO3 Re-Login (' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ')';
-               $GLOBALS['TBE_TEMPLATE']->startPage($title);
+               $this->getDocumentTemplate()->startPage($title);
 
                // Create the frameset for the window
-               $this->content = $GLOBALS['TBE_TEMPLATE']->getPageRenderer()->render(\TYPO3\CMS\Core\Page\PageRenderer::PART_HEADER) . '
+               $this->content = $this->getDocumentTemplate()->getPageRenderer()->render(PageRenderer::PART_HEADER) . '
                        <frameset rows="*,1">
                                <frame name="login" src="index.php?loginRefresh=1" marginwidth="0" marginheight="0" scrolling="no" noresize="noresize" />
-                               <frame name="dummy" src="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('dummy')) . '" marginwidth="0" marginheight="0" scrolling="auto" noresize="noresize" />
+                               <frame name="dummy" src="' . htmlspecialchars(BackendUtility::getModuleUrl('dummy')) . '" marginwidth="0" marginheight="0" scrolling="auto" noresize="noresize" />
                        </frameset>
                </html>';
        }
@@ -54,4 +57,13 @@ class LoginFramesetController {
                echo $this->content;
        }
 
+       /**
+        * Returns an instance of DocumentTemplate
+        *
+        * @return \TYPO3\CMS\Backend\Template\DocumentTemplate
+        */
+       protected function getDocumentTemplate() {
+               return $GLOBALS['TBE_TEMPLATE'];
+       }
+
 }
index 0e50af1..f3b21a3 100644 (file)
@@ -15,6 +15,8 @@ namespace TYPO3\CMS\Backend\Controller;
  */
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
+use TYPO3\CMS\Core\Utility\HttpUtility;
 
 /**
  * Script Class for logging a user out.
@@ -31,12 +33,23 @@ class LogoutController {
         */
        public function logout() {
                // Logout written to log
-               $GLOBALS['BE_USER']->writelog(255, 2, 0, 1, 'User %s logged out from TYPO3 Backend', array($GLOBALS['BE_USER']->user['username']));
-               \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get()->removeSessionTokenFromRegistry();
-               $GLOBALS['BE_USER']->logoff();
+               $this->getBackendUser()->writelog(255, 2, 0, 1, 'User %s logged out from TYPO3 Backend', array($this->getBackendUser()->user['username']));
+               /** @var \TYPO3\CMS\Core\FormProtection\BackendFormProtection $backendFormProtection */
+               $backendFormProtection = FormProtectionFactory::get();
+               $backendFormProtection->removeSessionTokenFromRegistry();
+               $this->getBackendUser()->logoff();
                $redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect'));
                $redirectUrl = $redirect ? $redirect : 'index.php';
-               \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
+               HttpUtility::redirect($redirectUrl);
+       }
+
+       /**
+        * Returns the current BE user.
+        *
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
        }
 
 }
index d48eed2..5d57b6b 100644 (file)
@@ -19,6 +19,10 @@ use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Template\DocumentTemplate;
+use TYPO3\CMS\Backend\Tree\View\PagePositionMap;
+use TYPO3\CMS\Backend\Tree\View\NewRecordPageTreeView;
+use TYPO3\CMS\Core\Utility\HttpUtility;
 
 /**
  * Script class for 'db_new'
@@ -150,7 +154,7 @@ class NewRecordController {
         */
        public function __construct() {
                $GLOBALS['SOBE'] = $this;
-               $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xlf');
+               $this->getLanguageService()->includeLLFile('EXT:lang/locallang_misc.xlf');
                $GLOBALS['BACK_PATH'] = '';
 
                $this->init();
@@ -162,11 +166,12 @@ class NewRecordController {
         * @return void
         */
        protected function init() {
+               $beUser = $this->getBackendUserAuthentication();
                // Page-selection permission clause (reading)
-               $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
+               $this->perms_clause = $beUser->getPagePermsClause(1);
                // This will hide records from display - it has nothing to do with user rights!!
-               if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) {
-                       if ($pidList = $GLOBALS['TYPO3_DB']->cleanIntList($pidList)) {
+               if ($pidList = $beUser->getTSConfigVal('options.hideRecords.pages')) {
+                       if ($pidList = $this->getDatabaseConnection()->cleanIntList($pidList)) {
                                $this->perms_clause .= ' AND pages.uid NOT IN (' . $pidList . ')';
                        }
                }
@@ -176,7 +181,7 @@ class NewRecordController {
                $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
                $this->pagesOnly = GeneralUtility::_GP('pagesOnly');
                // Create instance of template class for output
-               $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
+               $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_new.html');
                $this->doc->JScode = '';
@@ -184,7 +189,7 @@ class NewRecordController {
                $this->doc->getContextMenuCode();
                // Creating content
                $this->content = '';
-               $this->content .= $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle'));
+               $this->content .= $this->doc->header($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle'));
                // Id a positive id is supplied, ask for the page record with permission information contained:
                if ($this->id > 0) {
                        $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
@@ -194,16 +199,16 @@ class NewRecordController {
                        // Get record of parent page
                        $this->pidInfo = BackendUtility::getRecord('pages', $this->pageinfo['pid']);
                        // Checking the permissions for the user with regard to the parent page: Can he create new pages, new content record, new page after?
-                       if ($GLOBALS['BE_USER']->doesUserHaveAccess($this->pageinfo, 8)) {
+                       if ($beUser->doesUserHaveAccess($this->pageinfo, 8)) {
                                $this->newPagesInto = 1;
                        }
-                       if ($GLOBALS['BE_USER']->doesUserHaveAccess($this->pageinfo, 16)) {
+                       if ($beUser->doesUserHaveAccess($this->pageinfo, 16)) {
                                $this->newContentInto = 1;
                        }
-                       if (($GLOBALS['BE_USER']->isAdmin() || is_array($this->pidInfo)) && $GLOBALS['BE_USER']->doesUserHaveAccess($this->pidInfo, 8)) {
+                       if (($beUser->isAdmin() || is_array($this->pidInfo)) && $beUser->doesUserHaveAccess($this->pidInfo, 8)) {
                                $this->newPagesAfter = 1;
                        }
-               } elseif ($GLOBALS['BE_USER']->isAdmin()) {
+               } elseif ($beUser->isAdmin()) {
                        // Admins can do it all
                        $this->newPagesInto = 1;
                        $this->newContentInto = 1;
@@ -223,7 +228,7 @@ class NewRecordController {
         */
        public function main() {
                // If there was a page - or if the user is admin (admins has access to the root) we proceed:
-               if ($this->pageinfo['uid'] || $GLOBALS['BE_USER']->isAdmin()) {
+               if ($this->pageinfo['uid'] || $this->getBackendUserAuthentication()->isAdmin()) {
                        // Acquiring TSconfig for this module/current page:
                        $this->web_list_modTSconfig = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
                        $this->allowedNewTables = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig['properties']['allowedNewTables'], TRUE);
@@ -264,7 +269,7 @@ class NewRecordController {
                        $markers['CSH'] = $docHeaderButtons['csh'];
                        $markers['CONTENT'] = $this->content;
                        // Build the <body> for the module
-                       $this->content = $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle'));
+                       $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle'));
                        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
                        $this->content .= $this->doc->endPage();
                        $this->content = $this->doc->insertStylesAndJS($this->content);
@@ -287,7 +292,7 @@ class NewRecordController {
                if (!$this->pagesOnly) {
                        // New page
                        if ($this->showNewRecLink('pages')) {
-                               $buttons['new_page'] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('pagesOnly' => '1'))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xlf:newPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-page-new') . '</a>';
+                               $buttons['new_page'] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('pagesOnly' => '1'))) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:cms/layout/locallang.xlf:newPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-page-new') . '</a>';
                        }
                        // CSH
                        $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'new_regular');
@@ -298,11 +303,11 @@ class NewRecordController {
                }
                // Back
                if ($this->R_URI) {
-                       $buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
+                       $buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
                }
                if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
                        // View
-                       $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $this->backPath, BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
+                       $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $this->doc->backPath, BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
                }
                return $buttons;
        }
@@ -313,12 +318,12 @@ class NewRecordController {
         * @return void
         */
        public function pagesOnly() {
-               $numberOfPages = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'pages', '1=1' . BackendUtility::deleteClause('pages'));
+               $numberOfPages = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'pages', '1=1' . BackendUtility::deleteClause('pages'));
                if ($numberOfPages > 0) {
                        $this->code .= '
-                               <h3>' . htmlspecialchars($GLOBALS['LANG']->getLL('selectPosition')) . ':</h3>
+                               <h3>' . htmlspecialchars($this->getLanguageService()->getLL('selectPosition')) . ':</h3>
                        ';
-                       $positionMap = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\PagePositionMap::class, \TYPO3\CMS\Backend\Tree\View\NewRecordPageTreeView::class);
+                       $positionMap = GeneralUtility::makeInstance(PagePositionMap::class, NewRecordPageTreeView::class);
                        /** @var $positionMap \TYPO3\CMS\Backend\Tree\View\PagePositionMap */
                        $this->code .= $positionMap->positionTree($this->id, $this->pageinfo, $this->perms_clause, $this->R_URI);
                } else {
@@ -328,7 +333,7 @@ class NewRecordController {
                        $endPos = strpos($javascript, '\';');
                        $url = substr($javascript, $startPos, $endPos - $startPos);
                        @ob_end_clean();
-                       \TYPO3\CMS\Core\Utility\HttpUtility::redirect($url);
+                       HttpUtility::redirect($url);
                }
        }
 
@@ -338,7 +343,7 @@ class NewRecordController {
         * @return void
         */
        public function regularNew() {
-               $doNotShowFullDescr = FALSE;
+               $lang = $this->getLanguageService();
                // Initialize array for accumulating table rows:
                $this->tRows = array();
                // Get TSconfig for current page
@@ -362,16 +367,16 @@ class NewRecordController {
                $newPageLinks = array();
                if ($displayNewPagesIntoLink && $this->isTableAllowedForThisPage($this->pageinfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ?: $this->id), 'pages')) {
                        // Create link to new page inside:
-                       $newPageLinks[] = $this->linkWrap(IconUtility::getSpriteIconForRecord($table, array()) . $GLOBALS['LANG']->sL($v['ctrl']['title'], TRUE) . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.inside', TRUE) . ')', $table, $this->id);
+                       $newPageLinks[] = $this->linkWrap(IconUtility::getSpriteIconForRecord($table, array()) . $lang->sL($v['ctrl']['title'], TRUE) . ' (' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.inside', TRUE) . ')', $table, $this->id);
                }
                // New pages AFTER this pages
                if ($displayNewPagesAfterLink && $this->isTableAllowedForThisPage($this->pidInfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')) {
-                       $newPageLinks[] = $this->linkWrap($pageIcon . $GLOBALS['LANG']->sL($v['ctrl']['title'], TRUE) . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.after', TRUE) . ')', 'pages', -$this->id);
+                       $newPageLinks[] = $this->linkWrap($pageIcon . $lang->sL($v['ctrl']['title'], TRUE) . ' (' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.after', TRUE) . ')', 'pages', -$this->id);
                }
                // New pages at selection position
                if ($this->newPagesSelectPosition) {
                        // Link to page-wizard:
-                       $newPageLinks[] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('pagesOnly' => 1))) . '">' . $pageIcon . htmlspecialchars($GLOBALS['LANG']->getLL('pageSelectPosition')) . '</a>';
+                       $newPageLinks[] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('pagesOnly' => 1))) . '">' . $pageIcon . htmlspecialchars($lang->getLL('pageSelectPosition')) . '</a>';
                }
                // Assemble all new page links
                $numPageLinks = count($newPageLinks);
@@ -381,41 +386,42 @@ class NewRecordController {
                // Add row header and half-line if not empty
                if (!empty($rowContent)) {
                        $rowContent = '<ul class="list-tree"><li>' .$newPageIcon . '<strong>' .
-                               $GLOBALS['LANG']->getLL('createNewPage') . '</strong><ul>' . $rowContent . '</ul></li>';
+                               $lang->getLL('createNewPage') . '</strong><ul>' . $rowContent . '</ul></li>';
                }
                // Compile table row to show the icon for "new page (select position)"
                $startRows = array();
                if ($this->showNewRecLink('pages') && !empty($rowContent)) {
                        $startRows[] = $rowContent;
                }
+               $iconFile = array();
                // New tables (but not pages) INSIDE this pages
-               $isAdmin = $GLOBALS['BE_USER']->isAdmin();
+               $isAdmin = $this->getBackendUserAuthentication()->isAdmin();
                $newContentIcon = IconUtility::getSpriteIcon('actions-document-new');
                if ($this->newContentInto) {
                        if (is_array($GLOBALS['TCA'])) {
                                $groupName = '';
                                foreach ($GLOBALS['TCA'] as $table => $v) {
-                                       $counter = 1;
                                        if ($table != 'pages'
                                                && $this->showNewRecLink($table)
                                                && $this->isTableAllowedForThisPage($this->pageinfo, $table)
-                                               && $GLOBALS['BE_USER']->check('tables_modify', $table)
+                                               && $this->getBackendUserAuthentication()->check('tables_modify', $table)
                                                && (($v['ctrl']['rootLevel'] xor $this->id) || $v['ctrl']['rootLevel'] == -1)
-                                               && $GLOBALS['BE_USER']->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id), $table)
+                                               && $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id), $table)
                                        ) {
                                                $newRecordIcon = IconUtility::getSpriteIconForRecord($table, array());
                                                $rowContent = '';
+                                               $thisTitle = '';
                                                // Create new link for record:
-                                               $newLink = $this->linkWrap($newRecordIcon . $GLOBALS['LANG']->sL($v['ctrl']['title'], TRUE), $table, $this->id);
+                                               $newLink = $this->linkWrap($newRecordIcon . $lang->sL($v['ctrl']['title'], TRUE), $table, $this->id);
                                                // If the table is 'tt_content' (from "cms" extension), create link to wizard
                                                if ($table == 'tt_content') {
-                                                       $groupName = $GLOBALS['LANG']->getLL('createNewContent');
-                                                       $rowContent = $newContentIcon . '<strong>' . $GLOBALS['LANG']->getLL('createNewContent') . '</strong><ul>';
+                                                       $groupName = $lang->getLL('createNewContent');
+                                                       $rowContent = $newContentIcon . '<strong>' . $lang->getLL('createNewContent') . '</strong><ul>';
                                                        // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's wizard instead:
                                                        $overrideExt = $this->web_list_modTSconfig['properties']['newContentWiz.']['overrideWithExtension'];
                                                        $pathToWizard = ExtensionManagementUtility::isLoaded($overrideExt) ? ExtensionManagementUtility::extRelPath($overrideExt) . 'mod1/db_new_content_el.php?' : BackendUtility::getModuleUrl('new_content_element') . '&';
                                                        $href = $pathToWizard . 'id=' . $this->id . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'));
-                                                       $rowContent .= '<li>' . $newLink . ' ' . BackendUtility::wrapInHelp($table, '') . '</li><li><a href="' . htmlspecialchars($href) . '">' . $newContentIcon . htmlspecialchars($GLOBALS['LANG']->getLL('clickForWizard')) . '</a></li></ul>';
+                                                       $rowContent .= '<li>' . $newLink . ' ' . BackendUtility::wrapInHelp($table, '') . '</li><li><a href="' . htmlspecialchars($href) . '">' . $newContentIcon . htmlspecialchars($lang->getLL('clickForWizard')) . '</a></li></ul>';
                                                } else {
                                                        // Get the title
                                                        if ($v['ctrl']['readOnly'] || $v['ctrl']['hideTable'] || $v['ctrl']['is_static']) {
@@ -426,6 +432,7 @@ class NewRecordController {
                                                        }
                                                        $nameParts = explode('_', $table);
                                                        $thisTitle = '';
+                                                       $_EXTKEY = '';
                                                        if ($nameParts[0] == 'tx' || $nameParts[0] == 'tt') {
                                                                // Try to extract extension name
                                                                if (substr($v['ctrl']['title'], 0, 8) == 'LLL:EXT:') {
@@ -435,10 +442,12 @@ class NewRecordController {
                                                                                // First try to get localisation of extension title
                                                                                $temp = explode(':', substr($v['ctrl']['title'], 9 + strlen($_EXTKEY)));
                                                                                $langFile = $temp[0];
-                                                                               $thisTitle = $GLOBALS['LANG']->sL('LLL:EXT:' . $_EXTKEY . '/' . $langFile . ':extension.title');
+                                                                               $thisTitle = $lang->sL('LLL:EXT:' . $_EXTKEY . '/' . $langFile . ':extension.title');
                                                                                // If no localisation available, read title from ext_emconf.php
-                                                                               if (!$thisTitle && is_file(ExtensionManagementUtility::extPath($_EXTKEY) . 'ext_emconf.php')) {
-                                                                                       include ExtensionManagementUtility::extPath($_EXTKEY) . 'ext_emconf.php';
+                                                                               $extEmConfFile = ExtensionManagementUtility::extPath($_EXTKEY) . 'ext_emconf.php';
+                                                                               if (!$thisTitle && is_file($extEmConfFile)) {
+                                                                                       $EM_CONF = array();
+                                                                                       include $extEmConfFile;
                                                                                        $thisTitle = $EM_CONF[$_EXTKEY]['title'];
                                                                                }
                                                                                $iconFile[$_EXTKEY] = '<img ' . 'src="' . ExtensionManagementUtility::extRelPath($_EXTKEY) . $GLOBALS['TYPO3_LOADED_EXT'][$_EXTKEY]['ext_icon'] . '" ' . 'width="16" height="16" ' . 'alt="' . $thisTitle . '" />';
@@ -454,7 +463,7 @@ class NewRecordController {
                                                                        continue;
                                                                }
                                                                $_EXTKEY = 'system';
-                                                               $thisTitle = $GLOBALS['LANG']->getLL('system_records');
+                                                               $thisTitle = $lang->getLL('system_records');
                                                                $iconFile['system'] = IconUtility::getSpriteIcon('apps-pagetree-root');
                                                        }
                                                        if ($groupName == '' || $groupName != $_EXTKEY) {
@@ -562,11 +571,7 @@ class NewRecordController {
         */
        public function isTableAllowedForThisPage($pid_row, $checkTable) {
                if (!is_array($pid_row)) {
-                       if ($GLOBALS['BE_USER']->user['admin']) {
-                               return TRUE;
-                       } else {
-                               return FALSE;
-                       }
+                       return $this->getBackendUserAuthentication()->isAdmin();
                }
                // be_users and be_groups may not be created anywhere but in the root.
                if ($checkTable == 'be_users' || $checkTable == 'be_groups') {
@@ -630,6 +635,15 @@ class NewRecordController {
        }
 
        /**
+        * Return language service instance
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
+
+       /**
         * Returns the global BackendUserAuthentication object.
         *
         * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
index dbb8ea3..bfb2c90 100644 (file)
@@ -20,10 +20,21 @@ use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\HttpUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
-use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 use TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper;
+use TYPO3\CMS\Recordlist\RecordList;
+use TYPO3\CMS\Core\DataHandling\DataHandler;
+use TYPO3\CMS\Frontend\Page\PageRepository;
+use TYPO3\CMS\Backend\Module\ModuleLoader;
+use TYPO3\CMS\Backend\Template\DocumentTemplate;
+use TYPO3\CMS\Backend\View\BackendLayoutView;
+use TYPO3\CMS\Backend\Form\DataPreprocessor;
+use TYPO3\CMS\Backend\Form\FormEngine;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
+use TYPO3\CMS\Backend\View\PageLayoutView;
+use TYPO3\CMS\Backend\Tree\View\ContentLayoutPagePositionMap;
 
 /**
  * Script Class for Web > Layout module
@@ -246,19 +257,54 @@ class PageLayoutController {
        protected $markers = array();
 
        /**
+        * @var array
+        */
+       protected $eRParts = array();
+
+       /**
+        * @var string
+        */
+       protected $editSelect;
+
+       /**
+        * @var bool
+        */
+       protected $deleteButton;
+
+       /**
+        * @var bool
+        */
+       protected $undoButton;
+
+       /**
+        * @var array
+        */
+       protected $undoButtonR;
+
+       /**
+        * @var string
+        */
+       protected $R_URI;
+
+       /**
+        * @var string
+        */
+       protected $closeUrl;
+
+       /**
         * Initializing the module
         *
         * @return void
         */
        public function init() {
-               $GLOBALS['LANG']->includeLLFile('EXT:cms/layout/locallang.xlf');
+               $this->getLanguageService()->includeLLFile('EXT:cms/layout/locallang.xlf');
 
                // Setting module configuration / page select clause
                $this->MCONF = $GLOBALS['MCONF'];
-               $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
+               $this->perms_clause = $this->getBackendUser()->getPagePermsClause(1);
                $this->backPath = $GLOBALS['BACK_PATH'];
                // Get session data
-               $sessionData = $GLOBALS['BE_USER']->getSessionData(\TYPO3\CMS\Recordlist\RecordList::class);
+               $sessionData = $this->getBackendUser()->getSessionData(RecordList::class);
                $this->search_field = !empty($sessionData['search_field']) ? $sessionData['search_field'] : '';
                // GPvars:
                $this->id = (int)GeneralUtility::_GP('id');
@@ -275,7 +321,7 @@ class PageLayoutController {
                $this->externalTables = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables'];
                $sessionData['search_field'] = $this->search_field;
                // Store session data
-               $GLOBALS['BE_USER']->setAndSaveSessionData(\TYPO3\CMS\Recordlist\RecordList::class, $sessionData);
+               $this->getBackendUser()->setAndSaveSessionData(RecordList::class, $sessionData);
                // Load page info array:
                $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
                // Initialize menu
@@ -295,18 +341,19 @@ class PageLayoutController {
         * @return void
         */
        public function menuConfig() {
+               $lang = $this->getLanguageService();
                // MENU-ITEMS:
                $this->MOD_MENU = array(
                        'tt_content_showHidden' => '',
                        'showPalettes' => '',
                        'showDescriptions' => '',
                        'function' => array(
-                               0 => $GLOBALS['LANG']->getLL('m_function_0'),
-                               1 => $GLOBALS['LANG']->getLL('m_function_1'),
-                               2 => $GLOBALS['LANG']->getLL('m_function_2')
+                               0 => $lang->getLL('m_function_0'),
+                               1 => $lang->getLL('m_function_1'),
+                               2 => $lang->getLL('m_function_2')
                        ),
                        'language' => array(
-                               0 => $GLOBALS['LANG']->getLL('m_default')
+                               0 => $lang->getLL('m_default')
                        )
                );
                // example settings:
@@ -323,20 +370,20 @@ class PageLayoutController {
                                }
                                if (is_array($tableSettings) && count($tableSettings) > 1) {
                                        foreach ($tableSettings as $key => $settings) {
-                                               $this->MOD_MENU[$table][$key] = $GLOBALS['LANG']->sL($settings['MENU']);
+                                               $this->MOD_MENU[$table][$key] = $lang->sL($settings['MENU']);
                                        }
                                }
                        }
                }
                // First, select all pages_language_overlay records on the current page. Each represents a possibility for a language on the page. Add these to language selector.
                $res = $this->exec_languageQuery($this->id);
-               while ($lrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                       if ($GLOBALS['BE_USER']->checkLanguageAccess($lrow['uid'])) {
-                               $this->MOD_MENU['language'][$lrow['uid']] = $lrow['hidden'] ? '(' . $lrow['title'] . ')' : $lrow['title'];
+               while ($lRow = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
+                       if ($this->getBackendUser()->checkLanguageAccess($lRow['uid'])) {
+                               $this->MOD_MENU['language'][$lRow['uid']] = $lRow['hidden'] ? '(' . $lRow['title'] . ')' : $lRow['title'];
                        }
                }
                // Find if there are ANY languages at all (and if not, remove the language option from function menu).
-               $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'sys_language', $GLOBALS['BE_USER']->isAdmin() ? '' : 'hidden=0');
+               $count = $this->getDatabaseConnection()->exec_SELECTcountRows('uid', 'sys_language', $this->getBackendUser()->isAdmin() ? '' : 'hidden=0');
                if (!$count) {
                        unset($this->MOD_MENU['function']['2']);
                }
@@ -358,7 +405,7 @@ class PageLayoutController {
                // Clean up settings
                $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), 'web_layout');
                // For all elements to be shown in draft workspaces & to also show hidden elements by default if user hasn't disabled the option
-               if ($GLOBALS['BE_USER']->workspace != 0 || $this->MOD_SETTINGS['tt_content_showHidden'] !== '0') {
+               if ($this->getBackendUser()->workspace != 0 || $this->MOD_SETTINGS['tt_content_showHidden'] !== '0') {
                        $this->MOD_SETTINGS['tt_content_showHidden'] = 1;
                }
        }
@@ -370,8 +417,8 @@ class PageLayoutController {
         */
        public function clearCache() {
                if ($this->clear_cache) {
-                       $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
-                       $tce->stripslashes_values = 0;
+                       $tce = GeneralUtility::makeInstance(DataHandler::class);
+                       $tce->stripslashes_values = FALSE;
                        $tce->start(array(), array());
                        $tce->clear_cacheCmd($this->id);
                }
@@ -384,16 +431,17 @@ class PageLayoutController {
         */
        protected function getHeaderFlashMessagesForCurrentPid() {
                $content = '';
+               $lang = $this->getLanguageService();
                // If page is a folder
-               if ($this->pageinfo['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SYSFOLDER) {
+               if ($this->pageinfo['doktype'] == PageRepository::DOKTYPE_SYSFOLDER) {
                        // Access to list module
-                       $moduleLoader = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Module\ModuleLoader::class);
+                       $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class);
                        $moduleLoader->load($GLOBALS['TBE_MODULES']);
                        $modules = $moduleLoader->modules;
                        if (is_array($modules['web']['sub']['list'])) {
-                               $title = $GLOBALS['LANG']->getLL('goToListModule');
-                               $message = '<p>' . $GLOBALS['LANG']->getLL('goToListModuleMessage') . '</p>';
-                               $message .= '<a class="btn btn-info" href="javascript:top.goToModule(\'web_list\',1);">' . $GLOBALS['LANG']->getLL('goToListModule') . '</a>';
+                               $title = $lang->getLL('goToListModule');
+                               $message = '<p>' . $lang->getLL('goToListModuleMessage') . '</p>';
+                               $message .= '<a class="btn btn-info" href="javascript:top.goToModule(\'web_list\',1);">' . $lang->getLL('goToListModule') . '</a>';
 
                                $view = GeneralUtility::makeInstance(StandaloneView::class);
                                $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/InfoBox.html'));
@@ -411,7 +459,7 @@ class PageLayoutController {
                        $title = BackendUtility::getRecordTitle('pages', $contentPage);
                        $linkToPid = $this->local_linkThisScript(array('id' => $this->pageinfo['content_from_pid']));
                        $link = '<a href="' . $linkToPid . '">' . htmlspecialchars($title) . ' (PID ' . (int)$this->pageinfo['content_from_pid'] . ')</a>';
-                       $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, sprintf($GLOBALS['LANG']->getLL('content_from_pid_title'), $link), '', FlashMessage::INFO);
+                       $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, sprintf($lang->getLL('content_from_pid_title'), $link), '', FlashMessage::INFO);
                        $content .= $flashMessage->render();
                }
                return $content;
@@ -423,7 +471,7 @@ class PageLayoutController {
         */
        protected function getLocalizedPageTitle() {
                if ($this->current_sys_language > 0) {
-                       $overlayRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
+                       $overlayRecord = $this->getDatabaseConnection()->exec_SELECTgetSingleRow(
                                'title',
                                'pages_language_overlay',
                                'pid = ' . (int)$this->id .
@@ -448,15 +496,16 @@ class PageLayoutController {
         * @return void
         */
        public function main() {
+               $lang = $this->getLanguageService();
                // Access check...
                // The page will show only if there is a valid page and if this page may be viewed by the user
                $access = is_array($this->pageinfo) ? 1 : 0;
                if ($this->id && $access) {
                        // Initialize permission settings:
-                       $this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
+                       $this->CALC_PERMS = $this->getBackendUser()->calcPerms($this->pageinfo);
                        $this->EDIT_CONTENT = $this->CALC_PERMS & Permission::CONTENT_EDIT ? 1 : 0;
                        // Start document template object:
-                       $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
+                       $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
                        $this->doc->backPath = $GLOBALS['BACK_PATH'];
                        $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html');
 
@@ -481,8 +530,8 @@ class PageLayoutController {
                        ' . ($this->popView ? BackendUtility::viewOnClick($this->id, $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->id)) : '') . '
 
                                function deleteRecord(table,id,url) {   //
-                                       if (confirm(' . GeneralUtility::quoteJSvalue($GLOBALS['LANG']->getLL('deleteWarning')) . ')) {
-                                               window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1";
+                                       if (confirm(' . GeneralUtility::quoteJSvalue($lang->getLL('deleteWarning')) . ')) {
+                                               window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $this->getBackendUser()->veriCode() . BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1";
                                        }
                                        return false;
                                }
@@ -558,9 +607,9 @@ class PageLayoutController {
                                )) . '" method="post">';
                        // Creating the top function menu:
                        $this->topFuncMenu = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'], '', '');
-                       $this->languageMenu = count($this->MOD_MENU['language']) > 1 ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.language', TRUE) . BackendUtility::getFuncMenu($this->id, 'SET[language]', $this->current_sys_language, $this->MOD_MENU['language'], '', '') : '';
+                       $languageMenu = count($this->MOD_MENU['language']) > 1 ? $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.language', TRUE) . BackendUtility::getFuncMenu($this->id, 'SET[language]', $this->current_sys_language, $this->MOD_MENU['language'], '', '') : '';
                        // Find backend layout / coumns
-                       $backendLayout = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getSelectedBackendLayout', $this->id, $this);
+                       $backendLayout = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getSelectedBackendLayout', $this->id, $this);
                        if (count($backendLayout['__colPosList'])) {
                                $this->colPosList = implode(',', $backendLayout['__colPosList']);
                        }
@@ -598,15 +647,15 @@ class PageLayoutController {
                        $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS['function'] == 0 ? 'quickEdit' : '');
                        $this->markers['CSH'] = $docHeaderButtons['csh'];
                        $this->markers['TOP_FUNCTION_MENU'] = $this->topFuncMenu . $this->editSelect;
-                       $this->markers['LANGSELECTOR'] = $this->languageMenu;
+                       $this->markers['LANGSELECTOR'] = $languageMenu;
                        $this->markers['CONTENT'] = $body;
                        // Build the <body> for the module
                        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $this->markers);
                        // Renders the module page
-                       $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content);
+                       $this->content = $this->doc->render($lang->getLL('title'), $this->content);
                } else {
                        // If no access or id value, create empty document:
-                       $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
+                       $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
                        $this->doc->backPath = $GLOBALS['BACK_PATH'];
                        $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html');
                        $this->doc->JScode = $this->doc->wrapScriptTags('
@@ -615,8 +664,8 @@ class PageLayoutController {
 
                        $body = $this->doc->header($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']);
 
-                       $title = $GLOBALS['LANG']->getLL('clickAPage_header');
-                       $message = $GLOBALS['LANG']->getLL('clickAPage_content');
+                       $title = $lang->getLL('clickAPage_header');
+                       $message = $lang->getLL('clickAPage_content');
 
                        $view = GeneralUtility::makeInstance(StandaloneView::class);
                        $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/InfoBox.html'));
@@ -653,16 +702,19 @@ class PageLayoutController {
                        $this->markers['CONTENT'] = $body;
                        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $this->markers);
                        // Renders the module page
-                       $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content);
+                       $this->content = $this->doc->render($lang->getLL('title'), $this->content);
                }
        }
 
        /**
         * Rendering the quick-edit view.
         *
-        * @return void
+        * @return string
         */
        public function renderQuickEdit() {
+               $databaseConnection = $this->getDatabaseConnection();
+               $beUser = $this->getBackendUser();
+               $lang = $this->getLanguageService();
                // Alternative template
                $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout_quickedit.html');
                // Alternative form tag; Quick Edit submits its content to tce_db.php.
@@ -673,21 +725,21 @@ class PageLayoutController {
                $edit_record = $this->edit_record;
                // If a command to edit all records in a column is issue, then select all those elements, and redirect to FormEngine
                if (substr($edit_record, 0, 9) == '_EDIT_COL') {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . (int)$this->id . ' AND colPos=' . (int)substr($edit_record, 10) . ' AND sys_language_uid=' . (int)$this->current_sys_language . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting');
+                       $res = $databaseConnection->exec_SELECTquery('*', 'tt_content', 'pid=' . (int)$this->id . ' AND colPos=' . (int)substr($edit_record, 10) . ' AND sys_language_uid=' . (int)$this->current_sys_language . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting');
                        $idListA = array();
-                       while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                       while ($cRow = $databaseConnection->sql_fetch_assoc($res)) {
                                $idListA[] = $cRow['uid'];
                        }
                        $url = BackendUtility::getModuleUrl('record_edit', array(
                                'edit[tt_content][' . implode(',', $idListA) . ']' => 'edit',
                                'returnUrl' => $this->local_linkThisScript(array('edit_record' => ''))
                        ));
-                       \TYPO3\CMS\Core\Utility\HttpUtility::redirect($url);
+                       HttpUtility::redirect($url);
                }
                // If the former record edited was the creation of a NEW record, this will look up the created records uid:
                if ($this->new_unique_uid) {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid=' . (int)$GLOBALS['BE_USER']->user['uid'] . ' AND NEWid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log'));
-                       $sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
+                       $res = $databaseConnection->exec_SELECTquery('*', 'sys_log', 'userid=' . (int)$beUser->user['uid'] . ' AND NEWid=' . $databaseConnection->fullQuoteStr($this->new_unique_uid, 'sys_log'));
+                       $sys_log_row = $databaseConnection->sql_fetch_assoc($res);
                        if (is_array($sys_log_row)) {
                                $edit_record = $sys_log_row['tablename'] . ':' . $sys_log_row['recuid'];
                        }
@@ -702,19 +754,19 @@ class PageLayoutController {
                if (is_array($languageOverlayRecord)) {
                        $inValue = 'pages_language_overlay:' . $languageOverlayRecord['uid'];
                        $is_selected += (int)$edit_record == $inValue;
-                       $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('editLanguageHeader', TRUE) . ' ]</option>';
+                       $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $lang->getLL('editLanguageHeader', TRUE) . ' ]</option>';
                } else {
                        $inValue = 'pages:' . $this->id;
                        $is_selected += (int)$edit_record == $inValue;
-                       $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('editPageProperties', TRUE) . ' ]</option>';
+                       $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $lang->getLL('editPageProperties', TRUE) . ' ]</option>';
                }
                // Selecting all content elements from this language and allowed colPos:
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . (int)$this->id . ' AND sys_language_uid=' . (int)$this->current_sys_language . ' AND colPos IN (' . $this->colPosList . ')' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting');
+               $res = $databaseConnection->exec_SELECTquery('*', 'tt_content', 'pid=' . (int)$this->id . ' AND sys_language_uid=' . (int)$this->current_sys_language . ' AND colPos IN (' . $this->colPosList . ')' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting');
                $colPos = NULL;
                $first = 1;
                // Page is the pid if no record to put this after.
                $prev = $this->id;
-               while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+               while ($cRow = $databaseConnection->sql_fetch_assoc($res)) {
                        BackendUtility::workspaceOL('tt_content', $cRow);
                        if (is_array($cRow)) {
                                if ($first) {
@@ -726,11 +778,11 @@ class PageLayoutController {
                                if (!isset($colPos) || $cRow['colPos'] !== $colPos) {
                                        $colPos = $cRow['colPos'];
                                        $opt[] = '<option value=""></option>';
-                                       $opt[] = '<option value="_EDIT_COL:' . $colPos . '">__' . $GLOBALS['LANG']->sL(BackendUtility::getLabelFromItemlist('tt_content', 'colPos', $colPos), TRUE) . ':__</option>';
+                                       $opt[] = '<option value="_EDIT_COL:' . $colPos . '">__' . $lang->sL(BackendUtility::getLabelFromItemlist('tt_content', 'colPos', $colPos), TRUE) . ':__</option>';
                                }
                                $inValue = 'tt_content:' . $cRow['uid'];
                                $is_selected += (int)$edit_record == $inValue;
-                               $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(($cRow['header'] ? $cRow['header'] : '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title') . '] ' . strip_tags($cRow['bodytext'])), $GLOBALS['BE_USER']->uc['titleLen'])) . '</option>';
+                               $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(($cRow['header'] ? $cRow['header'] : '[' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title') . '] ' . strip_tags($cRow['bodytext'])), $beUser->uc['titleLen'])) . '</option>';
                                $prev = -$cRow['uid'];
                        }
                }
@@ -739,22 +791,22 @@ class PageLayoutController {
                        $edit_record = 'tt_content:new/' . $prev . '/' . $colPos;
                        $inValue = 'tt_content:new/' . $prev . '/' . $colPos;
                        $is_selected += (int)$edit_record == $inValue;
-                       $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('newLabel', 1) . ' ]</option>';
+                       $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $lang->getLL('newLabel', 1) . ' ]</option>';
                }
                // If none is yet selected...
                if (!$is_selected) {
                        $opt[] = '<option value=""></option>';
-                       $opt[] = '<option value="' . $edit_record . '"  selected="selected">[ ' . $GLOBALS['LANG']->getLL('newLabel', TRUE) . ' ]</option>';
+                       $opt[] = '<option value="' . $edit_record . '"  selected="selected">[ ' . $lang->getLL('newLabel', TRUE) . ' ]</option>';
                }
                // Splitting the edit-record cmd value into table/uid:
                $this->eRParts = explode(':', $edit_record);
                // Delete-button flag?
                $this->deleteButton = MathUtility::canBeInterpretedAsInteger($this->eRParts[1]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & Permission::PAGE_DELETE);
                // If undo-button should be rendered (depends on available items in sys_history)
-               $this->undoButton = 0;
-               $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->eRParts[0], 'sys_history') . ' AND recuid=' . (int)$this->eRParts[1], '', 'tstamp DESC', '1');
-               if ($this->undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
-                       $this->undoButton = 1;
+               $this->undoButton = FALSE;
+               $undoRes = $databaseConnection->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $databaseConnection->fullQuoteStr($this->eRParts[0], 'sys_history') . ' AND recuid=' . (int)$this->eRParts[1], '', 'tstamp DESC', '1');
+               if ($this->undoButtonR = $databaseConnection->sql_fetch_assoc($undoRes)) {
+                       $this->undoButton = TRUE;
                }
                // Setting up the Return URL for coming back to THIS script (if links take the user to another script)
                $R_URL_parts = parse_url(GeneralUtility::getIndpEnv('REQUEST_URI'));
@@ -775,18 +827,19 @@ class PageLayoutController {
                $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue(
                        BackendUtility::getModuleUrl('web_layout') . '&id=' . $this->id . '&edit_record='
                ) . '+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);') . '">' . implode('', $opt) . '</select>';
+               $content = '';
                // Creating editing form:
-               if ($GLOBALS['BE_USER']->check('tables_modify', $this->eRParts[0]) && $edit_record && ($this->eRParts[0] !== 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] === 'pages' && $this->CALC_PERMS & Permission::PAGE_SHOW)) {
+               if ($beUser->check('tables_modify', $this->eRParts[0]) && $edit_record && ($this->eRParts[0] !== 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] === 'pages' && $this->CALC_PERMS & Permission::PAGE_SHOW)) {
                        // Splitting uid parts for special features, if new:
                        list($uidVal, $ex_pid, $ex_colPos) = explode('/', $this->eRParts[1]);
                        // Convert $uidVal to workspace version if any:
                        if ($uidVal != 'new') {
-                               if ($draftRecord = BackendUtility::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->eRParts[0], $uidVal, 'uid')) {
+                               if ($draftRecord = BackendUtility::getWorkspaceVersionOfRecord($beUser->workspace, $this->eRParts[0], $uidVal, 'uid')) {
                                        $uidVal = $draftRecord['uid'];
                                }
                        }
                        // Initializing transfer-data object:
-                       $trData = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\DataPreprocessor::class);
+                       $trData = GeneralUtility::makeInstance(DataPreprocessor::class);
                        $trData->addRawData = TRUE;
                        $trData->defVals[$this->eRParts[0]] = array(
                                'colPos' => (int)$ex_colPos,
@@ -795,6 +848,7 @@ class PageLayoutController {
                        $trData->lockRecords = 1;
                        // 'new'
                        $trData->fetchRecord($this->eRParts[0], $uidVal == 'new' ? $this->id : $uidVal, $uidVal);
+                       $new_unique_uid = '';
                        // Getting/Making the record:
                        reset($trData->regTableItems_data);
                        $rec = current($trData->regTableItems_data);
@@ -806,20 +860,20 @@ class PageLayoutController {
                        } else {
                                $rec['uid'] = $uidVal;
                                // Checking internals access:
-                               $recordAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($this->eRParts[0], $uidVal);
+                               $recordAccess = $beUser->recordEditAccessInternals($this->eRParts[0], $uidVal);
                        }
                        if (!$recordAccess) {
                                // If no edit access, print error message:
-                               $content = $this->doc->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />' . ($GLOBALS['BE_USER']->errorMsg ? 'Reason: ' . $GLOBALS['BE_USER']->errorMsg . '<br /><br />' : ''), 0, 1);
+                               $content = $this->doc->section($lang->getLL('noAccess'), $lang->getLL('noAccess_msg') . '<br /><br />' . ($beUser->errorMsg ? 'Reason: ' . $beUser->errorMsg . '<br /><br />' : ''), 0, 1);
                        } elseif (is_array($rec)) {
                                // If the record is an array (which it will always be... :-)
                                // Create instance of TCEforms, setting defaults:
-                               $tceforms = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Form\FormEngine::class);
-                               $tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
+                               $tceForms = GeneralUtility::makeInstance(FormEngine::class);
+                               $tceForms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
                                // Render form, wrap it:
                                $panel = '';
-                               $panel .= $tceforms->getMainFields($this->eRParts[0], $rec);
-                               $panel = $tceforms->wrapTotal($panel, $rec, $this->eRParts[0]);
+                               $panel .= $tceForms->getMainFields($this->eRParts[0], $rec);
+                               $panel = $tceForms->wrapTotal($panel, $rec, $this->eRParts[0]);
                                // Add hidden fields:
                                $theCode = $panel;
                                if ($uidVal == 'new') {
@@ -836,14 +890,15 @@ class PageLayoutController {
                                                        'returnUrl' => $this->returnUrl
                                                )
                                        ) : $this->R_URI)) . '" />
-                                       ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction');
+                                       ' . FormEngine::getHiddenTokenField('tceAction');
                                // Add JavaScript as needed around the form:
-                               $theCode = $tceforms->printNeededJSFunctions_top() . $theCode . $tceforms->printNeededJSFunctions();
+                               $theCode = $tceForms->printNeededJSFunctions_top() . $theCode . $tceForms->printNeededJSFunctions();
                                // Add warning sign if record was "locked":
                                if ($lockInfo = BackendUtility::isRecordLocked($this->eRParts[0], $rec['uid'])) {
-                                       $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, htmlspecialchars($lockInfo['msg']), '', FlashMessage::WARNING);
+                                       /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */
+                                       $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, htmlspecialchars($lockInfo['msg']), '', FlashMessage::WARNING);
                                        /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
-                                       $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
+                                       $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
                                        /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
                                        $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
                                        $defaultFlashMessageQueue->enqueue($flashMessage);
@@ -853,7 +908,7 @@ class PageLayoutController {
                        }
                } else {
                        // If no edit access, print error message:
-                       $content = $this->doc->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />', 0, 1);
+                       $content = $this->doc->section($lang->getLL('noAccess'), $lang->getLL('noAccess_msg') . '<br /><br />', 0, 1);
                }
                // Bottom controls (function menus):
                $q_count = $this->getNumberOfHiddenElements();
@@ -861,14 +916,14 @@ class PageLayoutController {
                $h_func_b = '<div class="checkbox">' .
                        '<label for="checkTt_content_showHidden">' .
                        BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], '', '', 'id="checkTt_content_showHidden"') .
-                       (!$q_count ? ('<span class="text-muted">' . $GLOBALS['LANG']->getLL('hiddenCE', TRUE) . '</span>') : $GLOBALS['LANG']->getLL('hiddenCE', TRUE) . ' (' . $q_count . ')') .
+                       (!$q_count ? ('<span class="text-muted">' . $lang->getLL('hiddenCE', TRUE) . '</span>') : $lang->getLL('hiddenCE', TRUE) . ' (' . $q_count . ')') .
                        '</label>' .
                        '</div>';
 
                $h_func_b .= '<div class="checkbox">' .
                        '<label for="checkShowPalettes">' .
                        BackendUtility::getFuncCheck($this->id, 'SET[showPalettes]', $this->MOD_SETTINGS['showPalettes'], '', '', 'id="checkShowPalettes"') .
-                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPalettes', TRUE) .
+                       $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPalettes', TRUE) .
                        '</label>' .
                        '</div>';
 
@@ -876,7 +931,7 @@ class PageLayoutController {
                        $h_func_b .= '<div class="checkbox">' .
                                '<label for="checkShowDescriptions">' .
                                BackendUtility::getFuncCheck($this->id, 'SET[showDescriptions]', $this->MOD_SETTINGS['showDescriptions'], '', '', 'id="checkShowDescriptions"') .
-                               $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showDescriptions', TRUE) .
+                               $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showDescriptions', TRUE) .
                                '</label>' .
                                '</div>';
                }
@@ -885,7 +940,7 @@ class PageLayoutController {
                $content .= $this->doc->spacer(10);
                // Select element matrix:
                if ($this->eRParts[0] == 'tt_content' && MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) {
-                       $posMap = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\ContentLayoutPagePositionMap::class);
+                       $posMap = GeneralUtility::makeInstance(ContentLayoutPagePositionMap::class);
                        $posMap->backPath = $GLOBALS['BACK_PATH'];
                        $posMap->cur_sys_language = $this->current_sys_language;
                        $HTMLcode = '';
@@ -893,7 +948,7 @@ class PageLayoutController {
                        $HTMLcode .= BackendUtility::cshItem($this->descrTable, 'quickEdit_selElement', NULL, '|<br />');
                        $HTMLcode .= $posMap->printContentElementColumns($this->id, $this->eRParts[1], $this->colPosList, $this->MOD_SETTINGS['tt_content_showHidden'], $this->R_URI);
                        $content .= $this->doc->spacer(20);
-                       $content .= $this->doc->section($GLOBALS['LANG']->getLL('CEonThisPage'), $HTMLcode, 0, 1);
+                       $content .= $this->doc->section($lang->getLL('CEonThisPage'), $HTMLcode, 0, 1);
                        $content .= $this->doc->spacer(20);
                }
                return $content;
@@ -902,34 +957,35 @@ class PageLayoutController {
        /**
         * Rendering all other listings than QuickEdit
         *
-        * @return void
+        * @return string
         */
        public function renderListContent() {
                // Initialize list object (see "class.db_layout.inc"):
-               /** @var $dblist \TYPO3\CMS\Backend\View\PageLayoutView */
-               $dblist = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\View\PageLayoutView::class);
-               $dblist->backPath = $GLOBALS['BACK_PATH'];
-               $dblist->thumbs = $this->imagemode;
-               $dblist->no_noWrap = 1;
-               $dblist->descrTable = $this->descrTable;
+               /** @var $dbList \TYPO3\CMS\Backend\View\PageLayoutView */
+               $dbList = GeneralUtility::makeInstance(PageLayoutView::class);
+               $dbList->backPath = $GLOBALS['BACK_PATH'];
+               $dbList->thumbs = $this->imagemode;
+               $dbList->no_noWrap = 1;
+               $dbList->descrTable = $this->descrTable;
                $this->pointer = MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
-               $dblist->script = BackendUtility::getModuleUrl('web_layout');
-               $dblist->showIcon = 0;
-               $dblist->setLMargin = 0;
-               $dblist->doEdit = $this->EDIT_CONTENT;
-               $dblist->ext_CALC_PERMS = $this->CALC_PERMS;
-               $dblist->agePrefixes = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears');
-               $dblist->id = $this->id;
-               $dblist->nextThree = MathUtility::forceIntegerInRange($this->modTSconfig['properties']['editFieldsAtATime'], 0, 10);
-               $dblist->option_showBigButtons = $this->modTSconfig['properties']['disableBigButtons'] === '0';
-               $dblist->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
-               $dblist->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
-               if (!$dblist->nextThree) {
-                       $dblist->nextThree = 1;
+               $dbList->script = BackendUtility::getModuleUrl('web_layout');
+               $dbList->showIcon = 0;
+               $dbList->setLMargin = 0;
+               $dbList->doEdit = $this->EDIT_CONTENT;
+               $dbList->ext_CALC_PERMS = $this->CALC_PERMS;
+               $dbList->agePrefixes = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears');
+               $dbList->id = $this->id;
+               $dbList->nextThree = MathUtility::forceIntegerInRange($this->modTSconfig['properties']['editFieldsAtATime'], 0, 10);
+               $dbList->option_showBigButtons = $this->modTSconfig['properties']['disableBigButtons'] === '0';
+               $dbList->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
+               $dbList->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
+               if (!$dbList->nextThree) {
+                       $dbList->nextThree = 1;
                }
-               $dblist->externalTables = $this->externalTables;
+               $dbList->externalTables = $this->externalTables;
                // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!)
-               $h_menu = $dblist->getTableMenu($this->id);
+               // also fills $dbList->activeTables
+               $dbList->getTableMenu($this->id);
                // Initialize other variables:
                $h_func = '';
                $tableOutput = array();
@@ -937,25 +993,26 @@ class PageLayoutController {
                $CMcounter = 0;
                // Traverse the list of table names which has records on this page (that array is populated
                // by the $dblist object during the function getTableMenu()):
-               foreach ($dblist->activeTables as $table => $value) {
-                       if (!isset($dblist->externalTables[$table])) {
+               foreach ($dbList->activeTables as $table => $value) {
+                       $h_func_b = '';
+                       if (!isset($dbList->externalTables[$table])) {
                                $q_count = $this->getNumberOfHiddenElements();
 
                                $h_func_b = '<div class="checkbox">' .
                                        '<label for="checkTt_content_showHidden">' .
                                        BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], '', '', 'id="checkTt_content_showHidden"') .
-                                       (!$q_count ? ('<span class="text-muted">' . $GLOBALS['LANG']->getLL('hiddenCE') . '</span>') : $GLOBALS['LANG']->getLL('hiddenCE') . ' (' . $q_count . ')') .
+                                       (!$q_count ? ('<span class="text-muted">' . $this->getLanguageService()->getLL('hiddenCE') . '</span>') : $this->getLanguageService()->getLL('hiddenCE') . ' (' . $q_count . ')') .
                                        '</label>' .
                                        '</div>';
 
                                // Boolean: Display up/down arrows and edit icons for tt_content records
-                               $dblist->tt_contentConfig['showCommands'] = 1;
+                               $dbList->tt_contentConfig['showCommands'] = 1;
                                // Boolean: Display info-marks or not
-                               $dblist->tt_contentConfig['showInfo'] = 1;
+                               $dbList->tt_contentConfig['showInfo'] = 1;
                                // Setting up the tt_content columns to show:
                                if (is_array($GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'])) {
                                        $colList = array();
-                                       $tcaItems = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $this->id, $this);
+                                       $tcaItems = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getColPosListItemsParsed', $this->id, $this);
                                        foreach ($tcaItems as $temp) {
                                                $colList[] = $temp[1];
                                        }
@@ -967,16 +1024,16 @@ class PageLayoutController {
                                        $colList = array_intersect(GeneralUtility::intExplode(',', $this->colPosList), $colList);
                                }
                                // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
-                               $dblist->tt_contentConfig['cols'] = implode(',', $colList);
-                               $dblist->tt_contentConfig['activeCols'] = $this->activeColPosList;
-                               $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
-                               $dblist->tt_contentConfig['sys_language_uid'] = (int)$this->current_sys_language;
+                               $dbList->tt_contentConfig['cols'] = implode(',', $colList);
+                               $dbList->tt_contentConfig['activeCols'] = $this->activeColPosList;
+                               $dbList->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
+                               $dbList->tt_contentConfig['sys_language_uid'] = (int)$this->current_sys_language;
                                // If the function menu is set to "Language":
                                if ($this->MOD_SETTINGS['function'] == 2) {
-                                       $dblist->tt_contentConfig['single'] = 0;
-                                       $dblist->tt_contentConfig['languageMode'] = 1;
-                                       $dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
-                                       $dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
+                                       $dbList->tt_contentConfig['single'] = 0;
+                                       $dbList->tt_contentConfig['languageMode'] = 1;
+                                       $dbList->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
+                                       $dbList->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
                                }
                        } else {
                                if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) {
@@ -986,25 +1043,24 @@ class PageLayoutController {
                                }
                        }
                        // Start the dblist object:
-                       $dblist->itemsLimitSingleTable = 1000;
-                       $dblist->start($this->id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
-                       $dblist->counter = $CMcounter;
-                       $dblist->ext_function = $this->MOD_SETTINGS['function'];
+                       $dbList->itemsLimitSingleTable = 1000;
+                       $dbList->start($this->id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
+                       $dbList->counter = $CMcounter;
+                       $dbList->ext_function = $this->MOD_SETTINGS['function'];
                        // Render versioning selector:
-                       $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id);
+                       $dbList->HTMLcode .= $this->doc->getVersionSelector($this->id);
                        // Generate the list of elements here:
-                       $dblist->generateList();
+                       $dbList->generateList();
                        // Adding the list content to the tableOutput variable:
-                       $tableOutput[$table] = ($h_func ? $h_func . '<br /><img src="clear.gif" width="1" height="4" alt="" /><br />' : '') . $dblist->HTMLcode . ($h_func_b ? '<img src="clear.gif" width="1" height="10" alt="" /><br />' . $h_func_b : '');
+                       $tableOutput[$table] = ($h_func ? $h_func . '<br /><img src="clear.gif" width="1" height="4" alt="" /><br />' : '') . $dbList->HTMLcode . ($h_func_b ? '<img src="clear.gif" width="1" height="10" alt="" /><br />' . $h_func_b : '');
                        // ... and any accumulated JavaScript goes the same way!
-                       $tableJSOutput[$table] = $dblist->JScode;
+                       $tableJSOutput[$table] = $dbList->JScode;
                        // Increase global counter:
-                       $CMcounter += $dblist->counter;
+                       $CMcounter += $dbList->counter;
                        // Reset variables after operation:
-                       $dblist->HTMLcode = '';
-                       $dblist->JScode = '';
+                       $dbList->HTMLcode = '';
+                       $dbList->JScode = '';
                        $h_func = '';
-                       $h_func_b = '';
                }
                // END: traverse tables
                // For Context Sensitive Menus:
@@ -1027,8 +1083,8 @@ class PageLayoutController {
                }
                // Making search form:
                if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput)) {
-                       $this->markers['BUTTONLIST_ADDITIONAL'] = '<a href="#" onclick="toggleSearchToolbox(); return false;" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.title.searchIcon', TRUE) . '">'.\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-toolbar-menu-search').'</a>';
-                       $this->markers['SEARCHBOX'] = $dblist->getSearchBox(0);
+                       $this->markers['BUTTONLIST_ADDITIONAL'] = '<a href="#" onclick="toggleSearchToolbox(); return false;" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.title.searchIcon', TRUE) . '">'.IconUtility::getSpriteIcon('apps-toolbar-menu-search').'</a>';
+                       $this->markers['SEARCHBOX'] = $dbList->getSearchBox(0);
                }
                // Additional footer content
                $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawFooterHook'];
@@ -1062,6 +1118,7 @@ class PageLayoutController {
         * @return array all available buttons as an assoc. array
         */
        protected function getButtons($function = '') {
+               $lang = $this->getLanguageService();
                $buttons = array(
                        'view' => '',
                        'history_page' => '',
@@ -1083,14 +1140,14 @@ class PageLayoutController {
                        'history_record' => ''
                );
                // View page
-               $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
+               $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
                // Shortcut
-               if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
+               if ($this->getBackendUser()->mayMakeShortcut()) {
                        $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
                }
                // Cache
                if (!$this->modTSconfig['properties']['disableAdvanced']) {
-                       $buttons['cache'] = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_layout', array('id' => $this->pageinfo['uid'], 'clear_cache' => '1'))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-cache-clear') . '</a>';
+                       $buttons['cache'] = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_layout', array('id' => $this->pageinfo['uid'], 'clear_cache' => '1'))) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-cache-clear') . '</a>';
                }
                if (!$this->modTSconfig['properties']['disableIconToolbar']) {
                        // Move record
@@ -1100,7 +1157,7 @@ class PageLayoutController {
                                        'uid' => $this->eRParts[1],
                                        'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
                                ];
-                               $buttons['move_record'] = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('move_element', $urlParameters)) . '">' . IconUtility::getSpriteIcon(('actions-' . ($this->eRParts[0] == 'tt_content' ? 'document' : 'page') . '-move'), array('class' => 'c-inputButton', 'title' => $GLOBALS['LANG']->getLL(('move_' . ($this->eRParts[0] == 'tt_content' ? 'record' : 'page')), TRUE))) . '</a>';
+                               $buttons['move_record'] = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('move_element', $urlParameters)) . '">' . IconUtility::getSpriteIcon(('actions-' . ($this->eRParts[0] == 'tt_content' ? 'document' : 'page') . '-move'), array('class' => 'c-inputButton', 'title' => $lang->getLL(('move_' . ($this->eRParts[0] == 'tt_content' ? 'record' : 'page')), TRUE))) . '</a>';
                        }
 
                        // Edit page properties and page language overlay icons
@@ -1108,7 +1165,7 @@ class PageLayoutController {
 
                                // Edit localized page_language_overlay only when one specific language is selected
                                if ($this->MOD_SETTINGS['function'] == 1 && $this->current_sys_language > 0) {
-                                       $overlayRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
+                                       $overlayRecord = $this->getDatabaseConnection()->exec_SELECTgetSingleRow(
                                                'uid',
                                                'pages_language_overlay',
                                                'pid = ' . (int)$this->id . ' ' .
@@ -1124,8 +1181,8 @@ class PageLayoutController {
                                        $editLanguageOnClick = htmlspecialchars(BackendUtility::editOnClick('&edit[pages_language_overlay][' . $overlayRecord['uid'] . ']=edit'));
                                        $buttons['edit_language'] = '<a href="#" ' .
                                                'onclick="' . $editLanguageOnClick . '"' .
-                                               'title="' . $GLOBALS['LANG']->getLL('editPageLanguageOverlayProperties', TRUE) . '">' .
-                                               \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('mimetypes-x-content-page-language-overlay') .
+                                               'title="' . $lang->getLL('editPageLanguageOverlayProperties', TRUE) . '">' .
+                                               IconUtility::getSpriteIcon('mimetypes-x-content-page-language-overlay') .
                                                '</a>';
                                }
 
@@ -1134,8 +1191,8 @@ class PageLayoutController {
                                $editPageOnClick = htmlspecialchars(BackendUtility::editOnClick('&edit[pages][' . $this->id . ']=edit'));
                                $buttons['edit_page'] = '<a href="#" ' .
                                        'onclick="' . $editPageOnClick . '"' .
-                                       'title="' . $GLOBALS['LANG']->getLL('editPageProperties', TRUE) . '">' .
-                                       \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-open') .
+                                       'title="' . $lang->getLL('editPageProperties', TRUE) . '">' .
+                                       IconUtility::getSpriteIcon('actions-page-open') .
                                        '</a>';
                        }
 
@@ -1147,16 +1204,16 @@ class PageLayoutController {
                        }
                        if ($function == 'quickEdit') {
                                // Save record
-                               $buttons['savedok'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" name="_savedok" class="c-inputButton" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" />'));
+                               $buttons['savedok'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" name="_savedok" class="c-inputButton" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" />'));
                                // Save and close
-                               $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" class="c-inputButton" name="_saveandclosedok" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" />'));
+                               $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" class="c-inputButton" name="_saveandclosedok" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" />'));
                                // Save record and show page
-                               $buttons['savedokshow'] = '<a href="#" onclick="' . htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-save-view') . '</a>';
+                               $buttons['savedokshow'] = '<a href="#" onclick="' . htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-save-view') . '</a>';
                                // Close record
-                               $buttons['closedok'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue($this->closeUrl) . '); return false;') . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-close') . '</a>';
+                               $buttons['closedok'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue($this->closeUrl) . '); return false;') . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-close') . '</a>';
                                // Delete record
                                if ($this->deleteButton) {
-                                       $buttons['deletedok'] = '<a href="#" onclick="' . htmlspecialchars('return deleteRecord(' . GeneralUtility::quoteJSvalue($this->eRParts[0]) . ',' . GeneralUtility::quoteJSvalue($this->eRParts[1]) . ',' . GeneralUtility::quoteJSvalue(GeneralUtility::getIndpEnv('SCRIPT_NAME') . '?id=' . $this->id) . ');') . '" title="' . $GLOBALS['LANG']->getLL('deleteItem', TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
+                                       $buttons['deletedok'] = '<a href="#" onclick="' . htmlspecialchars('return deleteRecord(' . GeneralUtility::quoteJSvalue($this->eRParts[0]) . ',' . GeneralUtility::quoteJSvalue($this->eRParts[1]) . ',' . GeneralUtility::quoteJSvalue(GeneralUtility::getIndpEnv('SCRIPT_NAME') . '?id=' . $this->id) . ');') . '" title="' . $lang->getLL('deleteItem', TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
                                }
                                if ($this->undoButton) {
                                        // Undo button
@@ -1174,7 +1231,7 @@ class PageLayoutController {
                                                                        )
                                                                )
                                                        ) . '; return false;') . '"
-                                               title="' . htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('undoLastChange'), BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $this->undoButtonR['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')))) . '">' . IconUtility::getSpriteIcon('actions-edit-undo') . '</a>';
+                                               title="' . htmlspecialchars(sprintf($lang->getLL('undoLastChange'), BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $this->undoButtonR['tstamp'], $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')))) . '">' . IconUtility::getSpriteIcon('actions-edit-undo') . '</a>';
                                        // History button
                                        $buttons['history_record'] = '<a href="#"
                                                onclick="' . htmlspecialchars('jumpToUrl(' .
@@ -1188,7 +1245,7 @@ class PageLayoutController {
                                                                        )
                                                                ) . '#latest'
                                                        ) . ');return false;') . '"
-                                               title="' . $GLOBALS['LANG']->getLL('recordHistory', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-history-open') . '</a>';
+                                               title="' . $lang->getLL('recordHistory', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-history-open') . '</a>';
                                }
                        }
                }
@@ -1207,7 +1264,7 @@ class PageLayoutController {
         * @return int
         */
        public function getNumberOfHiddenElements() {
-               return $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
+               return $this->getDatabaseConnection()->exec_SELECTcountRows(
                        'uid',
                        'tt_content',
                        'pid=' . (int)$this->id . ' AND sys_language_uid=' . (int)$this->current_sys_language . BackendUtility::BEenableFields('tt_content', 1) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content')
@@ -1236,8 +1293,8 @@ class PageLayoutController {
        public function exec_languageQuery($id) {
                if ($id) {
                        $exQ = BackendUtility::deleteClause('pages_language_overlay') .
-                               ($GLOBALS['BE_USER']->isAdmin() ? '' : ' AND sys_language.hidden=0');
-                       return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                               ($this->getBackendUser()->isAdmin() ? '' : ' AND sys_language.hidden=0');
+                       return $this->getDatabaseConnection()->exec_SELECTquery(
                                'sys_language.*',
                                'pages_language_overlay,sys_language',
                                'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid=' . (int)$id . $exQ .
@@ -1246,7 +1303,7 @@ class PageLayoutController {
                                'sys_language.title'
                        );
                } else {
-                       return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                       return $this->getDatabaseConnection()->exec_SELECTquery(
                                'sys_language.*',
                                'sys_language',
                                'sys_language.hidden=0',
@@ -1256,4 +1313,31 @@ class PageLayoutController {
                }
        }
 
+       /**
+        * Returns LanguageService
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
+
+       /**
+        * Returns the current BE user.
+        *
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
+       /**
+        * Returns the database connection
+        *
+        * @return \TYPO3\CMS\Core\Database\DatabaseConnection
+        */
+       protected function getDatabaseConnection() {
+               return $GLOBALS['TYPO3_DB'];
+       }
+
 }
index 8dc9466..166f768 100644 (file)
@@ -17,6 +17,12 @@ namespace TYPO3\CMS\Backend\Controller;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\View\PageTreeView;
+use TYPO3\CMS\Backend\Template\DocumentTemplate;
+use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+use TYPO3\CMS\Workspaces\Service\WorkspaceService;
+use TYPO3\CMS\Core\Utility\MathUtility;
 
 /**
  * Main script class for the page tree navigation frame
@@ -103,12 +109,13 @@ class PageTreeNavigationController {
                $this->currentSubScript = GeneralUtility::_GP('currentSubScript');
                $this->setTempDBmount = GeneralUtility::_GP('setTempDBmount');
                // Create page tree object:
-               $this->pagetree = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\View\PageTreeView::class);
-               $this->pagetree->ext_IconMode = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');
-               $this->pagetree->ext_showPageId = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
-               $this->pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
-               $this->pagetree->ext_separateNotinmenuPages = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.separateNotinmenuPages');
-               $this->pagetree->ext_alphasortNotinmenuPages = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.alphasortNotinmenuPages');
+               $beUser = $this->getBackendUser();
+               $this->pagetree = GeneralUtility::makeInstance(PageTreeView::class);
+               $this->pagetree->ext_IconMode = $beUser->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');
+               $this->pagetree->ext_showPageId = $beUser->getTSConfigVal('options.pageTree.showPageIdWithTitle');
+               $this->pagetree->ext_showNavTitle = $beUser->getTSConfigVal('options.pageTree.showNavTitle');
+               $this->pagetree->ext_separateNotinmenuPages = $beUser->getTSConfigVal('options.pageTree.separateNotinmenuPages');
+               $this->pagetree->ext_alphasortNotinmenuPages = $beUser->getTSConfigVal('options.pageTree.alphasortNotinmenuPages');
                $this->pagetree->thisScript = 'alt_db_navframe.php';
                $this->pagetree->addField('alias');
                $this->pagetree->addField('shortcut');
@@ -128,9 +135,9 @@ class PageTreeNavigationController {
         */
        public function initPage() {
                // Setting highlight mode:
-               $this->doHighlight = !$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableTitleHighlight');
+               $doHighlight = !$this->getBackendUser()->getTSConfigVal('options.pageTree.disableTitleHighlight');
                // Create template object:
-               $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
+               $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_db_navframe.html');
                $this->doc->showFlashMessages = FALSE;
@@ -140,8 +147,8 @@ class PageTreeNavigationController {
                $dragDropCode = 'Tree.registerDragDropHandlers();';
 
                // If highlighting is active, define the CSS class for the active item depending on the workspace
-               if ($this->doHighlight) {
-                       $hlClass = $GLOBALS['BE_USER']->workspace === 0 ? 'active' : 'active active-ws wsver' . $GLOBALS['BE_USER']->workspace;
+               if ($doHighlight) {
+                       $hlClass = $this->getBackendUser()->workspace === 0 ? 'active' : 'active active-ws wsver' . $this->getBackendUser()->workspace;
                        $dragDropCode .= '
                                Tree.highlightClass = "' . $hlClass . '";
                                Tree.highlightActiveItem("",top.fsMod.navFrameHighlightedID["web"]);';
@@ -164,7 +171,7 @@ class PageTreeNavigationController {
                        top.fsMod.currentBank = bank;
                        top.TYPO3.Backend.ContentContainer.setUrl(theUrl);
 
-                       ' . ($this->doHighlight ? 'Tree.highlightActiveItem("web", highlightID + "_" + bank);' : '') . '
+                       ' . ($doHighlight ? 'Tree.highlightActiveItem("web", highlightID + "_" + bank);' : '') . '
                        if (linkObj) { linkObj.blur(); }
                        return false;
                }
@@ -185,9 +192,9 @@ class PageTreeNavigationController {
                // Outputting Temporary DB mount notice:
                if ($this->active_tempMountPoint) {
                        $flashText = '
-                               <a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('setTempDBmount' => 0))) . '">' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xlf:labels.temporaryDBmount', TRUE) . '</a>              <br />' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xlf:labels.path', TRUE) . ': <span title="' . htmlspecialchars($this->active_tempMountPoint['_thePathFull']) . '">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($this->active_tempMountPoint['_thePath'], -50)) . '</span>
+                               <a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('setTempDBmount' => 0))) . '">' . $this->getLanguageService()->sl('LLL:EXT:lang/locallang_core.xlf:labels.temporaryDBmount', TRUE) . '</a>           <br />' . $this->getLanguageService()->sl('LLL:EXT:lang/locallang_core.xlf:labels.path', TRUE) . ': <span title="' . htmlspecialchars($this->active_tempMountPoint['_thePathFull']) . '">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($this->active_tempMountPoint['_thePath'], -50)) . '</span>
                        ';
-                       $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $flashText, '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
+                       $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $flashText, '', FlashMessage::INFO);
                        $this->content .= $flashMessage->render();
                }
                // Outputting page tree:
@@ -198,10 +205,9 @@ class PageTreeNavigationController {
                        'WORKSPACEINFO' => $this->getWorkspaceInfo(),
                        'CONTENT' => $this->content
                );
-               $subparts = array();
                // Build the <body> for the module
                $this->content = $this->doc->startPage('TYPO3 Page Tree');
-               $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers, $subparts);
+               $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
                $this->content .= $this->doc->endPage();
                $this->content = $this->doc->insertStylesAndJS($this->content);
        }
@@ -228,9 +234,9 @@ class PageTreeNavigationController {
                );
                // New Page
                $onclickNewPageWizard = 'top.content.list_frame.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('db_new', ['pagesOnly' => 1, 'id' => ''])) . '+Tree.pageID;';
-               $buttons['new_page'] = '<a href="#" onclick="' . $onclickNewPageWizard . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xlf:newPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-page-new') . '</a>';
+               $buttons['new_page'] = '<a href="#" onclick="' . $onclickNewPageWizard . '" title="' . $this->getLanguageService()->sL('LLL:EXT:cms/layout/locallang.xlf:newPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-page-new') . '</a>';
                // Refresh
-               $buttons['refresh'] = '<a href="' . htmlspecialchars(GeneralUtility::getIndpEnv('REQUEST_URI')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.refresh', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
+               $buttons['refresh'] = '<a href="' . htmlspecialchars(GeneralUtility::getIndpEnv('REQUEST_URI')) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.refresh', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
                // CSH
                $buttons['csh'] = str_replace('typo3-csh-inline', 'typo3-csh-inline show-right', BackendUtility::cshItem('xMOD_csh_corebe', 'pagetree'));
                return $buttons;
@@ -242,8 +248,8 @@ class PageTreeNavigationController {
         * @return string HTML containing workspace info
         */
        protected function getWorkspaceInfo() {
-               if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces') && ($GLOBALS['BE_USER']->workspace !== 0 || $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.onlineWorkspaceInfo'))) {
-                       $wsTitle = htmlspecialchars(\TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle($GLOBALS['BE_USER']->workspace));
+               if (ExtensionManagementUtility::isLoaded('workspaces') && ($this->getBackendUser()->workspace !== 0 || $this->getBackendUser()->getTSConfigVal('options.pageTree.onlineWorkspaceInfo'))) {
+                       $wsTitle = htmlspecialchars(WorkspaceService::getWorkspaceTitle($this->getBackendUser()->workspace));
                        $workspaceInfo = '
                                <div class="bgColor4 workspace-info">' . IconUtility::getSpriteIcon('apps-toolbar-menu-workspace', array(
                                'title' => $wsTitle,
@@ -251,6 +257,8 @@ class PageTreeNavigationController {
                                'style' => 'cursor:pointer;'
                        )) . $wsTitle . '</div>
                        ';
+               } else {
+                       $workspaceInfo = '';
                }
                return $workspaceInfo;
        }
@@ -266,10 +274,11 @@ class PageTreeNavigationController {
         * @return void
         */
        public function initializeTemporaryDBmount() {
+               $beUser = $this->getBackendUser();
                // Set/Cancel Temporary DB Mount:
                if ((string)$this->setTempDBmount !== '') {
-                       $set = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->setTempDBmount, 0);
-                       if ($set > 0 && $GLOBALS['BE_USER']->isInWebMount($set)) {
+                       $set = MathUtility::forceIntegerInRange($this->setTempDBmount, 0);
+                       if ($set > 0 && $beUser->isInWebMount($set)) {
                                // Setting...:
                                $this->settingTemporaryMountPoint($set);
                        } else {
@@ -278,10 +287,10 @@ class PageTreeNavigationController {
                        }
                }
                // Getting temporary mount point ID:
-               $temporaryMountPoint = (int)$GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint');
+               $temporaryMountPoint = (int)$beUser->getSessionData('pageTree_temporaryMountPoint');
                // If mount point ID existed and is within users real mount points, then set it temporarily:
-               if ($temporaryMountPoint > 0 && $GLOBALS['BE_USER']->isInWebMount($temporaryMountPoint)) {
-                       if ($this->active_tempMountPoint = BackendUtility::readPageAccess($temporaryMountPoint, $GLOBALS['BE_USER']->getPagePermsClause(1))) {
+               if ($temporaryMountPoint > 0 && $beUser->isInWebMount($temporaryMountPoint)) {
+                       if ($this->active_tempMountPoint = BackendUtility::readPageAccess($temporaryMountPoint, $beUser->getPagePermsClause(1))) {
                                $this->pagetree->MOUNTS = array($temporaryMountPoint);
                        } else {
                                // Clear temporary mount point as we have no access to it any longer
@@ -297,7 +306,7 @@ class PageTreeNavigationController {
         * @return void
         */
        public function settingTemporaryMountPoint($pageId) {
-               $GLOBALS['BE_USER']->setAndSaveSessionData('pageTree_temporaryMountPoint', (int)$pageId);
+               $this->getBackendUser()->setAndSaveSessionData('pageTree_temporaryMountPoint', (int)$pageId);
        }
 
        /**********************************
@@ -323,4 +332,22 @@ class PageTreeNavigationController {
                }
        }
 
+       /**
+        * Returns LanguageService
+        *
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
+
+       /**
+        * Returns the current BE user.
+        *
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
 }
index a04d7d1..26b0e8e 100644 (file)
@@ -16,6 +16,13 @@ namespace TYPO3\CMS\Backend\Controller;
 
 use TYPO3\CMS\Core\Messaging\AbstractMessage;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\DataHandling\DataHandler;
+use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Backend\Clipboard\Clipboard;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Utility\HttpUtility;
+use TYPO3\CMS\Core\Http\AjaxRequestHandler;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
 
 /**
  * Script Class, creating object of \TYPO3\CMS\Core\DataHandling\DataHandler and
@@ -101,13 +108,6 @@ class SimpleDataHandlerController {
        public $uPT;
 
        /**
-        * String, general comment (for raising stages of workspace versions)
-        *
-        * @var string
-        */
-       public $generalComment;
-
-       /**
         * TYPO3 Core Engine
         *
         * @var \TYPO3\CMS\Core\DataHandling\DataHandler
@@ -128,6 +128,7 @@ class SimpleDataHandlerController {
         * @return void
         */
        public function init() {
+               $beUser = $this->getBackendUser();
                // GPvars:
                $this->flags = GeneralUtility::_GP('flags');
                $this->data = GeneralUtility::_GP('data');
@@ -139,24 +140,22 @@ class SimpleDataHandlerController {
                $this->CB = GeneralUtility::_GP('CB');
                $this->vC = GeneralUtility::_GP('vC');
                $this->uPT = GeneralUtility::_GP('uPT');
-               $this->generalComment = GeneralUtility::_GP('generalComment');
                // Creating TCEmain object
-               $this->tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
+               $this->tce = GeneralUtility::makeInstance(DataHandler::class);
                $this->tce->stripslashes_values = 0;
-               $this->tce->generalComment = $this->generalComment;
                // Configuring based on user prefs.
-               if ($GLOBALS['BE_USER']->uc['recursiveDelete']) {
+               if ($beUser->uc['recursiveDelete']) {
                        // TRUE if the delete Recursive flag is set.
                        $this->tce->deleteTree = 1;
                }
-               if ($GLOBALS['BE_USER']->uc['copyLevels']) {
+               if ($beUser->uc['copyLevels']) {
                        // Set to number of page-levels to copy.
-                       $this->tce->copyTree = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['BE_USER']->uc['copyLevels'], 0, 100);
+                       $this->tce->copyTree = MathUtility::forceIntegerInRange($beUser->uc['copyLevels'], 0, 100);
                }
-               if ($GLOBALS['BE_USER']->uc['neverHideAtCopy']) {
+               if ($beUser->uc['neverHideAtCopy']) {
                        $this->tce->neverHideAtCopy = 1;
                }
-               $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
+               $TCAdefaultOverride = $beUser->getTSConfigProp('TCAdefaults');
                if (is_array($TCAdefaultOverride)) {
                        $this->tce->setDefaultsFromUserTS($TCAdefaultOverride);
                }
@@ -173,7 +172,7 @@ class SimpleDataHandlerController {
         */
        public function initClipboard() {
                if (is_array($this->CB)) {
-                       $clipObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Clipboard\Clipboard::class);
+                       $clipObj = GeneralUtility::makeInstance(Clipboard::class);
                        $clipObj->initializeClipboard();
                        if ($this->CB['paste']) {
                                $clipObj->setCurrentPad($this->CB['pad']);
@@ -204,7 +203,7 @@ class SimpleDataHandlerController {
                // Checking referer / executing
                $refInfo = parse_url(GeneralUtility::getIndpEnv('HTTP_REFERER'));
                $httpHost = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY');
-               if ($httpHost != $refInfo['host'] && $this->vC != $GLOBALS['BE_USER']->veriCode() && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer']) {
+               if ($httpHost != $refInfo['host'] && $this->vC != $this->getBackendUser()->veriCode() && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer']) {
                        $this->tce->log('', 0, 0, 0, 1, 'Referer host "%s" and server host "%s" did not match and veriCode was not valid either!', 1, array($refInfo['host'], $httpHost));
                } else {
                        // Register uploaded files
@@ -218,7 +217,7 @@ class SimpleDataHandlerController {
                        }
                        // Update page tree?
                        if ($this->uPT && (isset($this->data['pages']) || isset($this->cmd['pages']))) {
-                               \TYPO3\CMS\Backend\Utility\BackendUtility::setUpdateSignal('updatePageTree');
+                               BackendUtility::setUpdateSignal('updatePageTree');
                        }
                }
        }
@@ -234,8 +233,8 @@ class SimpleDataHandlerController {
                if ($this->prErr) {
                        $this->tce->printLogErrorMessages($this->redirect);
                }
-               if ($this->redirect && !$this->tce->debug) {
-                       \TYPO3\CMS\Core\Utility\HttpUtility::redirect($this->redirect);
+               if ($this->redirect) {
+                       HttpUtility::redirect($this->redirect);
                }
        }
 
@@ -245,12 +244,13 @@ class SimpleDataHandlerController {
         * @param array $parameters
         * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler
         */
-       public function processAjaxRequest($parameters, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler) {
+       public function processAjaxRequest($parameters, AjaxRequestHandler $ajaxRequestHandler) {
                // do the regular / main logic
                $this->initClipboard();
                $this->main();
 
-               $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
+               /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
+               $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
 
                $content = array(
                        'redirect' => $this->redirect,
@@ -281,4 +281,13 @@ class SimpleDataHandlerController {
                $ajaxRequestHandler->setContent($content);
        }
 
+       /**
+        * Returns the current BE user.
+        *
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
 }
index 6ab27de..8266fb4 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\Controller;
 
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Http\AjaxRequestHandler;
 
 /**
  * A wrapper class to call BE_USER->uc
@@ -30,7 +31,7 @@ class UserSettingsController {
         * @param array $parameters
         * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler
         */
-       public function processAjaxRequest($parameters, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler) {
+       public function processAjaxRequest($parameters, AjaxRequestHandler $ajaxRequestHandler) {
                // do the regular / main logic, depending on the action parameter
                $action = GeneralUtility::_GP('action');
                $key = GeneralUtility::_GP('key');
index 34e7b4c..6102a98 100644 (file)
@@ -55,6 +55,11 @@ class FolderTreeView extends \TYPO3\CMS\Backend\Tree\View\AbstractTreeView {
        protected $scope;
 
        /**
+        * @var bool
+        */
+       public $ext_noTempRecyclerDirs;
+
+       /**
         * Constructor function of the class
         */
        public function __construct() {
index 9c29131..119a2cb 100644 (file)
@@ -37,13 +37,6 @@ class DataHandlerHook {
        protected $notificationEmailInfo = array();
 
        /**
-        * General comment, eg. for staging in workspaces
-        *
-        * @var string
-        */
-       protected $generalComment = '';
-
-       /**
         * Contains remapped IDs.
         *
         * @var array
@@ -82,7 +75,7 @@ class DataHandlerHook {
                if ($command == 'version') {
                        $commandIsProcessed = TRUE;
                        $action = (string)$value['action'];
-                       $comment = (isset($value['comment']) && $value['comment'] ? $value['comment'] : $this->generalComment);
+                       $comment = !empty($value['comment']) ? $value['comment'] : '';
                        $notificationAlternativeRecipients = (isset($value['notificationAlternativeRecipients'])) && is_array($value['notificationAlternativeRecipients']) ? $value['notificationAlternativeRecipients'] : array();
                        switch ($action) {
                                case 'new':