Documentation TYPO3 par Ameos

class.tslib_pagegen.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2007 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 ***************************************************************/
00088 class TSpagegen {
00089 
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                 if ($GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP'])   {
00116                         $temp_parts = t3lib_div::trimExplode(',',$GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP'],1);
00117                         foreach ($temp_parts as $temp_p)        {
00118                                 $GLOBALS['TSFE']->pEncAllowedParamNames[$temp_p]=1;
00119                         }
00120                 }
00121 
00122 
00123                         // Global vars...
00124                 $GLOBALS['TSFE']->indexedDocTitle = $GLOBALS['TSFE']->page['title'];
00125                 $GLOBALS['TSFE']->debug = ''.$GLOBALS['TSFE']->config['config']['debug'];
00126 
00127                         // Base url:
00128                 if ($GLOBALS['TSFE']->config['config']['baseURL'])      {
00129                         if ($GLOBALS['TSFE']->config['config']['baseURL']==='1')        {
00130                                         // Deprecated property, going to be dropped.
00131                                 $error = 'Unsupported TypoScript property was found in this template: "config.baseURL="1"
00132 
00133 This setting has been deprecated in TYPO 3.8.1 due to security concerns.
00134 You need to change this value to the URL of your website root, otherwise TYPO3 will not work!
00135 
00136 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.';
00137 
00138                                 $GLOBALS['TSFE']->printError(nl2br($error));
00139                                 exit;
00140                         } else {
00141                                 $GLOBALS['TSFE']->baseUrl = $GLOBALS['TSFE']->config['config']['baseURL'];
00142                         }
00143                         $GLOBALS['TSFE']->anchorPrefix = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL')));
00144                 }
00145 
00146                         // Internal and External target defaults
00147                 $GLOBALS['TSFE']->intTarget = ''.$GLOBALS['TSFE']->config['config']['intTarget'];
00148                 $GLOBALS['TSFE']->extTarget = ''.$GLOBALS['TSFE']->config['config']['extTarget'];
00149                 if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'] === 'ascii') {
00150                         $GLOBALS['TSFE']->spamProtectEmailAddresses = 'ascii';
00151                 } else {
00152                         $GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-10,10,0);
00153                 }
00154 
00155 
00156                 $GLOBALS['TSFE']->absRefPrefix = trim(''.$GLOBALS['TSFE']->config['config']['absRefPrefix']);
00157                 if ((!strcmp($GLOBALS['TSFE']->config['config']['simulateStaticDocuments'],'PATH_INFO') || $GLOBALS['TSFE']->absRefPrefix_force)
00158                                 && !$GLOBALS['TSFE']->absRefPrefix)     {
00159                         $GLOBALS['TSFE']->absRefPrefix=t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/';
00160                 }               // Force absRefPrefix to this value is PATH_INFO is used.
00161 
00162                 if ($GLOBALS['TSFE']->type && $GLOBALS['TSFE']->config['config']['frameReloadIfNotInFrameset']) {
00163                         $tdlLD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,'_top',$GLOBALS['TSFE']->no_cache,'');
00164                         $GLOBALS['TSFE']->JSCode = 'if(!parent.'.trim($GLOBALS['TSFE']->sPre).' && !parent.view_frame) top.location.href="'.$GLOBALS['TSFE']->baseUrlWrap($tdlLD['totalURL']).'"';
00165                 }
00166                 $GLOBALS['TSFE']->compensateFieldWidth = ''.$GLOBALS['TSFE']->config['config']['compensateFieldWidth'];
00167                 $GLOBALS['TSFE']->lockFilePath = ''.$GLOBALS['TSFE']->config['config']['lockFilePath'];
00168                 $GLOBALS['TSFE']->lockFilePath = $GLOBALS['TSFE']->lockFilePath ? $GLOBALS['TSFE']->lockFilePath : 'fileadmin/';
00169                 $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'];
00170                 $GLOBALS['TSFE']->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
00171 
00172                 $GLOBALS['TSFE']->ATagParams = trim($GLOBALS['TSFE']->config['config']['ATagParams']) ? ' '.trim($GLOBALS['TSFE']->config['config']['ATagParams']) : '';
00173                 if ($GLOBALS['TSFE']->config['config']['setJS_mouseOver'])      $GLOBALS['TSFE']->setJS('mouseOver');
00174                 if ($GLOBALS['TSFE']->config['config']['setJS_openPic'])        $GLOBALS['TSFE']->setJS('openPic');
00175 
00176                 $GLOBALS['TSFE']->sWordRegEx='';
00177                 $GLOBALS['TSFE']->sWordList = t3lib_div::_GP('sword_list');
00178                 if (is_array($GLOBALS['TSFE']->sWordList))      {
00179                         $standAlone = trim(''.$GLOBALS['TSFE']->config['config']['sword_standAlone']);
00180                         $noMixedCase = trim(''.$GLOBALS['TSFE']->config['config']['sword_noMixedCase']);
00181 
00182                         $space = ($standAlone) ? '[[:space:]]' : '';
00183                         reset($GLOBALS['TSFE']->sWordList);
00184                         while (list($key,$val) = each($GLOBALS['TSFE']->sWordList))     {
00185                                 if (trim($val)) {
00186                                         if (!$noMixedCase) {
00187                                                 $GLOBALS['TSFE']->sWordRegEx.= $space.sql_regcase(quotemeta($val)).$space.'|';
00188                                         } else {
00189                                                 $GLOBALS['TSFE']->sWordRegEx.= $space.quotemeta($val).$space.'|';
00190                                         }
00191                                 }
00192                         }
00193                         $GLOBALS['TSFE']->sWordRegEx = ereg_replace('\|$','',$GLOBALS['TSFE']->sWordRegEx);
00194                 }
00195 
00196                         // linkVars
00197                 $linkVars = (string)$GLOBALS['TSFE']->config['config']['linkVars'];
00198                 if ($linkVars)  {
00199                         $linkVarArr = explode(',',$linkVars);
00200 
00201                         $GLOBALS['TSFE']->linkVars='';
00202                         $GET = t3lib_div::_GET();
00203 
00204                         foreach ($linkVarArr as $val)   {
00205                                 $val = trim($val);
00206 
00207                                 if (preg_match('/^(.*)\((.+)\)$/',$val,$match)) {
00208                                         $val = trim($match[1]);
00209                                         $test = trim($match[2]);
00210                                 } else unset($test);
00211 
00212                                 if ($val && isset($GET[$val]))  {
00213                                         if (!is_array($GET[$val]))      {
00214                                                 $tmpVal = rawurlencode($GET[$val]);
00215 
00216                                                 if ($test && !TSpagegen::isAllowedLinkVarValue($tmpVal,$test))  {
00217                                                         continue;       // Error: This value was not allowed for this key
00218                                                 }
00219 
00220                                                 $value = '&'.$val.'='.$tmpVal;
00221                                         } else {
00222                                                 if ($test && strcmp('array',$test))     {
00223                                                         continue;       // Error: This key must not be an array!
00224                                                 }
00225                                                 $value = t3lib_div::implodeArrayForUrl($val,$GET[$val]);
00226                                         }
00227                                 } else continue;
00228 
00229                                 $GLOBALS['TSFE']->linkVars.= $value;
00230                         }
00231                         unset($GET);
00232                 } else {
00233                         $GLOBALS['TSFE']->linkVars='';
00234                 }
00235 
00236                         // Setting XHTML-doctype from doctype
00237                 if (!$GLOBALS['TSFE']->config['config']['xhtmlDoctype'])        {
00238                         $GLOBALS['TSFE']->config['config']['xhtmlDoctype'] = $GLOBALS['TSFE']->config['config']['doctype'];
00239                 }
00240 
00241                 if ($GLOBALS['TSFE']->config['config']['xhtmlDoctype']) {
00242                         $GLOBALS['TSFE']->xhtmlDoctype = $GLOBALS['TSFE']->config['config']['xhtmlDoctype'];
00243 
00244                                 // Checking XHTML-docytpe
00245                         switch((string)$GLOBALS['TSFE']->config['config']['xhtmlDoctype'])      {
00246                                 case 'xhtml_trans':
00247                                 case 'xhtml_strict':
00248                                 case 'xhtml_frames':
00249                                         $GLOBALS['TSFE']->xhtmlVersion = 100;
00250                                 break;
00251                                 case 'xhtml_basic':
00252                                         $GLOBALS['TSFE']->xhtmlVersion = 105;
00253                                 break;
00254                                 case 'xhtml_11':
00255                                         $GLOBALS['TSFE']->xhtmlVersion = 110;
00256                                 break;
00257                                 case 'xhtml_2':
00258                                         $GLOBALS['TSFE']->xhtmlVersion = 200;
00259                                 break;
00260                                 default:
00261                                         $GLOBALS['TSFE']->xhtmlDoctype = '';
00262                                         $GLOBALS['TSFE']->xhtmlVersion = 0;
00263                         }
00264                 }
00265         }
00266 
00272         function getIncFiles()  {
00273                 $incFilesArray = array();
00274                         // Get files from config.includeLibrary
00275                 $includeLibrary = trim(''.$GLOBALS['TSFE']->config['config']['includeLibrary']);
00276                 if ($includeLibrary)    {
00277                         $incFile=$GLOBALS['TSFE']->tmpl->getFileName($includeLibrary);
00278                         if ($incFile)   {
00279                                 $incFilesArray[] = $incFile;
00280                         }
00281                 }
00282 
00283                 if (is_array($GLOBALS['TSFE']->pSetup['includeLibs.'])) {$incLibs=$GLOBALS['TSFE']->pSetup['includeLibs.'];} else {$incLibs=array();}
00284                 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)
00285                 if (count($incLibs))    {
00286                         reset($incLibs);
00287                         while(list(,$theLib)=each($incLibs))    {
00288                                 if (!is_array($theLib) && $incFile=$GLOBALS['TSFE']->tmpl->getFileName($theLib))        {
00289                                         $incFilesArray[] = $incFile;
00290                                 }
00291                         }
00292                 }
00293                         // Include HTML mail library?
00294                 if ($GLOBALS['TSFE']->config['config']['incT3Lib_htmlmail'])    {
00295                         $incFilesArray[] = 't3lib/class.t3lib_htmlmail.php';
00296                 }
00297                 return $incFilesArray;
00298         }
00299 
00305         function JSeventFunctions()     {
00306                 $functions = array();
00307                 $setEvents = array();
00308                 $setBody = array();
00309 
00310                 foreach ($GLOBALS['TSFE']->JSeventFuncCalls as $event => $handlers)     {
00311                         if (count($handlers))   {
00312                                 $functions[] = '        function T3_'.$event.'Wrapper(e)        {       '.implode('   ',$handlers).'    }';
00313                                 $setEvents[] = '        document.'.$event.'=T3_'.$event.'Wrapper;';
00314                                 if ($event == 'onload') {
00315                                         $setBody[]='onload="T3_onloadWrapper();"';      // dubiuos double setting breaks on some browser - do we need it?
00316                                 }
00317                         }
00318                 }
00319 
00320                 return Array(count($functions)?'
00321 <script type="text/javascript">
00322         /*<![CDATA[*/
00323 '.implode(chr(10),$functions).'
00324 '.implode(chr(10),$setEvents).'
00325         /*]]>*/
00326 </script>
00327                         ':'',$setBody);
00328         }
00329 
00335         function renderContent()        {
00336                 // PAGE CONTENT
00337                 $GLOBALS['TT']->incStackPointer();
00338                 $GLOBALS['TT']->push($GLOBALS['TSFE']->sPre, 'PAGE');
00339                         $pageContent = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup);
00340 
00341                         if ($GLOBALS['TSFE']->pSetup['wrap'])   {$pageContent = $GLOBALS['TSFE']->cObj->wrap($pageContent, $GLOBALS['TSFE']->pSetup['wrap']);}
00342                         if ($GLOBALS['TSFE']->pSetup['stdWrap.'])       {$pageContent = $GLOBALS['TSFE']->cObj->stdWrap($pageContent, $GLOBALS['TSFE']->pSetup['stdWrap.']);}
00343 
00344                         // PAGE HEADER (after content - maybe JS is inserted!
00345 
00346                         // if 'disableAllHeaderCode' is set, all the header-code is discarded!
00347                 if ($GLOBALS['TSFE']->config['config']['disableAllHeaderCode']) {
00348                         $GLOBALS['TSFE']->content = $pageContent;
00349                 } else {
00350                         TSpagegen::renderContentWithHeader($pageContent);
00351                 }
00352                 $GLOBALS['TT']->pull($GLOBALS['TT']->LR?$GLOBALS['TSFE']->content:'');
00353                 $GLOBALS['TT']->decStackPointer();
00354         }
00355 
00362         function renderContentWithHeader($pageContent)  {
00363                 $customContent = $GLOBALS['TSFE']->config['config']['headerComment'];
00364                 if (trim($customContent))       {
00365                         $customContent = chr(10).$customContent;
00366                 } else $customContent='';
00367 
00368                         // Setting charset:
00369                 $theCharset = $GLOBALS['TSFE']->metaCharset;
00370 
00371                         // Reset the content variables:
00372                 $GLOBALS['TSFE']->content='';
00373                 $htmlTagAttributes = array();
00374                 $htmlLang = $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] ? $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] : 'en';
00375 
00376                         // Set content direction: (More info: http://www.tau.ac.il/~danon/Hebrew/HTML_and_Hebrew.html)
00377                 if ($GLOBALS['TSFE']->config['config']['htmlTag_dir'])  {
00378                         $htmlTagAttributes['dir'] = htmlspecialchars($GLOBALS['TSFE']->config['config']['htmlTag_dir']);
00379                 }
00380 
00381                         // Setting document type:
00382                 $docTypeParts = array();
00383                         // Part 1: XML prologue
00384                 switch((string)$GLOBALS['TSFE']->config['config']['xmlprologue'])       {
00385                         case 'none':
00386                         break;
00387                         case 'xml_10':
00388                                 $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
00389                         break;
00390                         case 'xml_11':
00391                                 $docTypeParts[]='<?xml version="1.1" encoding="'.$theCharset.'"?>';
00392                         break;
00393                         case '':
00394                                 if ($GLOBALS['TSFE']->xhtmlVersion)     $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
00395                         break;
00396                         default:
00397                                 $docTypeParts[]=$GLOBALS['TSFE']->config['config']['xmlprologue'];
00398                 }
00399                         // Part 2: DTD
00400                 if ($GLOBALS['TSFE']->config['config']['doctype'])      {
00401                         switch((string)$GLOBALS['TSFE']->config['config']['doctype'])   {
00402                                 case 'xhtml_trans':
00403                                         $docTypeParts[]='<!DOCTYPE html
00404      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
00405      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
00406                                 break;
00407                                 case 'xhtml_strict':
00408                                         $docTypeParts[]='<!DOCTYPE html
00409      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
00410      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
00411                                 break;
00412                                 case 'xhtml_frames':
00413                                         $docTypeParts[]='<!DOCTYPE html
00414      PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
00415      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
00416                                 break;
00417                                 case 'xhtml_basic':
00418                                         $docTypeParts[]='<!DOCTYPE html
00419     PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
00420     "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">';
00421                                 break;
00422                                 case 'xhtml_11':
00423                                         $docTypeParts[]='<!DOCTYPE html
00424      PUBLIC "-//W3C//DTD XHTML 1.1//EN"
00425      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
00426                                 break;
00427                                 case 'xhtml_2':
00428                                         $docTypeParts[]='<!DOCTYPE html
00429         PUBLIC "-//W3C//DTD XHTML 2.0//EN"
00430         "http://www.w3.org/TR/xhtml2/DTD/xhtml2.dtd">';
00431                                 break;
00432                                 case 'none':
00433                                 break;
00434                                 default:
00435                                         $docTypeParts[] = $GLOBALS['TSFE']->config['config']['doctype'];
00436                         }
00437                 } else {
00438                         $docTypeParts[]='<!DOCTYPE html
00439         PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
00440                 }
00441 
00442                 if ($GLOBALS['TSFE']->xhtmlVersion)     {
00443 
00444                                 // Setting <html> tag attributes:
00445                         $htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml';
00446                         $htmlTagAttributes['xml:lang'] = $htmlLang;
00447                         if ($GLOBALS['TSFE']->xhtmlVersion < 110)       {
00448                                         $htmlTagAttributes['lang'] = $htmlLang;
00449                         }
00450                 }
00451 
00452                         // Swap XML and doctype order around (for MSIE / Opera standards compliance)
00453                 if ($GLOBALS['TSFE']->config['config']['doctypeSwitch'])        {
00454                         $docTypeParts = array_reverse($docTypeParts);
00455                 }
00456 
00457                         // Adding doctype parts:
00458                 $GLOBALS['TSFE']->content.= count($docTypeParts) ? implode(chr(10),$docTypeParts).chr(10) : '';
00459 
00460                         // Begin header section:
00461                 if (strcmp($GLOBALS['TSFE']->config['config']['htmlTag_setParams'],'none'))     {
00462                         $_attr = $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] ? $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] : t3lib_div::implodeAttributes($htmlTagAttributes);
00463                 } else {
00464                         $_attr = '';
00465                 }
00466                 $GLOBALS['TSFE']->content.='<html'.($_attr ? ' '.$_attr : '').'>';
00467 
00468                         // Head tag:
00469                 $headTag = $GLOBALS['TSFE']->pSetup['headTag'] ? $GLOBALS['TSFE']->pSetup['headTag'] : '<head>';
00470                 $GLOBALS['TSFE']->content.= chr(10).$headTag;
00471 
00472                         // Setting charset meta tag:
00473                 $GLOBALS['TSFE']->content.='
00474         <meta http-equiv="Content-Type" content="text/html; charset='.$theCharset.'" />';
00475 
00476 $GLOBALS['TSFE']->content.='
00477 
00478 <!-- '.($customContent?$customContent.chr(10):'').'
00479         This website is powered by TYPO3 - inspiring people to share!
00480         TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
00481         TYPO3 is copyright 1998-2006 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
00482         Information and contribution at http://typo3.com/ and http://typo3.org/
00483 -->
00484 ';
00485 
00486 
00487                 if ($GLOBALS['TSFE']->baseUrl) {
00488                         $GLOBALS['TSFE']->content.='
00489         <base href="'.htmlspecialchars($GLOBALS['TSFE']->baseUrl).'" />';
00490                 }
00491 
00492                 if ($GLOBALS['TSFE']->pSetup['shortcutIcon']) {
00493                         $ss=$path.$GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['shortcutIcon']);
00494                         $GLOBALS['TSFE']->content.='
00495         <link rel="SHORTCUT ICON" href="'.htmlspecialchars($ss).'" />';
00496                 }
00497 
00498                         // Including CSS files
00499                 if (is_array($GLOBALS['TSFE']->tmpl->setup['plugin.'])) {
00500                         $temp_styleLines=array();
00501                         foreach ($GLOBALS['TSFE']->tmpl->setup['plugin.'] as $key=>$iCSScode)   {
00502                                 if (is_array($iCSScode) && $iCSScode['_CSS_DEFAULT_STYLE'])     {
00503                                         $temp_styleLines[]='/* default styles for extension "'.substr($key,0,-1).'" */'.chr(10).$iCSScode['_CSS_DEFAULT_STYLE'];
00504                                 }
00505                         }
00506                         if (count($temp_styleLines))    {
00507                                 if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
00508                                         $GLOBALS['TSFE']->content.=TSpagegen::inline2TempFile(implode(chr(10),$temp_styleLines),'css');
00509                                 } else {
00510                                         $GLOBALS['TSFE']->content.='
00511         <style type="text/css">
00512                 /*<![CDATA[*/
00513         <!--
00514         '.implode(chr(10),$temp_styleLines).'
00515         -->
00516                 /*]]>*/
00517         </style>';
00518                                 }
00519                         }
00520                 }
00521 
00522                 if ($GLOBALS['TSFE']->pSetup['stylesheet'])     {
00523                         $ss=$GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['stylesheet']);
00524                         if ($ss)        {
00525                                 $GLOBALS['TSFE']->content.='
00526         <link rel="stylesheet" type="text/css" href="'.htmlspecialchars($ss).'" />';
00527                         }
00528                 }
00529                 if (is_array($GLOBALS['TSFE']->pSetup['includeCSS.']))  {
00530                         foreach ($GLOBALS['TSFE']->pSetup['includeCSS.'] as $key=>$iCSSfile)    {
00531                                 if (!is_array($iCSSfile))       {
00532                                         $ss=$GLOBALS['TSFE']->tmpl->getFileName($iCSSfile);
00533                                         if ($ss)        {
00534                                                 if ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['import'])        {
00535                                                         if (substr($ss,0,1)!='/')       {       // To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
00536                                                                 $ss = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/'.$ss;
00537                                                         }
00538                                                         $GLOBALS['TSFE']->content.='
00539         <style type="text/css">
00540         <!--
00541         @import url("'.htmlspecialchars($ss).'") '.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['media']).';
00542         -->
00543         </style>
00544                                                         ';
00545                                                 } else {
00546                                                         $GLOBALS['TSFE']->content.='
00547         <link rel="'.($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['alternate'] ? 'alternate stylesheet' : 'stylesheet').'" type="text/css" href="'.htmlspecialchars($ss).'"'.
00548                         ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['title'] ? ' title="'.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['title']).'"' : '').
00549                         ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['media'] ? ' media="'.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['media']).'"' : '').
00550                         ' />';
00551                                                 }
00552                                         }
00553                                 }
00554                         }
00555                 }
00556 
00557                         // Stylesheets
00558                 $style='';
00559                 $style.=trim($GLOBALS['TSFE']->pSetup['CSS_inlineStyle']).chr(10);
00560 
00561                 if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE'])   {
00562                         $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();
00563                         $RTEclasses = $pageTSConfig['RTE.']['classes.'];
00564                         if (is_array($RTEclasses))      {
00565                                 foreach ($RTEclasses as $RTEclassName=>$RTEvalueArray)  {
00566                                         if ($RTEvalueArray['value'])    {
00567                                                 $style.='
00568 .'.substr($RTEclassName,0,-1).' {'.$RTEvalueArray['value'].'}';
00569                                         }
00570                                 }
00571                         }
00572 
00573                         if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs'] && is_array($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.']))    {
00574                                 $mSOa_tList = t3lib_div::trimExplode(',',strtoupper($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs']),1);
00575                                 foreach ($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'] as $mSOa_key=>$mSOa_value) {
00576                                         if (!is_array($mSOa_value) && (in_array('*',$mSOa_tList)||in_array($mSOa_key,$mSOa_tList)))     {
00577                                                 $style.='
00578 '.$mSOa_key.' {'.$mSOa_value.'}';
00579                                         }
00580                                 }
00581                         }
00582                 }
00583 
00584                         // Setting body tag margins in CSS:
00585                 if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']) && $GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {
00586                         $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
00587                         $style.='
00588         BODY {margin: '.$margins.'px '.$margins.'px '.$margins.'px '.$margins.'px;}';
00589                 }
00590 
00591                 if ($GLOBALS['TSFE']->pSetup['noLinkUnderline'])        {
00592                         $style.='
00593         A:link {text-decoration: none}
00594         A:visited {text-decoration: none}
00595         A:active {text-decoration: none}';
00596                 }
00597                 if (trim($GLOBALS['TSFE']->pSetup['hover']))    {
00598                         $style.='
00599         A:hover {color: '.trim($GLOBALS['TSFE']->pSetup['hover']).';}';
00600                 }
00601                 if (trim($GLOBALS['TSFE']->pSetup['hoverStyle']))       {
00602                         $style.='
00603         A:hover {'.trim($GLOBALS['TSFE']->pSetup['hoverStyle']).'}';
00604                 }
00605                 if ($GLOBALS['TSFE']->pSetup['smallFormFields'])        {
00606                         $style.='
00607         SELECT {  font-family: Verdana, Arial, Helvetica; font-size: 10px }
00608         TEXTAREA  {  font-family: Verdana, Arial, Helvetica; font-size: 10px}
00609         INPUT   {  font-family: Verdana, Arial, Helvetica; font-size: 10px }';
00610                 }
00611                 if ($GLOBALS['TSFE']->pSetup['adminPanelStyles'])       {
00612                         $style.='
00613 
00614         /* Default styles for the Admin Panel */
00615         TABLE.typo3-adminPanel { border: 1px solid black; background-color: #F6F2E6; }
00616         TABLE.typo3-adminPanel TR.typo3-adminPanel-hRow TD { background-color: #9BA1A8; }
00617         TABLE.typo3-adminPanel TR.typo3-adminPanel-itemHRow TD { background-color: #ABBBB4; }
00618         TABLE.typo3-adminPanel TABLE, TABLE.typo3-adminPanel TD { border: 0px; }
00619         TABLE.typo3-adminPanel TD FONT { font-family: verdana; font-size: 10px; color: black; }
00620         TABLE.typo3-adminPanel TD A FONT { font-family: verdana; font-size: 10px; color: black; }
00621         TABLE.typo3-editPanel { border: 1px solid black; background-color: #F6F2E6; }
00622         TABLE.typo3-editPanel TD { border: 0px; }
00623                         ';
00624                 }
00625 
00626                 if (trim($style))       {
00627                         if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
00628                                 $GLOBALS['TSFE']->content.=TSpagegen::inline2TempFile($style, 'css');
00629                         } else {
00630                                 $GLOBALS['TSFE']->content.='
00631         <style type="text/css">
00632                 /*<![CDATA[*/
00633         <!--'.$style.'
00634         -->
00635                 /*]]>*/
00636         </style>';
00637                         }
00638                 }
00639 
00640                         // JavaScript files
00641                 if (is_array($GLOBALS['TSFE']->pSetup['includeJS.']))   {
00642                         foreach ($GLOBALS['TSFE']->pSetup['includeJS.'] as $key=>$JSfile)       {
00643                                 if (!is_array($JSfile)) {
00644                                         $ss = $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
00645                                         if ($ss)        {
00646                                                 $type = $GLOBALS['TSFE']->pSetup['includeJS.'][$key.'.']['type'];
00647                                                 if (!$type)     $type = 'text/javascript';
00648 
00649                                                 $GLOBALS['TSFE']->content.='
00650         <script src="'.htmlspecialchars($ss).'" type="'.htmlspecialchars($type).'"></script>';
00651                                         }
00652                                 }
00653                         }
00654                 }
00655 
00656 
00657 
00658 
00659 
00660                         // Headerdata
00661                 if (is_array($GLOBALS['TSFE']->pSetup['headerData.']))  {
00662                         $GLOBALS['TSFE']->content.= chr(10).$GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['headerData.'],'headerData.');
00663                 }
00664 
00665                         // Title
00666                 $titleTagContent = $GLOBALS['TSFE']->tmpl->printTitle(
00667                         $GLOBALS['TSFE']->altPageTitle?$GLOBALS['TSFE']->altPageTitle:$GLOBALS['TSFE']->page['title'],
00668                         $GLOBALS['TSFE']->config['config']['noPageTitle'],
00669                         $GLOBALS['TSFE']->config['config']['pageTitleFirst']
00670                 );
00671                 if ($GLOBALS['TSFE']->config['config']['titleTagFunction'])     {
00672                         $titleTagContent = $GLOBALS['TSFE']->cObj->callUserFunction($GLOBALS['TSFE']->config['config']['titleTagFunction'], array(), $titleTagContent);
00673                 }
00674 
00675                 if (strlen($titleTagContent) && intval($GLOBALS['TSFE']->config['config']['noPageTitle'])!==2)  {
00676                         $GLOBALS['TSFE']->content.='
00677         <title>'.htmlspecialchars($titleTagContent).'</title>';
00678                 }
00679                 $GLOBALS['TSFE']->content.='
00680         <meta name="generator" content="TYPO3 '.TYPO3_branch.' CMS" />';
00681 
00682                 $conf=$GLOBALS['TSFE']->pSetup['meta.'];
00683                 if (is_array($conf))    {
00684                         reset($conf);
00685                         while(list($theKey,$theValue)=each($conf))      {
00686                                 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
00687                                         if (strstr($theKey,'.'))        {
00688                                                 $theKey = substr($theKey,0,-1);
00689                                         }
00690                                         $val = $GLOBALS['TSFE']->cObj->stdWrap($conf[$theKey],$conf[$theKey.'.']);
00691                                         $key = $theKey;
00692                                         if (trim($val)) {
00693                                                 $a='name';
00694                                                 if (strtolower($key)=='refresh')        {$a='http-equiv';}
00695                                                 $GLOBALS['TSFE']->content.= '
00696         <meta '.$a.'="'.$key.'" content="'.htmlspecialchars(trim($val)).'" />';
00697                                         }
00698                                 }
00699                         }
00700                 }
00701 
00702                 unset($GLOBALS['TSFE']->additionalHeaderData['JSCode']);
00703                 unset($GLOBALS['TSFE']->additionalHeaderData['JSImgCode']);
00704 
00705                 if (is_array($GLOBALS['TSFE']->config['INTincScript'])) {
00706                                 // Storing the JSCode and JSImgCode vars...
00707                         $GLOBALS['TSFE']->additionalHeaderData['JSCode'] = $GLOBALS['TSFE']->JSCode;
00708                         $GLOBALS['TSFE']->additionalHeaderData['JSImgCode'] = $GLOBALS['TSFE']->JSImgCode;
00709                         $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] = $GLOBALS['TSFE']->uniqueHash();
00710                         $GLOBALS['TSFE']->config['INTincScript_ext']['additionalHeaderData'] = $GLOBALS['TSFE']->additionalHeaderData;  // Storing the header-data array
00711                         $GLOBALS['TSFE']->config['INTincScript_ext']['additionalJavaScript'] = $GLOBALS['TSFE']->additionalJavaScript;  // Storing the JS-data array
00712                         $GLOBALS['TSFE']->config['INTincScript_ext']['additionalCSS'] = $GLOBALS['TSFE']->additionalCSS;        // Storing the Style-data array
00713 
00714                         $GLOBALS['TSFE']->additionalHeaderData = array('<!--HD_'.$GLOBALS['TSFE']->config['INTincScript_ext']['divKey'].'-->'); // Clearing the array
00715                         $GLOBALS['TSFE']->divSection.= '<!--TDS_'.$GLOBALS['TSFE']->config['INTincScript_ext']['divKey'].'-->';
00716                 } else {
00717                         $GLOBALS['TSFE']->INTincScript_loadJSCode();
00718                 }
00719                 $JSef = TSpagegen::JSeventFunctions();
00720 
00721                         // Adding default Java Script:
00722                 $_scriptCode = '
00723                 var browserName = navigator.appName;
00724                 var browserVer = parseInt(navigator.appVersion);
00725                 var version = "";
00726                 var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);
00727                 if ((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName=="Konqueror" || browserName=="Opera") {version = "n3";} else {version = "n2";}
00728                         // Blurring links:
00729                 function blurLink(theObject)    {       //
00730                         if (msie4)      {theObject.blur();}
00731                 }
00732                 ';
00733 
00734                 if ($GLOBALS['TSFE']->spamProtectEmailAddresses && $GLOBALS['TSFE']->spamProtectEmailAddresses !== 'ascii') {
00735                         $_scriptCode.= '
00736                         // decrypt helper function
00737                 function decryptCharcode(n,start,end,offset)    {
00738                         n = n + offset;
00739                         if (offset > 0 && n > end)      {
00740                                 n = start + (n - end - 1);
00741                         } else if (offset < 0 && n < start)     {
00742                                 n = end - (start - n - 1);
00743                         }
00744                         return String.fromCharCode(n);
00745                 }
00746                         // decrypt string
00747                 function decryptString(enc,offset)      {
00748                         var dec = "";
00749                         var len = enc.length;
00750                         for(var i=0; i < len; i++)      {
00751                                 var n = enc.charCodeAt(i);
00752                                 if (n >= 0x2B && n <= 0x3A)     {
00753                                         dec += decryptCharcode(n,0x2B,0x3A,offset);     // 0-9 . , - + / :
00754                                 } else if (n >= 0x40 && n <= 0x5A)      {
00755                                         dec += decryptCharcode(n,0x40,0x5A,offset);     // A-Z @
00756                                 } else if (n >= 0x61 && n <= 0x7A)      {
00757                                         dec += decryptCharcode(n,0x61,0x7A,offset);     // a-z
00758                                 } else {
00759                                         dec += enc.charAt(i);
00760                                 }
00761                         }
00762                         return dec;
00763                 }
00764                         // decrypt spam-protected emails
00765                 function linkTo_UnCryptMailto(s)        {
00766                         location.href = decryptString(s,'.($GLOBALS['TSFE']->spamProtectEmailAddresses*-1).');
00767                 }
00768                 ';
00769                 }
00770 
00771                 if (!$GLOBALS['TSFE']->config['config']['removeDefaultJS']) {
00772                                 // NOTICE: The following code must be kept synchronized with "tslib/default.js"!!!
00773                         $GLOBALS['TSFE']->content.='
00774         <script type="text/javascript">
00775                 /*<![CDATA[*/
00776         <!--'.$_scriptCode.'
00777         // -->
00778                 /*]]>*/
00779         </script>';
00780                 } elseif ($GLOBALS['TSFE']->config['config']['removeDefaultJS']==='external')   {
00781                         $GLOBALS['TSFE']->content.= TSpagegen::inline2TempFile($_scriptCode, 'js');
00782                 }
00783 
00784                 $GLOBALS['TSFE']->content.= chr(10).implode($GLOBALS['TSFE']->additionalHeaderData,chr(10)).'
00785 '.$JSef[0].'
00786 </head>';
00787                 if ($GLOBALS['TSFE']->pSetup['frameSet.'])      {
00788                         $fs = t3lib_div::makeInstance('tslib_frameset');
00789                         $GLOBALS['TSFE']->content.= $fs->make($GLOBALS['TSFE']->pSetup['frameSet.']);
00790                         $GLOBALS['TSFE']->content.= chr(10).'<noframes>'.chr(10);
00791                 }
00792 
00793                         // Bodytag:
00794                 $defBT = $GLOBALS['TSFE']->pSetup['bodyTagCObject'] ? $GLOBALS['TSFE']->cObj->cObjGetSingle($GLOBALS['TSFE']->pSetup['bodyTagCObject'],$GLOBALS['TSFE']->pSetup['bodyTagCObject.'],'bodyTagCObject') : '';
00795                 if (!$defBT)    $defBT = $GLOBALS['TSFE']->defaultBodyTag;
00796                 $bodyTag = $GLOBALS['TSFE']->pSetup['bodyTag'] ? $GLOBALS['TSFE']->pSetup['bodyTag'] : $defBT;
00797                 if ($bgImg=$GLOBALS['TSFE']->cObj->getImgResource($GLOBALS['TSFE']->pSetup['bgImg'],$GLOBALS['TSFE']->pSetup['bgImg.']))        {
00798                         $bodyTag = ereg_replace('>$','',trim($bodyTag)).' background="'.$GLOBALS["TSFE"]->absRefPrefix.$bgImg[3].'">';
00799                 }
00800 
00801                 if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']))  {
00802                         $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
00803                         if ($GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS'])      {
00804                                 // Setting margins in CSS, see above
00805                         } else {
00806                                 $bodyTag = ereg_replace('>$','',trim($bodyTag)).' leftmargin="'.$margins.'" topmargin="'.$margins.'" marginwidth="'.$margins.'" marginheight="'.$margins.'">';
00807                         }
00808                 }
00809 
00810                 if (trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']))       {
00811                         $bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']).'>';
00812                 }
00813 
00814                 if (count($JSef[1]))    {       // Event functions:
00815                         $bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim(implode(' ',$JSef[1])).'>';
00816                 }
00817                 $GLOBALS['TSFE']->content.= chr(10).$bodyTag;
00818 
00819 
00820                 // Div-sections
00821                 if ($GLOBALS['TSFE']->divSection)       {
00822                         $GLOBALS['TSFE']->content.= chr(10).$GLOBALS['TSFE']->divSection;
00823                 }
00824 
00825                 // Page content
00826                 $GLOBALS['TSFE']->content.= chr(10).$pageContent;
00827 
00828                 // Ending page
00829                 $GLOBALS['TSFE']->content.= chr(10).'</body>';
00830                 if ($GLOBALS['TSFE']->pSetup['frameSet.'])      {
00831                         $GLOBALS['TSFE']->content.= chr(10).'</noframes>';
00832                 }
00833                 $GLOBALS['TSFE']->content.=chr(10).'</html>';
00834         }
00835 
00836 
00837 
00838 
00839 
00840 
00841 
00842 
00843 
00844 
00845 
00846 
00847 
00848         /*************************
00849          *
00850          * Helper functions
00851          * Remember: Calls internally must still be done on the non-instantiated class: TSpagegen::inline2TempFile()
00852          *
00853          *************************/
00854 
00862         function inline2TempFile($str,$ext)     {
00863 
00864                         // Create filename / tags:
00865                 $script = '';
00866                 switch($ext)    {
00867                         case 'js':
00868                                 $script = 'typo3temp/javascript_'.substr(md5($str),0,10).'.js';
00869                                 $output = '
00870         <script type="text/javascript" src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$script).'"></script>';
00871                         break;
00872                         case 'css':
00873                                 $script = 'typo3temp/stylesheet_'.substr(md5($str),0,10).'.css';
00874                                 $output = '
00875         <link rel="stylesheet" type="text/css" href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$script).'" />';
00876                         break;
00877                 }
00878 
00879                         // Write file:
00880                 if ($script)    {
00881                         if (!@is_file(PATH_site.$script))       {
00882                                 t3lib_div::writeFile(PATH_site.$script,$str);
00883                         }
00884                 }
00885 
00886                 return $output;
00887         }
00888 
00896         function isAllowedLinkVarValue($haystack,$needle)       {
00897                 $OK = false;
00898 
00899                 if ($needle=='int' || $needle=='integer')       {       // Integer
00900 
00901                         if (t3lib_div::testInt($haystack))      {
00902                                 $OK = true;
00903                         }
00904 
00905                 } elseif (preg_match('/^\/.+\/[imsxeADSUXu]*$/', $needle))      {       // Regular expression, only "//" is allowed as delimiter
00906 
00907                         if (@preg_match($needle, $haystack))    {
00908                                 $OK = true;
00909                         }
00910 
00911                 } elseif (strstr($needle,'-'))  {       // Range
00912 
00913                         if (t3lib_div::testInt($haystack))      {
00914                                 $range = explode('-',$needle);
00915                                 if ($range[0] <= $haystack && $range[1] >= $haystack)   {
00916                                         $OK = true;
00917                                 }
00918                         }
00919 
00920                 } elseif (strstr($needle,'|'))  {       // List
00921 
00922                         $haystack = str_replace(' ','',$haystack);      // Trim the input
00923                         if (strstr('|'.$needle.'|', '|'.$haystack.'|')) {
00924                                 $OK = true;
00925                         }
00926 
00927                 } elseif (!strcmp($needle,$haystack))   {       // String comparison
00928                         $OK = true;
00929                 }
00930 
00931                 return $OK;
00932         }
00933 }
00934 
00935 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_pagegen.php'])   {
00936         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_pagegen.php']);
00937 }
00938 
00939 
00940 
00941 // ********************************************************
00942 // Includes the search-class if $sword and $scols are set.
00943 // ********************************************************
00944 if (t3lib_div::_GP('sword') && t3lib_div::_GP('scols')) {
00945         require_once(PATH_tslib.'class.tslib_search.php');
00946 }
00947 
00948 // ************
00949 // LoadDBGroup
00950 // ************
00951 require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');
00952 
00961 class FE_loadDBGroup extends t3lib_loadDBGroup  {
00962         var $fromTC = 0;                // Means the not only uid and label-field is returned, but everything
00963 }
00964 
00965 // **********************************
00966 // includes stuff for graphical work
00967 // **********************************
00968 require_once(PATH_t3lib.'class.t3lib_stdgraphic.php');
00969 require_once(PATH_tslib.'class.tslib_gifbuilder.php');
00970 
00971 // *************************
00972 // includes menu-management
00973 // *************************
00974 require_once(PATH_tslib.'class.tslib_menu.php');
00975 
00976 // *************************
00977 // Global content object...
00978 // *************************
00979 require_once(PATH_tslib.'class.tslib_content.php');
00980 
00981 ?>


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