Documentation TYPO3 par Ameos

index_ts.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2004 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 // DIV Library included
00079 // *********************
00080 $TT->push('Include class t3lib_db, t3lib_div, t3lib_extmgm','');
00081         require(PATH_t3lib.'class.t3lib_div.php');
00082         require(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(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->connectToMySQL();
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 // BE_USER
00166 // *********
00167 $BE_USER='';
00168 if ($_COOKIE['be_typo_user']) {         // If the backend cookie is set, we proceed and checks if a backend user is logged in.
00169         $TYPO3_MISC['microtime_BE_USER_start'] = microtime();
00170         $TT->push('Back End user initialized','');
00171                 require_once (PATH_t3lib.'class.t3lib_befunc.php');
00172                 require_once (PATH_t3lib.'class.t3lib_userauthgroup.php');
00173                 require_once (PATH_t3lib.'class.t3lib_beuserauth.php');
00174                 require_once (PATH_t3lib.'class.t3lib_tsfebeuserauth.php');
00175 
00176                         // the value this->formfield_status is set to empty in order to disable login-attempts to the backend account through this script
00177                 $BE_USER = t3lib_div::makeInstance('t3lib_tsfeBeUserAuth');     // New backend user object
00178                 $BE_USER->OS = TYPO3_OS;
00179                 $BE_USER->start();                      // Object is initialized
00180                 $BE_USER->unpack_uc('');
00181                 if ($BE_USER->user['uid'])      {
00182                         $BE_USER->fetchGroupData();
00183                         $TSFE->beUserLogin = 1;
00184                 }
00185                 if ($BE_USER->checkLockToIP() && $BE_USER->checkBackendAccessSettingsFromInitPhp())     {
00186                         $BE_USER->extInitFeAdmin();
00187                         if ($BE_USER->extAdmEnabled)    {
00188                                 require_once(t3lib_extMgm::extPath('lang').'lang.php');
00189                                 $LANG = t3lib_div::makeInstance('language');
00190                                 $LANG->init($BE_USER->uc['lang']);
00191 
00192                                 $BE_USER->extSaveFeAdminConfig();
00193                                         // Setting some values based on the admin panel
00194                                 $TSFE->forceTemplateParsing = $BE_USER->extGetFeAdminValue('tsdebug', 'forceTemplateParsing');
00195                                 $TSFE->displayEditIcons = $BE_USER->extGetFeAdminValue('edit', 'displayIcons');
00196                                 $TSFE->displayFieldEditIcons = $BE_USER->extGetFeAdminValue('edit', 'displayFieldIcons');
00197 
00198                                 if (t3lib_div::_GP('ADMCMD_editIcons')) {
00199                                         $TSFE->displayFieldEditIcons=1;
00200                                         $BE_USER->uc['TSFE_adminConfig']['edit_editNoPopup']=1;
00201                                 }
00202                                 if (t3lib_div::_GP('ADMCMD_simUser'))   {
00203                                         $BE_USER->uc['TSFE_adminConfig']['preview_simulateUserGroup']=intval(t3lib_div::_GP('ADMCMD_simUser'));
00204                                         $BE_USER->ext_forcePreview=1;
00205                                 }
00206                                 if (t3lib_div::_GP('ADMCMD_simTime'))   {
00207                                         $BE_USER->uc['TSFE_adminConfig']['preview_simulateDate']=intval(t3lib_div::_GP('ADMCMD_simTime'));
00208                                         $BE_USER->ext_forcePreview=1;
00209                                 }
00210 
00211                                         // Include classes for editing IF editing module in Admin Panel is open (it is assumed that $TSFE->displayEditIcons is set only if the Edit module is open in the Admin Panel)
00212                                 if ($BE_USER->extAdmModuleEnabled('edit') && $BE_USER->extIsAdmMenuOpen('edit'))        {
00213                                         $TSFE->includeTCA();
00214                                         if ($BE_USER->extIsEditAction())        {
00215                                                 require_once (PATH_t3lib.'class.t3lib_tcemain.php');
00216                                                 $BE_USER->extEditAction();
00217                                         }
00218                                         if ($BE_USER->extIsFormShown()) {
00219                                                 require_once(PATH_t3lib.'class.t3lib_tceforms.php');
00220                                                 require_once(PATH_t3lib.'class.t3lib_iconworks.php');
00221                                                 require_once(PATH_t3lib.'class.t3lib_loaddbgroup.php');
00222                                                 require_once(PATH_t3lib.'class.t3lib_transferdata.php');
00223                                         }
00224                                 }
00225 
00226                                 if ($TSFE->forceTemplateParsing || $TSFE->displayEditIcons || $TSFE->displayFieldEditIcons)     { $TSFE->set_no_cache(); }
00227                         }
00228 
00229         //              $WEBMOUNTS = (string)($BE_USER->groupData['webmounts'])!='' ? explode(',',$BE_USER->groupData['webmounts']) : Array();
00230         //              $FILEMOUNTS = $BE_USER->groupData['filemounts'];
00231                 } else {        // Unset the user initialization.
00232                         $BE_USER='';
00233                         $TSFE->beUserLogin=0;
00234                 }
00235         $TT->pull();
00236         $TYPO3_MISC['microtime_BE_USER_end'] = microtime();
00237 }
00238 
00239 
00240 // *****************************************
00241 // Proces the ID, type and other parameters
00242 // After this point we have an array, $page in TSFE, which is the page-record of the current page, $id
00243 // *****************************************
00244 $TT->push('Process ID','');
00245         $TSFE->checkAlternativeIdMethods();
00246         $TSFE->clear_preview();
00247         $TSFE->determineId();
00248 
00249                 // Now, if there is a backend user logged in and he has NO access to this page, then re-evaluate the id shown!
00250         if ($TSFE->beUserLogin && !$BE_USER->extPageReadAccess($TSFE->page))    {
00251 
00252                         // Remove user
00253                 unset($BE_USER);
00254                 $TSFE->beUserLogin = 0;
00255 
00256                         // Re-evaluate the page-id.
00257                 $TSFE->checkAlternativeIdMethods();
00258                 $TSFE->clear_preview();
00259                 $TSFE->determineId();
00260         }
00261         $TSFE->makeCacheHash();
00262 $TT->pull();
00263 
00264 
00265 // *******************************************
00266 // Get compressed $TCA-Array();
00267 // After this, we should now have a valid $TCA, though minimized
00268 // *******************************************
00269 $TSFE->getCompressedTCarray();
00270 
00271 
00272 // ********************************
00273 // Starts the template
00274 // *******************************
00275 $TT->push('Start Template','');
00276         $TSFE->initTemplate();
00277 $TT->pull();
00278 
00279 
00280 // ********************************
00281 // Get from cache
00282 // *******************************
00283 $TT->push('Get Page from cache','');
00284         $TSFE->getFromCache();
00285 $TT->pull();
00286 
00287 
00288 // ******************************************************
00289 // Get config if not already gotten
00290 // After this, we should have a valid config-array ready
00291 // ******************************************************
00292 $TSFE->getConfigArray();
00293 
00294 
00295 // ********************************
00296 // Convert POST data to internal "renderCharset" if different from the metaCharset:
00297 // *******************************
00298 $TSFE->convPOSTCharset();
00299 
00300 
00301 // *******************************************
00302 // Setting the internal var, sys_language_uid + locale settings
00303 // *******************************************
00304 $TSFE->settingLanguage();
00305 $TSFE->settingLocale();
00306 
00307 
00308 // ********************************
00309 // Check Submission of data.
00310 // This is done at this point, because we need the config values
00311 // *******************************
00312 switch($TSFE->checkDataSubmission())    {
00313         case 'email':
00314                 require_once(PATH_t3lib.'class.t3lib_htmlmail.php');
00315                 require_once(PATH_t3lib.'class.t3lib_formmail.php');
00316                 $TSFE->sendFormmail();
00317         break;
00318         case 'fe_tce':
00319                 require_once(PATH_tslib.'class.tslib_fetce.php');
00320                 $TSFE->includeTCA();
00321                 $TT->push('fe_tce','');
00322                 $TSFE->fe_tce();
00323                 $TT->pull();
00324         break;
00325 }
00326 
00327 
00328 // ********************************
00329 // Check JumpUrl
00330 // *******************************
00331 $TSFE->checkJumpUrl();
00332 
00333 
00334 // ********************************
00335 // Generate page
00336 // *******************************
00337 $TSFE->setUrlIdToken();
00338 
00339 $TT->push('Page generation','');
00340 if ($TSFE->doXHTML_cleaning())  {require_once(PATH_t3lib.'class.t3lib_parsehtml.php');}
00341 if ($TSFE->isGeneratePage())    {
00342                 $TSFE->generatePage_preProcessing();
00343                 $temp_theScript=$TSFE->generatePage_whichScript();
00344 
00345                 if ($temp_theScript)    {
00346                         include($temp_theScript);
00347                 } else {
00348                         require_once(PATH_tslib.'class.tslib_pagegen.php');
00349                         include(PATH_tslib.'pagegen.php');
00350                 }
00351                 $TSFE->generatePage_postProcessing();
00352 } elseif ($TSFE->isINTincScript())      {
00353         require_once(PATH_tslib.'class.tslib_pagegen.php');
00354         include(PATH_tslib.'pagegen.php');
00355 }
00356 $TT->pull();
00357 
00358 
00359 // ********************************
00360 // $GLOBALS['TSFE']->config['INTincScript']
00361 // *******************************
00362 if ($TSFE->isINTincScript())            {
00363         $TT->push('Non-cached objects','');
00364                 $INTiS_config = $GLOBALS['TSFE']->config['INTincScript'];
00365 
00366                         // Special feature: Include libraries
00367                 $TT->push('Include libraries');
00368                 foreach($INTiS_config as $INTiS_cPart)  {
00369                         if ($INTiS_cPart['conf']['includeLibs'])        {
00370                                 $INTiS_resourceList = t3lib_div::trimExplode(',',$INTiS_cPart['conf']['includeLibs'],1);
00371                                 $GLOBALS['TT']->setTSlogMessage('Files for inclusion: "'.implode(', ',$INTiS_resourceList).'"');
00372 
00373                                 foreach($INTiS_resourceList as $INTiS_theLib)   {
00374                                         $INTiS_incFile = $GLOBALS['TSFE']->tmpl->getFileName($INTiS_theLib);
00375                                         if ($INTiS_incFile)     {
00376                                                 require_once('./'.$INTiS_incFile);
00377                                         } else {
00378                                                 $GLOBALS['TT']->setTSlogMessage('Include file "'.$INTiS_theLib.'" did not exist!',2);
00379                                         }
00380                                 }
00381                         }
00382                 }
00383                 $TT->pull();
00384                 $TSFE->INTincScript();
00385         $TT->pull();
00386 }
00387 
00388 // ***************
00389 // Output content
00390 // ***************
00391 if ($TSFE->isOutputting())      {
00392         $TT->push('Print Content','');
00393         $TSFE->processOutput();
00394 
00395         // ***************************************
00396         // Outputs content / Includes EXT scripts
00397         // ***************************************
00398         if ($TSFE->isEXTincScript())    {
00399                 $TT->push('External PHP-script','');
00400                                 // Important global variables here are $EXTiS_*, they must not be overridden in include-scripts!!!
00401                         $EXTiS_config = $GLOBALS['TSFE']->config['EXTincScript'];
00402                         $EXTiS_splitC = explode('<!--EXT_SCRIPT.',$GLOBALS['TSFE']->content);                   // Splits content with the key.
00403 
00404                                 // Special feature: Include libraries
00405                         reset($EXTiS_config);
00406                         while(list(,$EXTiS_cPart)=each($EXTiS_config))  {
00407                                 if ($EXTiS_cPart['conf']['includeLibs'])        {
00408                                         $EXTiS_resourceList = t3lib_div::trimExplode(',',$EXTiS_cPart['conf']['includeLibs'],1);
00409                                         $GLOBALS['TT']->setTSlogMessage('Files for inclusion: "'.implode(', ',$EXTiS_resourceList).'"');
00410                                         reset($EXTiS_resourceList);
00411                                         while(list(,$EXTiS_theLib)=each($EXTiS_resourceList))   {
00412                                                 $EXTiS_incFile=$GLOBALS['TSFE']->tmpl->getFileName($EXTiS_theLib);
00413                                                 if ($EXTiS_incFile)     {
00414                                                         require_once($EXTiS_incFile);
00415                                                 } else {
00416                                                         $GLOBALS['TT']->setTSlogMessage('Include file "'.$EXTiS_theLib.'" did not exist!',2);
00417                                                 }
00418                                         }
00419                                 }
00420                         }
00421 
00422                         reset($EXTiS_splitC);
00423                         while(list($EXTiS_c,$EXTiS_cPart)=each($EXTiS_splitC))  {
00424                                 if (substr($EXTiS_cPart,32,3)=='-->')   {       // If the split had a comment-end after 32 characters it's probably a split-string
00425                                         $EXTiS_key = 'EXT_SCRIPT.'.substr($EXTiS_cPart,0,32);
00426                                         if (is_array($EXTiS_config[$EXTiS_key]))        {
00427                                                 $REC = $EXTiS_config[$EXTiS_key]['data'];
00428                                                 $CONF = $EXTiS_config[$EXTiS_key]['conf'];
00429                                                 $content='';
00430                                                 include($EXTiS_config[$EXTiS_key]['file']);
00431                                                 echo $content;  // The script MAY return content in $content or the script may just output the result directly!
00432                                         }
00433                                         echo substr($EXTiS_cPart,35);
00434                                 } else {
00435                                         echo ($c?'<!--EXT_SCRIPT.':'').$EXTiS_cPart;
00436                                 }
00437                         }
00438 
00439                 $TT->pull();
00440         } else {
00441                 echo $GLOBALS['TSFE']->content;
00442         }
00443         $TT->pull();
00444 }
00445 
00446 
00447 // ********************************
00448 // Store session data for fe_users
00449 // ********************************
00450 $TSFE->storeSessionData();
00451 
00452 
00453 // ***********
00454 // Statistics
00455 // ***********
00456 $TYPO3_MISC['microtime_end'] = microtime();
00457 $TSFE->setParseTime();
00458 if ($TSFE->isOutputting() && ($TSFE->TYPO3_CONF_VARS['FE']['debug'] || $TSFE->config['config']['debug']))       {
00459         echo '
00460 <!-- Parsetime: '.$TSFE->scriptParseTime.' ms-->';
00461 }
00462 $TSFE->statistics();
00463 
00464 
00465 // ***************
00466 // Check JumpUrl
00467 // ***************
00468 $TSFE->jumpurl();
00469 
00470 
00471 // *************
00472 // Preview info
00473 // *************
00474 $TSFE->previewInfo();
00475 
00476 
00477 // ******************
00478 // Publishing static
00479 // ******************
00480 if (is_object($BE_USER))        {
00481         if ($BE_USER->extAdmModuleEnabled('publish') && $BE_USER->extPublishList)       {
00482                 include_once(PATH_tslib.'publish.php');
00483         }
00484 }
00485 
00486 
00487 // ********************
00488 // Finish timetracking
00489 // ********************
00490 $TT->pull();
00491 
00492 
00493 // ******************
00494 // beLoginLinkIPList
00495 // ******************
00496 echo $GLOBALS['TSFE']->beLoginLinkIPList();
00497 
00498 
00499 // *************
00500 // Admin panel
00501 // *************
00502 if (is_object($BE_USER)
00503         && $GLOBALS['TSFE']->beUserLogin
00504         && $GLOBALS['TSFE']->config['config']['admPanel']
00505         && $BE_USER->extAdmEnabled
00506 //      && $BE_USER->extPageReadAccess($GLOBALS['TSFE']->page)  // This is already done, if there is a BE_USER object at this point!
00507         && !$BE_USER->extAdminConfig['hide'])   {
00508                 echo $BE_USER->extPrintFeAdminDialog();
00509 }
00510 
00511 
00512 // *************
00513 // Debugging Output
00514 // *************
00515 if(@is_callable(array($error,'debugOutput'))) {
00516         $error->debugOutput();
00517 }
00518 if (TYPO3_DLOG) t3lib_div::devLog('END of FRONTEND session','',0,array('_FLUSH'=>TRUE));
00519 
00520 
00521 // *************
00522 // Compressions
00523 // *************
00524 if ($TYPO3_CONF_VARS['FE']['compressionLevel']) {
00525         new gzip_encode($TYPO3_CONF_VARS['FE']['compressionLevel'], false, $GLOBALS['TYPO3_CONF_VARS']['FE']['compressionDebugInfo']);
00526 }
00527 
00528 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6