Documentation TYPO3 par Ameos

class.tslib_pagegen.php

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


Généré par L'expert TYPO3 avec  doxygen 1.4.6