/typo3/sysext/cms/tslib/class.tslib_fe.php
PHP | 4842 lines | 2699 code | 633 blank | 1510 comment | 608 complexity | ead83ebf7bf2a0da8f2109371dd3e7a8 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, Unlicense, LGPL-2.1, Apache-2.0
Large files files are truncated, but you can click here to view the full file
- <?php
- /***************************************************************
- * Copyright notice
- *
- * (c) 1999-2010 Kasper Skaarhoj (kasperYYYY@typo3.com)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- * A copy is found in the textfile GPL.txt and important notices to the license
- * from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
- /**
- * Class for the built TypoScript based Front End
- *
- * This class has a lot of functions and internal variable which are use from index_ts.php.
- * The class is instantiated as $GLOBALS['TSFE'] in index_ts.php.
- * The use of this class should be inspired by the order of function calls as found in index_ts.php.
- *
- * $Id: class.tslib_fe.php 8429 2010-07-28 09:19:00Z ohader $
- * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
- * XHTML compliant
- *
- * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
- */
- /**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- * 213: class tslib_fe
- * 382: function tslib_fe($TYPO3_CONF_VARS, $id, $type, $no_cache='', $cHash='', $jumpurl='',$MP='',$RDCT='')
- * 415: function connectToMySQL()
- * 425: function connectToDB()
- * 470: function sendRedirect()
- *
- * SECTION: Initializing, resolving page id
- * 508: function initFEuser()
- * 558: function initUserGroups()
- * 593: function isUserOrGroupSet()
- * 618: function checkAlternativeIdMethods()
- * 670: function clear_preview()
- * 683: function determineId()
- * 817: function fetch_the_id()
- * 911: function getPageAndRootline()
- * 994: function getPageShortcut($SC,$mode,$thisUid,$itera=20,$pageLog=array())
- * 1044: function checkRootlineForIncludeSection()
- * 1081: function checkEnableFields($row,$bypassGroupCheck=FALSE)
- * 1097: function checkPageGroupAccess($row, $groupList=NULL)
- * 1116: function checkPagerecordForIncludeSection($row)
- * 1125: function checkIfLoginAllowedInBranch()
- * 1150: function getPageAccessFailureReasons()
- * 1182: function setIDfromArgV()
- * 1198: function getPageAndRootlineWithDomain($domainStartPage)
- * 1225: function setSysPageWhereClause()
- * 1237: function findDomainRecord($recursive=0)
- * 1257: function pageNotFoundAndExit($reason='', $header='')
- * 1272: function pageNotFoundHandler($code, $header='', $reason='')
- * 1316: function checkAndSetAlias()
- * 1335: function idPartsAnalyze($str)
- * 1360: function mergingWithGetVars($GET_VARS)
- * 1390: function ADMCMD_preview()
- * 1433: function ADMCMD_preview_postInit($previewConfig)
- *
- * SECTION: Template and caching related functions.
- * 1465: function makeCacheHash()
- * 1489: function reqCHash()
- * 1511: function cHashParams($addQueryParams)
- * 1520: function initTemplate()
- * 1532: function getFromCache()
- * 1578: function getFromCache_queryRow()
- * 1608: function headerNoCache()
- * 1637: function getHash()
- * 1657: function getConfigArray()
- *
- * SECTION: Further initialization and data processing
- * 1818: function getCompressedTCarray()
- * 1872: function includeTCA($TCAloaded=1)
- * 1899: function settingLanguage()
- * 1992: function settingLocale()
- * 2017: function checkDataSubmission()
- * 2050: function fe_tce()
- * 2064: function locDataCheck($locationData)
- * 2080: function sendFormmail()
- * 2131: function extractRecipientCopy($bodytext)
- * 2145: function setExternalJumpUrl()
- * 2156: function checkJumpUrlReferer()
- * 2171: function jumpUrl()
- * 2215: function setUrlIdToken()
- *
- * SECTION: Page generation; cache handling
- * 2258: function isGeneratePage()
- * 2268: function tempPageCacheContent()
- * 2325: function realPageCacheContent()
- * 2355: function setPageCacheContent($content,$data,$tstamp)
- * 2382: function clearPageCacheContent()
- * 2392: function clearPageCacheContent_pidList($pidList)
- * 2426: function setSysLastChanged()
- *
- * SECTION: Page generation; rendering and inclusion
- * 2462: function generatePage_preProcessing()
- * 2484: function generatePage_whichScript()
- * 2496: function generatePage_postProcessing()
- * 2588: function INTincScript()
- * 2648: function INTincScript_loadJSCode()
- * 2689: function isINTincScript()
- * 2698: function doXHTML_cleaning()
- * 2707: function doLocalAnchorFix()
- *
- * SECTION: Finished off; outputting, storing session data, statistics...
- * 2738: function isOutputting()
- * 2761: function processOutput()
- * 2834: function sendCacheHeaders()
- * 2902: function isStaticCacheble()
- * 2915: function contentStrReplace()
- * 2941: function isEXTincScript()
- * 2950: function storeSessionData()
- * 2960: function setParseTime()
- * 2972: function statistics()
- * 3066: function previewInfo()
- * 3101: function hook_eofe()
- * 3117: function beLoginLinkIPList()
- * 3138: function addTempContentHttpHeaders()
- *
- * SECTION: Various internal API functions
- * 3184: function makeSimulFileName($inTitle,$page,$type,$addParams='',$no_cache='')
- * 3231: function simulateStaticDocuments_pEnc_onlyP_proc($linkVars)
- * 3260: function getSimulFileName()
- * 3271: function setSimulReplacementChar()
- * 3291: function fileNameASCIIPrefix($inTitle,$titleChars,$mergeChar='.')
- * 3314: function encryptEmail($string,$back=0)
- * 3340: function codeString($string, $decode=FALSE)
- * 3366: function roundTripCryptString($string)
- * 3386: function checkFileInclude($incFile)
- * 3401: function newCObj()
- * 3414: function setAbsRefPrefix()
- * 3428: function baseUrlWrap($url)
- * 3447: function printError($label,$header='Error!')
- * 3458: function updateMD5paramsRecord($hash)
- * 3469: function tidyHTML($content)
- * 3495: function prefixLocalAnchorsWithScript()
- * 3505: function workspacePreviewInit()
- * 3521: function doWorkspacePreview()
- * 3531: function whichWorkspace($returnTitle = FALSE)
- *
- * SECTION: Various external API functions - for use in plugins etc.
- * 3589: function getStorageSiterootPids()
- * 3604: function getPagesTSconfig()
- * 3637: function setJS($key,$content='')
- * 3677: function setCSS($key,$content)
- * 3692: function make_seed()
- * 3705: function uniqueHash($str='')
- * 3714: function set_no_cache()
- * 3724: function set_cache_timeout_default($seconds)
- * 3740: function plainMailEncoded($email,$subject,$message,$headers='')
- *
- * SECTION: Localization and character set conversion
- * 3784: function sL($input)
- * 3813: function readLLfile($fileRef)
- * 3824: function getLLL($index,$LOCAL_LANG)
- * 3838: function initLLvars()
- * 3872: function csConv($str,$from='')
- * 3890: function convOutputCharset($content,$label='')
- * 3903: function convPOSTCharset()
- *
- * TOTAL FUNCTIONS: 116
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
- /**
- * Main frontend class, instantiated in the index_ts.php script as the global object TSFE
- *
- * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tslib
- */
- class tslib_fe {
- // CURRENT PAGE:
- var $id=''; // The page id (int)
- var $type=''; // RO The type (int)
- var $idParts=array(); // Loaded with the id, exploded by ','
- var $cHash=''; // The submitted cHash
- var $no_cache=''; // Page will not be cached. Write only true. Never clear value (some other code might have reasons to set it true)
- var $rootLine=''; // The rootLine (all the way to tree root, not only the current site!) (array)
- var $page=''; // The pagerecord (array)
- var $contentPid=0; // This will normally point to the same value as id, but can be changed to point to another page from which content will then be displayed instead.
- protected $originalShortcutPage = null; // gets set when we are processing a page of type shortcut in the early stages opf init.php when we do not know about languages yet, used later in init.php to determine the correct shortcut in case a translation changes the shortcut target (array)
- /**
- * sys_page-object, pagefunctions
- *
- * @var t3lib_pageSelect
- */
- var $sys_page='';
- var $jumpurl='';
- var $pageNotFound=0; // Is set to 1 if a pageNotFound handler could have been called.
- var $domainStartPage=0; // Domain start page
- var $pageAccessFailureHistory=array(); // Array containing a history of why a requested page was not accessible.
- var $MP='';
- var $RDCT='';
- var $page_cache_reg1=0; // This can be set from applications as a way to tag cached versions of a page and later perform some external cache management, like clearing only a part of the cache of a page...
- var $siteScript=''; // Contains the value of the current script path that activated the frontend. Typically "index.php" but by rewrite rules it could be something else! Used for Speaking Urls / Simulate Static Documents.
- // USER
- /**
- * The FE user
- *
- * @var tslib_feUserAuth
- */
- var $fe_user='';
- var $loginUser=''; // Global flag indicating that a front-end user is logged in. This is set only if a user really IS logged in. The group-list may show other groups (like added by IP filter or so) even though there is no user.
- var $gr_list=''; // (RO=readonly) The group list, sorted numerically. Group '0,-1' is the default group, but other groups may be added by other means than a user being logged in though...
- var $beUserLogin=''; // Flag that indicates if a Backend user is logged in!
- var $workspacePreview=''; // Integer, that indicates which workspace is being previewed.
- var $loginAllowedInBranch = TRUE; // Shows whether logins are allowed in branch
- var $loginAllowedInBranch_mode = ''; // Shows specific mode (all or groups)
- var $ADMCMD_preview_BEUSER_uid = 0; // Integer, set to backend user ID to initialize when keyword-based preview is used.
- // PREVIEW
- var $fePreview=''; // Flag indication that preview is active. This is based on the login of a backend user and whether the backend user has read access to the current page. A value of 1 means ordinary preview, 2 means preview of a non-live workspace
- var $showHiddenPage=''; // Flag indicating that hidden pages should be shown, selected and so on. This goes for almost all selection of pages!
- var $showHiddenRecords=''; // Flag indicating that hidden records should be shown. This includes sys_template, pages_language_overlay and even fe_groups in addition to all other regular content. So in effect, this includes everything except pages.
- var $simUserGroup='0'; // Value that contains the simulated usergroup if any
- // CONFIGURATION
- var $TYPO3_CONF_VARS=array(); // The configuration array as set up in t3lib/config_default.php. Should be an EXACT copy of the global array.
- var $config=''; // "CONFIG" object from TypoScript. Array generated based on the TypoScript configuration of the current page. Saved with the cached pages.
- var $TCAcachedExtras=array(); // Array of cached information from TCA. This is NOT TCA itself!
- // TEMPLATE / CACHE
- /**
- * The TypoScript template object. Used to parse the TypoScript template
- *
- * @var t3lib_TStemplate
- */
- var $tmpl='';
- var $cacheTimeOutDefault=''; // Is set to the time-to-live time of cached pages. If false, default is 60*60*24, which is 24 hours.
- var $cacheContentFlag = 0; // Set internally if cached content is fetched from the database
- var $cacheExpires=0; // Set to the expire time of cached content
- var $isClientCachable=FALSE; // Set if cache headers allowing caching are sent.
- var $all=''; // $all used by template fetching system. This array is an identification of the template. If $this->all is empty it's because the template-data is not cached, which it must be.
- var $sPre=''; // toplevel - objArrayName, eg 'page'
- var $pSetup=''; // TypoScript configuration of the page-object pointed to by sPre. $this->tmpl->setup[$this->sPre.'.']
- var $newHash=''; // This hash is unique to the template, the $this->id and $this->type vars and the gr_list (list of groups). Used to get and later store the cached data
- var $getMethodUrlIdToken=''; // If config.ftu (Frontend Track User) is set in TypoScript for the current page, the string value of this var is substituted in the rendered source-code with the string, '&ftu=[token...]' which enables GET-method usertracking as opposed to cookie based
- var $no_CacheBeforePageGen=''; // This flag is set before inclusion of pagegen.php IF no_cache is set. If this flag is set after the inclusion of pagegen.php, no_cache is forced to be set. This is done in order to make sure that php-code from pagegen does not falsely clear the no_cache flag.
- var $tempContent = FALSE; // This flag indicates if temporary content went into the cache during page-generation.
- var $forceTemplateParsing=''; // Boolean, passed to TypoScript template class and tells it to render the template forcibly
- var $cHash_array=array(); // The array which cHash_calc is based on, see ->makeCacheHash().
- var $hash_base=''; // Loaded with the serialized array that is used for generating a hashstring for the cache
- var $pagesTSconfig=''; // May be set to the pagesTSconfig
- // PAGE-GENERATION / cOBJ
- /*
- Eg. insert JS-functions in this array ($additionalHeaderData) to include them once. Use associative keys.
- Keys in use:
- JSFormValidate : <script type="text/javascript" src="'.$GLOBALS["TSFE"]->absRefPrefix.'t3lib/jsfunc.validateform.js"></script>
- JSincludeFormupdate : <script type="text/javascript" src="t3lib/jsfunc.updateform.js"></script>
- JSMenuCode, JSMenuCode_menu : JavaScript for the JavaScript menu
- JSCode : reserved
- JSImgCode : reserved
- */
- var $additionalHeaderData=array(); // used to accumulate additional HTML-code for the header-section, <head>...</head>. Insert either associative keys (like additionalHeaderData['myStyleSheet'], see reserved keys above) or num-keys (like additionalHeaderData[] = '...')
- var $additionalJavaScript=array(); // used to accumulate additional JavaScript-code. Works like additionalHeaderData. Reserved keys at 'openPic' and 'mouseOver'
- var $additionalCSS=array(); // used to accumulate additional Style code. Works like additionalHeaderData.
- var $JSeventFuncCalls = array( // you can add JavaScript functions to each entry in these arrays. Please see how this is done in the GMENU_LAYERS script. The point is that many applications on a page can set handlers for onload, onmouseover and onmouseup
- 'onmousemove' => array(),
- 'onmouseup' => array(),
- 'onmousemove' => array(),
- 'onkeydown' => array(),
- 'onkeyup' => array(),
- 'onkeypress' => array(),
- 'onload' => array(),
- 'onunload' => array(),
- );
- /**
- * Adds JavaScript code
- *
- * @var string
- * @deprecated since TYPO3 3.5 - use additionalJavaScript instead.
- */
- var $JSCode='';
- var $JSImgCode=''; // Used to accumulate JavaScript loaded images (by menus)
- var $divSection=''; // Used to accumulate DHTML-layers.
- var $defaultBodyTag='<body>'; // Default bodytag, if nothing else is set. This can be overridden by applications like TemplaVoila.
- // RENDERING configuration, settings from TypoScript is loaded into these vars. See pagegen.php
- var $debug=''; // Debug flag, may output special debug html-code.
- var $intTarget=''; // Default internal target
- var $extTarget=''; // Default external target
- var $fileTarget=''; // Default file link target
- var $MP_defaults=array(); // Keys are page ids and values are default &MP (mount point) values to set when using the linking features...)
- var $spamProtectEmailAddresses=0; // If set, typolink() function encrypts email addresses. Is set in pagegen-class.
- var $absRefPrefix=''; // Absolute Reference prefix
- var $absRefPrefix_force=0; // Absolute Reference prefix force flag. This is set, if the type and id is retrieve from PATH_INFO and thus we NEED to prefix urls with at least '/'
- var $compensateFieldWidth=''; // Factor for form-field widths compensation
- var $lockFilePath=''; // Lock file path
- var $ATagParams=''; // <A>-tag parameters
- var $sWordRegEx=''; // Search word regex, calculated if there has been search-words send. This is used to mark up the found search words on a page when jumped to from a link in a search-result.
- var $sWordList=''; // Is set to the incoming array sword_list in case of a page-view jumped to from a search-result.
- var $linkVars=''; // A string prepared for insertion in all links on the page as url-parameters. Based on configuration in TypoScript where you defined which GET_VARS you would like to pass on.
- var $excludeCHashVars=''; // A string set with a comma list of additional GET vars which should NOT be included in the cHash calculation. These vars should otherwise be detected and involved in caching, eg. through a condition in TypoScript.
- var $displayEditIcons=''; // If set, edit icons are rendered aside content records. Must be set only if the ->beUserLogin flag is set and set_no_cache() must be called as well.
- var $displayFieldEditIcons=''; // If set, edit icons are rendered aside individual fields of content. Must be set only if the ->beUserLogin flag is set and set_no_cache() must be called as well.
- var $sys_language_uid=0; // Site language, 0 (zero) is default, int+ is uid pointing to a sys_language record. Should reflect which language menus, templates etc is displayed in (master language) - but not necessarily the content which could be falling back to default (see sys_language_content)
- var $sys_language_mode=''; // Site language mode for content fall back.
- var $sys_language_content=0; // Site content selection uid (can be different from sys_language_uid if content is to be selected from a fall-back language. Depends on sys_language_mode)
- var $sys_language_contentOL=0; // Site content overlay flag; If set - and sys_language_content is > 0 - , records selected will try to look for a translation pointing to their uid. (If configured in [ctrl][languageField] / [ctrl][transOrigP...]
- var $sys_language_isocode = ''; // Is set to the iso code of the sys_language_content if that is properly defined by the sys_language record representing the sys_language_uid. (Requires the extension "static_info_tables")
- // RENDERING data
- var $applicationData=Array(); // 'Global' Storage for various applications. Keys should be 'tx_'.extKey for extensions.
- var $register=Array();
- var $registerStack=Array(); // Stack used for storing array and retrieving register arrays (see LOAD_REGISTER and CLEAR_REGISTER)
- var $cObjectDepthCounter = 50; // Checking that the function is not called eternally. This is done by interrupting at a depth of 50
- var $recordRegister = Array(); // used by cObj->RECORDS and cObj->CONTENT to ensure the a records is NOT rendered twice through it!
- var $currentRecord = ''; // This is set to the [table]:[uid] of the latest record rendered. Note that class tslib_cObj has an equal value, but that is pointing to the record delivered in the $data-array of the tslib_cObj instance, if the cObjects CONTENT or RECORD created that instance
- var $accessKey =array(); // Used by class tslib_menu to keep track of access-keys.
- var $imagesOnPage=array(); // Numerical array where image filenames are added if they are referenced in the rendered document. This includes only TYPO3 generated/inserted images.
- var $lastImageInfo=array(); // Is set in tslib_cObj->cImage() function to the info-array of the most recent rendered image. The information is used in tslib_cObj->IMGTEXT
- var $uniqueCounter=0; // Used to generate page-unique keys. Point is that uniqid() functions is very slow, so a unikey key is made based on this, see function uniqueHash()
- var $uniqueString='';
- var $indexedDocTitle=''; // This value will be used as the title for the page in the indexer (if indexing happens)
- var $altPageTitle=''; // Alternative page title (normally the title of the page record). Can be set from applications you make.
- /**
- * An array that holds parameter names (keys) of GET parameters which MAY be MD5/base64 encoded with simulate_static_documents method.
- * @var array
- * @deprecated since TYPO3 4.3, remove in TYPO3 4.5
- */
- var $pEncAllowedParamNames=array();
- var $baseUrl=''; // The base URL set for the page header.
- var $anchorPrefix=''; // The proper anchor prefix needed when using speaking urls. (only set if baseUrl is set)
- /**
- * Page content render object
- *
- * @var tslib_cObj
- */
- var $cObj ='';
- // CONTENT accumulation
- var $content=''; // All page content is accumulated in this variable. See pagegen.php
- // GENERAL
- var $clientInfo=''; // Set to the browser: net / msie if 4+ browsers
- var $scriptParseTime=0;
- var $TCAloaded = 0; // Set ONLY if the full TCA is loaded
- // Character set (charset) conversion object:
- /**
- * charset conversion class. May be used by any application.
- *
- * @var t3lib_cs
- */
- var $csConvObj;
- var $defaultCharSet = 'iso-8859-1'; // The default charset used in the frontend if nothing else is set.
- var $renderCharset=''; // Internal charset of the frontend during rendering: Defaults to "forceCharset" and if that is not set, to ->defaultCharSet
- var $metaCharset=''; // Output charset of the websites content. This is the charset found in the header, meta tag etc. If different from $renderCharset a conversion happens before output to browser. Defaults to ->renderCharset if not set.
- var $localeCharset=''; // Assumed charset of locale strings.
- // LANG:
- var $lang=''; // Set to the system language key (used on the site)
- var $langSplitIndex=0; // Set to the index number of the language key
- var $LL_labels_cache=array();
- var $LL_files_cache=array();
- /**
- * Locking object
- *
- * @var t3lib_lock
- */
- var $pagesection_lockObj; // Locking object for accessing "cache_pagesection"
- /**
- * Locking object
- *
- * @var t3lib_lock
- */
- var $pages_lockObj; // Locking object for accessing "cache_pages"
- /**
- * @var t3lib_PageRenderer
- */
- protected $pageRenderer;
- /**
- * the page cache object, use this to save pages to the cache and to
- * retrieve them again
- *
- * @var t3lib_cache_AbstractBackend
- */
- protected $pageCache;
- protected $pageCacheTags = array();
- /**
- * Class constructor
- * Takes a number of GET/POST input variable as arguments and stores them internally.
- * The processing of these variables goes on later in this class.
- * Also sets internal clientInfo array (browser information) and a unique string (->uniqueString) for this script instance; A md5 hash of the microtime()
- *
- * @param array The global $TYPO3_CONF_VARS array. Will be set internally in ->TYPO3_CONF_VARS
- * @param mixed The value of t3lib_div::_GP('id')
- * @param integer The value of t3lib_div::_GP('type')
- * @param boolean The value of t3lib_div::_GP('no_cache'), evaluated to 1/0
- * @param string The value of t3lib_div::_GP('cHash')
- * @param string The value of t3lib_div::_GP('jumpurl')
- * @param string The value of t3lib_div::_GP('MP')
- * @param string The value of t3lib_div::_GP('RDCT')
- * @return void
- * @see index_ts.php
- */
- function tslib_fe($TYPO3_CONF_VARS, $id, $type, $no_cache='', $cHash='', $jumpurl='',$MP='',$RDCT='') {
- // Setting some variables:
- $this->TYPO3_CONF_VARS = $TYPO3_CONF_VARS;
- $this->id = $id;
- $this->type = $type;
- if ($no_cache) {
- if ($this->TYPO3_CONF_VARS['FE']['disableNoCacheParameter']) {
- $warning = '&no_cache=1 has been ignored because $TYPO3_CONF_VARS[\'FE\'][\'disableNoCacheParameter\'] is set!';
- $GLOBALS['TT']->setTSlogMessage($warning,2);
- } else {
- $warning = '&no_cache=1 has been supplied, so caching is disabled! URL: "'.t3lib_div::getIndpEnv('TYPO3_REQUEST_URL').'"';
- $this->disableCache();
- }
- t3lib_div::sysLog($warning, 'cms', 2);
- }
- $this->cHash = $cHash;
- $this->jumpurl = $jumpurl;
- $this->MP = $this->TYPO3_CONF_VARS['FE']['enable_mount_pids'] ? (string)$MP : '';
- $this->RDCT = $RDCT;
- $this->clientInfo = t3lib_div::clientInfo();
- $this->uniqueString=md5(microtime());
- $this->csConvObj = t3lib_div::makeInstance('t3lib_cs');
- // Call post processing function for constructor:
- if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['tslib_fe-PostProc'])) {
- $_params = array('pObj' => &$this);
- foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['tslib_fe-PostProc'] as $_funcRef) {
- t3lib_div::callUserFunction($_funcRef,$_params,$this);
- }
- }
- if (TYPO3_UseCachingFramework) {
- $this->initCaches();
- }
- }
- /**
- * Connect to MySQL database
- * May exit after outputting an error message or some JavaScript redirecting to the install tool.
- *
- * @return void
- * @deprecated since TYPO3 3.8, this function will be removed in TYPO3 4.5, use connectToDB() instead!
- */
- function connectToMySQL() {
- t3lib_div::logDeprecatedFunction();
- $this->connectToDB();
- }
- /**
- * Connect to SQL database
- * May exit after outputting an error message or some JavaScript redirecting to the install tool.
- *
- * @return void
- */
- function connectToDB() {
- try {
- $link = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password);
- } catch (RuntimeException $e) {
- if (TYPO3_db) {
- // Database is defined, this should normally not happen, user should be informed
- throw $e;
- }
- $link = FALSE;
- }
- if ($link !== FALSE) {
- if (!TYPO3_db) {
- $this->printError('No database selected','Database Error');
- // Redirects to the Install Tool:
- echo '<script type="text/javascript">
- /*<![CDATA[*/
- window.location.href = "'.TYPO3_mainDir.'install/index.php?mode=123&step=1&password=joh316";
- /*]]>*/
- </script>';
- exit;
- } elseif (!$GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) {
- if ($this->checkPageUnavailableHandler()) {
- $this->pageUnavailableAndExit('Cannot connect to the current database, "'.TYPO3_db.'"');
- } else {
- $message = 'Cannot connect to the current database, "'.TYPO3_db.'"';
- t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
- header('HTTP/1.0 503 Service Temporarily Unavailable');
- $this->printError($message, 'Database Error');
- exit;
- }
- }
- } else {
- if (!TYPO3_db) {
- // Redirects to the Install Tool:
- echo '<script type="text/javascript">
- /*<![CDATA[*/
- window.location.href = "'.TYPO3_mainDir.'install/index.php?mode=123&step=1&password=joh316";
- /*]]>*/
- </script>';
- exit;
- }
- if ($this->checkPageUnavailableHandler()) {
- $this->pageUnavailableAndExit('The current username, password or host was not accepted when the connection to the database was attempted to be established!');
- } else {
- $message = 'The current username, password or host was not accepted when the connection to the database was attempted to be established!';
- t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
- header('HTTP/1.0 503 Service Temporarily Unavailable');
- $this->printError($message, 'Database Error');
- exit;
- }
- }
- // Call post processing function for DB connection:
- if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['connectToDB'])) {
- $_params = array('pObj' => &$this);
- foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['connectToDB'] as $_funcRef) {
- t3lib_div::callUserFunction($_funcRef,$_params,$this);
- }
- }
- }
- /**
- * Looks up the value of $this->RDCT in the database and if it is found to be associated with a redirect URL then the redirection is carried out with a 'Location:' header
- * May exit after sending a location-header.
- *
- * @return void
- */
- function sendRedirect() {
- $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('params', 'cache_md5params', 'md5hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->RDCT, 'cache_md5params'));
- if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
- $this->updateMD5paramsRecord($this->RDCT);
- header('Location: '.$row['params']);
- exit;
- }
- }
- /**
- * Gets instance of PageRenderer
- *
- * @return t3lib_PageRenderer
- */
- public function getPageRenderer() {
- if (!isset($this->pageRenderer)) {
- $this->pageRenderer = t3lib_div::makeInstance('t3lib_PageRenderer');
- $this->pageRenderer->setTemplateFile(PATH_tslib . 'templates/tslib_page_frontend.html');
- $this->pageRenderer->setBackPath(TYPO3_mainDir);
- }
- return $this->pageRenderer;
- }
- /********************************************
- *
- * Initializing, resolving page id
- *
- ********************************************/
- /**
- * Initializes the caching system.
- *
- * @return void
- */
- protected function initCaches() {
- if (TYPO3_UseCachingFramework) {
- $GLOBALS['TT']->push('Initializing the Caching System','');
- $GLOBALS['typo3CacheManager'] = t3lib_div::makeInstance('t3lib_cache_Manager');
- $GLOBALS['typo3CacheFactory'] = t3lib_div::makeInstance('t3lib_cache_Factory');
- $GLOBALS['typo3CacheFactory']->setCacheManager($GLOBALS['typo3CacheManager']);
- try {
- $this->pageCache = $GLOBALS['typo3CacheManager']->getCache(
- 'cache_pages'
- );
- } catch(t3lib_cache_exception_NoSuchCache $e) {
- t3lib_cache::initPageCache();
- $this->pageCache = $GLOBALS['typo3CacheManager']->getCache(
- 'cache_pages'
- );
- }
- t3lib_cache::initPageSectionCache();
- t3lib_cache::initContentHashCache();
- $GLOBALS['TT']->pull();
- }
- }
- /**
- * Initializes the front-end login user.
- *
- * @return void
- */
- function initFEuser() {
- $this->fe_user = t3lib_div::makeInstance('tslib_feUserAuth');
- $this->fe_user->lockIP = $this->TYPO3_CONF_VARS['FE']['lockIP'];
- $this->fe_user->lockHashKeyWords = $this->TYPO3_CONF_VARS['FE']['lockHashKeyWords'];
- $this->fe_user->checkPid = $this->TYPO3_CONF_VARS['FE']['checkFeUserPid'];
- $this->fe_user->lifetime = intval($this->TYPO3_CONF_VARS['FE']['lifetime']);
- $this->fe_user->checkPid_value = $GLOBALS['TYPO3_DB']->cleanIntList(t3lib_div::_GP('pid')); // List of pid's acceptable
- // Check if a session is transferred:
- if (t3lib_div::_GP('FE_SESSION_KEY')) {
- $fe_sParts = explode('-',t3lib_div::_GP('FE_SESSION_KEY'));
- if (!strcmp(md5($fe_sParts[0].'/'.$this->TYPO3_CONF_VARS['SYS']['encryptionKey']), $fe_sParts[1])) { // If the session key hash check is OK:
- $_COOKIE[$this->fe_user->name] = $fe_sParts[0];
- $this->fe_user->forceSetCookie = 1;
- }
- }
- if ($this->TYPO3_CONF_VARS['FE']['dontSetCookie']) {
- $this->fe_user->dontSetCookie=1;
- }
- $this->fe_user->start();
- $this->fe_user->unpack_uc('');
- $this->fe_user->fetchSessionData(); // Gets session data
- $recs = t3lib_div::_GP('recs');
- if (is_array($recs)) { // If any record registration is submitted, register the record.
- $this->fe_user->record_registration($recs, $this->TYPO3_CONF_VARS['FE']['maxSessionDataSize']);
- }
- // Call hook for possible manipulation of frontend user object
- if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['initFEuser'])) {
- $_params = array('pObj' => &$this);
- foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['initFEuser'] as $_funcRef) {
- t3lib_div::callUserFunction($_funcRef,$_params,$this);
- }
- }
- // For every 60 seconds the is_online timestamp is updated.
- if (is_array($this->fe_user->user) && $this->fe_user->user['uid'] && $this->fe_user->user['is_online']<($GLOBALS['EXEC_TIME']-60)) {
- $GLOBALS['TYPO3_DB']->exec_UPDATEquery('fe_users', 'uid='.intval($this->fe_user->user['uid']), array('is_online' => $GLOBALS['EXEC_TIME']));
- }
- }
- /**
- * Initializes the front-end user groups.
- * Sets ->loginUser and ->gr_list based on front-end user status.
- *
- * @return void
- */
- function initUserGroups() {
- $this->fe_user->showHiddenRecords = $this->showHiddenRecords; // This affects the hidden-flag selecting the fe_groups for the user!
- $this->fe_user->fetchGroupData(); // no matter if we have an active user we try to fetch matching groups which can be set without an user (simulation for instance!)
- if (is_array($this->fe_user->user) && count($this->fe_user->groupData['uid'])) {
- $this->loginUser=1; // global flag!
- $this->gr_list = '0,-2'; // group -2 is not an existing group, but denotes a 'default' group when a user IS logged in. This is used to let elements be shown for all logged in users!
- $gr_array = $this->fe_user->groupData['uid'];
- } else {
- $this->loginUser=0;
- $this->gr_list = '0,-1'; // group -1 is not an existing group, but denotes a 'default' group when not logged in. This is used to let elements be hidden, when a user is logged in!
- if ($this->loginAllowedInBranch) {
- $gr_array = $this->fe_user->groupData['uid']; // For cases where logins are not banned from a branch usergroups can be set based on IP masks so we should add the usergroups uids.
- } else {
- $gr_array = array(); // Set to blank since we will NOT risk any groups being set when no logins are allowed!
- }
- }
- // Clean up.
- $gr_array = array_unique($gr_array); // Make unique...
- sort($gr_array); // sort
- if (count($gr_array) && !$this->loginAllowedInBranch_mode) {
- $this->gr_list.=','.implode(',',$gr_array);
- }
- if ($this->fe_user->writeDevLog) t3lib_div::devLog('Valid usergroups for TSFE: '.$this->gr_list, 'tslib_fe');
- }
- /**
- * Checking if a user is logged in or a group constellation different from "0,-1"
- *
- * @return boolean TRUE if either a login user is found (array fe_user->user) OR if the gr_list is set to something else than '0,-1' (could be done even without a user being logged in!)
- */
- function isUserOrGroupSet() {
- return is_array($this->fe_user->user) || $this->gr_list!=='0,-1';
- }
- /**
- * Provides ways to bypass the '?id=[xxx]&type=[xx]' format, using either PATH_INFO or virtual HTML-documents (using Apache mod_rewrite)
- *
- * Two options:
- * 1) Use PATH_INFO (also Apache) to extract id and type from that var. Does not require any special modules compiled with apache. (less typical)
- * 2) Using hook which enables features like those provided from "simulatestatic" or "realurl" extension (AKA "Speaking URLs")
- *
- * @return void
- * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&cHash=4ad9d7acb4
- */
- function checkAlternativeIdMethods() {
- $this->siteScript = t3lib_div::getIndpEnv('TYPO3_SITE_SCRIPT');
- // Call post processing function for custom URL methods.
- if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['checkAlternativeIdMethods-PostProc'])) {
- $_params = array('pObj' => &$this);
- foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['checkAlternativeIdMethods-PostProc'] as $_funcRef) {
- t3lib_div::callUserFunction($_funcRef,$_params,$this);
- }
- }
- }
- /**
- * Clears the preview-flags, sets sim_exec_time to current time.
- * Hidden pages must be hidden as default, $GLOBALS['SIM_EXEC_TIME'] is set to $GLOBALS['EXEC_TIME'] in t3lib/config_default.inc. Alter it by adding or subtracting seconds.
- *
- * @return void
- */
- function clear_preview() {
- $this->showHiddenPage = 0;
- $this->showHiddenRecords = 0;
- $GLOBALS['SIM_EXEC_TIME'] = $GLOBALS['EXEC_TIME'];
- $GLOBALS['SIM_ACCESS_TIME'] = $GLOBALS['ACCESS_TIME'];
- $this->fePreview = 0;
- }
- /**
- * Determines the id and evaluates any preview settings
- * Basically this function is about determining whether a backend user is logged in, if he has read access to the page and if he's previewing the page. That all determines which id to show and how to initialize the id.
- *
- * @return void
- */
- function determineId() {
- // Getting ARG-v values if some
- $this->setIDfromArgV();
- // If there is a Backend login we are going to check for any preview settings:
- $GLOBALS['TT']->push('beUserLogin','');
- if ($this->beUserLogin || $this->doWorkspacePreview()) {
- // Backend user preview features:
- if ($this->beUserLogin && ($GLOBALS['BE_USER']->adminPanel instanceof tslib_AdminPanel)) {
- $this->fePreview = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview') ? true : false;
- // If admin panel preview is enabled...
- if ($this->fePreview) {
- $fe_user_OLD_USERGROUP = $this->fe_user->user['usergroup'];
- $this->showHiddenPage = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'showHiddenPages');
- $this->showHiddenRecords = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'showHiddenRecords');
- // simulate date
- $simTime = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'simulateDate');
- if ($simTime) {
- $GLOBALS['SIM_EXEC_TIME'] = $simTime;
- $GLOBALS['SIM_ACCESS_TIME'] = $simTime - ($simTime % 60);
- }
- // simulate user
- $simUserGroup = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'simulateUserGroup');
- $this->simUserGroup = $simUserGroup;
- if ($simUserGroup) $this->fe_user->user['usergroup']=$simUserGroup;
- if (!$simUserGroup && !$simTime && !$this->showHiddenPage && !$this->showHiddenRecords) {
- $this->fePreview=0;
- }
- }
- }
- if ($this->id) {
- // Now it's investigated if the raw page-id points to a hidden page and if so, the flag is set.
- // This does not require the preview flag to be set in the admin panel
- $idQ = t3lib_div::testInt($this->id) ? 'uid='.intval($this->id) : 'alias='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->id, 'pages').' AND pid>=0'; // pid>=0 added for the sake of versioning...
- $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'pages', $idQ . ' AND hidden!=0 AND deleted=0');
- if ($count) {
- $this->fePreview = 1; // The preview flag is set only if the current page turns out to actually be hidden!
- $this->showHiddenPage = 1;
- }
- // For Live workspace: Check root line for proper connection to tree root (done because of possible preview of page / branch versions)
- if (!$this->fePreview && $this->whichWorkspace()===0) {
- // Initialize the page-select functions to check rootline:
- $temp_sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
- $temp_sys_page->init($this->showHiddenPage);
- // If root line contained NO records and ->error_getRootLine_failPid tells us that it was because of a pid=-1 (indicating a "version" record)...:
- if (!count($temp_sys_page->getRootLine($this->id,$this->MP)) && $temp_sys_page->error_getRootLine_failPid==-1) {
- // Setting versioningPreview flag and try again:
- $temp_sys_page->versioningPreview = TRUE;
- if (count($temp_sys_page->getRootLine($this->id,$this->MP))) {
- // Finally, we got a root line (meaning that it WAS due to versioning preview of a page somewhere) and we set the fePreview flag which in itself will allow sys_page class to display previews of versionized records.
- $this->fePreview = 1;
- }
- }
- }
- }
- // The preview flag will be set if a backend user is in an offline workspace
- if (($GLOBALS['BE_USER']->user['workspace_preview'] || t3lib_div::_GP('ADMCMD_view') || $this->doWorkspacePreview()) && ($this->whichWorkspace()===-1 || $this->whichWorkspace()>0)) {
- $this->fePreview = 2; // Will show special preview message.
- }
- // If the front-end is showing a preview, caching MUST be disabled.
- if ($this->fePreview) {
- $this->disableCache();
- }
- }
- $GLOBALS['TT']->pull();
- // Now, get the id, validate access etc:
- $this->fetch_the_id();
- // Check if backend user has read access to this page. If not, recalculate the id.
- if ($this->beUserLogin && $this->fePreview) {
- if (!$GLOBALS['BE_USER']->doesUserHaveAccess($this->page,1)) {
- // Resetting
- $this->clear_preview();
- $this->fe_user->user['usergroup'] = $fe_user_OLD_USERGROUP;
- // Fetching the id again, now with the preview settings reset.
- $this->fetch_the_id();
- }
- }
- // Checks if user logins are blocked for a certain branch and if so, will unset user login and re-fetch ID.
- $this->loginAllowedInBranch = $this->checkIfLoginAllowedInBranch();
- if (!$this->loginAllowedInBranch) { // Logins are not allowed:
- if ($this->isUserOrGroupSet()) { // Only if there is a login will we run this...
- if ($this->loginAllowedInBranch_mode=='all') {
- // Clear out user and group:
- unset($this->fe_user->user);
- $this->gr_list = '0,-1';
- } else {
- $this->gr_list = '0,-2';
- }
- // Fetching the id again, now with the preview settings reset.
- $this->fetch_the_id();
- }
- }
- // Final cleaning.
- $this->id = $this->contentPid = intval($this->id); // Make sure it's an integer
- $this->type = intval($this->type); // Make sure it's an integer
- // Look for alternative content PID if page is under version preview:
- if ($this->fePreview) {
- if ($this->page['_ORIG_pid']==-1 && $this->page['t3ver_swapmode']==0) { // Current page must have been an offline version and have swapmode set to 0:
- // Setting contentPid here for preview might not be completely correct to do. Strictly the "_ORIG_uid" value should be used for tables where "versioning_followPages" is set and for others not. However this is a working quick-fix to display content elements at least!
- $this->contentPid = $this->page['_ORIG_uid'];
- }
- }
- // Call post processing function for id determination:
- if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['determineId-PostProc'])) {
- $_params = array('pObj' => &$this);
- foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['determineId-PostProc'] as $_funcRef) {
- t3lib_div::callUserFunction($_funcRef,$_params,$this);
- }
- }
- }
- /**
- * Get The Page ID
- * This gets the id of the page, checks if the page is in the domain and if the page is accessible
- * Sets variables such as $this->sys_page, $this->loginUser, $this->gr_list, $this->id, $this->type, $this->domainStartPage, $this->idParts
- *
- * @return void
- * @access private
- */
- function fetch_the_id() {
- $GLOBALS['TT']->push('fetch_the_id initialize/','');
- // Initialize the page-select functions.
- $this->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
- $this->sys_page->versioningPreview = ($this->fePreview===2 || intval($this->workspacePreview) || t3lib_div::_GP('ADMCMD_view')) ? TRUE : FALSE;
- $this->sys_page->versioningWorkspaceId = $this->whichWorkspace();
- $this->sys_page->init($this->showHiddenPage);
- // Set the valid usergroups for FE
- $this->initUserGroups();
- // Sets sys_page where-clause
- $this->setSysPageWhereClause();
- // Splitting $this->id by a period (.). First part is 'id' and second part - if exists - will overrule the &type param if given
- $pParts = explode('.',$this->id);
- $this->id = $pParts[0]; // Set it.
- if (isset($pParts[1])) {$this->type=$pParts[1];}
- // Splitting $this->id by a comma (,). First part is 'id' and other parts are just stored for use in scripts.
- $this->idParts = explode(',',$this->id);
- // Splitting by a '+' sign - used for base64/md5 methods of parameter encryption for simulate static documents.
- list($pgID,$SSD_p)=explode('+',$this->idParts[0],2);
- if ($SSD_p) { $this->idPartsAnalyze($SSD_p); }
- $this->id = $pgID; // Set id
- // If $this->id is a string, it's an alias
- $this->checkAndSetAlias();
- // The id and type is set to the integer-value - just to be sure...
- $this->id = intval($this->id);
- $this->type = intval($this->type);
- $GLOBALS['TT']->pull();
- // We find the first page belonging to the current domain
- $GLOBALS['TT']->push('fetch_the_id domain/','');
- $this->domainStartPage = $this->findDomainRecord($this->TYPO3_CONF_VARS['SYS']['recursiveDomainSearch']); // the page_id of the current domain
- if (!$this->id) {
- if ($this->domainStartPage) {
- $this->id = $this->domainStartPage; // If the id was not previously set, set it to the id of the domain.
- } else {
- $theFirstPage = $this->sys_page->getFirstWebPage($this->id); // Find the first 'visible' page in that domain
- if ($theFirstPage) {
- $this->id = $theFirstPage['uid'];
- } else {
- if ($this->checkPageUnavailableHandler()) {
- $this->pageUnavailableAndExit('No pages are found on the rootlevel!');
- } else {
- $message = 'No pages are found on the rootlevel!';
- t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
- header('HTTP/1.0 503 Service Temporarily Unavailable');
- $this->printError($message);
- exit;
- }
- }
- }
- }
- $GLOBALS['TT']->pull();
- $GLOBALS['TT']->push('fetch_the_id rootLine/','');
- $requestedId = $this->id; // We store the originally requested id
- $this->getPageAndRootlineWithDomain($this->domainStartPage);
- $GLOBALS['TT']->pull();
- if ($this->pageNotFound && $this->TYPO3_CONF_VARS['FE']['pageNotFound_handling']) {
- $pNotFoundMsg = array(
- 1 => 'ID was not an accessible page',
- 2 => 'Subsection was found and not accessible',
- 3 => 'ID was outside the domain',
- 4 => 'The requested page alias does not exist'
- );
- $this->pageNotFoundAndExit($pNotFoundMsg[$this->pageNotFound]);
- }
- // set no_cache if set
- if ($this->page['no_cache']) {
- $this->set_no_cache();
- }
- // Init SYS_LASTCHANGED
- $this->register['SYS_LASTCHANGED'] = intval($this->page['tstamp']);
- if ($this->register['SYS_LASTCHANGED'] < intval($this->page['SYS_LASTCHANGED'])) {
- $this->register['SYS_LASTCHANGED'] = intval($this->page['SYS_LASTCHANGED']);
- }
- }
- /**
- * Gets the page and rootline arrays based on the id, $this->id
- *
- * If the id does not correspond to a proper page, the 'previous' valid page in the rootline is found
- * If the page is a shortcut (doktype=4), the ->id is loaded with that id
- *
- * Whether or not the ->id is changed to the shortcut id or the previous id in rootline (eg if a page is hidden), the ->page-array and ->rootline is found and must also be valid.
- *
- * Sets or manipulates internal variables such as: $this->id, $this->page, $this->rootLine, $this->MP, $this->pageNotFound
- *
- * @return void
- * @access private
- */
- function getPageAndRootline() {
- $this->page = $this->sys_page->getPage($this->id);
- if (!count($this->page)) {
- // If no page, we try to find the page before in the rootLine.
- $this->pageNotFound=1; // Page is 'not found' in case the id itself was not an accessible page. code 1
- $this->rootLine = $this->sys_page->getRootLine($this->id,$this->MP);
- if (count($this->rootLine)) {
- $c=count($this->rootLine)-1;
- while($c>0) {
- // Add to page access failure history:
- $this->pageAccessFailureHistory['direct_access'][] = $this->rootLine[$c];
- // Decrease to next page in rootline and check the access to that, if OK, set as page record and ID value.
- $c--;
- $this->id = $this->rootLine[$c]['uid'];
- $this->page = $this->sys_page->getPage($this->id);
- if (count($this->page)) { break; }
- }
- }
- // If still no page...
- if (!count($this->page)) {
- if ($this->TYPO3_CONF_VARS['FE']['pageNotFound_handling']) {
- $this->pageNotFoundAndExit('The requested page does not exist!');
- } else {
- $message = 'The requested page does not exist!';
- header('HTTP/1.0 404 Page Not Found');
- t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
- $this->printError($message);
- exit;
- }
- }
- }
- // Spacer is not accessible in frontend
- if ($this->page['doktype'] == 199) {
- if ($this->TYPO3_CONF_VARS['FE']['pageNotFound_handling']) {
- $this->pageNotFoundAndExit('The requested page does not exist!');
- } else {
- $message = 'The requested page does not exist!';
- header('HTTP/1.0 404 Page Not Found');
- t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
- $this->printError($message);
- exit;
- }
- }
- // Is the ID a link to another page??
- if ($this->page['doktype']==4) {
- $this->MP = ''; // We need to clear MP if the page is a shortcut. Reason is if the short cut goes to another page, then we LEAVE the rootline which the MP expects.
- // saving the page so that we can check later - when we know
- // about languages - whether we took the correct shortcut or
- // whether a translation of the page overwrites the shortcut
- // target and we need to follow the new target
- $this->originalShortcutPage = $this->page;
- $this->page = $this->getPageShortcut($this->page['shortcut'],$this->page['shortcut_mode'],$this->page['uid']);
- $this->id = $this->page['uid'];
- }
- // Gets the rootLine
- $this->rootLine = $this->sys_page->getRootLine($this->id,$this->MP);
- // If not rootline we're off...
- if (!count($this->rootLine)) {
- $ws = $this->whichWorkspace();
- if ($this->sys_page->error_getRootLine_failPid==-1 && $ws) {
- $this->sys_page->versioningPreview = TRUE;
- $this->versioningWorkspaceId = $ws;
- $this->rootLine = $this->sys_page->ge…
Large files files are truncated, but you can click here to view the full file