[TASK] Remove TYPO3_tables_script and handling
[Packages/TYPO3.CMS.git] / typo3 / init.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * TYPO3 Backend initialization
30 *
31 * This script is called by every backend script.
32 * The script authenticates the backend user.
33 * In addition this script also initializes the database and other stuff by including the script localconf.php
34 *
35 * IMPORTANT:
36 * This script exits if no user is logged in!
37 * If you want the script to return even if no user is logged in,
38 * you must define the constant TYPO3_PROCEED_IF_NO_USER=1
39 * before you include this script.
40 *
41 *
42 * This script does the following:
43 * - extracts and defines path's
44 * - includes certain libraries
45 * - authenticates the user
46 * - sets the configuration values (localconf.php)
47 * - includes tables.php that sets more values and possibly overrides others
48 * - load the groupdata for the user and set filemounts / webmounts
49 *
50 * For a detailed description of this script, the scope of constants and variables in it,
51 * please refer to the document "Inside TYPO3"
52 *
53 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
54 * @package TYPO3
55 * @subpackage core
56 */
57
58 // Prevent any unwanted output that may corrupt AJAX/compression. Note: this does
59 // not interfeer with "die()" or "echo"+"exit()" messages!
60 ob_start();
61
62 // Define constants
63 define('TYPO3_MODE', 'BE');
64
65 // We use require instead of require_once here so we get a fatal error if
66 // Bootstrap.php is accidentally included twice (which would indicate a clear bug).
67 require('Bootstrap.php');
68 Typo3_Bootstrap::checkEnvironmentOrDie();
69 Typo3_Bootstrap::defineBaseConstants();
70 Typo3_Bootstrap::defineAndCheckPaths('typo3/');
71 Typo3_Bootstrap::requireBaseClasses();
72 Typo3_Bootstrap::setUpEnvironment();
73
74 require(PATH_t3lib . 'config_default.php');
75
76 Typo3_Bootstrap::initializeTypo3DbGlobal(FALSE);
77 Typo3_Bootstrap::checkLockedBackendAndRedirectOrDie();
78 Typo3_Bootstrap::checkBackendIpOrDie();
79 Typo3_Bootstrap::checkSslBackendAndRedirectIfNeeded();
80
81 // Connect to the database
82 // Redirect to install tool if database host and database are not defined
83 if (!TYPO3_db_host && !TYPO3_db) {
84 t3lib_utility_Http::redirect('install/index.php?mode=123&step=1&password=joh316');
85 } else {
86 $TYPO3_DB->connectDB();
87 }
88
89 // Checks for proper browser
90 if (!$CLIENT['BROWSER']) {
91 throw new RuntimeException('Browser Error: Your browser version looks incompatible with this TYPO3 version!', 1294587023);
92 }
93
94 // Include standard tables.php file
95 include(PATH_t3lib . 'stddb/tables.php');
96 // Load temp_CACHED file of ext_tables or each ext_tables.php of loaded extensions
97 if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
98 include(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_tables.php');
99 } else {
100 include(PATH_t3lib . 'stddb/load_ext_tables.php');
101 }
102 // Load additional ext tables script
103 if (TYPO3_extTableDef_script) {
104 include(PATH_typo3conf . TYPO3_extTableDef_script);
105 }
106
107 Typo3_Bootstrap::runExtTablesPostProcessingHooks();
108 Typo3_Bootstrap::initializeSpriteManager(TRUE);
109 Typo3_Bootstrap::initializeBackendUser();
110 Typo3_Bootstrap::initializeBackendUserMounts();
111 Typo3_Bootstrap::initializeLanguageObject();
112
113 // Compression
114 ob_clean();
115 if (extension_loaded('zlib') && $TYPO3_CONF_VARS['BE']['compressionLevel']) {
116 if (t3lib_utility_Math::canBeInterpretedAsInteger($TYPO3_CONF_VARS['BE']['compressionLevel'])) {
117 @ini_set('zlib.output_compression_level', $TYPO3_CONF_VARS['BE']['compressionLevel']);
118 }
119 ob_start('ob_gzhandler');
120 }
121
122 ?>