Documentation TYPO3 par Ameos

class.tslib_pagegen.php

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


Généré par Les experts TYPO3 avec  doxygen 1.4.6