[TASK] Fix CGL violations InlineCommentWrongStyle in ext_emconf.php files
[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 * TYPO3 Backend initialization
29 *
30 * This script is called by every backend script.
31 * The script authenticates the backend user.
32 * In addition this script also initializes the database and other stuff by including the script localconf.php
33 *
34 * IMPORTANT:
35 * This script exits if no user is logged in!
36 * If you want the script to return even if no user is logged in,
37 * you must define the constant TYPO3_PROCEED_IF_NO_USER=1
38 * before you include this script.
39 *
40 *
41 * This script does the following:
42 * - extracts and defines path's
43 * - includes certain libraries
44 * - authenticates the user
45 * - sets the configuration values (localconf.php)
46 * - includes tables.php that sets more values and possibly overrides others
47 * - load the groupdata for the user and set filemounts / webmounts
48 *
49 * For a detailed description of this script, the scope of constants and variables in it,
50 * please refer to the document "Inside TYPO3"
51 *
52 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
53 * @package TYPO3
54 * @subpackage core
55 */
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 // *******************************
61 ob_start();
62
63 // *******************************
64 // Define constants
65 // *******************************
66 define('TYPO3_MODE', 'BE');
67
68 // We use require instead of require_once here so we get a fatal error if Bootstrap.php is accidentally included twice
69 // (which would indicate a clear bug).
70 require('Bootstrap.php');
71 Typo3_Bootstrap::checkEnvironmentOrDie();
72 Typo3_Bootstrap::defineBaseConstants();
73 Typo3_Bootstrap::defineAndCheckPaths('typo3/');
74 Typo3_Bootstrap::requireBaseClasses();
75 Typo3_Bootstrap::setUpEnvironment();
76
77
78 require(PATH_t3lib . 'config_default.php');
79
80 Typo3_Bootstrap::initializeTypo3DbGlobal(FALSE);
81 Typo3_Bootstrap::checkLockedBackendAndRedirectOrDie();
82 Typo3_Bootstrap::checkBackendIpOrDie();
83 Typo3_Bootstrap::checkSslBackendAndRedirectIfNeeded();
84
85 // *************************
86 // Connect to the database
87 // *************************
88 // Redirect to install tool if database host and database are not defined
89 if (!TYPO3_db_host && !TYPO3_db) {
90 t3lib_utility_Http::redirect('install/index.php?mode=123&step=1&password=joh316');
91 } else {
92 $TYPO3_DB->connectDB();
93 }
94
95
96 // *******************************
97 // Checks for proper browser
98 // *******************************
99 if (!$CLIENT['BROWSER']) {
100 throw new RuntimeException('Browser Error: Your browser version looks incompatible with this TYPO3 version!', 1294587023);
101 }
102
103 // Include standard tables.php or own file
104 if (TYPO3_tables_script) {
105 include(PATH_typo3conf . TYPO3_tables_script);
106 } else {
107 include(PATH_t3lib . 'stddb/tables.php');
108 }
109 // Load temp_CACHED file of ext_tables or each ext_tables.php of loaded extensions
110 if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
111 include(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_tables.php');
112 } else {
113 include(PATH_t3lib . 'stddb/load_ext_tables.php');
114 }
115 // Load additional ext tables script
116 if (TYPO3_extTableDef_script) {
117 include(PATH_typo3conf . TYPO3_extTableDef_script);
118 }
119
120 Typo3_Bootstrap::runExtTablesPostProcessingHooks();
121 Typo3_Bootstrap::initializeSpriteManager(TRUE);
122 Typo3_Bootstrap::initializeBackendUser();
123 Typo3_Bootstrap::initializeBackendUserMounts();
124 Typo3_Bootstrap::initializeLanguageObject();
125
126 // Compression
127 ob_clean();
128 if (extension_loaded('zlib') && $TYPO3_CONF_VARS['BE']['compressionLevel']) {
129 if (t3lib_utility_Math::canBeInterpretedAsInteger($TYPO3_CONF_VARS['BE']['compressionLevel'])) {
130 @ini_set('zlib.output_compression_level', $TYPO3_CONF_VARS['BE']['compressionLevel']);
131 }
132 ob_start('ob_gzhandler');
133 }
134
135 ?>