typo3/sysext/cms/tslib/class.tslib_pagegen.php

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

Generated on Wed Aug 10 07:55:25 2005 for TYPO3 3.8.0 by  doxygen 1.4.3-20050530