X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/blobdiff_plain/13674a598f53da93d1a2fa59daef18819b80eae9..f22792eceea631b8f01fbe0fcbf3e62b52246cad:/typo3/sysext/backend/Classes/Http/Application.php diff --git a/typo3/sysext/backend/Classes/Http/Application.php b/typo3/sysext/backend/Classes/Http/Application.php index faa247b810c..5ef0ad14b6d 100644 --- a/typo3/sysext/backend/Classes/Http/Application.php +++ b/typo3/sysext/backend/Classes/Http/Application.php @@ -15,7 +15,6 @@ namespace TYPO3\CMS\Backend\Http; */ use TYPO3\CMS\Core\Core\ApplicationInterface; use TYPO3\CMS\Core\Core\Bootstrap; -use TYPO3\CMS\Core\Utility\GeneralUtility; /** * Entry point for the TYPO3 Backend (HTTP requests) @@ -28,24 +27,20 @@ class Application implements ApplicationInterface protected $bootstrap; /** - * @var string + * Number of subdirectories where the entry script is located, relative to PATH_site + * Usually this is equal to PATH_site = 0 + * @var int */ - protected $entryPointPath = 'typo3/'; - - /** - * @var \Psr\Http\Message\ServerRequestInterface - */ - protected $request; + protected $entryPointLevel = 1; /** * All available request handlers that can handle backend requests (non-CLI) * @var array */ - protected $availableRequestHandlers = array( + protected $availableRequestHandlers = [ \TYPO3\CMS\Backend\Http\RequestHandler::class, - \TYPO3\CMS\Backend\Http\BackendModuleRequestHandler::class, \TYPO3\CMS\Backend\Http\AjaxRequestHandler::class - ); + ]; /** * Constructor setting up legacy constant and register available Request Handlers @@ -58,14 +53,12 @@ class Application implements ApplicationInterface $this->bootstrap = Bootstrap::getInstance() ->initializeClassLoader($classLoader) - ->baseSetup($this->entryPointPath); - - // can be done here after the base setup is done - $this->defineAdditionalEntryPointRelatedConstants(); + ->setRequestType(TYPO3_REQUESTTYPE_BE | (isset($_REQUEST['route']) && strpos($_REQUEST['route'], '/ajax/') === 0 ? TYPO3_REQUESTTYPE_AJAX : 0)) + ->baseSetup($this->entryPointLevel); // Redirect to install tool if base configuration is not found if (!$this->bootstrap->checkIfEssentialConfigurationExists()) { - $this->bootstrap->redirectToInstallTool($this->entryPointPath); + $this->bootstrap->redirectToInstallTool($this->entryPointLevel); } foreach ($this->availableRequestHandlers as $requestHandler) { @@ -79,19 +72,10 @@ class Application implements ApplicationInterface * Set up the application and shut it down afterwards * * @param callable $execute - * @return void */ public function run(callable $execute = null) { - $this->request = \TYPO3\CMS\Core\Http\ServerRequestFactory::fromGlobals(); - // see below when this option is set and Bootstrap::defineTypo3RequestTypes() for more details - if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) { - $this->request = $this->request->withAttribute('isAjaxRequest', true); - } elseif (isset($this->request->getQueryParams()['M'])) { - $this->request = $this->request->withAttribute('isModuleRequest', true); - } - - $this->bootstrap->handleRequest($this->request); + $this->bootstrap->handleRequest(\TYPO3\CMS\Core\Http\ServerRequestFactory::fromGlobals(), 'backend'); if ($execute !== null) { call_user_func($execute); @@ -107,21 +91,4 @@ class Application implements ApplicationInterface { define('TYPO3_MODE', 'BE'); } - - /** - * Define values that are based on the current script - */ - protected function defineAdditionalEntryPointRelatedConstants() - { - $currentScript = GeneralUtility::getIndpEnv('SCRIPT_NAME'); - - // Activate "AJAX" handler when called with the GET variable ajaxID - if (!empty(GeneralUtility::_GET('ajaxID'))) { - $GLOBALS['TYPO3_AJAX'] = true; - // The following check is security relevant! DO NOT REMOVE! - } elseif (empty(GeneralUtility::_GET('M')) && substr($currentScript, -16) === '/typo3/index.php') { - // Allow backend login to work, disallow module access without authenticated backend user - define('TYPO3_PROCEED_IF_NO_USER', 1); - } - } }