[TASK] Make logout.php dispatched 11/37411/2
authorWouter Wolters <typo3@wouterwolters.nl>
Sun, 1 Mar 2015 13:50:48 +0000 (14:50 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Sun, 1 Mar 2015 18:54:27 +0000 (19:54 +0100)
Use dispatching for logout.php

Resolves: #65291
Releases: master
Change-Id: Ic003ec6dda083f69da2aaf0373ad48ea3bf4f56f
Reviewed-on: http://review.typo3.org/37411
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/logout.php
typo3/sysext/backend/Classes/Backend/ToolbarItems/UserToolbarItem.php
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/View/ModuleMenuView.php
typo3/sysext/backend/Modules/Logout/conf.php [new file with mode: 0644]
typo3/sysext/backend/Modules/Logout/index.php [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/LoginRefresh.js
typo3/sysext/backend/ext_tables.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-65291-DeprecateLogoutEntryPoint.rst [new file with mode: 0644]

index cdf7766..8b57d7d 100644 (file)
@@ -20,5 +20,9 @@
  */
 require __DIR__ . '/init.php';
 
+\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
+       'The entry point to logout was moved to an own module. Please use BackendUtility::getModuleUrl(\'logout\') to link to logout.php. This script will be removed in TYPO3 CMS 8.'
+);
+
 $logoutController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\LogoutController::class);
 $logoutController->logout();
index 80816f6..ae483b4 100644 (file)
@@ -104,7 +104,7 @@ class UserToolbarItem implements ToolbarItemInterface {
                // Logout button
                $buttonLabel = 'LLL:EXT:lang/locallang_core.xlf:' . ($backendUser->user['ses_backuserid'] ? 'buttons.exit' : 'buttons.logout');
                $dropdown[] = '<li class="reset-dropdown">';
-               $dropdown[] = '<a href="logout.php" class="btn btn-danger pull-right" target="_top"><i class="fa fa-power-off"></i> ';
+               $dropdown[] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('logout')) . '" class="btn btn-danger pull-right" target="_top"><i class="fa fa-power-off"></i> ';
                $dropdown[] = $languageService->sL($buttonLabel, TRUE);
                $dropdown[] = '</a>';
                $dropdown[] = '</li>';
index c34cdd3..a397ff6 100644 (file)
@@ -130,6 +130,7 @@ class BackendController {
                if (!$this->debug) {
                        $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LoginRefresh', 'function(LoginRefresh) {
                                LoginRefresh.setLoginFramesetUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('login_frameset')) . ');
+                               LoginRefresh.setLogoutUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('logout')) . ');
                        }');
                }
 
index b1fc442..342e0c7 100644 (file)
@@ -357,7 +357,7 @@ class ModuleMenuView {
        public function renderLogoutButton() {
                $buttonLabel = $GLOBALS['BE_USER']->user['ses_backuserid'] ? 'LLL:EXT:lang/locallang_core.xlf:buttons.exit' : 'LLL:EXT:lang/locallang_core.xlf:buttons.logout';
                $buttonForm = '
-               <form action="logout.php" target="_top">
+               <form action="' . htmlspecialchars(BackendUtility::getModuleUrl('logout')) . '" target="_top">
                        <input class="btn btn-default" type="submit" id="logout-submit-button" value="' . $GLOBALS['LANG']->sL($buttonLabel, TRUE) . '" />
                </form>';
                return $buttonForm;
diff --git a/typo3/sysext/backend/Modules/Logout/conf.php b/typo3/sysext/backend/Modules/Logout/conf.php
new file mode 100644 (file)
index 0000000..34db869
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+$MCONF['script'] = '_DISPATCH';
+$MCONF['name'] = 'logout';
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/Logout/index.php b/typo3/sysext/backend/Modules/Logout/index.php
new file mode 100644 (file)
index 0000000..baefe67
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Logout script for the backend
+ * This script saves the interface positions and calls the closeTypo3Windows in the frameset
+ *
+ * @author Kasper Skårhøj <kasperYYYY@typo3.com>
+ */
+
+$logoutController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\LogoutController::class);
+$logoutController->logout();
\ No newline at end of file
index 12fb18c..86dbd7f 100644 (file)
@@ -34,7 +34,8 @@ define('TYPO3/CMS/Backend/LoginRefresh', ['jquery'], function($) {
                $timeoutModal: '',
                $backendLockedModal: '',
                $loginForm: '',
-               loginFramesetUrl: ''
+               loginFramesetUrl: '',
+               logoutUrl: ''
        };
 
        /**
@@ -76,6 +77,13 @@ define('TYPO3/CMS/Backend/LoginRefresh', ['jquery'], function($) {
        };
 
        /**
+        * Set logout url
+        */
+       LoginRefresh.setLogoutUrl = function(logoutUrl) {
+               LoginRefresh.logoutUrl = logoutUrl;
+       };
+
+       /**
         * Generates the modal displayed on near session time outs
         */
        LoginRefresh.initializeTimeoutModal = function() {
@@ -105,7 +113,7 @@ define('TYPO3/CMS/Backend/LoginRefresh', ['jquery'], function($) {
                                });
                        }),
                        $('<button />', {class: 'btn btn-default', 'data-action': 'logout'}).text(TYPO3.LLL.core.refresh_direct_logout_button).on('click', function() {
-                               top.location.href = TYPO3.configuration.siteUrl + TYPO3.configuration.TYPO3_mainDir + 'logout.php';
+                               top.location.href = TYPO3.configuration.siteUrl + TYPO3.configuration.TYPO3_mainDir + LoginRefresh.logoutUrl;
                        })
                );
 
@@ -196,7 +204,7 @@ define('TYPO3/CMS/Backend/LoginRefresh', ['jquery'], function($) {
                LoginRefresh.$loginForm.find('.modal-footer').append(
                        $('<button />', {type: 'submit', form: 'beLoginRefresh', class: 'btn btn-default', 'data-action': 'refreshSession'}).text(TYPO3.LLL.core.refresh_login_button),
                        $('<button />', {class: 'btn btn-default', 'data-action': 'logout'}).text(TYPO3.LLL.core.refresh_direct_logout_button).on('click', function() {
-                               top.location.href = TYPO3.configuration.siteUrl + TYPO3.configuration.TYPO3_mainDir + 'logout.php';
+                               top.location.href = TYPO3.configuration.siteUrl + TYPO3.configuration.TYPO3_mainDir + LoginRefresh.logoutUrl;
                        })
                );
 
index 98b0c57..52d48b9 100644 (file)
@@ -14,6 +14,12 @@ if (TYPO3_MODE === 'BE') {
                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/LoginFrameset/'
        );
 
+       // Register logout
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'logout',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Logout/'
+       );
+
        // Register file_edit
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
                'file_edit',
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65291-DeprecateLogoutEntryPoint.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65291-DeprecateLogoutEntryPoint.rst
new file mode 100644 (file)
index 0000000..6308736
--- /dev/null
@@ -0,0 +1,25 @@
+==================================================
+Deprecation: #65283 - Deprecate logout entry point
+==================================================
+
+Description
+===========
+
+The following entry point has been marked as deprecated:
+
+* typo3/logout.php
+
+
+Impact
+======
+
+Using this entry points in a backend module will throw a deprecation message.
+
+
+Migration
+=========
+
+Use ``\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl()`` instead with the according module name.
+
+typo3/logout.php
+``\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('logout')``
\ No newline at end of file