Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

tslib_fe Class Reference

List of all members.

Public Member Functions

 tslib_fe ($TYPO3_CONF_VARS, $id, $type, $no_cache='', $cHash='', $jumpurl='', $MP='', $RDCT='')
 Class constructor Takes a number of GET/POST input variable as arguments and stores them internally.
 connectToMySQL ()
 Connect to SQL database May exit after outputting an error message or some JavaScript redirecting to the install tool.
 sendRedirect ()
 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.
 initFEuser ()
 Initializes the front-end login user.
 initUserGroups ()
 Initializes the front-end user groups.
 checkAlternativeIdMethods ()
 Provides ways to bypass the '?id=[xxx]&type=[xx]' format, using either PATH_INFO or virtual HTML-documents (using Apache mod_rewrite).
 clear_preview ()
 Clears the preview-flags, sets sim_exec_time to current time.
 determineId ()
 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.
 fetch_the_id ()
 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.
 getPageAndRootline ()
 Gets the page and rootline arrays based on the id, $this->id.
 getPageShortcut ($SC, $mode, $thisUid, $itera=20, $pageLog=array())
 Get page shortcut; Finds the records pointed to by input value $SC (the shortcut value).
 checkRootlineForIncludeSection ()
 Checks the current rootline for defined sections.
 checkEnableFields ($row)
 Checks page record for enableFields Returns true if enableFields does not disable the page record.
 checkPageGroupAccess ($row, $groupList=NULL)
 Check group access against a page record.
 checkPagerecordForIncludeSection ($row)
 Checks page record for include section.
 setIDfromArgV ()
 This checks if there are ARGV-parameters in the QUERY_STRING and if so, those are used for the id $this->id must be 'false' in order for any processing to happen in here If an id/alias value is extracted from the QUERY_STRING it is set in $this->id.
 getPageAndRootlineWithDomain ($domainStartPage)
 Gets ->page and ->rootline information based on ->id.
 setSysPageWhereClause ()
 Sets sys_page where-clause.
 getPagesGroupClause ()
 Return where-clause for group access.
 findDomainRecord ($recursive=0)
 Looking up a domain record based on HTTP_HOST.
 pageNotFoundAndExit ($reason='')
 Page-not-found handler for use in frontend plugins from extensions.
 pageNotFoundHandler ($code, $header='', $reason='')
 Page not found handler.
 checkAndSetAlias ()
 Fetches the integer page id for a page alias.
 idPartsAnalyze ($str)
 Analyzes the second part of a id-string (after the "+"), looking for B6 or M5 encoding and if found it will resolve it and restore the variables in global $_GET (but NOT $_GET - yet) If values for ->cHash, ->no_cache, ->jumpurl and ->MP is found, they are also loaded into the internal vars of this class.
 mergingWithGetVars ($GET_VARS)
 Merging values into the global $_GET.
 makeCacheHash ()
 Calculates a hash string based on additional parameters in the url.
 cHashParams ($addQueryParams)
 Splits the input query-parameters into an array with certain parameters filtered out.
 initTemplate ()
 Initialize the TypoScript template parser.
 getFromCache ()
 See if page is in cache and get it if so Stores the page content in $this->content if something is found.
 getHash ()
 Calculates the cache-hash This hash is unique to the template, the variables ->id, ->type, ->gr_list (list of groups), ->MP (Mount Points) and cHash array Used to get and later store the cached data.
 getConfigArray ()
 Checks if config-array exists already but if not, gets it.
 getCompressedTCarray ()
 Get the compressed $TCA array for use in the front-end A compressed $TCA array holds only the ctrl- and feInterface-part for each table.
 includeTCA ($TCAloaded=1)
 Includes full TCA.
 settingLanguage ()
 Setting the language key that'll be used by the current page.
 settingLocale ()
 Setting locale for frontend rendering.
 checkDataSubmission ()
 Checks if any email-submissions or submission via the fe_tce.
 fe_tce ()
 Processes submitted user data (obsolete "Frontend TCE").
 locDataCheck ($locationData)
 Checks if a formmail submission can be sent as email.
 sendFormmail ()
 Sends the emails from the formmail content object.
 checkJumpUrl ()
 Checks if jumpurl is set.
 jumpUrl ()
 Sends a header 'Location' to jumpurl, if jumpurl is set.
 setUrlIdToken ()
 Sets the URL_ID_TOKEN in the internal var, $this->getMethodUrlIdToken.
 isGeneratePage ()
 Returns true if the page should be generated That is if jumpurl is not set and the cacheContentFlag is not set.
 tempPageCacheContent ()
 Temp cache content The temporary cache will expire after a few seconds (typ.
 realPageCacheContent ()
 Set cache content to $this->content.
 setPageCacheContent ($c, $d, $t)
 Sets cache content; Inserts the content string into the cache_pages table.
 clearPageCacheContent ()
 Clears cache content (for $this->newHash).
 clearPageCacheContent_pidList ($pidList)
 Clears cache content for a list of page ids.
 setSysLastChanged ()
 Sets sys last changed Setting the SYS_LASTCHANGED value in the pagerecord: This value will thus be set to the highest tstamp of records rendered on the page.
 generatePage_preProcessing ()
 Does some processing BEFORE the pagegen script is included.
 generatePage_whichScript ()
 Determines to include custom or pagegen.php script returns script-filename if a TypoScript (config) script is defined and should be include instead of pagegen.php.
 generatePage_postProcessing ()
 Does some processing AFTER the pagegen script is included.
 INTincScript ()
 Processes the INTinclude-scripts.
 INTincScript_loadJSCode ()
 Loads the JavaScript code for INTincScript.
 isINTincScript ()
 Determines if there are any INTincScripts to include.
 doXHTML_cleaning ()
 Returns the mode of XHTML cleaning.
 doLocalAnchorFix ()
 Returns the mode of Local Anchor prefixing.
 isOutputting ()
 Determines if content should be outputted.
 processOutput ()
 Processes the output before it's actually outputted.
 isEXTincScript ()
 Determines if any EXTincScripts should be included.
 storeSessionData ()
 Stores session data for the front end user.
 setParseTime ()
 Sets the parsetime of the page.
 statistics ()
 Saves hit statistics.
 previewInfo ()
 Outputs preview info.
 beLoginLinkIPList ()
 Returns a link to the login screen with redirect to the front-end.
 makeSimulFileName ($inTitle, $page, $type, $addParams='', $no_cache='')
 Make simulation filename (without the ".html" ending, only body of filename).
 simulateStaticDocuments_pEnc_onlyP_proc ($linkVars)
 Processes a query-string with GET-parameters and returns two strings, one with the parameters that CAN be encoded and one array with those which can't be encoded (encoded by the M5 or B6 methods).
 getSimulFileName ()
 Returns the simulated static file name (*.html) for the current page (using the page record in $this->page).
 encryptEmail ($string, $back=0)
 Encryption of email addresses for -tags See the spam protection setup in TS 'config.'.
 codeString ($string, $decode=FALSE)
 En/decodes strings with lightweight encryption and a hash containing the server encryptionKey (salt) Can be used for authentication of information sent from server generated pages back to the server to establish that the server generated the page.
 roundTripCryptString ($string)
 Encrypts a strings by XOR'ing all characters with the ASCII value of a character in $this->TYPO3_CONF_VARS['SYS']['encryptionKey'] If $this->TYPO3_CONF_VARS['SYS']['encryptionKey'] is empty, 255 is used for XOR'ing.
 checkFileInclude ($incFile)
 Checks if a PHPfile may be included.
 newCObj ()
 Creates an instance of tslib_cObj in $this->cObj This instance is used to start the rendering of the TypoScript template structure.
 setAbsRefPrefix ()
 Substitute the path's to files in the media/ folder like icons used in static_template of TypoScript Works on $this->content.
 baseUrlWrap ($url)
 Prefixing the input URL with ->baseUrl If ->baseUrl is set and the input url is not absolute in some way.
 printError ($label, $header='Error!')
 Prints error msg/header.
 updateMD5paramsRecord ($hash)
 Updates the tstamp field of a cache_md5params record to the current time.
 tidyHTML ($content)
 Pass the content through tidy - a little program that cleans up HTML-code Requires $this->TYPO3_CONF_VARS['FE']['tidy'] to be true and $this->TYPO3_CONF_VARS['FE']['tidy_path'] to contain the filename/path of tidy including clean-up arguments for tidy.
 prefixLocalAnchorsWithScript ()
 Substitutes all occurencies of <a href="#"...

Public Attributes

 $id = ''
 $type = ''
 $idParts = array()
 $cHash = ''
 $no_cache = ''
 $rootLine = ''
 $page = ''
 $contentPid = 0
 $sys_page = ''
 $jumpurl = ''
 $pageNotFound = 0
 $domainStartPage = 0
 $MP = ''
 $RDCT = ''
 $page_cache_reg1 = 0
 $siteScript = ''
 $fe_user = ''
 $loginUser = ''
 $gr_list = ''
 $beUserLogin = ''
 $fePreview = ''
 $showHiddenPage = ''
 $showHiddenRecords = ''
 $simUserGroup = '0'
 $versionPreviewMap = array()
 $TYPO3_CONF_VARS = array()
 $config = ''
 $TCAcachedExtras = array()
 $tmpl = ''
 $cacheTimeOutDefault = ''
 $cacheContentFlag = ''
 $all = ''
 $sPre = ''
 $pSetup = ''
 $newHash = ''
 $getMethodUrlIdToken = ''
 $noCacheBeforePageGen = ''
 $tempContent = ''
 $forceTemplateParsing = ''
 $cHash_array = array()
 $hash_base = ''
 $pagesTSconfig = ''
 $defaultBodyTag = '<body bgcolor="#FFFFFF">'
 $additionalHeaderData = array()
 $additionalJavaScript = array()
 $additionalCSS = array()
 $JSeventFuncCalls
 $JSCode = ''
 $JSImgCode = ''
 $divSection = ''
 $debug = ''
 $intTarget = ''
 $extTarget = ''
 $MP_defaults = array()
 $spamProtectEmailAddresses = 0
 $absRefPrefix = ''
 $absRefPrefix_force = 0
 $compensateFieldWidth = ''
 $lockFilePath = ''
 $ATagParams = ''
 $sWordRegEx = ''
 $sWordList = ''
 $linkVars = ''
 $excludeCHashVars = ''
 $displayEditIcons = ''
 $displayFieldEditIcons = ''
 $sys_language_uid = 0
 $sys_language_mode = ''
 $sys_language_content = 0
 $sys_language_contentOL = 0
 $sys_language_isocode = ''
 $applicationData = Array()
 $register = Array()
 $registerStack = Array()
 $cObjectDepthCounter = 50
 $recordRegister = Array()
 $currentRecord = ''
 $accessKey = array()
 $imagesOnPage = array()
 $lastImageInfo = array()
 $uniqueCounter = 0
 $uniqueString = ''
 $indexedDocTitle = ''
 $altPageTitle = ''
 $pEncAllowedParamNames = array()
 $baseUrl = ''
 $anchorPrefix = ''
 $cObj = ''
 $content = ''
 $clientInfo = ''
 $scriptParseTime = 0
 $TCAloaded = 0
 $csConvObj
 $defaultCharSet = 'iso-8859-1'
 $renderCharset = ''
 $metaCharset = ''
 $localeCharset = ''
 $lang = ''
 $langSplitIndex = 0
 $labelsCharset = ''
 $convCharsetToFrom = ''
 $LL_labels_cache = array()
 $LL_files_cache = array()

Constructor & Destructor Documentation

tslib_fe::tslib_fe TYPO3_CONF_VARS,
id,
type,
no_cache = '',
cHash = '',
jumpurl = '',
MP = '',
RDCT = ''
 

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()

Parameters:
array The global $TYPO3_CONF_VARS array. Will be set internally in ->TYPO3_CONF_VARS
mixed The value of t3lib_div::_GP('id')
integer The value of t3lib_div::_GP('type')
boolean The value of t3lib_div::_GP('no_cache'), evaluated to 1/0
string The value of t3lib_div::_GP('cHash')
string The value of t3lib_div::_GP('jumpurl')
string The value of t3lib_div::_GP('MP')
string The value of t3lib_div::_GP('RDCT')
Returns:
void
See also:
index_ts.php

Definition at line 356 of file class.tslib_fe.php.

References $MP, and $no_cache.

00356                                                                                                          {
00357 
00358          // Setting some variables:
00359       $this->TYPO3_CONF_VARS = $TYPO3_CONF_VARS;
00360       $this->id = $id;
00361       $this->type = $type;
00362       $this->no_cache = $no_cache ? 1 : 0;
00363       $this->cHash = $cHash;
00364       $this->jumpurl = $jumpurl;
00365       $this->MP = $this->TYPO3_CONF_VARS['FE']['enable_mount_pids'] ? $MP : '';
00366       $this->RDCT = $RDCT;
00367       $this->clientInfo = t3lib_div::clientInfo();
00368       $this->uniqueString=md5(microtime());
00369 
00370       $this->csConvObj = t3lib_div::makeInstance('t3lib_cs');
00371 
00372          // Call post processing function for constructor:
00373       if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['tslib_fe-PostProc']))  {
00374          $_params = array('pObj' => &$this);
00375          foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['tslib_fe-PostProc'] as $_funcRef) {
00376             t3lib_div::callUserFunction($_funcRef,$_params,$this);
00377          }
00378       }
00379    }


Member Function Documentation

tslib_fe::baseUrlWrap url  ) 
 

Prefixing the input URL with ->baseUrl If ->baseUrl is set and the input url is not absolute in some way.

Designed as a wrapper functions for use with all frontend links that are processed by JavaScript (for "realurl" compatibility!). So each time a URL goes into window.open, document.location or otherwise, wrap it with this function!

Parameters:
string Input URL, relative or absolute
Returns:
string Processed input value.

Definition at line 2851 of file class.tslib_fe.php.

02851                               {
02852       if ($this->baseUrl)  {
02853          $urlParts = parse_url($url);
02854          if (!strlen($urlParts['scheme']) && $url{0}!=='/') {
02855             $url = $this->baseUrl.$url;
02856          }
02857       }
02858       return $url;
02859    }

tslib_fe::beLoginLinkIPList  ) 
 

Returns a link to the login screen with redirect to the front-end.

Returns:
string HTML, a tag for a link to the backend.

Definition at line 2600 of file class.tslib_fe.php.

02600                                  {
02601       if ($this->config['config']['beLoginLinkIPList'])  {
02602          if (t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $this->config['config']['beLoginLinkIPList']))   {
02603             $label = !$this->beUserLogin ? $this->config['config']['beLoginLinkIPList_login'] : $this->config['config']['beLoginLinkIPList_logout'];
02604             if ($label) {
02605                if (!$this->beUserLogin)   {
02606                   $link = '<a href="'.htmlspecialchars(TYPO3_mainDir.'index.php?redirect_url='.rawurlencode(t3lib_div::getIndpEnv("REQUEST_URI"))).'">'.$label.'</a>';
02607                } else {
02608                   $link = '<a href="'.htmlspecialchars(TYPO3_mainDir.'index.php?L=OUT&redirect_url='.rawurlencode(t3lib_div::getIndpEnv("REQUEST_URI"))).'">'.$label.'</a>';
02609                }
02610                return $link;
02611             }
02612          }
02613       }
02614    }

tslib_fe::cHashParams addQueryParams  ) 
 

Splits the input query-parameters into an array with certain parameters filtered out.

Used to create the cHash value

Parameters:
string Query-parameters: "&xxx=yyy&zzz=uuu"
Returns:
array Array with key/value pairs of query-parameters WITHOUT a certain list of variable names (like id, type, no_cache etc) and WITH a variable, encryptionKey, specific for this server/installation private
See also:
makeCacheHash(), tslib_cObj::typoLink()

Definition at line 1256 of file class.tslib_fe.php.

Referenced by makeCacheHash().

01256                                          {
01257       $params = explode('&',substr($addQueryParams,1));  // Splitting parameters up
01258 
01259          // Make array:
01260       $pA = array();
01261       foreach($params as $theP)  {
01262          $pKV = explode('=', $theP);   // SPlitting single param by '=' sign
01263          if (!t3lib_div::inList('id,type,no_cache,cHash,MP,ftu',$pKV[0]))  {
01264             $pA[$pKV[0]] = (string)rawurldecode($pKV[1]);
01265          }
01266       }
01267       $pA['encryptionKey'] = $this->TYPO3_CONF_VARS['SYS']['encryptionKey'];
01268       ksort($pA);
01269       return $pA;
01270    }

tslib_fe::checkAlternativeIdMethods  ) 
 

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) Apache mod_rewrite: Here a .htaccess file maps all .html-files to index.php and then we extract the id and type from the name of that HTML-file. 2) Use PATH_INFO (also Apache) to extract id and type from that var. Does not require any special modules compiled with apache.

Support for RewriteRule to generate (simulateStaticDocuments) With the mod_rewrite compiled into apache, put these lines into a .htaccess in this directory: RewriteEngine On RewriteRule ^[^/]*\.html$ index.php The url must end with '.html' and the format must comply with either of these: 1: '[title].[id].[type].html' - title is just for easy recognition in the logfile!; no practical use of the title for TYPO3. 2: '[id].[type].html' - above, but title is omitted; no practical use of the title for TYPO3. 3: '[id].html' - only id, type is set to the default, zero! NOTE: In all case 'id' may be the uid-number OR the page alias (if any)

Returns:
void &tx_extrepmgm_pi1[extUid]=270&cHash=4ad9d7acb4

Definition at line 549 of file class.tslib_fe.php.

References checkAlternativeIdMethods().

Referenced by checkAlternativeIdMethods().

00549                                           {
00550 
00551       $this->siteScript = t3lib_div::getIndpEnv('TYPO3_SITE_SCRIPT');
00552 
00553          // Resolving of "simulateStaticDocuments" URLs:
00554       if ($this->siteScript && substr($this->siteScript,0,9)!='index.php') {     // If there has been a redirect (basically; we arrived here otherwise than via "index.php" in the URL) this can happend either due to a CGI-script or because of reWrite rule. Earlier we used $_SERVER['REDIRECT_URL'] to check but
00555          $uParts = parse_url($this->siteScript);   // Parse the path:
00556          $fI = t3lib_div::split_fileref($uParts['path']);
00557 
00558          if (!$fI['path'] && $fI['file'] && substr($fI['file'],-5)=='.html')  {
00559             $parts = explode('.',$fI['file']);
00560             $pCount = count($parts);
00561             if ($pCount>2) {
00562                $this->type = intval($parts[$pCount-2]);
00563                $this->id = $parts[$pCount-3];
00564             } else {
00565                $this->type = 0;
00566                $this->id = $parts[0];
00567             }
00568          }
00569       }
00570 
00571          // If PATH_INFO
00572       if (t3lib_div::getIndpEnv('PATH_INFO'))   {     // If pathinfo contains stuff...
00573          $parts=t3lib_div::trimExplode('/',t3lib_div::getIndpEnv('PATH_INFO'),1);
00574          $parts[]='html';
00575          $pCount = count($parts);
00576          if ($pCount>2) {
00577             $this->type = intval($parts[$pCount-2]);
00578             $this->id = $parts[$pCount-3];
00579          } else {
00580             $this->type = 0;
00581             $this->id = $parts[0];
00582          }
00583          $this->absRefPrefix_force=1;
00584       }
00585 
00586          // Call post processing function for custom URL methods.
00587       if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['checkAlternativeIdMethods-PostProc']))   {
00588          $_params = array('pObj' => &$this);
00589          foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['checkAlternativeIdMethods-PostProc'] as $_funcRef)  {
00590             t3lib_div::callUserFunction($_funcRef,$_params,$this);
00591          }
00592       }
00593    }

tslib_fe::checkAndSetAlias  ) 
 

Fetches the integer page id for a page alias.

Looks if ->id is not an integer and if so it will search for a page alias and if found the page uid of that page is stored in $this->id

Returns:
void private

Definition at line 1145 of file class.tslib_fe.php.

Referenced by fetch_the_id().

01145                                  {
01146       if ($this->id && !t3lib_div::testInt($this->id))   {
01147          $aid = $this->sys_page->getPageIdFromAlias($this->id);
01148          if ($aid)   {$this->id=$aid;}
01149       }
01150    }

tslib_fe::checkDataSubmission  ) 
 

Checks if any email-submissions or submission via the fe_tce.

Returns:
string 'email' if a formmail has been send, 'fe_tce' if front-end data submission (like forums, guestbooks) is send. '' if none.

Definition at line 1685 of file class.tslib_fe.php.

References fe_tce(), and locDataCheck().

01685                                     {
01686       if ($_POST['formtype_db'] || $_POST['formtype_mail']) {
01687          $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
01688          if (t3lib_div::getIndpEnv('TYPO3_HOST_ONLY')==$refInfo['host'] || $this->TYPO3_CONF_VARS['SYS']['doNotCheckReferer'])   {
01689             if ($this->locDataCheck($_POST['locationData']))   {
01690                $ret = '';
01691                if ($_POST['formtype_mail'])  {
01692                   $ret = 'email';
01693                } elseif ($_POST['formtype_db'] && is_array($_POST['data']))   {
01694                   $ret = 'fe_tce';
01695                }
01696                $GLOBALS['TT']->setTSlogMessage('"Check Data Submission": Return value: '.$ret,0);
01697                return $ret;
01698             }
01699          } else $GLOBALS['TT']->setTSlogMessage('"Check Data Submission": HTTP_HOST and REFERER HOST did not match when processing submitted formdata!',3);
01700       }
01701    }

tslib_fe::checkEnableFields row  ) 
 

Checks page record for enableFields Returns true if enableFields does not disable the page record.

Takes notice of the ->showHiddenPage flag and uses SIM_EXEC_TIME for start/endtime evaluation

Parameters:
array The page record to evaluate (needs fields: hidden, starttime, endtime, fe_group)
Returns:
boolean True, if record is viewable.
See also:
tslib_cObj::getTreeList(), checkPagerecordForIncludeSection()

Definition at line 961 of file class.tslib_fe.php.

References checkPageGroupAccess().

Referenced by checkPagerecordForIncludeSection().

00961                                     {
00962       if ((!$row['hidden'] || $this->showHiddenPage)
00963          && $row['starttime']<=$GLOBALS['SIM_EXEC_TIME']
00964          && ($row['endtime']==0 || $row['endtime']>$GLOBALS['SIM_EXEC_TIME'])
00965          && $this->checkPageGroupAccess($row)
00966       ) {
00967          return 1;
00968       }
00969    }

tslib_fe::checkFileInclude incFile  ) 
 

Checks if a PHPfile may be included.

Parameters:
string Relative path to php file
Returns:
boolean Returns true if $GLOBALS['TYPO3_CONF_VARS']['FE']['noPHPscriptInclude'] is not set OR if the file requested for inclusion is found in one of the allowed paths.
See also:
tslib_cObj::PHP_SCRIPT(), tslib_feTCE::includeScripts(), tslib_menu::includeMakeMenu()

Definition at line 2809 of file class.tslib_fe.php.

References TYPO3_mainDir.

02809                                        {
02810       return !$this->TYPO3_CONF_VARS['FE']['noPHPscriptInclude']
02811          || substr($incFile,0,14)=='media/scripts/'
02812          || substr($incFile,0,4+strlen(TYPO3_mainDir))==TYPO3_mainDir.'ext/'
02813          || substr($incFile,0,7+strlen(TYPO3_mainDir))==TYPO3_mainDir.'sysext/'
02814          || substr($incFile,0,14)=='typo3conf/ext/';
02815    }

tslib_fe::checkJumpUrl  ) 
 

Checks if jumpurl is set.

This function also takes care of jumpurl utilized by the Direct Mail module (ext: direct_mail) which may set an integer value for jumpurl which refers to a link in a certain mail-record, mid

Returns:
void

Definition at line 1783 of file class.tslib_fe.php.

References error().

01783                            {
01784       global $TCA;
01785 
01786       $mid = t3lib_div::_GP('mid');    // mail id, if direct mail link
01787       $rid = t3lib_div::_GP('rid');    // recipient id, if direct mail link
01788       if ((strcmp($this->jumpurl,'') && ((t3lib_div::getIndpEnv('HTTP_REFERER') || $this->TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) || $mid)) || ($this->jumpurl = $this->sys_page->getExtURL($this->page,$this->config['config']['disablePageExternalUrl']))) {
01789          if ($mid && is_array($TCA['sys_dmail']))  {  // Yes, it's OK if the link comes from a direct mail. AND sys_dmail module has installed the table, sys_dmail (and therefore we expect sys_dmail_maillog as well!)
01790             $temp_recip=explode('_',$rid);
01791             $url_id=0;
01792             if (t3lib_div::testInt($this->jumpurl))   {
01793                $temp_res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('mailContent', 'sys_dmail', 'uid='.intval($mid));
01794                if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($temp_res))   {
01795                   $temp_unpackedMail = unserialize($row['mailContent']);
01796                   $url_id=$this->jumpurl;
01797                   if ($this->jumpurl>=0)  {
01798                      $responseType=1;  // Link (number)
01799                      $this->jumpurl = $temp_unpackedMail['html']['hrefs'][$url_id]['absRef'];
01800                   } else {
01801                      $responseType=2;  // Link (number, plaintext)
01802                      $this->jumpurl = $temp_unpackedMail['plain']['link_ids'][abs($url_id)];
01803                   }
01804                   switch($temp_recip[0])  {
01805                      case 't':
01806                         $theTable = 'tt_address';
01807                      break;
01808                      case 'f':
01809                         $theTable = 'fe_users';
01810                      break;
01811                      default:
01812                         $theTable='';
01813                      break;
01814                   }
01815                   if ($theTable) {
01816                      $recipRow = $this->sys_page->getRawRecord($theTable,$temp_recip[1]);
01817                      if (is_array($recipRow))   {
01818 //                      debug($recipRow);
01819                         $authCode = t3lib_div::stdAuthCode($recipRow['uid']);
01820                         $rowFieldsArray = explode(',', 'uid,name,title,email,phone,www,address,company,city,zip,country,fax,firstname');
01821                         reset($rowFieldsArray);
01822                         while(list(,$substField)=each($rowFieldsArray)) {
01823                            $this->jumpurl = str_replace('###USER_'.$substField.'###', $recipRow[$substField], $this->jumpurl);
01824                         }
01825                         $this->jumpurl = str_replace('###SYS_TABLE_NAME###', $tableNameChar, $this->jumpurl);  // Put in the tablename of the userinformation
01826                         $this->jumpurl = str_replace('###SYS_MAIL_ID###', $mid, $this->jumpurl);   // Put in the uid of the mail-record
01827                         $this->jumpurl = str_replace('###SYS_AUTHCODE###', $authCode, $this->jumpurl);
01828 
01829                   //    debug($this->jumpurl);
01830                      }
01831                   }
01832                }
01833 
01834                $GLOBALS['TYPO3_DB']->sql_free_result($temp_res);
01835 
01836                if (!$this->jumpurl) die('Error: No further link. Please report error to the mail sender.');
01837             } else {
01838                $responseType=-1; // received (url, dmailerping)
01839             }
01840             if ($responseType!=0)   {
01841                $insertFields = array(
01842                   'mid' => intval($mid),
01843                   'rtbl' => $temp_recip[0],
01844                   'rid' => intval($temp_recip[1]),
01845                   'tstamp' => time(),
01846                   'url' => $this->jumpurl,
01847                   'response_type' => intval($responseType),
01848                   'url_id' => intval($url_id)
01849                );
01850 
01851                $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_dmail_maillog', $insertFields);
01852             }
01853          }
01854       } else {
01855          unset($this->jumpurl);
01856       }
01857    }

tslib_fe::checkPageGroupAccess row,
groupList = NULL
 

Check group access against a page record.

Parameters:
array The page record to evaluate (needs field: fe_group)
mixed List of group id's (comma list or array). Default is $this->gr_list
Returns:
boolean True, if group access is granted. private

Definition at line 979 of file class.tslib_fe.php.

Referenced by checkEnableFields().

00979                                                         {
00980       if(is_null($groupList)) {
00981          $groupList = $this->gr_list;
00982       }
00983       if(!is_array($groupList)) {
00984          $groupList = explode(',', $groupList);
00985       }
00986       $pageGroupList = explode(',', $row['fe_group']);
00987       return count(array_intersect($groupList, $pageGroupList)) > 0;
00988    }

tslib_fe::checkPagerecordForIncludeSection row  ) 
 

Checks page record for include section.

Parameters:
array The page record to evaluate (needs fields: extendToSubpages + hidden, starttime, endtime, fe_group)
Returns:
boolean Returns true if either extendToSubpages is not checked or if the enableFields does not disable the page record. private
See also:
checkEnableFields(), tslib_cObj::getTreeList(), checkRootlineForIncludeSection()

Definition at line 998 of file class.tslib_fe.php.

References checkEnableFields().

Referenced by checkRootlineForIncludeSection().

00998                                                    {
00999       return (!$row['extendToSubpages'] || $this->checkEnableFields($row)) ? 1 : 0;
01000    }

tslib_fe::checkRootlineForIncludeSection  ) 
 

Checks the current rootline for defined sections.

Returns:
boolean private

Definition at line 928 of file class.tslib_fe.php.

References $a, and checkPagerecordForIncludeSection().

Referenced by getPageAndRootline().

00928                                              {
00929       $c=count($this->rootLine);
00930       $removeTheRestFlag=0;
00931       for ($a=0;$a<$c;$a++)   {
00932          if (!$this->checkPagerecordForIncludeSection($this->rootLine[$a]))   {
00933             $removeTheRestFlag=1;
00934          }
00935          if ($this->rootLine[$a]['doktype']==6) {
00936             if ($this->beUserLogin) {  // If there is a backend user logged in, check if he has read access to the page:
00937                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'uid='.intval($this->id).' AND '.$GLOBALS['BE_USER']->getPagePermsClause(1));
00938                list($isPage) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
00939                if (!$isPage)  $removeTheRestFlag=1;   // If there was no page selected, the user apparently did not have read access to the current PAGE (not position in rootline) and we set the remove-flag...
00940             } else { // Dont go here, if there is no backend user logged in.
00941                $removeTheRestFlag=1;
00942             }
00943          }
00944          if ($removeTheRestFlag) {
00945             $this->pageNotFound=2;        // Page is 'not found' in case a subsection was found and not accessible, code 2
00946             unset($this->rootLine[$a]);
00947          }
00948       }
00949       return $removeTheRestFlag;
00950    }

tslib_fe::clear_preview  ) 
 

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.

Returns:
void

Definition at line 601 of file class.tslib_fe.php.

Referenced by determineId().

00601                               {
00602       $this->showHiddenPage = 0;
00603       $this->showHiddenRecords = 0;
00604       $GLOBALS['SIM_EXEC_TIME'] = $GLOBALS['EXEC_TIME'];
00605       $this->fePreview = 0;
00606    }

tslib_fe::clearPageCacheContent  ) 
 

Clears cache content (for $this->newHash).

Returns:
void

Definition at line 2044 of file class.tslib_fe.php.

Referenced by setPageCacheContent().

02044                                     {
02045       $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'hash="'.$GLOBALS['TYPO3_DB']->quoteStr($this->newHash, 'cache_pages').'"');
02046    }

tslib_fe::clearPageCacheContent_pidList pidList  ) 
 

Clears cache content for a list of page ids.

Parameters:
string A list of INTEGER numbers which points to page uids for which to clear entries in the cache_pages table (page content cache)
Returns:
void

Definition at line 2054 of file class.tslib_fe.php.

02054                                                       {
02055       $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($pidList).')');
02056    }

tslib_fe::codeString string,
decode = FALSE
 

En/decodes strings with lightweight encryption and a hash containing the server encryptionKey (salt) Can be used for authentication of information sent from server generated pages back to the server to establish that the server generated the page.

(Like hidden fields with recipient mail addresses) Encryption is mainly to avoid spam-bots to pick up information.

Parameters:
string Input string to en/decode
boolean If set, string is decoded, not encoded.
Returns:
string encoded/decoded version of $string

Definition at line 2763 of file class.tslib_fe.php.

Referenced by sendFormmail().

02763                                                 {
02764 
02765       if ($decode) {
02766          list($md5Hash, $str) = explode(':',$string,2);
02767          $newHash = substr(md5($this->TYPO3_CONF_VARS['SYS']['encryptionKey'].':'.$str),0,10);
02768          if (!strcmp($md5Hash, $newHash)) {
02769             $str = base64_decode($str);
02770             $str = $this->roundTripCryptString($str);
02771             return $str;
02772          } else return FALSE; // Decoding check failed! Original string not produced by this server!
02773       } else {
02774          $str = $string;
02775          $str = $this->roundTripCryptString($str);
02776          $str = base64_encode($str);
02777          $newHash = substr(md5($this->TYPO3_CONF_VARS['SYS']['encryptionKey'].':'.$str),0,10);
02778          return $newHash.':'.$str;
02779       }
02780    }

tslib_fe::connectToMySQL  ) 
 

Connect to SQL database May exit after outputting an error message or some JavaScript redirecting to the install tool.

Returns:
void

Definition at line 387 of file class.tslib_fe.php.

References printError(), TYPO3_db, TYPO3_db_host, TYPO3_db_password, and TYPO3_db_username.

00387                               {
00388       if ($GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
00389          if (!TYPO3_db) {
00390             $this->printError('No database selected','Database Error');
00391                // Redirects to the Install Tool:
00392             echo '<script type="text/javascript">
00393                   /*<![CDATA[*/
00394                document.location = "'.TYPO3_mainDir.'install/index.php?mode=123&step=1&password=joh316";
00395                   /*]]>*/
00396                </script>';
00397             exit;
00398          } elseif (!$GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db))   {
00399             $this->printError('Cannot connect to the current database, "'.TYPO3_db.'"','Database Error');
00400             exit;
00401          }
00402       } else {
00403          if (!TYPO3_db) {
00404                // Redirects to the Install Tool:
00405             echo '<script type="text/javascript">
00406                   /*<![CDATA[*/
00407                document.location = "'.TYPO3_mainDir.'install/index.php?mode=123&step=1&password=joh316";
00408                   /*]]>*/
00409                </script>';
00410             exit;
00411          }
00412          $this->printError('The current username, password or host was not accepted when the connection to the database was attempted to be established!','Database Error');
00413          exit;
00414       }
00415    }

tslib_fe::determineId  ) 
 

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.

Returns:
void

Definition at line 614 of file class.tslib_fe.php.

References $simUserGroup, clear_preview(), determineId(), fetch_the_id(), and setIDfromArgV().

Referenced by determineId().

00614                            {
00615 
00616          // Getting ARG-v values if some
00617       $this->setIDfromArgV();
00618 
00619          // If there is a Backend login we are going to check for any preview settings:
00620       $GLOBALS['TT']->push('beUserLogin','');
00621       if ($this->beUserLogin) {
00622          $this->fePreview = $GLOBALS['BE_USER']->extGetFeAdminValue('preview');
00623 
00624             // If admin panel preview is enabled...
00625          if ($this->fePreview)   {
00626             $fe_user_OLD_USERGROUP = $this->fe_user->user['usergroup'];
00627 
00628             $this->showHiddenPage = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','showHiddenPages');
00629             $this->showHiddenRecords = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','showHiddenRecords');
00630                // simulate date
00631             $simTime = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','simulateDate');
00632             if ($simTime)  $GLOBALS['SIM_EXEC_TIME']=$simTime;
00633                // simulate user
00634             $simUserGroup = $GLOBALS['BE_USER']->extGetFeAdminValue('preview','simulateUserGroup');
00635             $this->simUserGroup = $simUserGroup;
00636             if ($simUserGroup)   $this->fe_user->user['usergroup']=$simUserGroup;
00637             if (!$simUserGroup && !$simTime && !$this->showHiddenPage && !$this->showHiddenRecords)   {
00638                $this->fePreview=0;
00639             }
00640          }
00641 
00642             // Now it's investigated if the raw page-id points to a hidden page and if so, the flag is set.
00643             // This does not require the preview flag to be set in the admin panel
00644          if ($this->id) {
00645             $idQ = t3lib_div::testInt($this->id) ? 'uid="'.intval($this->id).'"' : 'alias="'.$GLOBALS['TYPO3_DB']->quoteStr($this->id, 'pages').'" AND pid>=0';   // pid>=0 added for the sake of versioning...
00646             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('hidden', 'pages', $idQ.' AND hidden AND NOT deleted');
00647             if ($GLOBALS['TYPO3_DB']->sql_num_rows($res))   {
00648                $this->fePreview = 1;   // The preview flag is set only if the current page turns out to actually be hidden!
00649                $this->showHiddenPage = 1;
00650             }
00651 
00652                // Check root line for proper connection to tree root (done because of possible preview of page / branch versions)
00653             if (!$this->fePreview)  {
00654 
00655                   // Initialize the page-select functions to check rootline:
00656                $temp_sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
00657                $temp_sys_page->init($this->showHiddenPage);
00658 
00659                   // If root line contained NO records and ->error_getRootLine_failPid tells us that it was because of a pid=-1 (indicating a "version" record)...:
00660                if (!count($temp_sys_page->getRootLine($this->id,$this->MP)) && $temp_sys_page->error_getRootLine_failPid==-1) {
00661 
00662                      // Setting versioningPreview flag and try again:
00663                   $temp_sys_page->versioningPreview = TRUE;
00664                   if (count($temp_sys_page->getRootLine($this->id,$this->MP)))   {
00665                         // 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.
00666                      $this->fePreview = 1;
00667 #debug('version in rootline...');
00668                   }
00669                }
00670             }
00671          }
00672 
00673             // Checking for specific version preview of records:
00674          if (is_array(t3lib_div::_GP('ADMCMD_vPrev')))   {
00675             $this->fePreview = 1;
00676             $this->versionPreviewMap = t3lib_div::_GP('ADMCMD_vPrev');
00677          }
00678 
00679          if ($this->fePreview)   {  // If the front-end is showing a preview, caching MUST be disabled.
00680             $this->set_no_cache();
00681          }
00682       }
00683       $GLOBALS['TT']->pull();
00684 
00685          // Now, get the id, validate access etc:
00686       $this->fetch_the_id();
00687 
00688          // Check if backend user has read access to this page. If not, recalculate the id.
00689       if ($this->beUserLogin && $this->fePreview)  {
00690          if (!$GLOBALS['BE_USER']->doesUserHaveAccess($this->page,1))   {
00691                // Resetting
00692             $this->clear_preview();
00693             $this->fe_user->user['usergroup'] = $fe_user_OLD_USERGROUP;
00694                // Fetching the id again, now with the preview settings reset.
00695             $this->fetch_the_id();
00696          }
00697       }
00698          // Final cleaning.
00699       $this->id = $this->contentPid = intval($this->id); // Make sure it's an integer
00700       $this->type = intval($this->type);  // Make sure it's an integer
00701 
00702 
00703          // Call post processing function for id determination:
00704       if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['determineId-PostProc']))  {
00705          $_params = array('pObj' => &$this);
00706          foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['determineId-PostProc'] as $_funcRef) {
00707             t3lib_div::callUserFunction($_funcRef,$_params,$this);
00708          }
00709       }
00710    }

tslib_fe::doLocalAnchorFix  ) 
 

Returns the mode of Local Anchor prefixing.

Returns:
string Keyword: "all", "cached" or "output"

Definition at line 2346 of file class.tslib_fe.php.

02346                                  {
02347       return $this->config['config']['prefixLocalAnchors'];
02348    }

tslib_fe::doXHTML_cleaning  ) 
 

Returns the mode of XHTML cleaning.

Returns:
string Keyword: "all", "cached" or "output"

Definition at line 2337 of file class.tslib_fe.php.

02337                                  {
02338       return $this->config['config']['xhtml_cleaning'];
02339    }

tslib_fe::encryptEmail string,
back = 0
 

Encryption of email addresses for -tags See the spam protection setup in TS 'config.'.

Parameters:
string Input string to en/decode: "mailto:blabla@bla.com"
boolean If set, the process is reversed, effectively decoding, not encoding.
Returns:
string encoded/decoded version of $string

Definition at line 2744 of file class.tslib_fe.php.

References $a, and $out.

02744                                           {
02745       $out = '';
02746       for ($a=0; $a<strlen($string); $a++)   {
02747          $charValue = ord(substr($string,$a,1));
02748          $charValue+= intval($this->spamProtectEmailAddresses)*($back?-1:1);
02749          $out.= chr($charValue);
02750       }
02751       return $out;
02752    }

tslib_fe::fe_tce  ) 
 

Processes submitted user data (obsolete "Frontend TCE").

Returns:
void
See also:
tslib_feTCE &tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=342&cHash=fdf55adb3b

Definition at line 1710 of file class.tslib_fe.php.

Referenced by checkDataSubmission().

01710                      {
01711       $fe_tce = t3lib_div::makeInstance('tslib_feTCE');
01712       $fe_tce->start(t3lib_div::_POST('data'),$this->config['FEData.']);
01713       $fe_tce->includeScripts();
01714    }

tslib_fe::fetch_the_id  ) 
 

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.

Returns:
void private

Definition at line 720 of file class.tslib_fe.php.

References checkAndSetAlias(), fetch_the_id(), findDomainRecord(), getPageAndRootlineWithDomain(), idPartsAnalyze(), initUserGroups(), pageNotFoundAndExit(), printError(), and setSysPageWhereClause().

Referenced by determineId(), and fetch_the_id().

00720                            {
00721       $GLOBALS['TT']->push('fetch_the_id initialize/','');
00722 
00723          // Initialize the page-select functions.
00724       $this->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
00725       $this->sys_page->init($this->showHiddenPage);
00726       $this->sys_page->versioningPreview = $this->fePreview ? TRUE : FALSE;
00727       if ($this->sys_page->versioningPreview)   {
00728          $this->sys_page->versionPreviewMap = $this->versionPreviewMap;
00729 #debug($this->sys_page->versionPreviewMap);
00730       }
00731 
00732          // Set the valid usergroups for FE
00733       $this->initUserGroups();
00734 
00735          // Sets sys_page where-clause
00736       $this->setSysPageWhereClause();
00737 
00738          // Splitting $this->id by a period (.). First part is 'id' and second part - if exists - will overrule the &type param if given
00739       $pParts = explode('.',$this->id);
00740       $this->id = $pParts[0]; // Set it.
00741       if (isset($pParts[1]))  {$this->type=$pParts[1];}
00742 
00743          // Splitting $this->id by a comma (,). First part is 'id' and other parts are just stored for use in scripts.
00744       $this->idParts = explode(',',$this->id);
00745 
00746          // Splitting by a '+' sign - used for base64/md5 methods of parameter encryption for simulate static documents.
00747       list($pgID,$SSD_p)=explode('+',$this->idParts[0],2);
00748       if ($SSD_p) {  $this->idPartsAnalyze($SSD_p);   }
00749       $this->id = $pgID;   // Set id
00750 
00751          // If $this->id is a string, it's an alias
00752       $this->checkAndSetAlias();
00753 
00754          // The id and type is set to the integer-value - just to be sure...
00755       $this->id = intval($this->id);
00756       $this->type = intval($this->type);
00757       $GLOBALS['TT']->pull();
00758 
00759          // We find the first page belonging to the current domain
00760       $GLOBALS['TT']->push('fetch_the_id domain/','');
00761       $this->domainStartPage = $this->findDomainRecord($this->TYPO3_CONF_VARS['SYS']['recursiveDomainSearch']);   // the page_id of the current domain
00762       if (!$this->id)   {
00763          if ($this->domainStartPage)   {
00764             $this->id = $this->domainStartPage; // If the id was not previously set, set it to the id of the domain.
00765          } else {
00766             $theFirstPage = $this->sys_page->getFirstWebPage($this->id);   // Find the first 'visible' page in that domain
00767             if ($theFirstPage)   {
00768                $this->id = $theFirstPage['uid'];
00769             } else {
00770                $this->printError('No pages are found on the rootlevel!');
00771                exit;
00772             }
00773          }
00774       }
00775       $GLOBALS['TT']->pull();
00776 
00777       $GLOBALS['TT']->push('fetch_the_id rootLine/','');
00778       $requestedId = $this->id;     // We store the originally requested id
00779       $this->getPageAndRootlineWithDomain($this->domainStartPage);
00780       $GLOBALS['TT']->pull();
00781 
00782       if ($this->pageNotFound && $this->TYPO3_CONF_VARS['FE']['pageNotFound_handling'])   {
00783          $pNotFoundMsg = array(
00784             1 => 'ID was not an accessible page',
00785             2 => 'Subsection was found and not accessible',
00786             3 => 'ID was outside the domain',
00787          );
00788          $this->pageNotFoundAndExit($pNotFoundMsg[$this->pageNotFound]);
00789       }
00790 
00791          // set no_cache if set
00792       if ($this->page['no_cache'])  {
00793          $this->set_no_cache();
00794       }
00795          // Init SYS_LASTCHANGED
00796       $this->register['SYS_LASTCHANGED'] = intval($this->page['tstamp']);
00797    }

tslib_fe::findDomainRecord recursive = 0  ) 
 

Looking up a domain record based on HTTP_HOST.

Parameters:
boolean If set, it looks "recursively" meaning that a domain like "123.456.typo3.com" would find a domain record like "typo3.com" if "123.456.typo3.com" or "456.typo3.com" did not exist.
Returns:
integer Returns the page id of the page where the domain record was found. private

Definition at line 1074 of file class.tslib_fe.php.

Referenced by fetch_the_id().

01074                                              {
01075       if ($recursive)   {
01076          $host = explode('.',t3lib_div::getIndpEnv('HTTP_HOST'));
01077          while(count($host))  {
01078             $pageUid = $this->sys_page->getDomainStartPage(implode('.',$host),t3lib_div::getIndpEnv('SCRIPT_NAME'),t3lib_div::getIndpEnv('REQUEST_URI'));
01079             if ($pageUid)  return $pageUid; else array_shift($host);
01080          }
01081          return $pageUid;
01082       } else {
01083          return $this->sys_page->getDomainStartPage(t3lib_div::getIndpEnv('HTTP_HOST'),t3lib_div::getIndpEnv('SCRIPT_NAME'),t3lib_div::getIndpEnv('REQUEST_URI'));
01084       }
01085    }

tslib_fe::generatePage_postProcessing  ) 
 

Does some processing AFTER the pagegen script is included.

This includes calling tidy (if configured), XHTML cleaning (if configured), caching the page, indexing the page (if configured) and setting sysLastChanged

Returns:
void

Definition at line 2135 of file class.tslib_fe.php.

02135                                           {
02136          // This is to ensure, that the page is NOT cached if the no_cache parameter was set before the page was generated. This is a safety precaution, as it could have been unset by some script.
02137       if ($this->no_cacheBeforePageGen) $this->set_no_cache();
02138 
02139          // Tidy up the code, if flag...
02140       if ($this->TYPO3_CONF_VARS['FE']['tidy_option'] == 'all')      {
02141          $GLOBALS['TT']->push('Tidy, all','');
02142             $this->content = $this->tidyHTML($this->content);
02143          $GLOBALS['TT']->pull();
02144       }
02145 
02146          // XHTML-clean the code, if flag set
02147       if ($this->doXHTML_cleaning() == 'all')      {
02148          $GLOBALS['TT']->push('XHTML clean, all','');
02149             $XHTML_clean = t3lib_div::makeInstance('t3lib_parsehtml');
02150             $this->content = $XHTML_clean->XHTML_clean($this->content);
02151          $GLOBALS['TT']->pull();
02152       }
02153 
02154          // Fix local anchors in links, if flag set
02155       if ($this->doLocalAnchorFix() == 'all')      {
02156          $GLOBALS['TT']->push('Local anchor fix, all','');
02157             $this->prefixLocalAnchorsWithScript();
02158          $GLOBALS['TT']->pull();
02159       }
02160 
02161          // Hook for post-processing of page content cached/non-cached:
02162       if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all']))   {
02163          $_params = array('pObj' => &$this);
02164          foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all'] as $_funcRef)  {
02165             t3lib_div::callUserFunction($_funcRef,$_params,$this);
02166          }
02167       }
02168 
02169          // Processing if caching is enabled:
02170       if (!$this->no_cache)   {
02171                // Tidy up the code, if flag...
02172          if ($this->TYPO3_CONF_VARS['FE']['tidy_option'] == 'cached')      {
02173             $GLOBALS['TT']->push('Tidy, cached','');
02174                $this->content = $this->tidyHTML($this->content);
02175             $GLOBALS['TT']->pull();
02176          }
02177             // XHTML-clean the code, if flag set
02178          if ($this->doXHTML_cleaning() == 'cached')      {
02179             $GLOBALS['TT']->push('XHTML clean, cached','');
02180                $XHTML_clean = t3lib_div::makeInstance('t3lib_parsehtml');
02181                $this->content = $XHTML_clean->XHTML_clean($this->content);
02182             $GLOBALS['TT']->pull();
02183          }
02184             // Fix local anchors in links, if flag set
02185          if ($this->doLocalAnchorFix() == 'cached')      {
02186             $GLOBALS['TT']->push('Local anchor fix, cached','');
02187                $this->prefixLocalAnchorsWithScript();
02188             $GLOBALS['TT']->pull();
02189          }
02190 
02191             // Hook for post-processing of page content before being cached:
02192          if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-cached']))   {
02193             $_params = array('pObj' => &$this);
02194             foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-cached'] as $_funcRef)  {
02195                t3lib_div::callUserFunction($_funcRef,$_params,$this);
02196             }
02197          }
02198       }
02199 
02200          // Hook for indexing pages
02201       if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageIndexing'])) {
02202          foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageIndexing'] as $_classRef)  {
02203             $_procObj = &t3lib_div::getUserObj($_classRef);
02204             $_procObj->hook_indexContent($this);
02205          }
02206       }
02207 
02208          // Convert char-set for output:
02209       $this->content = $this->convOutputCharset($this->content,'mainpage');
02210 
02211          // Storing for cache:
02212       if (!$this->no_cache)   {
02213          $this->realPageCacheContent();
02214       } elseif ($this->tempContent) {     // If there happens to be temporary content in the cache and the cache was not cleared due to new content put in it... ($this->no_cache=0)
02215          $this->clearPageCacheContent();
02216       }
02217 
02218          // Sets sys-last-change:
02219       $this->setSysLastChanged();
02220    }

tslib_fe::generatePage_preProcessing  ) 
 

Does some processing BEFORE the pagegen script is included.

Returns:
void

Definition at line 2101 of file class.tslib_fe.php.

02101                                           {
02102       ksort($this->all);
02103          // Same codeline as in getFromCache(). BUT $this->all has been set in the meantime, so we can't just skip this line and let it be set above! Keep this line!
02104       $this->newHash = $this->getHash();
02105 
02106          // Here we put some temporary stuff in the cache in order to let the first hit generate the page. The temporary cache will expire after a few seconds (typ. 30) or will be cleared by the rendered page, which will also clear and rewrite the cache.
02107       $this->tempPageCacheContent();
02108 
02109 
02110          // Setting cache_timeout_default. May be overridden by PHP include scritps.
02111       $this->cacheTimeOutDefault = intval($this->config['config']['cache_period']);
02112 
02113          // page is generated
02114       $this->no_cacheBeforePageGen = $this->no_cache;
02115    }

tslib_fe::generatePage_whichScript  ) 
 

Determines to include custom or pagegen.php script returns script-filename if a TypoScript (config) script is defined and should be include instead of pagegen.php.

Returns:
string The relative filepath of "config.pageGenScript" if found and allowed

Definition at line 2123 of file class.tslib_fe.php.

02123                                        {
02124       if (!$this->TYPO3_CONF_VARS['FE']['noPHPscriptInclude'] && $this->config['config']['pageGenScript'])  {
02125          return $this->tmpl->getFileName($this->config['config']['pageGenScript']);
02126       }
02127    }

tslib_fe::getCompressedTCarray  ) 
 

Get the compressed $TCA array for use in the front-end A compressed $TCA array holds only the ctrl- and feInterface-part for each table.

But the column-definitions are omitted in order to save some memory and be more efficient. Operates on the global variable, $TCA

Returns:
void
See also:
includeTCA()

Definition at line 1489 of file class.tslib_fe.php.

References $TCA, $val, includeTCA(), PATH_t3lib, PATH_typo3conf, and TYPO3_extTableDef_script.

01489                                     {
01490       global $TCA;
01491 
01492       $GLOBALS['TT']->push('Get Compressed TC array');
01493       if (!$this->TCAloaded)  {
01494             // Create hash string for storage / retrieval of cached content:
01495          $tempHash = md5('tables.php:'.
01496             filemtime(TYPO3_extTableDef_script ? PATH_typo3conf.TYPO3_extTableDef_script : PATH_t3lib.'stddb/tables.php').
01497             (TYPO3_extTableDef_script?filemtime(PATH_typo3conf.TYPO3_extTableDef_script):'').
01498             ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] ? filemtime(PATH_typo3conf.$GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'].'_ext_tables.php') : '')
01499          );
01500             // Try to fetch if:
01501          list($TCA,$this->TCAcachedExtras) = unserialize($this->sys_page->getHash($tempHash, 0));
01502             // If no result, create it:
01503          if (!is_array($TCA)) {
01504             $this->includeTCA(0);
01505             $newTc = Array();
01506             $this->TCAcachedExtras = array();   // Collects other information
01507 
01508             foreach($TCA as $key => $val)    {
01509                $newTc[$key]['ctrl'] = $val['ctrl'];
01510                $newTc[$key]['feInterface'] = $val['feInterface'];
01511 
01512                   // Collect information about localization exclusion of fields:
01513                t3lib_div::loadTCA($key);
01514                if (is_array($TCA[$key]['columns']))   {
01515                   $this->TCAcachedExtras[$key]['l10n_mode'] = array();
01516                   foreach($TCA[$key]['columns'] as $fN => $fV) {
01517                      if ($fV['l10n_mode'])   {
01518                         $this->TCAcachedExtras[$key]['l10n_mode'][$fN] = $fV['l10n_mode'];
01519                      }
01520                   }
01521                }
01522             }
01523 
01524                // Store it in cache:
01525             $TCA = $newTc;
01526             $this->sys_page->storeHash($tempHash, serialize(array($newTc,$this->TCAcachedExtras)), 'SHORT TC');
01527          }
01528       }
01529       $GLOBALS['TT']->pull();
01530    }

tslib_fe::getConfigArray  ) 
 

Checks if config-array exists already but if not, gets it.

Returns:
void

Definition at line 1367 of file class.tslib_fe.php.

References exit, header(), INTincScript(), PATH_site, and printError().

01367                               {
01368       if (!is_array($this->config) || is_array($this->config['INTincScript']) || $this->forceTemplateParsing)  {  // If config is not set by the cache (which would be a major mistake somewhere) OR if INTincScripts-include-scripts have been registered, then we must parse the template in order to get it
01369             $GLOBALS['TT']->push('Parse template','');
01370 
01371             // Force parsing, if set?:
01372          $this->tmpl->forceTemplateParsing = $this->forceTemplateParsing;
01373 
01374             // Start parsing the TS template. Might return cached version.
01375          $this->tmpl->start($this->rootLine);
01376             $GLOBALS['TT']->pull();
01377 
01378          if ($this->tmpl->loaded)   {
01379             $GLOBALS['TT']->push('Setting the config-array','');
01380          // t3lib_div::print_array($this->tmpl->setup);
01381             $this->sPre = $this->tmpl->setup['types.'][$this->type]; // toplevel - objArrayName
01382             $this->pSetup = $this->tmpl->setup[$this->sPre.'.'];
01383 
01384             if (!is_array($this->pSetup)) {
01385                $this->printError('The page is not configured! [type= '.$this->type.']['.$this->sPre.']');
01386                exit;
01387             } else {
01388                $this->config['config']=Array();
01389 
01390                   // Filling the config-array.
01391                if (is_array($this->tmpl->setup['config.'])) {
01392                   $this->config['config'] = $this->tmpl->setup['config.'];
01393                }
01394                if (is_array($this->pSetup['config.']))   {
01395                   reset($this->pSetup['config.']);
01396                   while(list($theK,$theV)=each($this->pSetup['config.']))  {
01397                      $this->config['config'][$theK] = $theV;
01398                   }
01399                }
01400                   // if .simulateStaticDocuments was not present, the default value will rule.
01401                if (!isset($this->config['config']['simulateStaticDocuments']))   {
01402                   $this->config['config']['simulateStaticDocuments'] = $this->TYPO3_CONF_VARS['FE']['simulateStaticDocuments'];
01403                }
01404 
01405                      // Processing for the config_array:
01406                $this->config['rootLine'] = $this->tmpl->rootLine;
01407                $this->config['mainScript'] = trim($this->config['config']['mainScript']) ? trim($this->config['config']['mainScript']) : 'index.php';
01408 
01409                   // STAT:
01410                $theLogFile = $this->TYPO3_CONF_VARS['FE']['logfile_dir'].$this->config['config']['stat_apache_logfile'];
01411                   // Add PATH_site left to $theLogFile if the path is not absolute yet
01412                if(!ereg("^/", $theLogFile)) $theLogFile = PATH_site.$theLogFile;
01413 
01414                if ($this->config['config']['stat_apache'] && $this->config['config']['stat_apache_logfile'] && !strstr($this->config['config']['stat_apache_logfile'],'/'))   {
01415                   if(t3lib_div::isAllowedAbsPath($theLogFile) && @is_file($theLogFile) && @is_writeable($theLogFile))   {
01416                      $this->config['stat_vars']['logFile'] = $theLogFile;
01417                      $shortTitle = substr(ereg_replace('[^\.[:alnum:]_-]','_',$this->page['title']),0,30);
01418                      $pageName = $this->config['config']['stat_apache_pagenames'] ? $this->config['config']['stat_apache_pagenames'] : '[path][title]--[uid].html';
01419                      $pageName = str_replace('[title]', $shortTitle ,$pageName);
01420                      $pageName = str_replace('[uid]',$this->page['uid'],$pageName);
01421                      $pageName = str_replace('[alias]',$this->page['alias'],$pageName);
01422                      $pageName = str_replace('[type]',$this->page['type'],$pageName);
01423                      $temp = $this->config['rootLine'];
01424                      array_pop($temp);
01425                      $len = t3lib_div::intInRange($this->config['config']['stat_titleLen'],1,100,20);
01426                      $pageName = str_replace('[path]', ereg_replace('[^\.[:alnum:]\/_-]','_',$this->sys_page->getPathFromRootline($temp,$len)).'/' ,$pageName);
01427                      $this->config['stat_vars']['pageName'] = $pageName;
01428                   } else {
01429                      $GLOBALS['TT']->setTSlogMessage('Could not set logfile path. Check filepath and permissions.',3);
01430                   }
01431                }
01432                $this->config['FEData'] = $this->tmpl->setup['FEData'];
01433                $this->config['FEData.'] = $this->tmpl->setup['FEData.'];
01434             }
01435             $GLOBALS['TT']->pull();
01436          } else {
01437             $this->printError('No template found!');
01438             exit;
01439          }
01440       }
01441 
01442          // Initialize charset settings etc.
01443       $this->initLLvars();
01444 
01445          // No cache
01446       if ($this->config['config']['no_cache'])  {$this->set_no_cache();}      // Set $this->no_cache true if the config.no_cache value is set!
01447 
01448          // Check PATH_INFO url
01449       if ($this->absRefPrefix_force && strcmp($this->config['config']['simulateStaticDocuments'],'PATH_INFO')) {
01450          $redirectUrl = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR').'index.php?id='.$this->id.'&type='.$this->type;
01451          if ($this->config['config']['simulateStaticDocuments_dontRedirectPathInfoError'])   {
01452             $this->printError('PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!<br /><br /><a href="'.htmlspecialchars($redirectUrl).'">Click here to get to the right page.</a>','Error: PATH_INFO not configured');
01453          } else {
01454             header('Location: '.t3lib_div::locationHeaderUrl($redirectUrl));
01455          }
01456          exit;
01457 //       $this->set_no_cache();  // Set no_cache if PATH_INFO is NOT used as simulateStaticDoc. and if absRefPrefix_force shows that such an URL has been passed along.
01458       }
01459    }

tslib_fe::getFromCache  ) 
 

See if page is in cache and get it if so Stores the page content in $this->content if something is found.

Returns:
void

Definition at line 1289 of file class.tslib_fe.php.

References debug(), and getHash().

01289                            {
01290       $this->tmpl->getCurrentPageData();
01291       $cc = Array();
01292       if (is_array($this->tmpl->currentPageData))  {
01293             // BE CAREFULL to change the content of the cc-array. This array is serialized and an md5-hash based on this is used for caching the page.
01294             // If this hash is not the same in here in this section and after page-generation the page will not be properly cached!
01295 
01296          $cc['all'] = $this->tmpl->currentPageData['all'];
01297          $cc['rowSum'] = $this->tmpl->currentPageData['rowSum'];
01298          $cc['rootLine'] = $this->tmpl->currentPageData['rootLine'];    // This rootline is used with templates only (matching()-function)
01299          $this->all = $this->tmpl->matching($cc);  // 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.
01300          ksort($this->all);
01301       }
01302 
01303       $this->content='';   // clearing the content-variable, which will hold the pagecontent
01304       unset($this->config);   // Unsetting the lowlevel config
01305       $this->cacheContentFlag=0;
01306       if ($this->all && !$this->no_cache) {
01307          $this->newHash = $this->getHash();
01308 
01309          $GLOBALS['TT']->push('Cache Query','');
01310             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01311                      'S.*',
01312                      'cache_pages AS S,pages AS P',
01313                      'S.hash="'.$GLOBALS['TYPO3_DB']->quoteStr($this->newHash, 'cache_pages').'"
01314                         AND S.page_id=P.uid
01315                         AND S.expires > '.intval($GLOBALS['EXEC_TIME']).'
01316                         AND NOT P.deleted
01317                         AND NOT P.hidden
01318                         AND P.starttime<='.intval($GLOBALS['EXEC_TIME']).'
01319                         AND (P.endtime=0 OR P.endtime>'.intval($GLOBALS['EXEC_TIME']).')'
01320                   );
01321          $GLOBALS['TT']->pull();
01322          $GLOBALS['TT']->push('Cache Row','');
01323             if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
01324                $this->config = unserialize($row['cache_data']);      // Fetches the lowlevel config stored with the cached data
01325                $this->content = $row['HTML'];   // Getting the content
01326                $this->cacheContentFlag=1; // Setting flag, so we know, that some cached content is gotten.
01327 
01328                if ($this->TYPO3_CONF_VARS['FE']['debug'] || $this->config['config']['debug'])   {
01329                   $this->content.=chr(10).'<!-- Cached page generated '.Date('d/m Y H:i', $row['tstamp']).'. Expires '.Date('d/m Y H:i', $row['expires']).' -->';
01330                }
01331             }
01332          $GLOBALS['TT']->pull();
01333 
01334          $GLOBALS['TYPO3_DB']->sql_free_result($res);
01335       }
01336    }

tslib_fe::getHash  ) 
 

Calculates the cache-hash This hash is unique to the template, the variables ->id, ->type, ->gr_list (list of groups), ->MP (Mount Points) and cHash array Used to get and later store the cached data.

Returns:
string MD5 hash of $this->hash_base which is a serialized version of there variables. private
See also:
getFromCache()

Definition at line 1347 of file class.tslib_fe.php.

Referenced by getFromCache().

01347                         {
01348       $this->hash_base = serialize(
01349          array(
01350             'all' => $this->all,
01351             'id' => intval($this->id),
01352             'type' => intval($this->type),
01353             'gr_list' => $this->gr_list,
01354             'MP' => $this->MP,
01355             'cHash' => $this->cHash_array
01356          )
01357       );
01358 
01359       return md5($this->hash_base);
01360    }

tslib_fe::getPageAndRootline  ) 
 

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

Returns:
void private

Definition at line 812 of file class.tslib_fe.php.

References checkRootlineForIncludeSection(), exit, getPageShortcut(), pageNotFoundAndExit(), and printError().

Referenced by getPageAndRootlineWithDomain().

00812                                  {
00813       $this->page = $this->sys_page->getPage($this->id);
00814       if (!count($this->page))   {
00815             // If no page, we try to find the page before in the rootLine.
00816          $this->pageNotFound=1;        // Page is 'not found' in case the id itself was not an accessible page. code 1
00817          $this->rootLine = $this->sys_page->getRootLine($this->id,$this->MP);
00818          if (count($this->rootLine))   {
00819             $c=count($this->rootLine)-1;
00820             while($c>0) {
00821                $c--;
00822                $this->id=$this->rootLine[$c]['uid'];
00823                $this->page = $this->sys_page->getPage($this->id);
00824                if (count($this->page)){break;}
00825             }
00826          }
00827             // If still no page...
00828          if (!count($this->page))   {
00829             if ($this->TYPO3_CONF_VARS['FE']['pageNotFound_handling'])  {
00830                $this->pageNotFoundAndExit('The requested page does not exist!');
00831             } else {
00832                $this->printError('The requested page does not exist!');
00833                exit;
00834             }
00835          }
00836       }
00837          // Is the ID a link to another page??
00838       if ($this->page['doktype']==4)   {
00839          $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.
00840          $this->page = $this->getPageShortcut($this->page['shortcut'],$this->page['shortcut_mode'],$this->page['uid']);
00841          $this->id = $this->page['uid'];
00842       }
00843          // Gets the rootLine
00844       $this->rootLine = $this->sys_page->getRootLine($this->id,$this->MP);
00845 
00846          // If not rootline we're off...
00847       if (!count($this->rootLine))  {
00848          $this->printError('The requested page didn\'t have a proper connection to the tree-root! <br /><br />('.$this->sys_page->error_getRootLine.')');
00849          exit;
00850       }
00851 
00852          // Checking for include section regarding the hidden/starttime/endtime/fe_user (that is access control of a whole subbranch!)
00853       if ($this->checkRootlineForIncludeSection()) {
00854          if (!count($this->rootLine))  {
00855             $this->printError('The requested page was not accessible!');
00856             exit;
00857          } else {
00858             $el = reset($this->rootLine);
00859             $this->id = $el['uid'];
00860             $this->page = $this->sys_page->getPage($this->id);
00861             $this->rootLine = $this->sys_page->getRootLine($this->id,$this->MP);
00862          }
00863       }
00864    }

tslib_fe::getPageAndRootlineWithDomain domainStartPage  ) 
 

Gets ->page and ->rootline information based on ->id.

->id may change during this operation. If not inside domain, then default to first page in domain.

Parameters:
integer Page uid of the page where the found domain record is (pid of the domain record)
Returns:
void private

Definition at line 1026 of file class.tslib_fe.php.

References $domainStartPage, $val, and getPageAndRootline().

Referenced by fetch_the_id().

01026                                                             {
01027       $this->getPageAndRootline();
01028 
01029       // Checks if the $domain-startpage is in the rootLine. This is necessary so that references to page-id's from other domains are not possible.
01030       if ($domainStartPage && is_array($this->rootLine)) {
01031          reset ($this->rootLine);
01032          $idFound = 0;
01033          while(list($key,$val)=each($this->rootLine)) {
01034             if ($val['uid']==$domainStartPage)  {
01035                $idFound=1;
01036                break;
01037             }
01038          }
01039          if (!$idFound) {
01040             $this->pageNotFound=3;        // Page is 'not found' in case the id was outside the domain, code 3
01041             $this->id = $domainStartPage;
01042             $this->getPageAndRootline();     //re-get the page and rootline if the id was not found.
01043          }
01044       }
01045    }

tslib_fe::getPagesGroupClause  ) 
 

Return where-clause for group access.

Returns:
string Group where clause part private

Definition at line 1063 of file class.tslib_fe.php.

01063                                    {
01064       return ' AND fe_group IN ('.$this->gr_list.')';
01065    }

tslib_fe::getPageShortcut SC,
mode,
thisUid,
itera = 20,
pageLog = array()
 

Get page shortcut; Finds the records pointed to by input value $SC (the shortcut value).

Parameters:
integer The value of the "shortcut" field from the pages record
integer The shortcut mode: 1 and 2 will select either first subpage or random subpage; the default is the page pointed to by $SC
integer The current page UID of the page which is a shortcut
integer Safety feature which makes sure that the function is calling itself recursively max 20 times (since this function can find shortcuts to other shortcuts to other shortcuts...)
array An array filled with previous page uids tested by the function - new page uids are evaluated against this to avoid going in circles.
Returns:
mixed Returns the page record of the page that the shortcut pointed to. private
See also:
getPageAndRootline()

Definition at line 878 of file class.tslib_fe.php.

References $page, $page, and printError().

Referenced by getPageAndRootline().

00878                                                                            {
00879       $idArray = t3lib_div::intExplode(',',$SC);
00880 
00881          // Find $page record depending on shortcut mode:
00882       switch($mode)  {
00883          case 1:
00884          case 2:
00885             $pageArray = $this->sys_page->getMenu($idArray[0]?$idArray[0]:$thisUid,'*','sorting','AND pages.doktype<199 AND pages.doktype!=6');
00886             $pO = 0;
00887             if ($mode==2 && count($pageArray))  {  // random
00888                $this->make_seed();
00889                $randval = intval(rand(0,count($pageArray)-1));
00890                $pO = $randval;
00891             }
00892             $c = 0;
00893             reset($pageArray);
00894             while(list(,$pV)=each($pageArray))  {
00895                if ($c==$pO)   {
00896                   $page = $pV;
00897                   break;
00898                }
00899                $c++;
00900             }
00901          break;
00902          default:
00903             $page = $this->sys_page->getPage($idArray[0]);
00904          break;
00905       }
00906 
00907          // Check if short cut page was a shortcut itself, if so look up recursively:
00908       if ($page['doktype']==4)   {
00909          if (!in_array($page['uid'],$pageLog) && $itera>0)  {
00910             $pageLog[] = $page['uid'];
00911             $page = $this->getPageShortcut($page['shortcut'],$page['shortcut_mode'],$page['uid'],$itera-1,$pageLog);
00912          } else {
00913             $pageLog[] = $page['uid'];
00914             $this->printError('Page shortcuts were looping in uids '.implode(',',$pageLog).'...!');
00915             exit;
00916          }
00917       }
00918          // Return resulting page:
00919       return $page;
00920    }

tslib_fe::getSimulFileName  ) 
 

Returns the simulated static file name (*.html) for the current page (using the page record in $this->page).

Returns:
string The filename (without path)
See also:
makeSimulFileName(), publish.php

Definition at line 2731 of file class.tslib_fe.php.

02731                                  {
02732       $url='';
02733       $url.=$this->makeSimulFileName($this->page['title'], $this->page['alias']?$this->page['alias']:$this->id, $this->type).'.html';
02734       return $url;
02735    }

tslib_fe::idPartsAnalyze str  ) 
 

Analyzes the second part of a id-string (after the "+"), looking for B6 or M5 encoding and if found it will resolve it and restore the variables in global $_GET (but NOT $_GET - yet) If values for ->cHash, ->no_cache, ->jumpurl and ->MP is found, they are also loaded into the internal vars of this class.

Parameters:
string String to analyze
Returns:
void private

Definition at line 1160 of file class.tslib_fe.php.

References mergingWithGetVars(), and updateMD5paramsRecord().

Referenced by fetch_the_id().

01160                                  {
01161       $GET_VARS = '';
01162       switch(substr($str,0,2))   {
01163          case 'B6':
01164             $addParams = base64_decode(str_replace('_','=',str_replace('-','/',substr($str,2))));
01165             parse_str($addParams,$GET_VARS);
01166          break;
01167          case 'M5':
01168             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('params', 'cache_md5params', 'md5hash="'.$GLOBALS['TYPO3_DB']->quoteStr(substr($str,2), 'cache_md5params').'"');
01169             $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
01170 
01171             $this->updateMD5paramsRecord(substr($str,2));
01172             parse_str($row['params'],$GET_VARS);
01173          break;
01174       }
01175 
01176       $this->mergingWithGetVars($GET_VARS);
01177    }

tslib_fe::includeTCA TCAloaded = 1  ) 
 

Includes full TCA.

Normally in the frontend only a part of the global $TCA array is loaded, for instance the "ctrl" part. Thus it doesn't take up too much memory. If you need the FULL TCA available for some reason (like plugins using it) you should call this function which will include the FULL TCA. Global vars $TCA, $PAGES_TYPES, $LANG_GENERAL_LABELS can/will be affected. The flag $this->TCAloaded will make sure that such an inclusion happens only once since; If $this->TCAloaded is set, nothing is included.

Parameters:
boolean Probably, keep hands of this value. Just don't set it. (This may affect the first-ever time this function is called since if you set it to zero/false any subsequent call will still trigger the inclusion; In other words, this value will be set in $this->TCAloaded after inclusion and therefore if its false, another inclusion will be possible on the next call. See ->getCompressedTCarray())
Returns:
void
See also:
getCompressedTCarray()

Definition at line 1543 of file class.tslib_fe.php.

References $TCA, PATH_t3lib, PATH_typo3conf, and TYPO3_tables_script.

Referenced by getCompressedTCarray().

01543                                        {
01544       global $TCA, $PAGES_TYPES, $LANG_GENERAL_LABELS, $TBE_MODULES;
01545       if (!$this->TCAloaded)  {
01546          $TCA = Array();
01547          include (TYPO3_tables_script ? PATH_typo3conf.TYPO3_tables_script : PATH_t3lib.'stddb/tables.php');
01548             // Extension additions
01549          if ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE']) {
01550             include(PATH_typo3conf.$GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'].'_ext_tables.php');
01551          } else {
01552             include(PATH_t3lib.'stddb/load_ext_tables.php');
01553          }
01554             // ext-script
01555          if (TYPO3_extTableDef_script) {
01556             include (PATH_typo3conf.TYPO3_extTableDef_script);
01557          }
01558 
01559          $this->TCAloaded = $TCAloaded;
01560       }
01561    }

tslib_fe::initFEuser  ) 
 

Initializes the front-end login user.

Returns:
void

Definition at line 461 of file class.tslib_fe.php.

00461                            {
00462       $this->fe_user = t3lib_div::makeInstance('tslib_feUserAuth');
00463 
00464       $this->fe_user->lockIP = $this->TYPO3_CONF_VARS['FE']['lockIP'];
00465       $this->fe_user->lockHashKeyWords = $this->TYPO3_CONF_VARS['FE']['lockHashKeyWords'];
00466       $this->fe_user->checkPid = $this->TYPO3_CONF_VARS['FE']['checkFeUserPid'];
00467       $this->fe_user->checkPid_value = $GLOBALS['TYPO3_DB']->cleanIntList(t3lib_div::_GP('pid'));  // List of pid's acceptable
00468 
00469          // Check if a session is transferred:
00470       if (t3lib_div::_GP('FE_SESSION_KEY'))  {
00471          $fe_sParts = explode('-',t3lib_div::_GP('FE_SESSION_KEY'));
00472          if (!strcmp(md5($fe_sParts[0].'/'.$this->TYPO3_CONF_VARS['SYS']['encryptionKey']), $fe_sParts[1])) {  // If the session key hash check is OK:
00473             $_COOKIE[$this->fe_user->name]=$fe_sParts[0];
00474             $this->fe_user->forceSetCookie=1;
00475          }
00476       }
00477 
00478       if ($this->TYPO3_CONF_VARS['FE']['dontSetCookie']) {
00479          $this->fe_user->dontSetCookie=1;
00480       }
00481 
00482       $this->fe_user->start();
00483       $this->fe_user->unpack_uc('');
00484       $this->fe_user->fetchSessionData(); // Gets session data
00485       $recs = t3lib_div::_GP('recs');
00486       if (is_array($recs)) {  // If any record registration is submitted, register the record.
00487          $this->fe_user->record_registration($recs);
00488       }
00489 
00490          // For every 60 seconds the is_online timestamp is updated.
00491       if (is_array($this->fe_user->user) && $this->fe_user->user['is_online']<($GLOBALS['EXEC_TIME']-60))   {
00492          $GLOBALS['TYPO3_DB']->exec_UPDATEquery('fe_users', 'uid='.intval($this->fe_user->user['uid']), array('is_online' => $GLOBALS['EXEC_TIME']));
00493       }
00494    }

tslib_fe::initTemplate  ) 
 

Initialize the TypoScript template parser.

Returns:
void

Definition at line 1277 of file class.tslib_fe.php.

01277                            {
01278       $this->tmpl = t3lib_div::makeInstance('t3lib_TStemplate');
01279       $this->tmpl->init();
01280       $this->tmpl->tt_track= $this->beUserLogin ? 1 : 0;
01281    }

tslib_fe::initUserGroups  ) 
 

Initializes the front-end user groups.

Returns:
void

Definition at line 501 of file class.tslib_fe.php.

Referenced by fetch_the_id().

00501                              {
00502          // Sets ->loginUser and ->gr_list based on front-end user status.
00503       $this->fe_user->showHiddenRecords = $this->showHiddenRecords;     // This affects the hidden-flag selecting the fe_groups for the user!
00504       // if (is_array($this->fe_user->user) && $this->fe_user->fetchGroupData()) {
00505       $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.
00506       if (is_array($this->fe_user->user) && count($this->fe_user->groupData['uid']))   {
00507          $this->loginUser=1;  // global flag!
00508          $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!
00509          $gr_array = $this->fe_user->groupData['uid'];
00510       } else {
00511          $this->loginUser=0;
00512          $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!
00513          $gr_array = $this->fe_user->groupData['uid'];
00514       }
00515 
00516       // TYPO3_CONF_VARS']['FE']['IPmaskMountGroups'] moved to sysext/sv/class.tx_sv_auth.php service
00517 
00518          // Clean up.
00519       $gr_array = array_unique($gr_array);   // Make unique...
00520       sort($gr_array);  // sort
00521       if (count($gr_array))   {
00522          $this->gr_list.=','.implode(',',$gr_array);
00523       }
00524 
00525       if ($this->fe_user->writeDevLog)    t3lib_div::devLog('Valid usergroups for TSFE: '.$this->gr_list, 'tslib_fe');
00526    }

tslib_fe::INTincScript  ) 
 

Processes the INTinclude-scripts.

Returns:
void

Definition at line 2227 of file class.tslib_fe.php.

References $INTiS_config, additionalHeaderData, header(), and section().

Referenced by getConfigArray().

02227                            {
02228       $GLOBALS['TT']->push('Split content');
02229       $INTiS_splitC = explode('<!--INT_SCRIPT.',$this->content);        // Splits content with the key.
02230       $this->content='';
02231       $GLOBALS['TT']->setTSlogMessage('Parts: '.count($INTiS_splitC));
02232       $GLOBALS['TT']->pull();
02233 
02234          // Depreciated stuff:
02235       $this->additionalHeaderData = is_array($this->config['INTincScript_ext']['additionalHeaderData']) ? $this->config['INTincScript_ext']['additionalHeaderData'] : array();
02236       $this->additionalJavaScript = $this->config['INTincScript_ext']['additionalJavaScript'];
02237       $this->additionalCSS = $this->config['INTincScript_ext']['additionalCSS'];
02238       $this->JSCode = $this->additionalHeaderData['JSCode'];
02239       $this->JSImgCode = $this->additionalHeaderData['JSImgCode'];
02240       $this->divSection='';
02241 
02242       $INTiS_config = $GLOBALS['TSFE']->config['INTincScript'];
02243       foreach($INTiS_splitC as $INTiS_c => $INTiS_cPart) {
02244          if (substr($INTiS_cPart,32,3)=='-->')  {  // If the split had a comment-end after 32 characters it's probably a split-string
02245             $GLOBALS['TT']->push('Include '.$INTiS_config[$INTiS_key]['file'],'');
02246             $INTiS_key = 'INT_SCRIPT.'.substr($INTiS_cPart,0,32);
02247             $incContent='';
02248             if (is_array($INTiS_config[$INTiS_key]))  {
02249                $INTiS_cObj = unserialize($INTiS_config[$INTiS_key]['cObj']);
02250                $INTiS_cObj->INT_include=1;
02251                switch($INTiS_config[$INTiS_key]['type']) {
02252                   case 'SCRIPT':
02253                      $incContent = $INTiS_cObj->PHP_SCRIPT($INTiS_config[$INTiS_key]['conf']);
02254                   break;
02255                   case 'COA':
02256                      $incContent = $INTiS_cObj->COBJ_ARRAY($INTiS_config[$INTiS_key]['conf']);
02257                   break;
02258                   case 'FUNC':
02259                      $incContent = $INTiS_cObj->USER($INTiS_config[$INTiS_key]['conf']);
02260                   break;
02261                   case 'POSTUSERFUNC':
02262                      $incContent = $INTiS_cObj->callUserFunction($INTiS_config[$INTiS_key]['postUserFunc'], $INTiS_config[$INTiS_key]['conf'], $INTiS_config[$INTiS_key]['content']);
02263                   break;
02264                }
02265             }
02266             $this->content.= $this->convOutputCharset($incContent,'INC-'.$INTiS_c);
02267             $this->content.= substr($INTiS_cPart,35);
02268             $GLOBALS['TT']->pull($incContent);
02269          } else {
02270             $this->content.= ($INTiS_c?'<!--INT_SCRIPT.':'').$INTiS_cPart;
02271          }
02272       }
02273       $GLOBALS['TT']->push('Substitute header section');
02274       $this->INTincScript_loadJSCode();
02275       $this->content = str_replace('<!--HD_'.$this->config['INTincScript_ext']['divKey'].'-->', $this->convOutputCharset(implode(chr(10),$this->additionalHeaderData),'HD'), $this->content);
02276       $this->content = str_replace('<!--TDS_'.$this->config['INTincScript_ext']['divKey'].'-->', $this->convOutputCharset($this->divSection,'TDS'), $this->content);
02277       $this->setAbsRefPrefix();
02278       $GLOBALS['TT']->pull();
02279    }

tslib_fe::INTincScript_loadJSCode  ) 
 

Loads the JavaScript code for INTincScript.

Returns:
void private

Definition at line 2287 of file class.tslib_fe.php.

References additionalHeaderData.

02287                                        {
02288       if ($this->JSImgCode)   {  // If any images added, then add them to the javascript section
02289          $this->additionalHeaderData['JSImgCode']='
02290 <script type="text/javascript">
02291    /*<![CDATA[*/
02292 <!--
02293 if (version == "n3") {
02294 '.trim($this->JSImgCode).'
02295 }
02296 // -->
02297    /*]]>*/
02298 </script>';
02299       }
02300       if ($this->JSCode || count($this->additionalJavaScript)) {  // Add javascript
02301          $this->additionalHeaderData['JSCode']='
02302 <script type="text/javascript">
02303    /*<![CDATA[*/
02304 <!--
02305 '.implode(chr(10),$this->additionalJavaScript).'
02306 '.trim($this->JSCode).'
02307 // -->
02308    /*]]>*/
02309 </script>';
02310       }
02311       if (count($this->additionalCSS)) {  // Add javascript
02312          $this->additionalHeaderData['_CSS']='
02313 <style type="text/css">
02314    /*<![CDATA[*/
02315 <!--
02316 '.implode(chr(10),$this->additionalCSS).'
02317 // -->
02318    /*]]>*/
02319 </style>';
02320       }
02321    }

tslib_fe::isEXTincScript  ) 
 

Determines if any EXTincScripts should be included.

Returns:
boolean True, if external php scripts should be included (set by PHP_SCRIPT_EXT cObjects)
See also:
tslib_cObj::PHP_SCRIPT

Definition at line 2454 of file class.tslib_fe.php.

02454                               {
02455       return is_array($this->config['EXTincScript']);
02456    }

tslib_fe::isGeneratePage  ) 
 

Returns true if the page should be generated That is if jumpurl is not set and the cacheContentFlag is not set.

Returns:
boolean

Definition at line 1951 of file class.tslib_fe.php.

01951                               {
01952       return (!$this->cacheContentFlag && !$this->jumpurl);
01953    }

tslib_fe::isINTincScript  ) 
 

Determines if there are any INTincScripts to include.

Returns:
boolean Returns true if scripts are found (and not jumpurl)

Definition at line 2328 of file class.tslib_fe.php.

02328                               {
02329       return   (is_array($this->config['INTincScript']) && !$this->jumpurl);
02330    }

tslib_fe::isOutputting  ) 
 

Determines if content should be outputted.

Outputting content is done only if jumpurl is NOT set.

Returns:
boolean Returns true if $this->jumpurl is not set.

Definition at line 2377 of file class.tslib_fe.php.

02377                            {
02378       return (!$this->jumpurl);
02379    }

tslib_fe::jumpUrl  ) 
 

Sends a header 'Location' to jumpurl, if jumpurl is set.

Will exit if a location header is sent (for instance if JumpUrl was triggered)

Returns:
void

Definition at line 1865 of file class.tslib_fe.php.

References locDataCheck().

01865                         {
01866       if ($this->jumpurl)  {
01867          if (t3lib_div::_GP('juSecure'))  {
01868             $hArr = array(
01869                $this->jumpurl,
01870                t3lib_div::_GP('locationData'),
01871                $this->TYPO3_CONF_VARS['SYS']['encryptionKey']
01872             );
01873             $calcJuHash=t3lib_div::shortMD5(serialize($hArr));
01874             $locationData = t3lib_div::_GP('locationData');
01875             $juHash = t3lib_div::_GP('juHash');
01876             if ($juHash == $calcJuHash)   {
01877                if ($this->locDataCheck($locationData))   {
01878                   $this->jumpurl = rawurldecode($this->jumpurl);  // 211002 - goes with cObj->filelink() rawurlencode() of filenames so spaces can be allowed.
01879                   if (@is_file($this->jumpurl)) {
01880                      $mimeType = t3lib_div::_GP('mimeType');
01881                      $mimeType = $mimeType ? $mimeType : 'application/octet-stream';
01882                      Header('Content-Type: '.$mimeType);
01883                      Header('Content-Disposition: attachment; filename='.basename($this->jumpurl));
01884                      readfile($this->jumpurl);
01885                      exit;
01886                   } else die('jumpurl Secure: "'.$this->jumpurl.'" was not a valid file!');
01887                } else die('jumpurl Secure: locationData, '.$locationData.', was not accessible.');
01888             } else die('jumpurl Secure: Calculated juHash, '.$calcJuHash.', did not match the submitted juHash.');
01889          } else {
01890             $TSConf = $this->getPagesTSconfig();
01891             if ($TSConf['TSFE.']['jumpUrl_transferSession'])   {
01892                $uParts = parse_url($this->jumpurl);
01893                $params = '&FE_SESSION_KEY='.rawurlencode($this->fe_user->id.'-'.md5($this->fe_user->id.'/'.$this->TYPO3_CONF_VARS['SYS']['encryptionKey']));
01894                $this->jumpurl.=($uParts['query']?'':'?').$params; // Add the session parameter ...
01895             }
01896             Header('Location: '.$this->jumpurl);
01897             exit;
01898          }
01899       }
01900    }

tslib_fe::locDataCheck locationData  ) 
 

Checks if a formmail submission can be sent as email.

Parameters:
string The input from $_POST['locationData']
Returns:
void private
See also:
checkDataSubmission()

Definition at line 1724 of file class.tslib_fe.php.

Referenced by checkDataSubmission(), and jumpUrl().

01724                                           {
01725       $locData = explode(':',$locationData);
01726       if (!$locData[1] ||  $this->sys_page->checkRecord($locData[1],$locData[2],1)) {
01727          if (count($this->sys_page->getPage($locData[0])))  {  // $locData[1] -check means that a record is checked only if the locationData has a value for a record else than the page.
01728             return 1;
01729          } else $GLOBALS['TT']->setTSlogMessage('LocationData Error: The page pointed to by location data ('.$locationData.') was not accessible.',2);
01730       } else $GLOBALS['TT']->setTSlogMessage('LocationData Error: Location data ('.$locationData.') record pointed to was not accessible.',2);
01731    }

tslib_fe::makeCacheHash  ) 
 

Calculates a hash string based on additional parameters in the url.

This is used to cache pages with more parameters than just id and type

Returns:
void

Definition at line 1233 of file class.tslib_fe.php.

References cHashParams().

01233                               {
01234       $GET = t3lib_div::_GET();
01235       if ($this->cHash && is_array($GET)) {
01236          $pA = $this->cHashParams(t3lib_div::implodeArrayForUrl('',$GET));
01237          $this->cHash_array = $pA;
01238          $cHash_calc = t3lib_div::shortMD5(serialize($this->cHash_array));
01239 #debug(array($cHash_calc,$this->cHash,$pA));
01240          if ($cHash_calc!=$this->cHash)   {
01241             $this->set_no_cache();
01242             $GLOBALS['TT']->setTSlogMessage('The incoming cHash "'.$this->cHash.'" and calculated cHash "'.$cHash_calc.'" did not match, so caching was disabled. The fieldlist used was "'.implode(',',array_keys($pA)).'"',2);
01243          }
01244       }
01245    }

tslib_fe::makeSimulFileName inTitle,
page,
type,
addParams = '',
no_cache = ''
 

Make simulation filename (without the ".html" ending, only body of filename).

Parameters:
string The page title to use
mixed The page id (integer) or alias (string)
integer The type number
string Query-parameters to encode (will be done only if caching is enabled and TypoScript configured for it. I don't know it this makes much sense in fact...)
boolean The "no_cache" status of the link.
Returns:
string The body of the filename.
See also:
getSimulFileName(), t3lib_tstemplate::linkData(), tslib_frameset::frameParams()

Definition at line 2655 of file class.tslib_fe.php.

References $out.

02655                                                                                  {
02656       $titleChars = intval($this->config['config']['simulateStaticDocuments_addTitle']);
02657       $out = '';
02658       if ($titleChars)  {
02659          $out = $this->csConvObj->specCharsToASCII($this->renderCharset, $inTitle);
02660          $out= ereg_replace('[^[:alnum:]_-]','_',trim(substr($out,0,$titleChars)));
02661          $out= ereg_replace('_*$','',$out);
02662          $out= ereg_replace('^_*','',$out);
02663          if ($out)   $out.='.';
02664       }
02665       $enc = '';
02666       if (strcmp($addParams,'') && !$no_cache)  {
02667          switch ((string)$this->config['config']['simulateStaticDocuments_pEnc'])   {
02668             case 'md5':
02669                $md5=substr(md5($addParams),0,10);
02670                $enc='+M5'.$md5;
02671 
02672                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('md5hash', 'cache_md5params', 'md5hash="'.$GLOBALS['TYPO3_DB']->quoteStr($md5, 'cache_md5params').'"');
02673                if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res))  {
02674                   $insertFields = array(
02675                      'md5hash' => $md5,
02676                      'tstamp' => time(),
02677                      'type' => 1,
02678                      'params' => $addParams
02679                   );
02680 
02681                   $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_md5params', $insertFields);
02682                }
02683             break;
02684             case 'base64':
02685                $enc='+B6'.str_replace('=','_',str_replace('/','-',base64_encode($addParams)));
02686             break;
02687          }
02688       }
02689          // Setting page and type number:
02690       $url = $out.$page.$enc;
02691       $url.= ($type || $out || !$this->config['config']['simulateStaticDocuments_noTypeIfNoTitle']) ? '.'.$type : '';
02692       return $url;
02693    }

tslib_fe::mergingWithGetVars GET_VARS  ) 
 

Merging values into the global $_GET.

Parameters:
array Array of key/value pairs that will be merged into the current GET-vars. (Non-escaped values)
Returns:
void

Definition at line 1185 of file class.tslib_fe.php.

Referenced by idPartsAnalyze().

01185                                           {
01186       if (is_array($GET_VARS))   {
01187          $realGet = t3lib_div::_GET();    // Getting $_GET var, unescaped.
01188          if (!is_array($realGet))   $realGet = array();
01189 
01190             // Merge new values on top:
01191          $realGet = t3lib_div::array_merge_recursive_overrule($realGet,$GET_VARS);
01192 
01193             // Write values back to $_GET:
01194          t3lib_div::_GETset($realGet);
01195 
01196             // Setting these specifically (like in the init-function):
01197          if (isset($GET_VARS['type']))    $this->type = intval($GET_VARS['type']);
01198          if (isset($GET_VARS['cHash']))      $this->cHash = $GET_VARS['cHash'];
01199          if (isset($GET_VARS['jumpurl'])) $this->jumpurl = $GET_VARS['jumpurl'];
01200          if (isset($GET_VARS['MP']))         $this->MP = $this->TYPO3_CONF_VARS['FE']['enable_mount_pids'] ? $GET_VARS['MP'] : '';
01201 
01202          if (isset($GET_VARS['no_cache']) && $GET_VARS['no_cache'])  $this->set_no_cache();
01203       }
01204    }

tslib_fe::newCObj  ) 
 

Creates an instance of tslib_cObj in $this->cObj This instance is used to start the rendering of the TypoScript template structure.

Returns:
void
See also:
pagegen.php

Definition at line 2824 of file class.tslib_fe.php.

02824                         {
02825       $this->cObj =t3lib_div::makeInstance('tslib_cObj');
02826       $this->cObj->start($this->page,'pages');
02827    }

tslib_fe::pageNotFoundAndExit reason = ''  ) 
 

Page-not-found handler for use in frontend plugins from extensions.

Parameters:
string Reason text
Returns:
void Function exits.

Definition at line 1093 of file class.tslib_fe.php.

References pageNotFoundHandler().

Referenced by fetch_the_id(), getPageAndRootline(), and settingLanguage().

01093                                              {
01094       $this->pageNotFoundHandler($this->TYPO3_CONF_VARS['FE']['pageNotFound_handling'], $this->TYPO3_CONF_VARS['FE']['pageNotFound_handling_statheader'], $reason);
01095       exit;
01096    }

tslib_fe::pageNotFoundHandler code,
header = '',
reason = ''
 

Page not found handler.

Exits.

Parameters:
mixed Which type of handling; If a true PHP-boolean and TRUE then a ->printError message is outputted. If integer an error message with that number is shown. Otherwise the $code value is expected to be a "Location:" header value.
string If set, this is passed directly to the PHP function, header()
string If set, error messages will also mention this as the reason for the page-not-found.
Returns:
void (The function exists!)

Definition at line 1107 of file class.tslib_fe.php.

References header(), and printError().

Referenced by pageNotFoundAndExit().

01107                                                                {
01108          // Issue header in any case:
01109       if ($header)   {header($header);}
01110 
01111          // Create response:
01112       if (gettype($code)=='boolean' || !strcmp($code,1)) {
01113          $this->printError('The page did not exist or was inaccessible.'.($reason ? ' Reason: '.htmlspecialchars($reason) : ''));
01114          exit;
01115       } else if (t3lib_div::testInt($code))  {
01116          $this->printError('Error '.$code.($reason ? ' Reason: '.htmlspecialchars($reason) : ''));
01117          exit;
01118       } elseif (t3lib_div::isFirstPartOfStr($code,'READFILE:')) {
01119          $readFile = t3lib_div::getFileAbsFileName(trim(substr($code,9)));
01120          if (@is_file($readFile))   {
01121             $fileContent = t3lib_div::getUrl($readFile);
01122             $fileContent = str_replace('###CURRENT_URL###', t3lib_div::getIndpEnv('REQUEST_URI'), $fileContent);
01123             $fileContent = str_replace('###REASON###', htmlspecialchars($reason), $fileContent);
01124             echo $fileContent;
01125       } else {
01126             $this->printError('Configuration Error: 404 page "'.$readFile.'" could not be found.');
01127          }
01128          exit;
01129       } elseif (strlen($code)) {
01130          header('Location: '.t3lib_div::locationHeaderUrl($code));
01131          exit;
01132       } else {
01133          $this->printError('Error.'.($reason ? ' Reason: '.htmlspecialchars($reason) : ''));
01134          exit;
01135       }
01136    }

tslib_fe::prefixLocalAnchorsWithScript  ) 
 

Substitutes all occurencies of <a href="#"...

in $this->content with <a href="[path-to-url]#"...

Returns:
void Works directly on $this->content

Definition at line 2918 of file class.tslib_fe.php.

tslib_fe::previewInfo  ) 
 

Outputs preview info.

Returns:
void

Definition at line 2579 of file class.tslib_fe.php.

02579                            {
02580       if ($this->fePreview)   {
02581             $stdMsg = '
02582             <br />
02583             <div align="center">
02584                <table border="3" bordercolor="black" cellpadding="2" bgcolor="red">
02585                   <tr>
02586                      <td>&nbsp;&nbsp;<font face="Verdana" size="1"><b>PREVIEW!</b></font>&nbsp;&nbsp;</td>
02587                   </tr>
02588                </table>
02589             </div>';
02590             $temp_content = $this->config['config']['message_preview'] ? $this->config['config']['message_preview'] : $stdMsg;
02591             echo $temp_content;
02592       }
02593    }

tslib_fe::printError label,
header = 'Error!'
 

Prints error msg/header.

Echoes out the HTML content

Parameters:
string Message string
string Header string
Returns:
void
See also:
t3lib_timeTrack::debug_typo3PrintError()

Definition at line 2870 of file class.tslib_fe.php.

References header().

Referenced by connectToMySQL(), fetch_the_id(), getConfigArray(), getPageAndRootline(), getPageShortcut(), and pageNotFoundHandler().

02870                                                 {
02871       t3lib_timeTrack::debug_typo3PrintError($header,$label,0,t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
02872    }

tslib_fe::processOutput  ) 
 

Processes the output before it's actually outputted.

Sends headers also. This includes substituting the USERNAME comment, getMethodUrlIdToken, sending additional headers (as defined in the TypoScript "config.additionalheaders" object), tidy'ing content, XHTML cleaning content (if configured) Works on $this->content

Returns:
void

Definition at line 2388 of file class.tslib_fe.php.

References header().

02388                               {
02389          // Substitutes username mark with the username
02390       if ($this->fe_user->user['uid']) {
02391          $token = trim($this->config['config']['USERNAME_substToken']);
02392          $this->content = str_replace($token ? $token : '<!--###USERNAME###-->',$this->fe_user->user['username'],$this->content);
02393       }
02394          // Substitutes get_URL_ID in case of GET-fallback
02395       if ($this->getMethodUrlIdToken)  {
02396          $this->content = str_replace($this->getMethodUrlIdToken, $this->fe_user->get_URL_ID, $this->content);
02397       }
02398 
02399          // Set header for charset-encoding unless disabled
02400       if (!$this->config['config']['disableCharsetHeader']) {
02401          $headLine = 'Content-Type:text/html;charset='.trim($this->metaCharset);
02402          header ($headLine);
02403       }
02404 
02405          // Set headers, if any
02406       if ($this->config['config']['additionalHeaders'])  {
02407          $headerArray = explode('|', $this->config['config']['additionalHeaders']);
02408          while(list(,$headLine)=each($headerArray))   {
02409             $headLine = trim($headLine);
02410             header($headLine);
02411          }
02412       }
02413 
02414             // Tidy up the code, if flag...
02415       if ($this->TYPO3_CONF_VARS['FE']['tidy_option'] == 'output')      {
02416          $GLOBALS['TT']->push('Tidy, output','');
02417             $this->content = $this->tidyHTML($this->content);
02418          $GLOBALS['TT']->pull();
02419       }
02420          // XHTML-clean the code, if flag set
02421       if ($this->doXHTML_cleaning() == 'output')      {
02422          $GLOBALS['TT']->push('XHTML clean, output','');
02423             $XHTML_clean = t3lib_div::makeInstance('t3lib_parsehtml');
02424             $this->content = $XHTML_clean->XHTML_clean($this->content);
02425          $GLOBALS['TT']->pull();
02426       }
02427          // Fix local anchors in links, if flag set
02428       if ($this->doLocalAnchorFix() == 'output')      {
02429          $GLOBALS['TT']->push('Local anchor fix, output','');
02430             $this->prefixLocalAnchorsWithScript();
02431          $GLOBALS['TT']->pull();
02432       }
02433 
02434          // Hook for post-processing of page content before output:
02435       if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-output']))   {
02436          $_params = array('pObj' => &$this);
02437          foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-output'] as $_funcRef)  {
02438             t3lib_div::callUserFunction($_funcRef,$_params,$this);
02439          }
02440       }
02441 
02442 /*    if ($this->beUserLogin && t3lib_div::_GP('ADMCMD_view')) {     // This is a try to change target=_top to target=_self if pages are shown in the Web>View module...
02443          $this->content = str_replace('target="_top"','target="_self"',$this->content);
02444          $this->content = str_replace('target=_top','target="_self"',$this->content);
02445       }*/
02446    }

tslib_fe::realPageCacheContent  ) 
 

Set cache content to $this->content.

Returns:
void

Definition at line 1992 of file class.tslib_fe.php.

References setPageCacheContent().

01992                                     {
01993       $cache_timeout = $this->page['cache_timeout'] ? $this->page['cache_timeout'] : ($this->cacheTimeOutDefault ? $this->cacheTimeOutDefault : 60*60*24);     // seconds until a cached page is too old
01994       $timeOutTime = $GLOBALS['EXEC_TIME']+$cache_timeout;
01995       if ($this->config['config']['cache_clearAtMidnight']) {
01996          $midnightTime = mktime (0,0,0,date('m',$timeOutTime),date('d',$timeOutTime),date('Y',$timeOutTime));
01997          if ($midnightTime > time())   {     // If the midnight time of the expire-day is greater than the current time, we may set the timeOutTime to the new midnighttime.
01998             $timeOutTime = $midnightTime;
01999          }
02000       }
02001       $this->config['hash_base'] = $this->hash_base;
02002       $this->setPageCacheContent($this->content,$this->config,$timeOutTime);
02003 
02004          // Hook for cache post processing (eg. writing static files!)
02005       if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['insertPageIncache']))  {
02006          foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['insertPageIncache'] as $_classRef)   {
02007             $_procObj = &t3lib_div::getUserObj($_classRef);
02008             $_procObj->insertPageIncache($this,$timeOutTime);
02009          }
02010       }
02011    }

tslib_fe::roundTripCryptString string  ) 
 

Encrypts a strings by XOR'ing all characters with the ASCII value of a character in $this->TYPO3_CONF_VARS['SYS']['encryptionKey'] If $this->TYPO3_CONF_VARS['SYS']['encryptionKey'] is empty, 255 is used for XOR'ing.

Using XOR means that the string can be decrypted by simply calling the function again - just like rot-13 works (but in this case for ANY byte value).

Parameters:
string Input string
Returns:
string Output string

Definition at line 2789 of file class.tslib_fe.php.

References $a, and $out.

02789                                           {
02790       $out = '';
02791       $strLen = strlen($string);
02792       $cryptLen = strlen($this->TYPO3_CONF_VARS['SYS']['encryptionKey']);
02793 
02794       for ($a=0; $a < $strLen; $a++)   {
02795          $xorVal = $cryptLen>0 ? ord($this->TYPO3_CONF_VARS['SYS']['encryptionKey']{($a%$cryptLen)}) : 255;
02796          $out.= chr(ord($string{$a}) ^ $xorVal);
02797       }
02798 
02799       return $out;
02800    }

tslib_fe::sendFormmail  ) 
 

Sends the emails from the formmail content object.

Returns:
void private
See also:
checkDataSubmission()

Definition at line 1740 of file class.tslib_fe.php.

References codeString(), and sendFormmail().

Referenced by sendFormmail().

01740                            {
01741       $formmail = t3lib_div::makeInstance('t3lib_formmail');
01742 
01743       $EMAIL_VARS = t3lib_div::_POST();
01744       unset($EMAIL_VARS['locationData']);
01745       unset($EMAIL_VARS['formtype_mail']);
01746 
01747       $integrityCheck = $this->TYPO3_CONF_VARS['FE']['strictFormmail'];
01748 
01749          // Check recipient field:
01750       $encodedFields = explode(',','recipient,recipient_copy');   // These two fields are the ones which contain recipient addresses that can be misused to send mail from foreign servers.
01751       foreach($encodedFields as $fieldKey)   {
01752          if (strlen($EMAIL_VARS[$fieldKey])) {
01753             if ($res = $this->codeString($EMAIL_VARS[$fieldKey], TRUE)) {  // Decode...
01754                $EMAIL_VARS[$fieldKey] = $res;   // Set value if OK
01755             } elseif ($integrityCheck) {  // Otherwise abort:
01756                $GLOBALS['TT']->setTSlogMessage('"Formmail" discovered a field ('.$fieldKey.') which could not be decoded to a valid string. Sending formmail aborted due to security reasons!',3);
01757                return FALSE;
01758             } else {
01759                $GLOBALS['TT']->setTSlogMessage('"Formmail" discovered a field ('.$fieldKey.') which could not be decoded to a valid string. The security level accepts this, but you should consider a correct coding though!',2);
01760             }
01761          }
01762       }
01763 
01764          // Hook for preprocessing of the content for formmails:
01765       if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['sendFormmail-PreProcClass']))   {
01766          foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['sendFormmail-PreProcClass'] as $_classRef) {
01767             $_procObj = &t3lib_div::getUserObj($_classRef);
01768             $EMAIL_VARS = $_procObj->sendFormmail_preProcessVariables($EMAIL_VARS,$this);
01769          }
01770       }
01771 
01772       $formmail->start($EMAIL_VARS);
01773       $formmail->sendtheMail();
01774       $GLOBALS['TT']->setTSlogMessage('"Formmail" invoked, sending mail to '.$EMAIL_VARS['recipient'],0);
01775    }

tslib_fe::sendRedirect  ) 
 

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.

Returns:
void

Definition at line 423 of file class.tslib_fe.php.

References header(), and updateMD5paramsRecord().

00423                            {
00424       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('params', 'cache_md5params', 'md5hash="'.$GLOBALS['TYPO3_DB']->quoteStr($this->RDCT, 'cache_md5params').'"');
00425       if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00426          $this->updateMD5paramsRecord($this->RDCT);
00427          header('Location: '.$row['params']);
00428          exit;
00429       }
00430    }

tslib_fe::setAbsRefPrefix  ) 
 

Substitute the path's to files in the media/ folder like icons used in static_template of TypoScript Works on $this->content.

Returns:
void private
See also:
pagegen.php, INTincScript()

Definition at line 2837 of file class.tslib_fe.php.

02837                               {
02838       if ($this->absRefPrefix)   {
02839          $this->content = str_replace('"media/', '"'.$this->absRefPrefix.'media/', $this->content);
02840          $this->content = str_replace('"fileadmin/', '"'.$this->absRefPrefix.'fileadmin/', $this->content);
02841       }
02842    }

tslib_fe::setIDfromArgV  ) 
 

This checks if there are ARGV-parameters in the QUERY_STRING and if so, those are used for the id $this->id must be 'false' in order for any processing to happen in here If an id/alias value is extracted from the QUERY_STRING it is set in $this->id.

Returns:
void private

Definition at line 1010 of file class.tslib_fe.php.

Referenced by determineId().

01010                               {
01011       if (!$this->id)   {
01012          list($theAlias) = explode('&',t3lib_div::getIndpEnv('QUERY_STRING'));
01013          $theAlias = trim($theAlias);
01014          $this->id = $theAlias ? $theAlias : 0;
01015       }
01016    }

tslib_fe::setPageCacheContent c,
d,
t
 

Sets cache content; Inserts the content string into the cache_pages table.

Parameters:
string The content to store in the HTML field of the cache table
mixed The additional cache_data array, fx. $this->config
integer Timestamp
Returns:
void
See also:
realPageCacheContent(), tempPageCacheContent()

Definition at line 2022 of file class.tslib_fe.php.

References clearPageCacheContent().

Referenced by realPageCacheContent(), and tempPageCacheContent().

02022                                           {
02023       $this->clearPageCacheContent();
02024       $insertFields = array(
02025          'hash' => $this->newHash,
02026          'page_id' => $this->id,
02027          'HTML' => $c,
02028          'cache_data' => serialize($d),
02029          'expires' => $t,
02030          'tstamp' => time()
02031       );
02032       if ($this->page_cache_reg1)   {
02033          $insertFields['reg1'] = intval($this->page_cache_reg1);
02034       }
02035 
02036       $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_pages', $insertFields);
02037    }

tslib_fe::setParseTime  ) 
 

Sets the parsetime of the page.

Returns:
void private

Definition at line 2473 of file class.tslib_fe.php.

02473                            {
02474          // Compensates for the time consumed with Back end user initialization.
02475       $this->scriptParseTime = $GLOBALS['TT']->convertMicrotime($GLOBALS['TYPO3_MISC']['microtime_end'])
02476                         - $GLOBALS['TT']->convertMicrotime($GLOBALS['TYPO3_MISC']['microtime_start'])
02477                         - ($GLOBALS['TT']->convertMicrotime($GLOBALS['TYPO3_MISC']['microtime_BE_USER_end'])-$GLOBALS['TT']->convertMicrotime($GLOBALS['TYPO3_MISC']['microtime_BE_USER_start']));
02478    }

tslib_fe::setSysLastChanged  ) 
 

Sets sys last changed Setting the SYS_LASTCHANGED value in the pagerecord: This value will thus be set to the highest tstamp of records rendered on the page.

This includes all records with no regard to hidden records, userprotection and so on.

Returns:
void
See also:
tslib_cObj::lastChanged()

Definition at line 2065 of file class.tslib_fe.php.

02065                                  {
02066       if ($this->page['SYS_LASTCHANGED'] < intval($this->register['SYS_LASTCHANGED'])) {
02067          $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'uid='.intval($this->id), array('SYS_LASTCHANGED' => intval($this->register['SYS_LASTCHANGED'])));
02068       }
02069    }

tslib_fe::setSysPageWhereClause  ) 
 

Sets sys_page where-clause.

Returns:
void private

Definition at line 1053 of file class.tslib_fe.php.

Referenced by fetch_the_id().

01053                                      {
01054       $this->sys_page->where_hid_del.=' AND doktype<200'.$this->getPagesGroupClause();
01055    }

tslib_fe::settingLanguage  ) 
 

Setting the language key that'll be used by the current page.

In this function it should be checked, 1) that this language exists, 2) that a page_overlay_record exists, .. and if not the default language, 0 (zero), should be set.

Returns:
void private

Definition at line 1570 of file class.tslib_fe.php.

References t3lib_extMgm::isLoaded(), and pageNotFoundAndExit().

01570                               {
01571 
01572          // Get values from TypoScript:
01573       $this->sys_language_uid = $this->sys_language_content = intval($this->config['config']['sys_language_uid']);
01574       list($this->sys_language_mode,$sys_language_content) = t3lib_div::trimExplode(';', $this->config['config']['sys_language_mode']);
01575       $this->sys_language_contentOL = $this->config['config']['sys_language_overlay'];
01576 
01577          // If sys_language_uid is set to another language than default:
01578       if ($this->sys_language_uid>0)   {
01579             // Request the overlay record for the sys_language_uid:
01580          $olRec = $this->sys_page->getPageOverlay($this->id, $this->sys_language_uid);
01581          if (!count($olRec))  {
01582 
01583                // If no OL record exists and a foreign language is asked for...
01584             if ($this->sys_language_uid)  {
01585 
01586                   // If requested translation is not available:
01587                if ($this->page['l18n_cfg']&2)   {
01588                   $this->pageNotFoundAndExit('Page is not available in the requested language.');
01589                } else {
01590                   switch((string)$this->sys_language_mode)  {
01591                      case 'strict':
01592                         $this->pageNotFoundAndExit('Page is not available in the requested language (strict).');
01593                      break;
01594                      case 'content_fallback':
01595                         $fallBackOrder = t3lib_div::intExplode(',', $sys_language_content);
01596                         foreach($fallBackOrder as $orderValue) {
01597                            if (!strcmp($orderValue,'0') || count($this->sys_page->getPageOverlay($this->id, $orderValue))) {
01598                               $this->sys_language_content = $orderValue;   // Setting content uid (but leaving the sys_language_uid)
01599                               break;
01600                            }
01601                         }
01602                      break;
01603                      default:
01604                            // Default is that everything defaults to the default language...
01605                         $this->sys_language_uid = $this->sys_language_content = 0;
01606                      break;
01607                   }
01608                }
01609             }
01610          } else {
01611                // Setting sys_language if an overlay record was found (which it is only if a language is used)
01612             $this->page = $this->sys_page->getPageOverlay($this->page, $this->sys_language_uid);
01613          }
01614       }
01615 
01616          // Setting sys_language_uid inside sys-page:
01617       $this->sys_page->sys_language_uid = $this->sys_language_uid;
01618 
01619          // If default translation is not available:
01620       if ((!$this->sys_language_uid || !$this->sys_language_content) && $this->page['l18n_cfg']&1) {
01621          $this->pageNotFoundAndExit('Page is not available in default language.');
01622       }
01623 
01624          // Updating content of the two rootLines IF the language key is set!
01625       if ($this->sys_language_uid && is_array($this->tmpl->rootLine))   {
01626          reset($this->tmpl->rootLine);
01627          while(list($rLk)=each($this->tmpl->rootLine))   {
01628             $this->tmpl->rootLine[$rLk] = $this->sys_page->getPageOverlay($this->tmpl->rootLine[$rLk]);
01629          }
01630       }
01631       if ($this->sys_language_uid && is_array($this->rootLine))   {
01632          reset($this->rootLine);
01633          while(list($rLk)=each($this->rootLine))   {
01634             $this->rootLine[$rLk] = $this->sys_page->getPageOverlay($this->rootLine[$rLk]);
01635          }
01636       }
01637 
01638          // Finding the ISO code:
01639       if (t3lib_extMgm::isLoaded('static_info_tables') && $this->sys_language_content) {  // using sys_language_content because the ISO code only (currently) affect content selection from FlexForms - which should follow "sys_language_content"
01640          $sys_language_row = $this->sys_page->getRawRecord('sys_language',$this->sys_language_content,'static_lang_isocode');
01641          if (is_array($sys_language_row) && $sys_language_row['static_lang_isocode'])  {
01642             $stLrow = $this->sys_page->getRawRecord('static_languages',$sys_language_row['static_lang_isocode'],'lg_iso_2');
01643             $this->sys_language_isocode = $stLrow['lg_iso_2'];
01644          }
01645       }
01646 
01647          // Setting softMergeIfNotBlank:
01648       $table_fields = t3lib_div::trimExplode(',', $this->config['config']['sys_language_softMergeIfNotBlank'],1);
01649       foreach($table_fields as $TF) {
01650          list($tN,$fN) = explode(':',$TF);
01651          $this->TCAcachedExtras[$tN]['l10n_mode'][$fN] = 'mergeIfNotBlank';
01652       }
01653    }

tslib_fe::settingLocale  ) 
 

Setting locale for frontend rendering.

Returns:
void

Definition at line 1660 of file class.tslib_fe.php.

01660                               {
01661 
01662          // Setting locale
01663       if ($this->config['config']['locale_all'])   {
01664          # Change by Rene Fritz, 22/10 2002
01665          # there`s the problem that PHP parses float values in scripts wrong if the locale LC_NUMERIC is set to something with a komma as decimal point
01666          # this does not work in php 4.2.3
01667          #setlocale('LC_ALL',$this->config['config']['locale_all']);
01668          #setlocale('LC_NUMERIC','en_US');
01669 
01670          # so we set all except LC_NUMERIC
01671          setlocale(LC_COLLATE,$this->config['config']['locale_all']);
01672          setlocale(LC_CTYPE,$this->config['config']['locale_all']);
01673          setlocale(LC_MONETARY,$this->config['config']['locale_all']);
01674          setlocale(LC_TIME,$this->config['config']['locale_all']);
01675 
01676          $this->localeCharset = $this->csConvObj->get_locale_charset($this->config['config']['locale_all']);
01677       }
01678    }

tslib_fe::setUrlIdToken  ) 
 

Sets the URL_ID_TOKEN in the internal var, $this->getMethodUrlIdToken.

Returns:
void private

Definition at line 1908 of file class.tslib_fe.php.

01908                               {
01909       if ($this->config['config']['ftu']) {
01910          $this->getMethodUrlIdToken = $this->TYPO3_CONF_VARS['FE']['get_url_id_token'];
01911       } else {
01912          $this->getMethodUrlIdToken = '';
01913       }
01914    }

tslib_fe::simulateStaticDocuments_pEnc_onlyP_proc linkVars  ) 
 

Processes a query-string with GET-parameters and returns two strings, one with the parameters that CAN be encoded and one array with those which can't be encoded (encoded by the M5 or B6 methods).

Parameters:
string Query string to analyse
Returns:
array Two num keys returned, first is the parameters that MAY be encoded, second is the non-encodable parameters.
See also:
makeSimulFileName(), t3lib_tstemplate::linkData()

Definition at line 2702 of file class.tslib_fe.php.

02702                                                                {
02703       $remainLinkVars = '';
02704       if (strcmp($linkVars,''))  {
02705          $p = explode('&',$linkVars);
02706          sort($p);   // This sorts the parameters - and may not be needed and further it will generate new MD5 hashes in many cases. Maybe not so smart. Hmm?
02707          $rem = array();
02708          foreach($p as $k => $v) {
02709             if (strlen($v))   {
02710                list($pName) = explode('=',$v,2);
02711                $pName = rawurldecode($pName);
02712                if (!$this->pEncAllowedParamNames[$pName])   {
02713                   unset($p[$k]);
02714                   $rem[] = $v;
02715                }
02716             } else unset($p[$k]);
02717          }
02718 
02719          $linkVars = count($p) ? '&'.implode('&',$p) : '';
02720          $remainLinkVars = count($rem) ? '&'.implode('&',$rem) : '';
02721       }
02722       return array($linkVars, $remainLinkVars);
02723    }

tslib_fe::statistics  ) 
 

Saves hit statistics.

Returns:
void

Definition at line 2485 of file class.tslib_fe.php.

References $flags, t3lib_extMgm::isLoaded(), and TYPO3_OS.

02485                            {
02486       if ($this->config['config']['stat'] &&
02487             (!strcmp('',$this->config['config']['stat_typeNumList']) || t3lib_div::inList(str_replace(' ','',$this->config['config']['stat_typeNumList']), $this->type)) &&
02488             (!$this->config['config']['stat_excludeBEuserHits'] || !$this->beUserLogin) &&
02489             (!$this->config['config']['stat_excludeIPList'] || !t3lib_div::inList(str_replace(' ','',$this->config['config']['stat_excludeIPList']), t3lib_div::getIndpEnv('REMOTE_ADDR')))) {
02490          $GLOBALS['TT']->push('Stat');
02491             if (t3lib_extMgm::isLoaded('sys_stat') && $this->config['config']['stat_mysql']) {
02492 
02493                   // Jumpurl:
02494                $sword = t3lib_div::_GP('sword');
02495                if ($sword) {
02496                   $jumpurl_msg = 'sword:'.$sword;
02497                } elseif ($this->jumpurl) {
02498                   $jumpurl_msg = 'jumpurl:'.$this->jumpurl;
02499                } else {
02500                   $jumpurl_msg = '';
02501                }
02502 
02503                   // Flags: bits: 0 = BE_user, 1=Cached page?
02504                $flags=0;
02505                if ($this->beUserLogin) {$flags|=1;}
02506                if ($this->cacheContentFlag) {$flags|=2;}
02507 
02508                   // Ref url:
02509                $refUrl = t3lib_div::getIndpEnv('HTTP_REFERER');
02510                $thisUrl = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR');
02511                if (t3lib_div::isFirstPartOfStr($refUrl,$thisUrl)) {
02512                   $refUrl='[LOCAL]';
02513                }
02514 
02515                $insertFields = array(
02516                   'page_id' => intval($this->id),                    // id
02517                   'page_type' => intval($this->type),                // type
02518                   'jumpurl' => $jumpurl_msg,                      // jumpurl message
02519                   'feuser_id' => $this->fe_user->user['uid'],           // fe_user id, integer
02520                   'cookie' => $this->fe_user->id,                    // cookie as set or retrieve. If people has cookies disabled this will vary all the time...
02521                   'sureCookie' => hexdec(substr($this->fe_user->cookieId,0,8)),  // This is the cookie value IF the cookie WAS actually set. However the first hit where the cookie is set will thus NOT be logged here. So this lets you select for a session of at least two clicks...
02522                   'rl0' => $this->config['rootLine'][0]['uid'],         // RootLevel 0 uid
02523                   'rl1' => $this->config['rootLine'][1]['uid'],         // RootLevel 1 uid
02524                   'client_browser' => $GLOBALS['CLIENT']['BROWSER'],    // Client browser (net, msie, opera)
02525                   'client_version' => $GLOBALS['CLIENT']['VERSION'],    // Client version (double value)
02526                   'client_os' => $GLOBALS['CLIENT']['SYSTEM'],       // Client Operating system (win, mac, unix)
02527                   'parsetime' => intval($this->scriptParseTime),        // Parsetime for the page.
02528                   'flags' => $flags,                              // Flags: Is be user logged in? Is page cached?
02529                   'IP' => t3lib_div::getIndpEnv('REMOTE_ADDR'),         // Remote IP address
02530                   'host' => t3lib_div::getIndpEnv('REMOTE_HOST'),       // Remote Host Address
02531                   'referer' => $refUrl,                           // Referer URL
02532                   'browser' => t3lib_div::getIndpEnv('HTTP_USER_AGENT'),   // User Agent Info.
02533                   'tstamp' => $GLOBALS['EXEC_TIME']                  // Time stamp
02534                );
02535 
02536                $GLOBALS['TT']->push('Store SQL');
02537                   $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_stat', $insertFields);
02538                $GLOBALS['TT']->pull();
02539             }
02540 
02541                // Apache:
02542             if ($this->config['config']['stat_apache'] && $this->config['stat_vars']['pageName'])  {
02543                if (@is_file($this->config['stat_vars']['logFile']) && TYPO3_OS!='WIN') {
02544                   $LogLine = ((t3lib_div::getIndpEnv('REMOTE_HOST') && !$this->config['config']['stat_apache_noHost']) ? t3lib_div::getIndpEnv('REMOTE_HOST') : t3lib_div::getIndpEnv('REMOTE_ADDR')).' - - '.Date('[d/M/Y:H:i:s +0000]',$GLOBALS['EXEC_TIME']).' "GET '.$this->config['stat_vars']['pageName'].' HTTP/1.1" 200 '.strlen($this->content);
02545                   if (!$this->config['config']['stat_apache_notExtended']) {
02546                      $LogLine.= ' "'.t3lib_div::getIndpEnv('HTTP_REFERER').'" "'.t3lib_div::getIndpEnv('HTTP_USER_AGENT').'"';
02547                   }
02548 
02549                   switch($this->TYPO3_CONF_VARS['FE']['logfile_write']) {
02550                      case 'fputs':
02551                         $GLOBALS['TT']->push('Write to log file (fputs)');
02552                            $logfilehandle = fopen($this->config['stat_vars']['logFile'], 'a');
02553                            fputs($logfilehandle, $LogLine."\n");
02554                            @fclose($logfilehandle);
02555                         $GLOBALS['TT']->pull();
02556                      break;
02557                      default:
02558                         $GLOBALS['TT']->push('Write to log file (echo)');
02559                            $execCmd = 'echo "'.addslashes($LogLine).'" >> '.$this->config['stat_vars']['logFile'];
02560                            exec($execCmd);
02561                         $GLOBALS['TT']->pull();
02562                      break;
02563                   }
02564 
02565                   $GLOBALS['TT']->setTSlogMessage('Writing to logfile: OK',0);
02566                } else {
02567                   $GLOBALS['TT']->setTSlogMessage('Writing to logfile: Error - logFile did not exist or OS is Windows!',3);
02568                }
02569             }
02570          $GLOBALS['TT']->pull();
02571       }
02572    }

tslib_fe::storeSessionData  ) 
 

Stores session data for the front end user.

Returns:
void

Definition at line 2463 of file class.tslib_fe.php.

02463                                  {
02464       $this->fe_user->storeSessionData();
02465    }

tslib_fe::tempPageCacheContent  ) 
 

Temp cache content The temporary cache will expire after a few seconds (typ.

30) or will be cleared by the rendered page, which will also clear and rewrite the cache.

Returns:
void

Definition at line 1961 of file class.tslib_fe.php.

References message(), and setPageCacheContent().

01961                                     {
01962       $this->tempContent=0;
01963       if (!$this->no_cache)   {
01964          $seconds=30;
01965          $stdMsg = '
01966          <html>
01967             <head>
01968                <title>'.htmlspecialchars($this->tmpl->printTitle($this->page['title'])).'</title>
01969                <meta http-equiv=Refresh Content="3; Url='.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'" />
01970             </head>
01971             <body bgcolor="white">
01972                <font size="1" face="VERDANA,ARIAL,HELVETICA" color="#cccccc">
01973                <div align="center">
01974                   <b>Page is being generated.</b><br />
01975                   If this message does not disappear within '.$seconds.' seconds, please reload.
01976                </div>
01977                </font>
01978             </body>
01979          </html>';
01980          $temp_content = $this->config['config']['message_page_is_being_generated'] ? $this->config['config']['message_page_is_being_generated'] : $stdMsg;
01981 
01982          $this->setPageCacheContent($temp_content,'',$GLOBALS['EXEC_TIME']+$seconds);
01983          $this->tempContent=1;      // This flag shows that temporary content is put in the cache
01984       }
01985    }

tslib_fe::tidyHTML content  ) 
 

Pass the content through tidy - a little program that cleans up HTML-code Requires $this->TYPO3_CONF_VARS['FE']['tidy'] to be true and $this->TYPO3_CONF_VARS['FE']['tidy_path'] to contain the filename/path of tidy including clean-up arguments for tidy.

See default value in TYPO3_CONF_VARS in t3lib/config_default.php

Parameters:
string The page content to clean up. Will be written to a temporary file which "tidy" is then asked to clean up. File content is read back and returned.
Returns:
string Returns the

Definition at line 2892 of file class.tslib_fe.php.

References $content.

02892                                     {
02893       if ($this->TYPO3_CONF_VARS['FE']['tidy'] && $this->TYPO3_CONF_VARS['FE']['tidy_path']) {
02894          $oldContent = $content;
02895          $fname = t3lib_div::tempnam('Typo3_Tidydoc_');     // Create temporary name
02896          @unlink ($fname); // Delete if exists, just to be safe.
02897          $fp = fopen ($fname,'wb'); // Open for writing
02898          fputs ($fp, $content);  // Put $content
02899          @fclose ($fp); // Close
02900 
02901          exec ($this->TYPO3_CONF_VARS['FE']['tidy_path'].' '.$fname, $output);         // run the $content through 'tidy', which formats the HTML to nice code.
02902          @unlink ($fname); // Delete the tempfile again
02903          $content = implode(chr(10),$output);
02904          if (!trim($content)) {
02905             $content = $oldContent; // Restore old content due empty return value.
02906             $GLOBALS['TT']->setTSlogMessage('"tidy" returned an empty value!',2);
02907          }
02908          $GLOBALS['TT']->setTSlogMessage('"tidy" content lenght: '.strlen($content),0);
02909       }
02910       return $content;
02911    }

tslib_fe::updateMD5paramsRecord hash  ) 
 

Updates the tstamp field of a cache_md5params record to the current time.

Parameters:
string The hash string identifying the cache_md5params record for which to update the "tstamp" field to the current time.
Returns:
void private

Definition at line 2881 of file class.tslib_fe.php.

Referenced by idPartsAnalyze(), and sendRedirect().

02881                                           {
02882       $GLOBALS['TYPO3_DB']->exec_UPDATEquery('cache_md5params', 'md5hash="'.$GLOBALS['TYPO3_DB']->quoteStr($hash, 'cache_md5params').'"', array('tstamp' => time()));
02883    }


Member Data Documentation

tslib_fe::$absRefPrefix = ''
 

Definition at line 274 of file class.tslib_fe.php.

tslib_fe::$absRefPrefix_force = 0
 

Definition at line 275 of file class.tslib_fe.php.

tslib_fe::$accessKey = array()
 

Definition at line 298 of file class.tslib_fe.php.

tslib_fe::$additionalCSS = array()
 

Definition at line 258 of file class.tslib_fe.php.

tslib_fe::$additionalHeaderData = array()
 

Definition at line 256 of file class.tslib_fe.php.

tslib_fe::$additionalJavaScript = array()
 

Definition at line 257 of file class.tslib_fe.php.

tslib_fe::$all = ''
 

Definition at line 234 of file class.tslib_fe.php.

tslib_fe::$altPageTitle = ''
 

Definition at line 304 of file class.tslib_fe.php.

tslib_fe::$anchorPrefix = ''
 

Definition at line 307 of file class.tslib_fe.php.

tslib_fe::$applicationData = Array()
 

Definition at line 292 of file class.tslib_fe.php.

tslib_fe::$ATagParams = ''
 

Definition at line 278 of file class.tslib_fe.php.

tslib_fe::$baseUrl = ''
 

Definition at line 306 of file class.tslib_fe.php.

tslib_fe::$beUserLogin = ''
 

Definition at line 216 of file class.tslib_fe.php.

tslib_fe::$cacheContentFlag = ''
 

Definition at line 233 of file class.tslib_fe.php.

tslib_fe::$cacheTimeOutDefault = ''
 

Definition at line 232 of file class.tslib_fe.php.

tslib_fe::$cHash = ''
 

Definition at line 198 of file class.tslib_fe.php.

tslib_fe::$cHash_array = array()
 

Definition at line 242 of file class.tslib_fe.php.

tslib_fe::$clientInfo = ''
 

Definition at line 316 of file class.tslib_fe.php.

tslib_fe::$cObj = ''
 

Definition at line 310 of file class.tslib_fe.php.

tslib_fe::$cObjectDepthCounter = 50
 

Definition at line 295 of file class.tslib_fe.php.

tslib_fe::$compensateFieldWidth = ''
 

Definition at line 276 of file class.tslib_fe.php.

tslib_fe::$config = ''
 

Definition at line 227 of file class.tslib_fe.php.

tslib_fe::$content = ''
 

Definition at line 313 of file class.tslib_fe.php.

tslib_fe::$contentPid = 0
 

Definition at line 202 of file class.tslib_fe.php.

tslib_fe::$convCharsetToFrom = ''
 

Definition at line 331 of file class.tslib_fe.php.

tslib_fe::$csConvObj
 

Definition at line 321 of file class.tslib_fe.php.

tslib_fe::$currentRecord = ''
 

Definition at line 297 of file class.tslib_fe.php.

tslib_fe::$debug = ''
 

Definition at line 269 of file class.tslib_fe.php.

tslib_fe::$defaultBodyTag = '<body bgcolor="#FFFFFF">'
 

Definition at line 255 of file class.tslib_fe.php.

tslib_fe::$defaultCharSet = 'iso-8859-1'
 

Definition at line 322 of file class.tslib_fe.php.

tslib_fe::$displayEditIcons = ''
 

Definition at line 283 of file class.tslib_fe.php.

tslib_fe::$displayFieldEditIcons = ''
 

Definition at line 284 of file class.tslib_fe.php.

tslib_fe::$divSection = ''
 

Definition at line 266 of file class.tslib_fe.php.

tslib_fe::$domainStartPage = 0
 

Definition at line 206 of file class.tslib_fe.php.

Referenced by getPageAndRootlineWithDomain().

tslib_fe::$excludeCHashVars = ''
 

Definition at line 282 of file class.tslib_fe.php.

tslib_fe::$extTarget = ''
 

Definition at line 271 of file class.tslib_fe.php.

tslib_fe::$fe_user = ''
 

Definition at line 213 of file class.tslib_fe.php.

tslib_fe::$fePreview = ''
 

Definition at line 219 of file class.tslib_fe.php.

tslib_fe::$forceTemplateParsing = ''
 

Definition at line 241 of file class.tslib_fe.php.

tslib_fe::$getMethodUrlIdToken = ''
 

Definition at line 238 of file class.tslib_fe.php.

tslib_fe::$gr_list = ''
 

Definition at line 215 of file class.tslib_fe.php.

tslib_fe::$hash_base = ''
 

Definition at line 243 of file class.tslib_fe.php.

tslib_fe::$id = ''
 

Definition at line 195 of file class.tslib_fe.php.

tslib_fe::$idParts = array()
 

Definition at line 197 of file class.tslib_fe.php.

tslib_fe::$imagesOnPage = array()
 

Definition at line 299 of file class.tslib_fe.php.

tslib_fe::$indexedDocTitle = ''
 

Definition at line 303 of file class.tslib_fe.php.

tslib_fe::$intTarget = ''
 

Definition at line 270 of file class.tslib_fe.php.

tslib_fe::$JSCode = ''
 

Definition at line 264 of file class.tslib_fe.php.

tslib_fe::$JSeventFuncCalls
 

Initial value:

 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(),
      'onload' => array(),
   )

Definition at line 259 of file class.tslib_fe.php.

tslib_fe::$JSImgCode = ''
 

Definition at line 265 of file class.tslib_fe.php.

tslib_fe::$jumpurl = ''
 

Definition at line 204 of file class.tslib_fe.php.

tslib_fe::$labelsCharset = ''
 

Definition at line 330 of file class.tslib_fe.php.

tslib_fe::$lang = ''
 

Definition at line 328 of file class.tslib_fe.php.

tslib_fe::$langSplitIndex = 0
 

Definition at line 329 of file class.tslib_fe.php.

tslib_fe::$lastImageInfo = array()
 

Definition at line 300 of file class.tslib_fe.php.

tslib_fe::$linkVars = ''
 

Definition at line 281 of file class.tslib_fe.php.

tslib_fe::$LL_files_cache = array()
 

Definition at line 333 of file class.tslib_fe.php.

tslib_fe::$LL_labels_cache = array()
 

Definition at line 332 of file class.tslib_fe.php.

tslib_fe::$localeCharset = ''
 

Definition at line 325 of file class.tslib_fe.php.

tslib_fe::$lockFilePath = ''
 

Definition at line 277 of file class.tslib_fe.php.

tslib_fe::$loginUser = ''
 

Definition at line 214 of file class.tslib_fe.php.

tslib_fe::$metaCharset = ''
 

Definition at line 324 of file class.tslib_fe.php.

tslib_fe::$MP = ''
 

Definition at line 207 of file class.tslib_fe.php.

Referenced by tslib_fe().

tslib_fe::$MP_defaults = array()
 

Definition at line 272 of file class.tslib_fe.php.

tslib_fe::$newHash = ''
 

Definition at line 237 of file class.tslib_fe.php.

tslib_fe::$no_cache = ''
 

Definition at line 199 of file class.tslib_fe.php.

Referenced by tslib_fe().

tslib_fe::$noCacheBeforePageGen = ''
 

Definition at line 239 of file class.tslib_fe.php.

tslib_fe::$page = ''
 

Definition at line 201 of file class.tslib_fe.php.

Referenced by getPageShortcut().

tslib_fe::$page_cache_reg1 = 0
 

Definition at line 209 of file class.tslib_fe.php.

tslib_fe::$pageNotFound = 0
 

Definition at line 205 of file class.tslib_fe.php.

tslib_fe::$pagesTSconfig = ''
 

Definition at line 244 of file class.tslib_fe.php.

tslib_fe::$pEncAllowedParamNames = array()
 

Definition at line 305 of file class.tslib_fe.php.

tslib_fe::$pSetup = ''
 

Definition at line 236 of file class.tslib_fe.php.

tslib_fe::$RDCT = ''
 

Definition at line 208 of file class.tslib_fe.php.

tslib_fe::$recordRegister = Array()
 

Definition at line 296 of file class.tslib_fe.php.

tslib_fe::$register = Array()
 

Definition at line 293 of file class.tslib_fe.php.

tslib_fe::$registerStack = Array()
 

Definition at line 294 of file class.tslib_fe.php.

tslib_fe::$renderCharset = ''
 

Definition at line 323 of file class.tslib_fe.php.

tslib_fe::$rootLine = ''
 

Definition at line 200 of file class.tslib_fe.php.

tslib_fe::$scriptParseTime = 0
 

Definition at line 317 of file class.tslib_fe.php.

tslib_fe::$showHiddenPage = ''
 

Definition at line 220 of file class.tslib_fe.php.

tslib_fe::$showHiddenRecords = ''
 

Definition at line 221 of file class.tslib_fe.php.

tslib_fe::$simUserGroup = '0'
 

Definition at line 222 of file class.tslib_fe.php.

Referenced by determineId().

tslib_fe::$siteScript = ''
 

Definition at line 210 of file class.tslib_fe.php.

tslib_fe::$spamProtectEmailAddresses = 0
 

Definition at line 273 of file class.tslib_fe.php.

tslib_fe::$sPre = ''
 

Definition at line 235 of file class.tslib_fe.php.

tslib_fe::$sWordList = ''
 

Definition at line 280 of file class.tslib_fe.php.

tslib_fe::$sWordRegEx = ''
 

Definition at line 279 of file class.tslib_fe.php.

tslib_fe::$sys_language_content = 0
 

Definition at line 287 of file class.tslib_fe.php.

tslib_fe::$sys_language_contentOL = 0
 

Definition at line 288 of file class.tslib_fe.php.

tslib_fe::$sys_language_isocode = ''
 

Definition at line 289 of file class.tslib_fe.php.

tslib_fe::$sys_language_mode = ''
 

Definition at line 286 of file class.tslib_fe.php.

tslib_fe::$sys_language_uid = 0
 

Definition at line 285 of file class.tslib_fe.php.

tslib_fe::$sys_page = ''
 

Definition at line 203 of file class.tslib_fe.php.

tslib_fe::$TCAcachedExtras = array()
 

Definition at line 228 of file class.tslib_fe.php.

tslib_fe::$TCAloaded = 0
 

Definition at line 318 of file class.tslib_fe.php.

tslib_fe::$tempContent = ''
 

Definition at line 240 of file class.tslib_fe.php.

tslib_fe::$tmpl = ''
 

Definition at line 231 of file class.tslib_fe.php.

tslib_fe::$type = ''
 

Definition at line 196 of file class.tslib_fe.php.

tslib_fe::$TYPO3_CONF_VARS = array()
 

Definition at line 226 of file class.tslib_fe.php.

tslib_fe::$uniqueCounter = 0
 

Definition at line 301 of file class.tslib_fe.php.

tslib_fe::$uniqueString = ''
 

Definition at line 302 of file class.tslib_fe.php.

tslib_fe::$versionPreviewMap = array()
 

Definition at line 223 of file class.tslib_fe.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 3 01:07:37 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913