[CLEANUP] Add missing empty lines after copyright comments I
[Packages/TYPO3.CMS.git] / typo3 / mod.php
1 <?php
2 /*
3 * This file is part of the TYPO3 CMS project.
4 *
5 * It is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License, either version 2
7 * of the License, or any later version.
8 *
9 * For the full copyright and license information, please read the
10 * LICENSE.txt file that was distributed with this source code.
11 *
12 * The TYPO3 project - inspiring people to share!
13 */
14
15 /**
16 * Module Dispatch script
17 *
18 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
19 */
20 unset($MCONF);
21 require __DIR__ . '/init.php';
22 // Find module path:
23 $moduleName = (string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('M');
24 $isDispatched = FALSE;
25 $formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
26 if (!$formProtection->validateToken(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('moduleToken'), 'moduleCall', $moduleName)) {
27 throw new UnexpectedValueException('Invalid form/module token detected. Access Denied!', 1392409507);
28 }
29 if ($temp_path = $GLOBALS['TBE_MODULES']['_PATHS'][$moduleName]) {
30 $GLOBALS['MCONF']['_'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl($moduleName);
31 if (file_exists($temp_path . 'conf.php')) {
32 require $temp_path . 'conf.php';
33 $moduleConfiguration = $GLOBALS['MCONF'];
34 } else {
35 $moduleConfiguration = $GLOBALS['TBE_MODULES']['_configuration'][$moduleName];
36 }
37 if (!empty($moduleConfiguration['access'])) {
38 $GLOBALS['BE_USER']->modAccess($moduleConfiguration, TRUE);
39 }
40
41 $BACK_PATH = '';
42 require $temp_path . 'index.php';
43 $isDispatched = TRUE;
44 } else {
45 if (is_array($GLOBALS['TBE_MODULES']['_dispatcher'])) {
46 foreach ($GLOBALS['TBE_MODULES']['_dispatcher'] as $dispatcherClassName) {
47 $dispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class)->get($dispatcherClassName);
48 if ($dispatcher->callModule($moduleName) === TRUE) {
49 $isDispatched = TRUE;
50 break;
51 }
52 }
53 }
54 }
55 if ($isDispatched === FALSE) {
56 throw new UnexpectedValueException('No module "' . htmlspecialchars($moduleName) . '" could be found.', 1294585070);
57 }
58 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->shutdown();