TYPO3 CMS  TYPO3_7-6
Application.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Http;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
19 
24 {
28  protected $bootstrap;
29 
33  protected $entryPointPath = 'typo3/';
34 
38  protected $request;
39 
45  \TYPO3\CMS\Backend\Http\RequestHandler::class,
46  \TYPO3\CMS\Backend\Http\BackendModuleRequestHandler::class,
47  \TYPO3\CMS\Backend\Http\AjaxRequestHandler::class
48  ];
49 
55  public function __construct($classLoader)
56  {
57  $this->defineLegacyConstants();
58 
59  $this->bootstrap = Bootstrap::getInstance()
60  ->initializeClassLoader($classLoader)
61  ->baseSetup($this->entryPointPath);
62 
63  // can be done here after the base setup is done
65 
66  // Redirect to install tool if base configuration is not found
67  if (!$this->bootstrap->checkIfEssentialConfigurationExists()) {
68  $this->bootstrap->redirectToInstallTool($this->entryPointPath);
69  }
70 
71  foreach ($this->availableRequestHandlers as $requestHandler) {
72  $this->bootstrap->registerRequestHandlerImplementation($requestHandler);
73  }
74 
75  $this->bootstrap->configure();
76  }
77 
84  public function run(callable $execute = null)
85  {
87  // see below when this option is set and Bootstrap::defineTypo3RequestTypes() for more details
88  if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
89  $this->request = $this->request->withAttribute('isAjaxRequest', true);
90  } elseif (isset($this->request->getQueryParams()['M'])) {
91  $this->request = $this->request->withAttribute('isModuleRequest', true);
92  }
93 
94  $this->bootstrap->handleRequest($this->request);
95 
96  if ($execute !== null) {
97  call_user_func($execute);
98  }
99 
100  $this->bootstrap->shutdown();
101  }
102 
106  protected function defineLegacyConstants()
107  {
108  define('TYPO3_MODE', 'BE');
109  }
110 
115  {
116  $currentScript = GeneralUtility::getIndpEnv('SCRIPT_NAME');
117 
118  // Activate "AJAX" handler when called with the GET variable ajaxID
119  if (!empty(GeneralUtility::_GET('ajaxID'))) {
120  $GLOBALS['TYPO3_AJAX'] = true;
121  // The following check is security relevant! DO NOT REMOVE!
122  } elseif (empty(GeneralUtility::_GET('M')) && substr($currentScript, -16) === '/typo3/index.php') {
123  // Allow backend login to work, disallow module access without authenticated backend user
124  define('TYPO3_PROCEED_IF_NO_USER', 1);
125  }
126  }
127 }
run(callable $execute=null)
Definition: Application.php:84
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']