25d8e925e49105ff047f0fc7c4354f84b8d5eb41
[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 // classes/Bootstrap/Backend.php is accidentally included twice (which would indicate a clear bug).
67 require('classes/Bootstrap/Backend.php');
68 Typo3_Bootstrap_Backend::getInstance()
69 ->checkEnvironmentOrDie()
70 ->defineBaseConstants()
71 ->defineAndCheckPaths('typo3/')
72 ->requireBaseClasses()
73 ->setUpEnvironment()
74 ->loadDefaultTypo3ConfVars()
75 ->registerExtDirectComponents()
76 ->initializeGlobalVariables()
77 ->checkLocalconfExistsOrDie()
78 ->setGlobalDatabaseVariablesToEmptyString()
79 ->loadMainConfigurationFile()
80 ->defineTypo3DatabaseConstants()
81 ->initializeCachingFramework()
82 ->registerAutoloader()
83 ->addCorePearPathToIncludePath()
84 ->checkUtf8DatabaseSettingsOrDie()
85 ->transferDeprecatedCurlSettings()
86 ->setCacheHashOptions()
87 ->enforceCorrectProxyAuthScheme()
88 ->setDefaultTimezone()
89 ->initializeL10nLocales()
90 ->configureImageProcessingOptions()
91 ->convertPageNotFoundHandlingToBoolean()
92 ->registerGlobalDebugFunctions()
93 ->registerSwiftMailer()
94 ->configureExceptionHandling()
95 ->setMemoryLimit()
96 ->defineTypo3RequestTypes()
97 ->loadAdditionalConfigurationFromExtensions()
98 ->deprecationLogForOldXclassRegistration()
99 ->initializeExceptionHandling()
100 ->requireAdditionalExtensionFiles()
101 ->setFinalCachingFrameworkCacheConfiguration()
102 ->defineLoggingAndExceptionConstants()
103 ->unsetReservedGlobalVariables()
104 ->initializeGlobalTimeVariables()
105 ->initializeTypo3DbGlobal(FALSE)
106 ->checkLockedBackendAndRedirectOrDie()
107 ->checkBackendIpOrDie()
108 ->checkSslBackendAndRedirectIfNeeded();
109
110 // Connect to the database
111 // Redirect to install tool if database host and database are not defined
112 if (!TYPO3_db_host && !TYPO3_db) {
113 t3lib_utility_Http::redirect('install/index.php?mode=123&step=1&password=joh316');
114 } else {
115 $TYPO3_DB->connectDB();
116 }
117
118 // Checks for proper browser
119 if (!$CLIENT['BROWSER']) {
120 throw new RuntimeException('Browser Error: Your browser version looks incompatible with this TYPO3 version!', 1294587023);
121 }
122
123 Typo3_Bootstrap_Backend::getInstance()
124 ->loadExtensionTables()
125 ->initializeSpriteManager(TRUE)
126 ->initializeBackendUser()
127 ->initializeBackendUserMounts()
128 ->initializeLanguageObject();
129
130 // Compression
131 ob_clean();
132 if (extension_loaded('zlib') && $TYPO3_CONF_VARS['BE']['compressionLevel']) {
133 if (t3lib_utility_Math::canBeInterpretedAsInteger($TYPO3_CONF_VARS['BE']['compressionLevel'])) {
134 @ini_set('zlib.output_compression_level', $TYPO3_CONF_VARS['BE']['compressionLevel']);
135 }
136 ob_start('ob_gzhandler');
137 }
138
139 ?>