TYPO3 CMS  TYPO3_6-2
index_ts.php
Go to the documentation of this file.
1 <?php
30 define('TYPO3_MODE', 'FE');
31 
33  ->startOutputBuffering()
34  ->loadConfigurationAndInitialize()
35  ->loadTypo3LoadedExtAndExtLocalconf(TRUE)
36  ->applyAdditionalConfigurationSettings();
37 
38 // Timetracking started
39 $configuredCookieName = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['cookieName']);
40 if (empty($configuredCookieName)) {
41  $configuredCookieName = 'be_typo_user';
42 }
43 if ($_COOKIE[$configuredCookieName]) {
44  $TT = new \TYPO3\CMS\Core\TimeTracker\TimeTracker();
45 } else {
46  $TT = new \TYPO3\CMS\Core\TimeTracker\NullTimeTracker();
47 }
48 
49 $TT->start();
50 
51 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeTypo3DbGlobal();
52 // Hook to preprocess the current request:
53 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'])) {
54  foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'] as $hookFunction) {
55  $hookParameters = array();
56  \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $hookParameters);
57  }
58  unset($hookFunction);
59  unset($hookParameters);
60 }
61 // Look for extension ID which will launch alternative output engine
62 if ($temp_extId = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('eID')) {
63  if ($classPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($TYPO3_CONF_VARS['FE']['eID_include'][$temp_extId])) {
64  // Remove any output produced until now
65  ob_clean();
66  require $classPath;
67  }
68  die;
69 }
70 
73  'TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController',
75  \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'),
76  \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('type'),
77  \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('no_cache'),
78  \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cHash'),
79  \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('jumpurl'),
80  \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('MP'),
81  \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('RDCT')
82 );
83 
84 if ($TYPO3_CONF_VARS['FE']['pageUnavailable_force']
85  && !\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(
86  \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'),
87  $TYPO3_CONF_VARS['SYS']['devIPmask'])
88 ) {
89  $TSFE->pageUnavailableAndExit('This page is temporarily unavailable.');
90 }
91 
92 $TSFE->connectToDB();
93 $TSFE->sendRedirect();
94 
95 // Output compression
96 // Remove any output produced until now
97 ob_clean();
98 if ($TYPO3_CONF_VARS['FE']['compressionLevel'] && extension_loaded('zlib')) {
99  if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($TYPO3_CONF_VARS['FE']['compressionLevel'])) {
100  // Prevent errors if ini_set() is unavailable (safe mode)
101  @ini_set('zlib.output_compression_level', $TYPO3_CONF_VARS['FE']['compressionLevel']);
102  }
103  ob_start(array(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Utility\\CompressionUtility'), 'compressionOutputHandler'));
104 }
105 
106 // FE_USER
107 $TT->push('Front End user initialized', '');
109 $TSFE->initFEuser();
110 $TT->pull();
111 
112 // BE_USER
114 $BE_USER = $TSFE->initializeBackendUser();
115 
116 // Process the ID, type and other parameters.
117 // After this point we have an array, $page in TSFE, which is the page-record
118 // of the current page, $id.
119 $TT->push('Process ID', '');
120 // Initialize admin panel since simulation settings are required here:
121 if ($TSFE->isBackendUserLoggedIn()) {
122  $BE_USER->initializeAdminPanel();
123  \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadExtensionTables(TRUE);
124 } else {
126 }
127 $TSFE->checkAlternativeIdMethods();
128 $TSFE->clear_preview();
129 $TSFE->determineId();
130 
131 // Now, if there is a backend user logged in and he has NO access to this page,
132 // then re-evaluate the id shown! _GP('ADMCMD_noBeUser') is placed here because
133 // \TYPO3\CMS\Version\Hook\PreviewHook might need to know if a backend user is logged in.
134 if (
135  $TSFE->isBackendUserLoggedIn()
136  && (!$BE_USER->extPageReadAccess($TSFE->page) || \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ADMCMD_noBeUser'))
137 ) {
138  // Remove user
139  unset($BE_USER);
140  $TSFE->beUserLogin = FALSE;
141  // Re-evaluate the page-id.
142  $TSFE->checkAlternativeIdMethods();
143  $TSFE->clear_preview();
144  $TSFE->determineId();
145 }
146 
147 $TSFE->makeCacheHash();
148 $TT->pull();
149 
150 // Admin Panel & Frontend editing
151 if ($TSFE->isBackendUserLoggedIn()) {
152  $BE_USER->initializeFrontendEdit();
153  if ($BE_USER->adminPanel instanceof \TYPO3\CMS\Frontend\View\AdminPanelView) {
155  ->initializeLanguageObject()
156  ->initializeSpriteManager();
157  }
158  if ($BE_USER->frontendEdit instanceof \TYPO3\CMS\Core\FrontendEditing\FrontendEditingController) {
159  $BE_USER->frontendEdit->initConfigOptions();
160  }
161 }
162 
163 // Starts the template
164 $TT->push('Start Template', '');
165 $TSFE->initTemplate();
166 $TT->pull();
167 // Get from cache
168 $TT->push('Get Page from cache', '');
169 $TSFE->getFromCache();
170 $TT->pull();
171 // Get config if not already gotten
172 // After this, we should have a valid config-array ready
173 $TSFE->getConfigArray();
174 // Setting language and locale
175 $TT->push('Setting language and locale', '');
176 $TSFE->settingLanguage();
177 $TSFE->settingLocale();
178 $TT->pull();
179 
180 // Convert POST data to internal "renderCharset" if different from the metaCharset
181 $TSFE->convPOSTCharset();
182 
183 // Check JumpUrl
184 $TSFE->setExternalJumpUrl();
185 $TSFE->checkJumpUrlReferer();
186 
187 $TSFE->handleDataSubmission();
188 
189 // Check for shortcut page and redirect
190 $TSFE->checkPageForShortcutRedirect();
191 $TSFE->checkPageForMountpointRedirect();
192 
193 // Generate page
194 $TSFE->setUrlIdToken();
195 $TT->push('Page generation', '');
196 if ($TSFE->isGeneratePage()) {
197  $TSFE->generatePage_preProcessing();
198  $temp_theScript = $TSFE->generatePage_whichScript();
199  if ($temp_theScript) {
200  include $temp_theScript;
201  } else {
203  // Global content object
204  $TSFE->newCObj();
205  // LIBRARY INCLUSION, TypoScript
207  foreach ($temp_incFiles as $temp_file) {
208  include_once './' . $temp_file;
209  }
210  // Content generation
211  if (!$TSFE->isINTincScript()) {
213  $TSFE->setAbsRefPrefix();
214  }
215  }
216  $TSFE->generatePage_postProcessing();
217 } elseif ($TSFE->isINTincScript()) {
219  // Global content object
220  $TSFE->newCObj();
221  // LIBRARY INCLUSION, TypoScript
223  foreach ($temp_incFiles as $temp_file) {
224  include_once './' . $temp_file;
225  }
226 }
227 $TT->pull();
228 
229 // $TSFE->config['INTincScript']
230 if ($TSFE->isINTincScript()) {
231  $TT->push('Non-cached objects', '');
232  $TSFE->INTincScript();
233  $TT->pull();
234 }
235 // Output content
237 if ($TSFE->isOutputting()) {
238  $TT->push('Print Content', '');
239  $TSFE->processOutput();
240  $sendTSFEContent = TRUE;
241  $TT->pull();
242 }
243 // Store session data for fe_users
244 $TSFE->storeSessionData();
245 // Statistics
246 $TYPO3_MISC['microtime_end'] = microtime(TRUE);
247 $TSFE->setParseTime();
248 if (isset($TSFE->config['config']['debug'])) {
249  $debugParseTime = (bool)$TSFE->config['config']['debug'];
250 } else {
251  $debugParseTime = !empty($TSFE->TYPO3_CONF_VARS['FE']['debug']);
252 }
253 if ($TSFE->isOutputting() && $debugParseTime) {
254  $TSFE->content .= LF . '<!-- Parsetime: ' . $TSFE->scriptParseTime . 'ms -->';
255 }
256 // Check JumpUrl
257 $TSFE->jumpurl();
258 // Preview info
259 $TSFE->previewInfo();
260 // Hook for end-of-frontend
261 $TSFE->hook_eofe();
262 // Finish timetracking
263 $TT->pull();
264 // Check memory usage
265 \TYPO3\CMS\Core\Utility\MonitorUtility::peakMemoryUsage();
266 // beLoginLinkIPList
267 echo $TSFE->beLoginLinkIPList();
268 
269 // Admin panel
270 if (
271  $TSFE->isBackendUserLoggedIn()
272  && $BE_USER instanceof \TYPO3\CMS\Backend\FrontendBackendUserAuthentication
273  && $BE_USER->isAdminPanelVisible()
274 ) {
275  $TSFE->content = str_ireplace('</head>', $BE_USER->adminPanel->getAdminPanelHeaderData() . '</head>', $TSFE->content);
276  $TSFE->content = str_ireplace('</body>', $BE_USER->displayAdminPanel() . '</body>', $TSFE->content);
277 }
278 
279 if ($sendTSFEContent) {
280  echo $TSFE->content;
281 }
282 // Debugging Output
283 if (isset($error) && is_object($error) && @is_callable(array($error, 'debugOutput'))) {
284  $error->debugOutput();
285 }
286 if (TYPO3_DLOG) {
287  \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('END of FRONTEND session', 'cms', 0, array('_FLUSH' => TRUE));
288 }
$TYPO3_CONF_VARS['SYS']['contentTable']
$configuredCookieName
Definition: index_ts.php:39
static devLog($msg, $extKey, $severity=0, $dataVar=FALSE)
die
Definition: index.php:6
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
$TSFE
Definition: index_ts.php:72
if($TSFE->isINTincScript()) $sendTSFEContent
Definition: index_ts.php:236
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
$TYPO3_MISC['microtime_end']
Definition: index_ts.php:246
$BE_USER
Definition: index_ts.php:114