class.tslib_pagegen.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Libraries for pagegen.php
00029  * The script "pagegen.php" is included by "index_ts.php" when a page is not cached but needs to be rendered.
00030  *
00031  * $Id: class.tslib_pagegen.php 4572 2008-12-18 20:11:29Z dmitry $
00032  * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
00033  * XHTML compliant
00034  *
00035  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00036  */
00037 /**
00038  * [CLASS/FUNCTION INDEX of SCRIPT]
00039  *
00040  *
00041  *
00042  *   88: class TSpagegen
00043  *   95:     function pagegenInit()
00044  *  271:     function getIncFiles()
00045  *  304:     function JSeventFunctions()
00046  *  338:     function renderContent()
00047  *  365:     function renderContentWithHeader($pageContent)
00048  *
00049  *              SECTION: Helper functions
00050  *  827:     function inline2TempFile($str,$ext)
00051  *
00052  *
00053  *  881: class FE_loadDBGroup extends t3lib_loadDBGroup
00054  *
00055  * TOTAL FUNCTIONS: 6
00056  * (This index is automatically created/updated by the extension "extdeveval")
00057  *
00058  */
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 /**
00079  * Class for starting TypoScript page generation
00080  *
00081  * The class is not instantiated as an objects but called directly with the "::" operator.
00082  * eg: TSpagegen::pagegenInit()
00083  *
00084  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00085  * @package TYPO3
00086  * @subpackage tslib
00087  */
00088 class TSpagegen {
00089 
00090     /**
00091      * Setting some vars in TSFE, primarily based on TypoScript config settings.
00092      *
00093      * @return  void
00094      */
00095     function pagegenInit()  {
00096         if ($GLOBALS['TSFE']->page['content_from_pid']>0)   {
00097             $temp_copy_TSFE = clone($GLOBALS['TSFE']);  // make REAL copy of TSFE object - not reference!
00098             $temp_copy_TSFE->id = $GLOBALS['TSFE']->page['content_from_pid'];   // Set ->id to the content_from_pid value - we are going to evaluate this pid as was it a given id for a page-display!
00099             $temp_copy_TSFE->getPageAndRootlineWithDomain($GLOBALS['TSFE']->config['config']['content_from_pid_allowOutsideDomain']?0:$GLOBALS['TSFE']->domainStartPage);
00100             $GLOBALS['TSFE']->contentPid = intval($temp_copy_TSFE->id);
00101             unset($temp_copy_TSFE);
00102         }
00103         if ($GLOBALS['TSFE']->config['config']['MP_defaults'])  {
00104             $temp_parts = t3lib_div::trimExplode('|',$GLOBALS['TSFE']->config['config']['MP_defaults'],1);
00105             reset($temp_parts);
00106             while(list(,$temp_p)=each($temp_parts)) {
00107                 list($temp_idP,$temp_MPp) = explode(':',$temp_p,2);
00108                 $temp_ids=t3lib_div::intExplode(',',$temp_idP);
00109                 reset($temp_ids);
00110                 while(list(,$temp_id)=each($temp_ids))  {
00111                     $GLOBALS['TSFE']->MP_defaults[$temp_id]=$temp_MPp;
00112                 }
00113             }
00114         }
00115 
00116             // Global vars...
00117         $GLOBALS['TSFE']->indexedDocTitle = $GLOBALS['TSFE']->page['title'];
00118         $GLOBALS['TSFE']->debug = ''.$GLOBALS['TSFE']->config['config']['debug'];
00119 
00120             // Base url:
00121         if ($GLOBALS['TSFE']->config['config']['baseURL'])  {
00122             if ($GLOBALS['TSFE']->config['config']['baseURL']==='1')    {
00123                     // Deprecated property, going to be dropped.
00124                 $error = 'Unsupported TypoScript property was found in this template: "config.baseURL="1"
00125 
00126 This setting has been deprecated in TYPO 3.8.1 due to security concerns.
00127 You need to change this value to the URL of your website root, otherwise TYPO3 will not work!
00128 
00129 See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.typo3.org/index.php/TYPO3_3.8.1</a> for more information.';
00130 
00131                 $GLOBALS['TSFE']->printError(nl2br($error));
00132                 exit;
00133             } else {
00134                 $GLOBALS['TSFE']->baseUrl = $GLOBALS['TSFE']->config['config']['baseURL'];
00135             }
00136             $GLOBALS['TSFE']->anchorPrefix = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL')));
00137         }
00138 
00139             // Internal and External target defaults
00140         $GLOBALS['TSFE']->intTarget = ''.$GLOBALS['TSFE']->config['config']['intTarget'];
00141         $GLOBALS['TSFE']->extTarget = ''.$GLOBALS['TSFE']->config['config']['extTarget'];
00142         $GLOBALS['TSFE']->fileTarget = ''.$GLOBALS['TSFE']->config['config']['fileTarget'];
00143         if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'] === 'ascii') {
00144             $GLOBALS['TSFE']->spamProtectEmailAddresses = 'ascii';
00145         } else {
00146             $GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-10,10,0);
00147         }
00148 
00149         $GLOBALS['TSFE']->absRefPrefix = ($GLOBALS['TSFE']->config['config']['absRefPrefix'] ? trim($GLOBALS['TSFE']->config['config']['absRefPrefix']) : '');
00150 
00151         if ($GLOBALS['TSFE']->type && $GLOBALS['TSFE']->config['config']['frameReloadIfNotInFrameset']) {
00152             $tdlLD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,'_top',$GLOBALS['TSFE']->no_cache,'');
00153             $GLOBALS['TSFE']->JSCode = 'if(!parent.'.trim($GLOBALS['TSFE']->sPre).' && !parent.view_frame) top.location.href="'.$GLOBALS['TSFE']->baseUrlWrap($tdlLD['totalURL']).'"';
00154         }
00155         $GLOBALS['TSFE']->compensateFieldWidth = ''.$GLOBALS['TSFE']->config['config']['compensateFieldWidth'];
00156         $GLOBALS['TSFE']->lockFilePath = ''.$GLOBALS['TSFE']->config['config']['lockFilePath'];
00157         $GLOBALS['TSFE']->lockFilePath = $GLOBALS['TSFE']->lockFilePath ? $GLOBALS['TSFE']->lockFilePath : 'fileadmin/';
00158         $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'] = isset($GLOBALS['TSFE']->config['config']['noScaleUp']) ? ''.$GLOBALS['TSFE']->config['config']['noScaleUp'] : $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
00159         $GLOBALS['TSFE']->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
00160 
00161         $GLOBALS['TSFE']->ATagParams = trim($GLOBALS['TSFE']->config['config']['ATagParams']) ? ' '.trim($GLOBALS['TSFE']->config['config']['ATagParams']) : '';
00162         if ($GLOBALS['TSFE']->config['config']['setJS_mouseOver'])  $GLOBALS['TSFE']->setJS('mouseOver');
00163         if ($GLOBALS['TSFE']->config['config']['setJS_openPic'])    $GLOBALS['TSFE']->setJS('openPic');
00164 
00165         $GLOBALS['TSFE']->sWordRegEx='';
00166         $GLOBALS['TSFE']->sWordList = t3lib_div::_GP('sword_list');
00167         if (is_array($GLOBALS['TSFE']->sWordList))  {
00168             $standAlone = trim(''.$GLOBALS['TSFE']->config['config']['sword_standAlone']);
00169             $noMixedCase = trim(''.$GLOBALS['TSFE']->config['config']['sword_noMixedCase']);
00170 
00171             $space = ($standAlone) ? '[[:space:]]' : '';
00172             reset($GLOBALS['TSFE']->sWordList);
00173             while (list($key,$val) = each($GLOBALS['TSFE']->sWordList)) {
00174                 if (trim($val)) {
00175                     if (!$noMixedCase) {
00176                         $GLOBALS['TSFE']->sWordRegEx.= $space.sql_regcase(quotemeta($val)).$space.'|';
00177                     } else {
00178                         $GLOBALS['TSFE']->sWordRegEx.= $space.quotemeta($val).$space.'|';
00179                     }
00180                 }
00181             }
00182             $GLOBALS['TSFE']->sWordRegEx = ereg_replace('\|$','',$GLOBALS['TSFE']->sWordRegEx);
00183         }
00184 
00185             // linkVars
00186         $linkVars = (string)$GLOBALS['TSFE']->config['config']['linkVars'];
00187         if ($linkVars)  {
00188             $linkVarArr = explode(',',$linkVars);
00189 
00190             $GLOBALS['TSFE']->linkVars='';
00191             $GET = t3lib_div::_GET();
00192 
00193             foreach ($linkVarArr as $val)   {
00194                 $val = trim($val);
00195 
00196                 if (preg_match('/^(.*)\((.+)\)$/',$val,$match)) {
00197                     $val = trim($match[1]);
00198                     $test = trim($match[2]);
00199                 } else unset($test);
00200 
00201                 if ($val && isset($GET[$val]))  {
00202                     if (!is_array($GET[$val]))  {
00203                         $tmpVal = rawurlencode($GET[$val]);
00204 
00205                         if ($test && !TSpagegen::isAllowedLinkVarValue($tmpVal,$test))  {
00206                             continue;   // Error: This value was not allowed for this key
00207                         }
00208 
00209                         $value = '&'.$val.'='.$tmpVal;
00210                     } else {
00211                         if ($test && strcmp('array',$test)) {
00212                             continue;   // Error: This key must not be an array!
00213                         }
00214                         $value = t3lib_div::implodeArrayForUrl($val,$GET[$val]);
00215                     }
00216                 } else continue;
00217 
00218                 $GLOBALS['TSFE']->linkVars.= $value;
00219             }
00220             unset($GET);
00221         } else {
00222             $GLOBALS['TSFE']->linkVars='';
00223         }
00224 
00225             // Setting XHTML-doctype from doctype
00226         if (!$GLOBALS['TSFE']->config['config']['xhtmlDoctype'])    {
00227             $GLOBALS['TSFE']->config['config']['xhtmlDoctype'] = $GLOBALS['TSFE']->config['config']['doctype'];
00228         }
00229 
00230         if ($GLOBALS['TSFE']->config['config']['xhtmlDoctype']) {
00231             $GLOBALS['TSFE']->xhtmlDoctype = $GLOBALS['TSFE']->config['config']['xhtmlDoctype'];
00232 
00233                 // Checking XHTML-docytpe
00234             switch((string)$GLOBALS['TSFE']->config['config']['xhtmlDoctype'])  {
00235                 case 'xhtml_trans':
00236                 case 'xhtml_strict':
00237                 case 'xhtml_frames':
00238                     $GLOBALS['TSFE']->xhtmlVersion = 100;
00239                 break;
00240                 case 'xhtml_basic':
00241                     $GLOBALS['TSFE']->xhtmlVersion = 105;
00242                 break;
00243                 case 'xhtml_11':
00244                     $GLOBALS['TSFE']->xhtmlVersion = 110;
00245                 break;
00246                 case 'xhtml_2':
00247                     $GLOBALS['TSFE']->xhtmlVersion = 200;
00248                 break;
00249                 default:
00250                     $GLOBALS['TSFE']->xhtmlDoctype = '';
00251                     $GLOBALS['TSFE']->xhtmlVersion = 0;
00252             }
00253         }
00254     }
00255 
00256     /**
00257      * Returns an array with files to include. These files are the ones set up in TypoScript config.
00258      *
00259      * @return  array       Files to include. Paths are relative to PATH_site.
00260      */
00261     function getIncFiles()  {
00262         $incFilesArray = array();
00263             // Get files from config.includeLibrary
00264         $includeLibrary = trim(''.$GLOBALS['TSFE']->config['config']['includeLibrary']);
00265         if ($includeLibrary)    {
00266             $incFile=$GLOBALS['TSFE']->tmpl->getFileName($includeLibrary);
00267             if ($incFile)   {
00268                 $incFilesArray[] = $incFile;
00269             }
00270         }
00271 
00272         if (is_array($GLOBALS['TSFE']->pSetup['includeLibs.'])) {$incLibs=$GLOBALS['TSFE']->pSetup['includeLibs.'];} else {$incLibs=array();}
00273         if (is_array($GLOBALS['TSFE']->tmpl->setup['includeLibs.']))    {$incLibs+=$GLOBALS['TSFE']->tmpl->setup['includeLibs.'];}  // toplevel 'includeLibs' is added to the PAGE.includeLibs. In that way, PAGE-libs get first priority, because if the key already exist, it's not altered. (Due to investigation by me)
00274         if (count($incLibs))    {
00275             reset($incLibs);
00276             while(list(,$theLib)=each($incLibs))    {
00277                 if (!is_array($theLib) && $incFile=$GLOBALS['TSFE']->tmpl->getFileName($theLib))    {
00278                     $incFilesArray[] = $incFile;
00279                 }
00280             }
00281         }
00282             // Include HTML mail library?
00283         if ($GLOBALS['TSFE']->config['config']['incT3Lib_htmlmail'])    {
00284             $incFilesArray[] = 't3lib/class.t3lib_htmlmail.php';
00285         }
00286         return $incFilesArray;
00287     }
00288 
00289     /**
00290      * Processing JavaScript handlers
00291      *
00292      * @return  array       Array with a) a JavaScript section with event handlers and variables set and b) an array with attributes for the body tag.
00293      */
00294     function JSeventFunctions() {
00295         $functions = array();
00296         $setEvents = array();
00297         $setBody = array();
00298 
00299         foreach ($GLOBALS['TSFE']->JSeventFuncCalls as $event => $handlers) {
00300             if (count($handlers))   {
00301                 $functions[] = '    function T3_'.$event.'Wrapper(e)    {   '.implode('   ',$handlers).'    }';
00302                 $setEvents[] = '    document.'.$event.'=T3_'.$event.'Wrapper;';
00303                 if ($event == 'onload') {
00304                     $setBody[]='onload="T3_onloadWrapper();"';  // dubiuos double setting breaks on some browser - do we need it?
00305                 }
00306             }
00307         }
00308 
00309         return array(count($functions)? implode(chr(10), $functions) . chr(10) . implode(chr(10), $setEvents) : '', $setBody);
00310     }
00311 
00312     /**
00313      * Rendering the page content
00314      *
00315      * @return  void
00316      */
00317     function renderContent()    {
00318             // PAGE CONTENT
00319         $GLOBALS['TT']->incStackPointer();
00320         $GLOBALS['TT']->push($GLOBALS['TSFE']->sPre, 'PAGE');
00321             $pageContent = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup);
00322 
00323             if ($GLOBALS['TSFE']->pSetup['wrap'])   {$pageContent = $GLOBALS['TSFE']->cObj->wrap($pageContent, $GLOBALS['TSFE']->pSetup['wrap']);}
00324             if ($GLOBALS['TSFE']->pSetup['stdWrap.'])   {$pageContent = $GLOBALS['TSFE']->cObj->stdWrap($pageContent, $GLOBALS['TSFE']->pSetup['stdWrap.']);}
00325 
00326             // PAGE HEADER (after content - maybe JS is inserted!
00327 
00328             // if 'disableAllHeaderCode' is set, all the header-code is discarded!
00329         if ($GLOBALS['TSFE']->config['config']['disableAllHeaderCode']) {
00330             $GLOBALS['TSFE']->content = $pageContent;
00331         } else {
00332             TSpagegen::renderContentWithHeader($pageContent);
00333         }
00334         $GLOBALS['TT']->pull($GLOBALS['TT']->LR?$GLOBALS['TSFE']->content:'');
00335         $GLOBALS['TT']->decStackPointer();
00336     }
00337 
00338     /**
00339      * Rendering normal HTML-page with header by wrapping the generated content ($pageContent) in body-tags and setting the header accordingly.
00340      *
00341      * @param   string      The page content which TypoScript objects has generated
00342      * @return  void
00343      */
00344     function renderContentWithHeader($pageContent)  {
00345         $customContent = $GLOBALS['TSFE']->config['config']['headerComment'];
00346         if (trim($customContent))   {
00347             $customContent = chr(10).$customContent;
00348         } else $customContent='';
00349 
00350             // Setting charset:
00351         $theCharset = $GLOBALS['TSFE']->metaCharset;
00352 
00353             // Reset the content variables:
00354         $GLOBALS['TSFE']->content='';
00355         $htmlTagAttributes = array();
00356         $htmlLang = $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] ? $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] : 'en';
00357 
00358             // Set content direction: (More info: http://www.tau.ac.il/~danon/Hebrew/HTML_and_Hebrew.html)
00359         if ($GLOBALS['TSFE']->config['config']['htmlTag_dir'])  {
00360             $htmlTagAttributes['dir'] = htmlspecialchars($GLOBALS['TSFE']->config['config']['htmlTag_dir']);
00361         }
00362 
00363             // Setting document type:
00364         $docTypeParts = array();
00365             // Part 1: XML prologue
00366         switch((string)$GLOBALS['TSFE']->config['config']['xmlprologue'])   {
00367             case 'none':
00368             break;
00369             case 'xml_10':
00370                 $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
00371             break;
00372             case 'xml_11':
00373                 $docTypeParts[]='<?xml version="1.1" encoding="'.$theCharset.'"?>';
00374             break;
00375             case '':
00376                 if ($GLOBALS['TSFE']->xhtmlVersion) $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
00377             break;
00378             default:
00379                 $docTypeParts[]=$GLOBALS['TSFE']->config['config']['xmlprologue'];
00380         }
00381             // Part 2: DTD
00382         if ($GLOBALS['TSFE']->config['config']['doctype'])  {
00383             switch((string)$GLOBALS['TSFE']->config['config']['doctype'])   {
00384                 case 'xhtml_trans':
00385                     $docTypeParts[]='<!DOCTYPE html
00386      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
00387      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
00388                 break;
00389                 case 'xhtml_strict':
00390                     $docTypeParts[]='<!DOCTYPE html
00391      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
00392      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
00393                 break;
00394                 case 'xhtml_frames':
00395                     $docTypeParts[]='<!DOCTYPE html
00396      PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
00397      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
00398                 break;
00399                 case 'xhtml_basic':
00400                     $docTypeParts[]='<!DOCTYPE html
00401     PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
00402     "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">';
00403                 break;
00404                 case 'xhtml_11':
00405                     $docTypeParts[]='<!DOCTYPE html
00406      PUBLIC "-//W3C//DTD XHTML 1.1//EN"
00407      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
00408                 break;
00409                 case 'xhtml_2':
00410                     $docTypeParts[]='<!DOCTYPE html
00411     PUBLIC "-//W3C//DTD XHTML 2.0//EN"
00412     "http://www.w3.org/TR/xhtml2/DTD/xhtml2.dtd">';
00413                 break;
00414                 case 'none':
00415                 break;
00416                 default:
00417                     $docTypeParts[] = $GLOBALS['TSFE']->config['config']['doctype'];
00418             }
00419         } else {
00420             $docTypeParts[]='<!DOCTYPE html
00421     PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
00422         }
00423 
00424         if ($GLOBALS['TSFE']->xhtmlVersion) {
00425 
00426                 // Setting <html> tag attributes:
00427             $htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml';
00428             $htmlTagAttributes['xml:lang'] = $htmlLang;
00429             if ($GLOBALS['TSFE']->xhtmlVersion < 110)   {
00430                     $htmlTagAttributes['lang'] = $htmlLang;
00431             }
00432         }
00433 
00434             // Swap XML and doctype order around (for MSIE / Opera standards compliance)
00435         if ($GLOBALS['TSFE']->config['config']['doctypeSwitch'])    {
00436             $docTypeParts = array_reverse($docTypeParts);
00437         }
00438 
00439             // Adding doctype parts:
00440         $GLOBALS['TSFE']->content.= count($docTypeParts) ? implode(chr(10),$docTypeParts).chr(10) : '';
00441 
00442             // Begin header section:
00443         if (strcmp($GLOBALS['TSFE']->config['config']['htmlTag_setParams'],'none')) {
00444             $_attr = $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] ? $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] : t3lib_div::implodeAttributes($htmlTagAttributes);
00445         } else {
00446             $_attr = '';
00447         }
00448         $GLOBALS['TSFE']->content.='<html'.($_attr ? ' '.$_attr : '').'>';
00449 
00450             // Head tag:
00451         $headTag = $GLOBALS['TSFE']->pSetup['headTag'] ? $GLOBALS['TSFE']->pSetup['headTag'] : '<head>';
00452         $GLOBALS['TSFE']->content.= chr(10).$headTag;
00453 
00454             // Setting charset meta tag:
00455         $GLOBALS['TSFE']->content.='
00456     <meta http-equiv="Content-Type" content="text/html; charset='.$theCharset.'" />';
00457 
00458         $GLOBALS['TSFE']->content.='
00459 
00460 <!-- '.($customContent?$customContent.chr(10):'').'
00461     This website is powered by TYPO3 - inspiring people to share!
00462     TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
00463     TYPO3 is copyright 1998-2008 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
00464     Information and contribution at http://typo3.com/ and http://typo3.org/
00465 -->
00466 ';
00467 
00468 
00469         if ($GLOBALS['TSFE']->baseUrl) {
00470             $GLOBALS['TSFE']->content.='
00471     <base href="'.htmlspecialchars($GLOBALS['TSFE']->baseUrl).'" />';
00472         }
00473 
00474         if ($GLOBALS['TSFE']->pSetup['shortcutIcon']) {
00475             $favIcon = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['shortcutIcon']);
00476             $iconMimeType = '';
00477             if (function_exists('finfo_open')) {
00478                 if (($finfo = @finfo_open(FILEINFO_MIME))) {
00479                     $iconMimeType = ' type="' . finfo_file($finfo, $favIcon) . '"';
00480                     finfo_close($finfo);
00481                 }
00482             }
00483 
00484             $GLOBALS['TSFE']->content.= '
00485     <link rel="shortcut icon" href="'.htmlspecialchars($favIcon).'"'.$iconMimeType.' />
00486     <link rel="icon" href="'.htmlspecialchars($favIcon).'"'.$iconMimeType.' />';
00487         }
00488 
00489             // Including CSS files
00490         if (is_array($GLOBALS['TSFE']->tmpl->setup['plugin.'])) {
00491             $temp_styleLines=array();
00492             foreach ($GLOBALS['TSFE']->tmpl->setup['plugin.'] as $key=>$iCSScode)   {
00493                 if (is_array($iCSScode) && $iCSScode['_CSS_DEFAULT_STYLE']) {
00494                     $temp_styleLines[]='/* default styles for extension "'.substr($key,0,-1).'" */'.chr(10).$iCSScode['_CSS_DEFAULT_STYLE'];
00495                 }
00496             }
00497             if (count($temp_styleLines))    {
00498                 if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
00499                     $GLOBALS['TSFE']->content.=TSpagegen::inline2TempFile(implode(chr(10),$temp_styleLines),'css');
00500                 } else {
00501                     $GLOBALS['TSFE']->content.='
00502     <style type="text/css">
00503         /*<![CDATA[*/
00504     <!--
00505     '.implode(chr(10),$temp_styleLines).'
00506     -->
00507         /*]]>*/
00508     </style>';
00509                 }
00510             }
00511         }
00512 
00513         if ($GLOBALS['TSFE']->pSetup['stylesheet']) {
00514             $ss = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['stylesheet']);
00515             if ($ss)    {
00516                 $GLOBALS['TSFE']->content.='
00517     <link rel="stylesheet" type="text/css" href="'.htmlspecialchars($ss).'" />';
00518             }
00519         }
00520         if (is_array($GLOBALS['TSFE']->pSetup['includeCSS.']))  {
00521             foreach ($GLOBALS['TSFE']->pSetup['includeCSS.'] as $key=>$iCSSfile)    {
00522                 if (!is_array($iCSSfile))   {
00523                     $ss=$GLOBALS['TSFE']->tmpl->getFileName($iCSSfile);
00524                     if ($ss)    {
00525                         if ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['import'])    {
00526                             if (substr($ss,0,1)!='/')   {   // To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
00527                                 $ss = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/'.$ss;
00528                             }
00529                             $GLOBALS['TSFE']->content.='
00530     <style type="text/css">
00531     <!--
00532     @import url("'.htmlspecialchars($ss).'") '.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['media']).';
00533     -->
00534     </style>
00535                             ';
00536                         } else {
00537                             $GLOBALS['TSFE']->content.='
00538     <link rel="'.($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['alternate'] ? 'alternate stylesheet' : 'stylesheet').'" type="text/css" href="'.htmlspecialchars($ss).'"'.
00539             ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['title'] ? ' title="'.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['title']).'"' : '').
00540             ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['media'] ? ' media="'.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['media']).'"' : '').
00541             ' />';
00542                         }
00543                     }
00544                 }
00545             }
00546         }
00547 
00548             // Stylesheets
00549         $style='';
00550         $style.=trim($GLOBALS['TSFE']->pSetup['CSS_inlineStyle']).chr(10);
00551 
00552         if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE'])   {
00553             $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();
00554             $RTEclasses = $pageTSConfig['RTE.']['classes.'];
00555             if (is_array($RTEclasses))  {
00556                 foreach ($RTEclasses as $RTEclassName=>$RTEvalueArray)  {
00557                     if ($RTEvalueArray['value'])    {
00558                         $style.='
00559 .'.substr($RTEclassName,0,-1).' {'.$RTEvalueArray['value'].'}';
00560                     }
00561                 }
00562             }
00563 
00564             if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs'] && is_array($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.']))    {
00565                 $mSOa_tList = t3lib_div::trimExplode(',',strtoupper($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs']),1);
00566                 foreach ($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'] as $mSOa_key=>$mSOa_value) {
00567                     if (!is_array($mSOa_value) && (in_array('*',$mSOa_tList)||in_array($mSOa_key,$mSOa_tList))) {
00568                         $style.='
00569 '.$mSOa_key.' {'.$mSOa_value.'}';
00570                     }
00571                 }
00572             }
00573         }
00574 
00575             // Setting body tag margins in CSS:
00576         if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']) && $GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {
00577             $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
00578             $style.='
00579     BODY {margin: '.$margins.'px '.$margins.'px '.$margins.'px '.$margins.'px;}';
00580         }
00581 
00582         if ($GLOBALS['TSFE']->pSetup['noLinkUnderline'])    {
00583             $style.='
00584     A:link {text-decoration: none}
00585     A:visited {text-decoration: none}
00586     A:active {text-decoration: none}';
00587         }
00588         if (trim($GLOBALS['TSFE']->pSetup['hover']))    {
00589             $style.='
00590     A:hover {color: '.trim($GLOBALS['TSFE']->pSetup['hover']).';}';
00591         }
00592         if (trim($GLOBALS['TSFE']->pSetup['hoverStyle']))   {
00593             $style.='
00594     A:hover {'.trim($GLOBALS['TSFE']->pSetup['hoverStyle']).'}';
00595         }
00596         if ($GLOBALS['TSFE']->pSetup['smallFormFields'])    {
00597             $style.='
00598     SELECT {  font-family: Verdana, Arial, Helvetica; font-size: 10px }
00599     TEXTAREA  {  font-family: Verdana, Arial, Helvetica; font-size: 10px}
00600     INPUT   {  font-family: Verdana, Arial, Helvetica; font-size: 10px }';
00601         }
00602         if ($GLOBALS['TSFE']->pSetup['adminPanelStyles'])   {
00603             $style.='
00604 
00605     /* Default styles for the Admin Panel */
00606     TABLE.typo3-adminPanel { border: 1px solid black; background-color: #F6F2E6; }
00607     TABLE.typo3-adminPanel TR.typo3-adminPanel-hRow TD { background-color: #9BA1A8; }
00608     TABLE.typo3-adminPanel TR.typo3-adminPanel-itemHRow TD { background-color: #ABBBB4; }
00609     TABLE.typo3-adminPanel TABLE, TABLE.typo3-adminPanel TD { border: 0px; }
00610     TABLE.typo3-adminPanel TD FONT { font-family: verdana; font-size: 10px; color: black; }
00611     TABLE.typo3-adminPanel TD A FONT { font-family: verdana; font-size: 10px; color: black; }
00612     TABLE.typo3-editPanel { border: 1px solid black; background-color: #F6F2E6; }
00613     TABLE.typo3-editPanel TD { border: 0px; }
00614             ';
00615         }
00616 
00617         if (trim($style))   {
00618             if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
00619                 $GLOBALS['TSFE']->content.=TSpagegen::inline2TempFile($style, 'css');
00620             } else {
00621                 $GLOBALS['TSFE']->content.='
00622     <style type="text/css">
00623         /*<![CDATA[*/
00624     <!--'.$style.'
00625     -->
00626         /*]]>*/
00627     </style>';
00628             }
00629         }
00630 
00631             // JavaScript files
00632         if (is_array($GLOBALS['TSFE']->pSetup['includeJS.']))   {
00633             foreach ($GLOBALS['TSFE']->pSetup['includeJS.'] as $key=>$JSfile)   {
00634                 if (!is_array($JSfile)) {
00635                     $ss = $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
00636                     if ($ss)    {
00637                         $type = $GLOBALS['TSFE']->pSetup['includeJS.'][$key.'.']['type'];
00638                         if (!$type) $type = 'text/javascript';
00639 
00640                         $GLOBALS['TSFE']->content.='
00641     <script src="' . htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . $ss) . '" type="' . htmlspecialchars($type) . '"></script>';
00642                     }
00643                 }
00644             }
00645         }
00646 
00647 
00648 
00649 
00650 
00651             // Headerdata
00652         if (is_array($GLOBALS['TSFE']->pSetup['headerData.']))  {
00653             $GLOBALS['TSFE']->content.= chr(10).$GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['headerData.'],'headerData.');
00654         }
00655 
00656             // Title
00657         $titleTagContent = $GLOBALS['TSFE']->tmpl->printTitle(
00658             $GLOBALS['TSFE']->altPageTitle?$GLOBALS['TSFE']->altPageTitle:$GLOBALS['TSFE']->page['title'],
00659             $GLOBALS['TSFE']->config['config']['noPageTitle'],
00660             $GLOBALS['TSFE']->config['config']['pageTitleFirst']
00661         );
00662         if ($GLOBALS['TSFE']->config['config']['titleTagFunction']) {
00663             $titleTagContent = $GLOBALS['TSFE']->cObj->callUserFunction($GLOBALS['TSFE']->config['config']['titleTagFunction'], array(), $titleTagContent);
00664         }
00665 
00666         if (strlen($titleTagContent) && intval($GLOBALS['TSFE']->config['config']['noPageTitle'])!==2)  {
00667             $GLOBALS['TSFE']->content.='
00668     <title>'.htmlspecialchars($titleTagContent).'</title>';
00669         }
00670         $GLOBALS['TSFE']->content.='
00671     <meta name="generator" content="TYPO3 '.TYPO3_branch.' CMS" />';
00672 
00673         $conf=$GLOBALS['TSFE']->pSetup['meta.'];
00674         if (is_array($conf))    {
00675             reset($conf);
00676             while(list($theKey,$theValue)=each($conf))  {
00677                 if (!strstr($theKey,'.') || !isset($conf[substr($theKey,0,-1)]))    {       // Only if 1) the property is set but not the value itself, 2) the value and/or any property
00678                     if (strstr($theKey,'.'))    {
00679                         $theKey = substr($theKey,0,-1);
00680                     }
00681                     $val = $GLOBALS['TSFE']->cObj->stdWrap($conf[$theKey],$conf[$theKey.'.']);
00682                     $key = $theKey;
00683                     if (trim($val)) {
00684                         $a='name';
00685                         if (strtolower($key)=='refresh')    {$a='http-equiv';}
00686                         $GLOBALS['TSFE']->content.= '
00687     <meta '.$a.'="'.$key.'" content="'.htmlspecialchars(trim($val)).'" />';
00688                     }
00689                 }
00690             }
00691         }
00692 
00693         unset($GLOBALS['TSFE']->additionalHeaderData['JSCode']);
00694         unset($GLOBALS['TSFE']->additionalHeaderData['JSImgCode']);
00695 
00696         if (is_array($GLOBALS['TSFE']->config['INTincScript'])) {
00697                 // Storing the JSCode and JSImgCode vars...
00698             $GLOBALS['TSFE']->additionalHeaderData['JSCode'] = $GLOBALS['TSFE']->JSCode;
00699             $GLOBALS['TSFE']->additionalHeaderData['JSImgCode'] = $GLOBALS['TSFE']->JSImgCode;
00700             $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] = $GLOBALS['TSFE']->uniqueHash();
00701             $GLOBALS['TSFE']->config['INTincScript_ext']['additionalHeaderData'] = $GLOBALS['TSFE']->additionalHeaderData;  // Storing the header-data array
00702             $GLOBALS['TSFE']->config['INTincScript_ext']['additionalJavaScript'] = $GLOBALS['TSFE']->additionalJavaScript;  // Storing the JS-data array
00703             $GLOBALS['TSFE']->config['INTincScript_ext']['additionalCSS'] = $GLOBALS['TSFE']->additionalCSS;    // Storing the Style-data array
00704 
00705             $GLOBALS['TSFE']->additionalHeaderData = array('<!--HD_'.$GLOBALS['TSFE']->config['INTincScript_ext']['divKey'].'-->'); // Clearing the array
00706             $GLOBALS['TSFE']->divSection.= '<!--TDS_'.$GLOBALS['TSFE']->config['INTincScript_ext']['divKey'].'-->';
00707         } else {
00708             $GLOBALS['TSFE']->INTincScript_loadJSCode();
00709         }
00710         $JSef = TSpagegen::JSeventFunctions();
00711 
00712             // Adding default Java Script:
00713         $_scriptCode = '
00714         var browserName = navigator.appName;
00715         var browserVer = parseInt(navigator.appVersion);
00716         var version = "";
00717         var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);
00718         if ((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName=="Konqueror" || browserName=="Opera") {version = "n3";} else {version = "n2";}
00719             // Blurring links:
00720         function blurLink(theObject)    {   //
00721             if (msie4)  {theObject.blur();}
00722         }
00723         ' . $JSef[0];
00724 
00725         if ($GLOBALS['TSFE']->spamProtectEmailAddresses && $GLOBALS['TSFE']->spamProtectEmailAddresses !== 'ascii') {
00726             $_scriptCode.= '
00727             // decrypt helper function
00728         function decryptCharcode(n,start,end,offset)    {
00729             n = n + offset;
00730             if (offset > 0 && n > end)  {
00731                 n = start + (n - end - 1);
00732             } else if (offset < 0 && n < start) {
00733                 n = end - (start - n - 1);
00734             }
00735             return String.fromCharCode(n);
00736         }
00737             // decrypt string
00738         function decryptString(enc,offset)  {
00739             var dec = "";
00740             var len = enc.length;
00741             for(var i=0; i < len; i++)  {
00742                 var n = enc.charCodeAt(i);
00743                 if (n >= 0x2B && n <= 0x3A) {
00744                     dec += decryptCharcode(n,0x2B,0x3A,offset); // 0-9 . , - + / :
00745                 } else if (n >= 0x40 && n <= 0x5A)  {
00746                     dec += decryptCharcode(n,0x40,0x5A,offset); // A-Z @
00747                 } else if (n >= 0x61 && n <= 0x7A)  {
00748                     dec += decryptCharcode(n,0x61,0x7A,offset); // a-z
00749                 } else {
00750                     dec += enc.charAt(i);
00751                 }
00752             }
00753             return dec;
00754         }
00755             // decrypt spam-protected emails
00756         function linkTo_UnCryptMailto(s)    {
00757             location.href = decryptString(s,'.($GLOBALS['TSFE']->spamProtectEmailAddresses*-1).');
00758         }
00759         ';
00760         }
00761 
00762             //add inline JS
00763         $_inlineJS = '';
00764             // defined in TS with page.inlineJS
00765         if (is_array($GLOBALS['TSFE']->pSetup['inlineJS.']))    {
00766             $GLOBALS['TSFE']->inlineJS[]= $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['inlineJS.'],'inlineJS.');
00767         }
00768             // defined in php
00769         if(is_array($GLOBALS['TSFE']->inlineJS)) {
00770             foreach($GLOBALS['TSFE']->inlineJS as $key=>$val) {
00771                 if(!is_array($val)) {
00772                     $_inlineJS .= chr(10).$val.chr(10);
00773                 }
00774             }
00775         }
00776 
00777             // Should minify?
00778         if ($GLOBALS['TSFE']->config['config']['minifyJS']) {
00779             $minifyErrorScript = $minifyErrorInline = '';
00780             $_scriptCode = t3lib_div::minifyJavaScript($_scriptCode,$minifyErrorScript);
00781             if ($minifyErrorScript) {
00782                 $GLOBALS['TT']->setTSlogMessage($minifyErrorScript, 3);
00783             }
00784             if ($_inlineJS) {
00785                 $_inlineJS = t3lib_div::minifyJavaScript($_inlineJS,$minifyErrorInline);
00786                 if ($minifyErrorInline) {
00787                     $GLOBALS['TT']->setTSlogMessage($minifyErrorInline, 3);
00788                 }
00789             }
00790         }
00791 
00792         if (!$GLOBALS['TSFE']->config['config']['removeDefaultJS']) {
00793                 // inlude default and inlineJS
00794             $GLOBALS['TSFE']->content.='
00795     <script type="text/javascript">
00796         /*<![CDATA[*/
00797     <!--'.$_scriptCode.$_inlineJS.'
00798     // -->
00799         /*]]>*/
00800     </script>';
00801         } elseif ($GLOBALS['TSFE']->config['config']['removeDefaultJS']==='external')   {
00802                 // put default and inlineJS in external file
00803             $GLOBALS['TSFE']->content.= TSpagegen::inline2TempFile($_scriptCode.$_inlineJS, 'js');
00804         } elseif ($_inlineJS) {
00805                 // include only inlineJS
00806             $GLOBALS['TSFE']->content.='
00807     <script type="text/javascript">
00808         /*<![CDATA[*/
00809     <!--'.$_inlineJS.'
00810     // -->
00811         /*]]>*/
00812     </script>';
00813         }
00814 
00815         $GLOBALS['TSFE']->content.= chr(10).implode($GLOBALS['TSFE']->additionalHeaderData,chr(10)).'
00816 </head>';
00817         if ($GLOBALS['TSFE']->pSetup['frameSet.'])  {
00818             $fs = t3lib_div::makeInstance('tslib_frameset');
00819             $GLOBALS['TSFE']->content.= $fs->make($GLOBALS['TSFE']->pSetup['frameSet.']);
00820             $GLOBALS['TSFE']->content.= chr(10).'<noframes>'.chr(10);
00821         }
00822 
00823             // Bodytag:
00824         $defBT = $GLOBALS['TSFE']->pSetup['bodyTagCObject'] ? $GLOBALS['TSFE']->cObj->cObjGetSingle($GLOBALS['TSFE']->pSetup['bodyTagCObject'],$GLOBALS['TSFE']->pSetup['bodyTagCObject.'],'bodyTagCObject') : '';
00825         if (!$defBT)    $defBT = $GLOBALS['TSFE']->defaultBodyTag;
00826         $bodyTag = $GLOBALS['TSFE']->pSetup['bodyTag'] ? $GLOBALS['TSFE']->pSetup['bodyTag'] : $defBT;
00827         if ($bgImg=$GLOBALS['TSFE']->cObj->getImgResource($GLOBALS['TSFE']->pSetup['bgImg'],$GLOBALS['TSFE']->pSetup['bgImg.']))    {
00828             $bodyTag = ereg_replace('>$','',trim($bodyTag)).' background="'.$GLOBALS["TSFE"]->absRefPrefix.$bgImg[3].'">';
00829         }
00830 
00831         if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']))  {
00832             $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
00833             if ($GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS'])  {
00834                 // Setting margins in CSS, see above
00835             } else {
00836                 $bodyTag = ereg_replace('>$','',trim($bodyTag)).' leftmargin="'.$margins.'" topmargin="'.$margins.'" marginwidth="'.$margins.'" marginheight="'.$margins.'">';
00837             }
00838         }
00839 
00840         if (trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']))   {
00841             $bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']).'>';
00842         }
00843 
00844         if (count($JSef[1]))    {   // Event functions:
00845             $bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim(implode(' ',$JSef[1])).'>';
00846         }
00847         $GLOBALS['TSFE']->content.= chr(10).$bodyTag;
00848 
00849 
00850             // Div-sections
00851         if ($GLOBALS['TSFE']->divSection)   {
00852             $GLOBALS['TSFE']->content.= chr(10).$GLOBALS['TSFE']->divSection;
00853         }
00854 
00855             // Page content
00856         $GLOBALS['TSFE']->content.= chr(10).$pageContent;
00857 
00858             // Ending page
00859         $GLOBALS['TSFE']->content.= chr(10).'</body>';
00860         if ($GLOBALS['TSFE']->pSetup['frameSet.'])  {
00861             $GLOBALS['TSFE']->content.= chr(10).'</noframes>';
00862         }
00863         $GLOBALS['TSFE']->content.=chr(10).'</html>';
00864     }
00865 
00866 
00867 
00868 
00869 
00870 
00871 
00872 
00873 
00874 
00875 
00876 
00877 
00878     /*************************
00879      *
00880      * Helper functions
00881      * Remember: Calls internally must still be done on the non-instantiated class: TSpagegen::inline2TempFile()
00882      *
00883      *************************/
00884 
00885     /**
00886      * Writes string to a temporary file named after the md5-hash of the string
00887      *
00888      * @param   string      CSS styles / JavaScript to write to file.
00889      * @param   string      Extension: "css" or "js"
00890      * @return  string      <script> or <link> tag for the file.
00891      */
00892     function inline2TempFile($str,$ext) {
00893 
00894             // Create filename / tags:
00895         $script = '';
00896         switch($ext)    {
00897             case 'js':
00898                 $script = 'typo3temp/javascript_'.substr(md5($str),0,10).'.js';
00899                 $output = '
00900     <script type="text/javascript" src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$script).'"></script>';
00901             break;
00902             case 'css':
00903                 $script = 'typo3temp/stylesheet_'.substr(md5($str),0,10).'.css';
00904                 $output = '
00905     <link rel="stylesheet" type="text/css" href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$script).'" />';
00906             break;
00907         }
00908 
00909             // Write file:
00910         if ($script)    {
00911             if (!@is_file(PATH_site.$script))   {
00912                 t3lib_div::writeFile(PATH_site.$script,$str);
00913             }
00914         }
00915 
00916         return $output;
00917     }
00918 
00919     /**
00920      * Checks if the value defined in "config.linkVars" contains an allowed value. Otherwise, return false which means the value will not be added to any links.
00921      *
00922      * @param   string      The string in which to find $needle
00923      * @param   string      The string to find in $haystack
00924      * @return  boolean     Returns true if $needle matches or is found in $haystack
00925      */
00926     function isAllowedLinkVarValue($haystack,$needle)   {
00927         $OK = false;
00928 
00929         if ($needle=='int' || $needle=='integer')   {   // Integer
00930 
00931             if (t3lib_div::testInt($haystack))  {
00932                 $OK = true;
00933             }
00934 
00935         } elseif (preg_match('/^\/.+\/[imsxeADSUXu]*$/', $needle))  {   // Regular expression, only "//" is allowed as delimiter
00936 
00937             if (@preg_match($needle, $haystack))    {
00938                 $OK = true;
00939             }
00940 
00941         } elseif (strstr($needle,'-'))  {   // Range
00942 
00943             if (t3lib_div::testInt($haystack))  {
00944                 $range = explode('-',$needle);
00945                 if ($range[0] <= $haystack && $range[1] >= $haystack)   {
00946                     $OK = true;
00947                 }
00948             }
00949 
00950         } elseif (strstr($needle,'|'))  {   // List
00951 
00952             $haystack = str_replace(' ','',$haystack);  // Trim the input
00953             if (strstr('|'.$needle.'|', '|'.$haystack.'|')) {
00954                 $OK = true;
00955             }
00956 
00957         } elseif (!strcmp($needle,$haystack))   {   // String comparison
00958             $OK = true;
00959         }
00960 
00961         return $OK;
00962     }
00963 }
00964 
00965 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_pagegen.php'])   {
00966     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_pagegen.php']);
00967 }
00968 
00969 
00970 
00971 // ********************************************************
00972 // Includes the search-class if $sword and $scols are set.
00973 // ********************************************************
00974 if (t3lib_div::_GP('sword') && t3lib_div::_GP('scols')) {
00975     require_once(PATH_tslib.'class.tslib_search.php');
00976 }
00977 
00978 // ************
00979 // LoadDBGroup
00980 // ************
00981 require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');
00982 
00983 /**
00984  * Class for fetching record relations for the frontend.
00985  *
00986  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00987  * @package TYPO3
00988  * @subpackage tslib
00989  * @see tslib_cObj::RECORDS()
00990  */
00991 class FE_loadDBGroup extends t3lib_loadDBGroup {
00992     var $fromTC = 0;    // Means that everything is returned instead of only uid and label-field
00993 }
00994 
00995 // **********************************
00996 // includes stuff for graphical work
00997 // **********************************
00998 require_once(PATH_t3lib.'class.t3lib_stdgraphic.php');
00999 require_once(PATH_tslib.'class.tslib_gifbuilder.php');
01000 
01001 // *************************
01002 // includes menu-management
01003 // *************************
01004 require_once(PATH_tslib.'class.tslib_menu.php');
01005 
01006 // *************************
01007 // Global content object...
01008 // *************************
01009 require_once(PATH_tslib.'class.tslib_content.php');
01010 
01011 ?>

Generated on Sat Jan 3 04:23:31 2009 for TYPO3 API by  doxygen 1.4.7