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