[TASK] Deprecate init.php
[Packages/TYPO3.CMS.git] / typo3 / alt_doc.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 * Main form rendering script
17 * By sending certain parameters to this script you can bring up a form
18 * which allows the user to edit the content of one or more database records.
19 *
20 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
21 */
22 define('TYPO3_MODE', 'BE');
23
24 require __DIR__ . '/sysext/core/Classes/Core/Bootstrap.php';
25 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->run('typo3/');
26 \TYPO3\CMS\Backend\Utility\BackendUtility::lockRecords();
27
28 \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
29 'The entry point to FormEngine was moved to an own module. Please use BackendUtility::getModuleUrl(\'record_edit\') to link to alt_doc.php. This script will be removed in TYPO3 CMS 8.'
30 );
31
32 /* @var $editDocumentController \TYPO3\CMS\Backend\Controller\EditDocumentController */
33 $editDocumentController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\EditDocumentController::class);
34
35 // Preprocessing, storing data if submitted to
36 $editDocumentController->preInit();
37
38 // Checks, if a save button has been clicked (or the doSave variable is sent)
39 if ($editDocumentController->doProcessData()) {
40 $formprotection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
41 if ($formprotection->validateToken(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('formToken'), 'editRecord')) {
42 $editDocumentController->processData();
43 }
44 }
45
46 $editDocumentController->init();
47 $editDocumentController->main();
48 $editDocumentController->printContent();