Documentation TYPO3 par Ameos

index.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00046 // *******************************
00047 // Set error reporting
00048 // *******************************
00049 error_reporting (E_ALL ^ E_NOTICE);
00050 
00051 
00052 // ******************
00053 // Constants defined
00054 // ******************
00055 $TYPO3_MISC['microtime_start'] = microtime();
00056 define('TYPO3_OS', stristr(PHP_OS,'win')&&!stristr(PHP_OS,'darwin')?'WIN':'');
00057 define('TYPO3_MODE','FE');
00058 define('PATH_thisScript',str_replace('//','/', str_replace('\\','/', (php_sapi_name()=='cgi'||php_sapi_name()=='isapi' ||php_sapi_name()=='cgi-fcgi')&&($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])? ($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):($_SERVER['ORIG_SCRIPT_FILENAME']?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME']))));
00059 
00060 define('PATH_site', dirname(PATH_thisScript).'/');
00061 define('PATH_t3lib', PATH_site.'t3lib/');
00062 define('PATH_tslib', PATH_site.'tslib/');
00063 define('PATH_typo3conf', PATH_site.'typo3conf/');
00064 define('TYPO3_mainDir', 'typo3/');              // This is the directory of the backend administration for the sites of this TYPO3 installation.
00065 
00066 if (!@is_dir(PATH_typo3conf))   die('Cannot find configuration. This file is probably executed from the wrong location.');
00067 
00068 // *********************
00069 // Timetracking started
00070 // *********************
00071 require_once(PATH_t3lib.'class.t3lib_timetrack.php');
00072 $TT = new t3lib_timeTrack;
00073 $TT->start();
00074 $TT->push('','Script start');
00075 
00076 
00077 // *********************
00078 // Mandatory libraries included
00079 // *********************
00080 $TT->push('Include class t3lib_db, t3lib_div, t3lib_extmgm','');
00081         require_once(PATH_t3lib.'class.t3lib_div.php');
00082         require_once(PATH_t3lib.'class.t3lib_extmgm.php');
00083 $TT->pull();
00084 
00085 
00086 
00087 // **********************
00088 // Include configuration
00089 // **********************
00090 $TT->push('Include config files','');
00091 require(PATH_t3lib.'config_default.php');
00092 if (!defined ('TYPO3_db'))      die ('The configuration file was not included.');       // the name of the TYPO3 database is stored in this constant. Here the inclusion of the config-file is verified by checking if this var is set.
00093 if (!t3lib_extMgm::isLoaded('cms'))     die('<strong>Error:</strong> The main frontend extension "cms" was not loaded. Enable it in the extension manager in the backend.');
00094 
00095 require_once(PATH_t3lib.'class.t3lib_db.php');
00096 $TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
00097 
00098 $CLIENT = t3lib_div::clientInfo();                              // Set to the browser: net / msie if 4+ browsers
00099 $TT->pull();
00100 
00101 
00102 // *********************
00103 // Libraries included
00104 // *********************
00105 $TT->push('Include Frontend libraries','');
00106         require_once(PATH_tslib.'class.tslib_fe.php');
00107         require_once(PATH_t3lib.'class.t3lib_page.php');
00108         require_once(PATH_t3lib.'class.t3lib_userauth.php');
00109         require_once(PATH_tslib.'class.tslib_feuserauth.php');
00110         require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
00111         require_once(PATH_t3lib.'class.t3lib_cs.php');
00112 $TT->pull();
00113 
00114 
00115 // *******************************
00116 // Checking environment
00117 // *******************************
00118 if (t3lib_div::int_from_ver(phpversion())<4001000)      die ('TYPO3 runs with PHP4.1.0+ only');
00119 
00120 if (isset($_POST['GLOBALS']) || isset($_GET['GLOBALS']))        die('You cannot set the GLOBALS-array from outside the script.');
00121 if (!get_magic_quotes_gpc())    {
00122         $TT->push('Add slashes to GET/POST arrays','');
00123         t3lib_div::addSlashesOnArray($_GET);
00124         t3lib_div::addSlashesOnArray($_POST);
00125         $HTTP_GET_VARS = $_GET;
00126         $HTTP_POST_VARS = $_POST;
00127         $TT->pull();
00128 }
00129 
00130 // ***********************************
00131 // Create $TSFE object (TSFE = TypoScript Front End)
00132 // Connecting to database
00133 // ***********************************
00134 $temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
00135 $TSFE = new $temp_TSFEclassName(
00136                 $TYPO3_CONF_VARS,
00137                 t3lib_div::_GP('id'),
00138                 t3lib_div::_GP('type'),
00139                 t3lib_div::_GP('no_cache'),
00140                 t3lib_div::_GP('cHash'),
00141                 t3lib_div::_GP('jumpurl'),
00142                 t3lib_div::_GP('MP'),
00143                 t3lib_div::_GP('RDCT')
00144         );
00145 $TSFE->connectToDB();
00146 if ($TSFE->RDCT)        {$TSFE->sendRedirect();}
00147 
00148 
00149 // *******************
00150 // output compression
00151 // *******************
00152 if ($TYPO3_CONF_VARS['FE']['compressionLevel']) {
00153         ob_start();
00154         require_once(PATH_t3lib.'class.gzip_encode.php');
00155 }
00156 
00157 // *********
00158 // FE_USER
00159 // *********
00160 $TT->push('Front End user initialized','');
00161         $TSFE->initFEuser();
00162 $TT->pull();
00163 
00164 // ****************
00165 // PRE BE_USER HOOK
00166 // ****************
00167 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/index_ts.php']['preBeUser'])) {
00168         foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/index_ts.php']['preBeUser'] as $_funcRef) {
00169                 $_params = array();
00170                 t3lib_div::callUserFunction($_funcRef, $_params , $_params);
00171         }
00172 }
00173 
00174 // *********
00175 // BE_USER
00176 // *********
00177 $BE_USER='';
00178 if ($_COOKIE['be_typo_user']) {         // If the backend cookie is set, we proceed and checks if a backend user is logged in.
00179         $TYPO3_MISC['microtime_BE_USER_start'] = microtime();
00180         $TT->push('Back End user initialized','');
00181                 require_once (PATH_t3lib.'class.t3lib_befunc.php');
00182                 require_once (PATH_t3lib.'class.t3lib_userauthgroup.php');
00183                 require_once (PATH_t3lib.'class.t3lib_beuserauth.php');
00184                 require_once (PATH_t3lib.'class.t3lib_tsfebeuserauth.php');
00185 
00186                         // the value this->formfield_status is set to empty in order to disable login-attempts to the backend account through this script
00187                 $BE_USER = t3lib_div::makeInstance('t3lib_tsfeBeUserAuth');     // New backend user object
00188                 $BE_USER->OS = TYPO3_OS;
00189                 $BE_USER->lockIP = $TYPO3_CONF_VARS['BE']['lockIP'];
00190                 $BE_USER->start();                      // Object is initialized
00191                 $BE_USER->unpack_uc('');
00192                 if ($BE_USER->user['uid'])      {
00193                         $BE_USER->fetchGroupData();
00194                         $TSFE->beUserLogin = 1;
00195                 }
00196                 if ($BE_USER->checkLockToIP() && $BE_USER->checkBackendAccessSettingsFromInitPhp())     {
00197                         $BE_USER->extInitFeAdmin();
00198                         if ($BE_USER->extAdmEnabled)    {
00199                                 require_once(t3lib_extMgm::extPath('lang').'lang.php');
00200                                 $LANG = t3lib_div::makeInstance('language');
00201                                 $LANG->init($BE_USER->uc['lang']);
00202 
00203                                 $BE_USER->extSaveFeAdminConfig();
00204                                         // Setting some values based on the admin panel
00205                                 $TSFE->forceTemplateParsing = $BE_USER->extGetFeAdminValue('tsdebug', 'forceTemplateParsing');
00206                                 $TSFE->displayEditIcons = $BE_USER->extGetFeAdminValue('edit', 'displayIcons');
00207                                 $TSFE->displayFieldEditIcons = $BE_USER->extGetFeAdminValue('edit', 'displayFieldIcons');
00208 
00209                                 if (t3lib_div::_GP('ADMCMD_editIcons')) {
00210                                         $TSFE->displayFieldEditIcons=1;
00211                                         $BE_USER->uc['TSFE_adminConfig']['edit_editNoPopup']=1;
00212                                 }
00213                                 if (t3lib_div::_GP('ADMCMD_simUser'))   {
00214                                         $BE_USER->uc['TSFE_adminConfig']['preview_simulateUserGroup']=intval(t3lib_div::_GP('ADMCMD_simUser'));
00215                                         $BE_USER->ext_forcePreview=1;
00216                                 }
00217                                 if (t3lib_div::_GP('ADMCMD_simTime'))   {
00218                                         $BE_USER->uc['TSFE_adminConfig']['preview_simulateDate']=intval(t3lib_div::_GP('ADMCMD_simTime'));
00219                                         $BE_USER->ext_forcePreview=1;
00220                                 }
00221 
00222                                         // Include classes for editing IF editing module in Admin Panel is open
00223                                 if (($BE_USER->extAdmModuleEnabled('edit') && $BE_USER->extIsAdmMenuOpen('edit')) || $TSFE->displayEditIcons == 1)      {
00224                                         $TSFE->includeTCA();
00225                                         if ($BE_USER->extIsEditAction())        {
00226                                                 require_once (PATH_t3lib.'class.t3lib_tcemain.php');
00227                                                 $BE_USER->extEditAction();
00228                                         }
00229                                         if ($BE_USER->extIsFormShown()) {
00230                                                 require_once(PATH_t3lib.'class.t3lib_tceforms.php');
00231                                                 require_once(PATH_t3lib.'class.t3lib_iconworks.php');
00232                                                 require_once(PATH_t3lib.'class.t3lib_loaddbgroup.php');
00233                                                 require_once(PATH_t3lib.'class.t3lib_transferdata.php');
00234                                         }
00235                                 }
00236 
00237                                 if ($TSFE->forceTemplateParsing || $TSFE->displayEditIcons || $TSFE->displayFieldEditIcons)     { $TSFE->set_no_cache(); }
00238                         }
00239 
00240         //              $WEBMOUNTS = (string)($BE_USER->groupData['webmounts'])!='' ? explode(',',$BE_USER->groupData['webmounts']) : Array();
00241         //              $FILEMOUNTS = $BE_USER->groupData['filemounts'];
00242                 } else {        // Unset the user initialization.
00243                         $BE_USER='';
00244                         $TSFE->beUserLogin=0;
00245                 }
00246         $TT->pull();
00247         $TYPO3_MISC['microtime_BE_USER_end'] = microtime();
00248 }
00249 
00250 
00251 // *****************************************
00252 // Proces the ID, type and other parameters
00253 // After this point we have an array, $page in TSFE, which is the page-record of the current page, $id
00254 // *****************************************
00255 $TT->push('Process ID','');
00256         $TSFE->checkAlternativeIdMethods();
00257         $TSFE->clear_preview();
00258         $TSFE->determineId();
00259 
00260                 // Now, if there is a backend user logged in and he has NO access to this page, then re-evaluate the id shown!
00261         if ($TSFE->beUserLogin && !$BE_USER->extPageReadAccess($TSFE->page))    {
00262 
00263                         // Remove user
00264                 unset($BE_USER);
00265                 $TSFE->beUserLogin = 0;
00266 
00267                         // Re-evaluate the page-id.
00268                 $TSFE->checkAlternativeIdMethods();
00269                 $TSFE->clear_preview();
00270                 $TSFE->determineId();
00271         }
00272         $TSFE->makeCacheHash();
00273 $TT->pull();
00274 
00275 
00276 // *******************************************
00277 // Get compressed $TCA-Array();
00278 // After this, we should now have a valid $TCA, though minimized
00279 // *******************************************
00280 $TSFE->getCompressedTCarray();
00281 
00282 
00283 // ********************************
00284 // Starts the template
00285 // *******************************
00286 $TT->push('Start Template','');
00287         $TSFE->initTemplate();
00288 $TT->pull();
00289 
00290 
00291 // ********************************
00292 // Get from cache
00293 // *******************************
00294 $TT->push('Get Page from cache','');
00295         $TSFE->getFromCache();
00296 $TT->pull();
00297 
00298 
00299 // ******************************************************
00300 // Get config if not already gotten
00301 // After this, we should have a valid config-array ready
00302 // ******************************************************
00303 $TSFE->getConfigArray();
00304 
00305 
00306 // ********************************
00307 // Convert POST data to internal "renderCharset" if different from the metaCharset:
00308 // *******************************
00309 $TSFE->convPOSTCharset();
00310 
00311 
00312 // *******************************************
00313 // Setting the internal var, sys_language_uid + locale settings
00314 // *******************************************
00315 $TSFE->settingLanguage();
00316 $TSFE->settingLocale();
00317 
00318 
00319 // ********************************
00320 // Check Submission of data.
00321 // This is done at this point, because we need the config values
00322 // *******************************
00323 switch($TSFE->checkDataSubmission())    {
00324         case 'email':
00325                 require_once(PATH_t3lib.'class.t3lib_htmlmail.php');
00326                 require_once(PATH_t3lib.'class.t3lib_formmail.php');
00327                 $TSFE->sendFormmail();
00328         break;
00329         case 'fe_tce':
00330                 require_once(PATH_tslib.'class.tslib_fetce.php');
00331                 $TSFE->includeTCA();
00332                 $TT->push('fe_tce','');
00333                 $TSFE->fe_tce();
00334                 $TT->pull();
00335         break;
00336 }
00337 
00338 
00339 // ********************************
00340 // Check JumpUrl
00341 // *******************************
00342 $TSFE->checkJumpUrl();
00343 
00344 
00345 // ********************************
00346 // Generate page
00347 // *******************************
00348 $TSFE->setUrlIdToken();
00349 
00350 $TT->push('Page generation','');
00351 if ($TSFE->doXHTML_cleaning())  {require_once(PATH_t3lib.'class.t3lib_parsehtml.php');}
00352 if ($TSFE->isGeneratePage())    {
00353                 $TSFE->generatePage_preProcessing();
00354                 $temp_theScript=$TSFE->generatePage_whichScript();
00355 
00356                 if ($temp_theScript)    {
00357                         include($temp_theScript);
00358                 } else {
00359                         require_once(PATH_tslib.'class.tslib_pagegen.php');
00360                         include(PATH_tslib.'pagegen.php');
00361                 }
00362                 $TSFE->generatePage_postProcessing();
00363 } elseif ($TSFE->isINTincScript())      {
00364         require_once(PATH_tslib.'class.tslib_pagegen.php');
00365         include(PATH_tslib.'pagegen.php');
00366 }
00367 $TT->pull();
00368 
00369 
00370 // ********************************
00371 // $GLOBALS['TSFE']->config['INTincScript']
00372 // *******************************
00373 if ($TSFE->isINTincScript())            {
00374         $TT->push('Non-cached objects','');
00375                 $INTiS_config = $GLOBALS['TSFE']->config['INTincScript'];
00376 
00377                         // Special feature: Include libraries
00378                 $TT->push('Include libraries');
00379                 foreach($INTiS_config as $INTiS_cPart)  {
00380                         if ($INTiS_cPart['conf']['includeLibs'])        {
00381                                 $INTiS_resourceList = t3lib_div::trimExplode(',',$INTiS_cPart['conf']['includeLibs'],1);
00382                                 $GLOBALS['TT']->setTSlogMessage('Files for inclusion: "'.implode(', ',$INTiS_resourceList).'"');
00383 
00384                                 foreach($INTiS_resourceList as $INTiS_theLib)   {
00385                                         $INTiS_incFile = $GLOBALS['TSFE']->tmpl->getFileName($INTiS_theLib);
00386                                         if ($INTiS_incFile)     {
00387                                                 require_once('./'.$INTiS_incFile);
00388                                         } else {
00389                                                 $GLOBALS['TT']->setTSlogMessage('Include file "'.$INTiS_theLib.'" did not exist!',2);
00390                                         }
00391                                 }
00392                         }
00393                 }
00394                 $TT->pull();
00395                 $TSFE->INTincScript();
00396         $TT->pull();
00397 }
00398 
00399 // ***************
00400 // Output content
00401 // ***************
00402 if ($TSFE->isOutputting())      {
00403         $TT->push('Print Content','');
00404         $TSFE->processOutput();
00405 
00406         // ***************************************
00407         // Outputs content / Includes EXT scripts
00408         // ***************************************
00409         if ($TSFE->isEXTincScript())    {
00410                 $TT->push('External PHP-script','');
00411                                 // Important global variables here are $EXTiS_*, they must not be overridden in include-scripts!!!
00412                         $EXTiS_config = $GLOBALS['TSFE']->config['EXTincScript'];
00413                         $EXTiS_splitC = explode('<!--EXT_SCRIPT.',$GLOBALS['TSFE']->content);                   // Splits content with the key.
00414 
00415                                 // Special feature: Include libraries
00416                         reset($EXTiS_config);
00417                         while(list(,$EXTiS_cPart)=each($EXTiS_config))  {
00418                                 if ($EXTiS_cPart['conf']['includeLibs'])        {
00419                                         $EXTiS_resourceList = t3lib_div::trimExplode(',',$EXTiS_cPart['conf']['includeLibs'],1);
00420                                         $GLOBALS['TT']->setTSlogMessage('Files for inclusion: "'.implode(', ',$EXTiS_resourceList).'"');
00421                                         reset($EXTiS_resourceList);
00422                                         while(list(,$EXTiS_theLib)=each($EXTiS_resourceList))   {
00423                                                 $EXTiS_incFile=$GLOBALS['TSFE']->tmpl->getFileName($EXTiS_theLib);
00424                                                 if ($EXTiS_incFile)     {
00425                                                         require_once($EXTiS_incFile);
00426                                                 } else {
00427                                                         $GLOBALS['TT']->setTSlogMessage('Include file "'.$EXTiS_theLib.'" did not exist!',2);
00428                                                 }
00429                                         }
00430                                 }
00431                         }
00432 
00433                         reset($EXTiS_splitC);
00434                         while(list($EXTiS_c,$EXTiS_cPart)=each($EXTiS_splitC))  {
00435                                 if (substr($EXTiS_cPart,32,3)=='-->')   {       // If the split had a comment-end after 32 characters it's probably a split-string
00436                                         $EXTiS_key = 'EXT_SCRIPT.'.substr($EXTiS_cPart,0,32);
00437                                         if (is_array($EXTiS_config[$EXTiS_key]))        {
00438                                                 $REC = $EXTiS_config[$EXTiS_key]['data'];
00439                                                 $CONF = $EXTiS_config[$EXTiS_key]['conf'];
00440                                                 $content='';
00441                                                 include($EXTiS_config[$EXTiS_key]['file']);
00442                                                 echo $content;  // The script MAY return content in $content or the script may just output the result directly!
00443                                         }
00444                                         echo substr($EXTiS_cPart,35);
00445                                 } else {
00446                                         echo ($c?'<!--EXT_SCRIPT.':'').$EXTiS_cPart;
00447                                 }
00448                         }
00449 
00450                 $TT->pull();
00451         } else {
00452                 echo $GLOBALS['TSFE']->content;
00453         }
00454         $TT->pull();
00455 }
00456 
00457 
00458 // ********************************
00459 // Store session data for fe_users
00460 // ********************************
00461 $TSFE->storeSessionData();
00462 
00463 
00464 // ***********
00465 // Statistics
00466 // ***********
00467 $TYPO3_MISC['microtime_end'] = microtime();
00468 $TSFE->setParseTime();
00469 if ($TSFE->isOutputting() && ($TSFE->TYPO3_CONF_VARS['FE']['debug'] || $TSFE->config['config']['debug']))       {
00470         echo '
00471 <!-- Parsetime: '.$TSFE->scriptParseTime.' ms-->';
00472 }
00473 $TSFE->statistics();
00474 
00475 
00476 // ***************
00477 // Check JumpUrl
00478 // ***************
00479 $TSFE->jumpurl();
00480 
00481 
00482 // *************
00483 // Preview info
00484 // *************
00485 $TSFE->previewInfo();
00486 
00487 
00488 // ******************
00489 // Publishing static
00490 // ******************
00491 if (is_object($BE_USER))        {
00492         if ($BE_USER->extAdmModuleEnabled('publish') && $BE_USER->extPublishList)       {
00493                 include_once(PATH_tslib.'publish.php');
00494         }
00495 }
00496 
00497 
00498 // ******************
00499 // Hook for end-of-frontend
00500 // ******************
00501 $TSFE->hook_eofe();
00502 
00503 
00504 // ********************
00505 // Finish timetracking
00506 // ********************
00507 $TT->pull();
00508 
00509 
00510 // ******************
00511 // beLoginLinkIPList
00512 // ******************
00513 echo $GLOBALS['TSFE']->beLoginLinkIPList();
00514 
00515 
00516 // *************
00517 // Admin panel
00518 // *************
00519 if (is_object($BE_USER)
00520         && $GLOBALS['TSFE']->beUserLogin
00521         && $GLOBALS['TSFE']->config['config']['admPanel']
00522         && $BE_USER->extAdmEnabled
00523 //      && $BE_USER->extPageReadAccess($GLOBALS['TSFE']->page)  // This is already done, if there is a BE_USER object at this point!
00524         && !$BE_USER->extAdminConfig['hide'])   {
00525                 echo $BE_USER->extPrintFeAdminDialog();
00526 }
00527 
00528 
00529 // *************
00530 // Debugging Output
00531 // *************
00532 if(@is_callable(array($error,'debugOutput'))) {
00533         $error->debugOutput();
00534 }
00535 if (TYPO3_DLOG) t3lib_div::devLog('END of FRONTEND session','',0,array('_FLUSH'=>TRUE));
00536 
00537 
00538 // *************
00539 // Compressions
00540 // *************
00541 if ($TYPO3_CONF_VARS['FE']['compressionLevel']) {
00542         new gzip_encode($TYPO3_CONF_VARS['FE']['compressionLevel'], false, $GLOBALS['TYPO3_CONF_VARS']['FE']['compressionDebugInfo']);
00543 }
00544 
00545 ?>


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6