2 /***************************************************************
5 * (c) 1999-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Libraries for pagegen.php
29 * The script "pagegen.php" is included by "index_ts.php" when a page is not cached but needs to be rendered.
32 * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
35 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
38 * [CLASS/FUNCTION INDEX of SCRIPT]
43 * 95: function pagegenInit()
44 * 225: function getIncFiles()
45 * 258: function JSeventFunctions()
46 * 292: function renderContent()
47 * 319: function renderContentWithHeader($pageContent)
49 * SECTION: Helper functions
50 * 754: function inline2TempFile($str,$ext)
53 * 808: class FE_loadDBGroup extends t3lib_loadDBGroup
56 * (This index is automatically created/updated by the extension "extdeveval")
79 * Class for starting TypoScript page generation
81 * The class is not instantiated as an objects but called directly with the "::" operator.
82 * eg: TSpagegen::pagegenInit()
84 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
91 * Setting some vars in TSFE, primarily based on TypoScript config settings.
95 function pagegenInit() {
96 if ($GLOBALS['TSFE']->page
['content_from_pid']>0) {
97 $temp_copy_TSFE = $GLOBALS['TSFE']; // make REAL copy of TSFE object - not reference!
98 $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!
99 $temp_copy_TSFE->getPageAndRootlineWithDomain($GLOBALS['TSFE']->config
['config']['content_from_pid_allowOutsideDomain']?
0:$GLOBALS['TSFE']->domainStartPage
);
100 $GLOBALS['TSFE']->contentPid
= intval($temp_copy_TSFE->id
);
101 unset($temp_copy_TSFE);
103 if ($GLOBALS['TSFE']->config
['config']['MP_defaults']) {
104 $temp_parts = t3lib_div
::trimExplode('|',$GLOBALS['TSFE']->config
['config']['MP_defaults'],1);
106 while(list(,$temp_p)=each($temp_parts)) {
107 list($temp_idP,$temp_MPp) = explode(':',$temp_p,2);
108 $temp_ids=t3lib_div
::intExplode(',',$temp_idP);
110 while(list(,$temp_id)=each($temp_ids)) {
111 $GLOBALS['TSFE']->MP_defaults
[$temp_id]=$temp_MPp;
115 if ($GLOBALS['TSFE']->config
['config']['simulateStaticDocuments_pEnc_onlyP']) {
116 $temp_parts = t3lib_div
::trimExplode(',',$GLOBALS['TSFE']->config
['config']['simulateStaticDocuments_pEnc_onlyP'],1);
117 foreach ($temp_parts as $temp_p) {
118 $GLOBALS['TSFE']->pEncAllowedParamNames
[$temp_p]=1;
124 $GLOBALS['TSFE']->indexedDocTitle
= $GLOBALS['TSFE']->page
['title'];
125 $GLOBALS['TSFE']->debug
= ''.$GLOBALS['TSFE']->config
['config']['debug'];
128 if ($GLOBALS['TSFE']->config
['config']['baseURL']) {
129 $GLOBALS['TSFE']->baseUrl
= (intval($GLOBALS['TSFE']->config
['config']['baseURL']) ? t3lib_div
::getIndpEnv('TYPO3_SITE_URL') : $GLOBALS['TSFE']->config
['config']['baseURL']);
130 $GLOBALS['TSFE']->anchorPrefix
= substr(t3lib_div
::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div
::getIndpEnv('TYPO3_SITE_URL')));
133 // Internal and External target defaults
134 $GLOBALS['TSFE']->intTarget
= ''.$GLOBALS['TSFE']->config
['config']['intTarget'];
135 $GLOBALS['TSFE']->extTarget
= ''.$GLOBALS['TSFE']->config
['config']['extTarget'];
136 $GLOBALS['TSFE']->spamProtectEmailAddresses
= t3lib_div
::intInRange($GLOBALS['TSFE']->config
['config']['spamProtectEmailAddresses'],-5,5,0);
137 if ($GLOBALS['TSFE']->spamProtectEmailAddresses
) {
138 $GLOBALS['TSFE']->additionalJavaScript
['UnCryptMailto()']='
139 // JS function for uncrypting spam-protected emails:
140 function UnCryptMailto(s) { //
143 for(var i=0; i < s.length; i++) {
145 if (n>=8364) {n = 128;}
146 r += String.fromCharCode(n-('.$GLOBALS['TSFE']->spamProtectEmailAddresses
.'));
150 // JS function for uncrypting spam-protected emails:
151 function linkTo_UnCryptMailto(s) { //
152 location.href=UnCryptMailto(s);
158 $GLOBALS['TSFE']->absRefPrefix
= trim(''.$GLOBALS['TSFE']->config
['config']['absRefPrefix']);
159 if ((!strcmp($GLOBALS['TSFE']->config
['config']['simulateStaticDocuments'],'PATH_INFO') ||
$GLOBALS['TSFE']->absRefPrefix_force
)
160 && !$GLOBALS['TSFE']->absRefPrefix
) {
161 $GLOBALS['TSFE']->absRefPrefix
=t3lib_div
::dirname(t3lib_div
::getIndpEnv('SCRIPT_NAME')).'/';
162 } // Force absRefPrefix to this value is PATH_INFO is used.
164 if ($GLOBALS['TSFE']->type
&& $GLOBALS['TSFE']->config
['config']['frameReloadIfNotInFrameset']) {
165 $tdlLD = $GLOBALS['TSFE']->tmpl
->linkData($GLOBALS['TSFE']->page
,'_top',$GLOBALS['TSFE']->no_cache
,'');
166 $GLOBALS['TSFE']->JSCode
= 'if(!parent.'.trim($GLOBALS['TSFE']->sPre
).' && !parent.view_frame) top.document.location="'.$GLOBALS['TSFE']->baseUrlWrap($tdlLD['totalURL']).'"';
168 $GLOBALS['TSFE']->compensateFieldWidth
= ''.$GLOBALS['TSFE']->config
['config']['compensateFieldWidth'];
169 $GLOBALS['TSFE']->lockFilePath
= ''.$GLOBALS['TSFE']->config
['config']['lockFilePath'];
170 $GLOBALS['TSFE']->lockFilePath
= $GLOBALS['TSFE']->lockFilePath ?
$GLOBALS['TSFE']->lockFilePath
: 'fileadmin/';
171 $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'];
172 $GLOBALS['TSFE']->TYPO3_CONF_VARS
['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
174 $GLOBALS['TSFE']->ATagParams
= trim($GLOBALS['TSFE']->config
['config']['ATagParams']) ?
' '.trim($GLOBALS['TSFE']->config
['config']['ATagParams']) : '';
175 if ($GLOBALS['TSFE']->config
['config']['setJS_mouseOver']) $GLOBALS['TSFE']->setJS('mouseOver');
176 if ($GLOBALS['TSFE']->config
['config']['setJS_openPic']) $GLOBALS['TSFE']->setJS('openPic');
178 $GLOBALS['TSFE']->sWordRegEx
='';
179 $GLOBALS['TSFE']->sWordList
= t3lib_div
::_GP('sword_list');
180 if (is_array($GLOBALS['TSFE']->sWordList
)) {
181 $standAlone = trim(''.$GLOBALS['TSFE']->config
['config']['sword_standAlone']);
182 $noMixedCase = trim(''.$GLOBALS['TSFE']->config
['config']['sword_noMixedCase']);
184 $space = ($standAlone) ?
'[[:space:]]' : '';
185 reset($GLOBALS['TSFE']->sWordList
);
186 while (list($key,$val) = each($GLOBALS['TSFE']->sWordList
)) {
189 $GLOBALS['TSFE']->sWordRegEx
.= $space.sql_regcase(quotemeta($val)).$space.'|';
191 $GLOBALS['TSFE']->sWordRegEx
.= $space.quotemeta($val).$space.'|';
195 $GLOBALS['TSFE']->sWordRegEx
= ereg_replace('\|$','',$GLOBALS['TSFE']->sWordRegEx
);
199 $GLOBALS['TSFE']->linkVars
= ''.$GLOBALS['TSFE']->config
['config']['linkVars'];
200 if ($GLOBALS['TSFE']->linkVars
) {
201 $linkVarArr = explode(',',$GLOBALS['TSFE']->linkVars
);
202 $GLOBALS['TSFE']->linkVars
='';
204 while(list(,$val)=each($linkVarArr)) {
206 $GET = t3lib_div
::_GET();
207 if ($val && isset($GET[$val])) {
208 if (!is_array($GET[$val])) {
209 $GLOBALS['TSFE']->linkVars
.='&'.$val.'='.rawurlencode($GET[$val]);
211 $GLOBALS['TSFE']->linkVars
.=t3lib_div
::implodeArrayForUrl($val,$GET[$val]);
216 $GLOBALS['TSFE']->linkVars
='';
221 * Returns an array with files to include. These files are the ones set up in TypoScript config.
223 * @return array Files to include. Paths are relative to PATH_site.
225 function getIncFiles() {
226 $incFilesArray = array();
227 // Get files from config.includeLibrary
228 $includeLibrary = trim(''.$GLOBALS['TSFE']->config
['config']['includeLibrary']);
229 if ($includeLibrary) {
230 $incFile=$GLOBALS['TSFE']->tmpl
->getFileName($includeLibrary);
232 $incFilesArray[] = $incFile;
236 if (is_array($GLOBALS['TSFE']->pSetup
['includeLibs.'])) {$incLibs=$GLOBALS['TSFE']->pSetup
['includeLibs.'];} else {$incLibs=array();}
237 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)
238 if (count($incLibs)) {
240 while(list(,$theLib)=each($incLibs)) {
241 if (!is_array($theLib) && $incFile=$GLOBALS['TSFE']->tmpl
->getFileName($theLib)) {
242 $incFilesArray[] = $incFile;
246 // Include HTML mail library?
247 if ($GLOBALS['TSFE']->config
['config']['incT3Lib_htmlmail']) {
248 $incFilesArray[] = 't3lib/class.t3lib_htmlmail.php';
250 return $incFilesArray;
254 * Processing JavaScript handlers
256 * @return array Array with a) a JavaScript section with event handlers and variables set and b) an array with attributes for the body tag.
258 function JSeventFunctions() {
263 if (is_array($GLOBALS['TSFE']->JSeventFuncCalls
['onmousemove']) && count($GLOBALS['TSFE']->JSeventFuncCalls
['onmousemove'])) {
264 $functions[]=' function T3_onmousemoveWrapper(e) { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls
['onmousemove']).' }';
265 $setEvents[]=' document.onmousemove=T3_onmousemoveWrapper;';
267 if (is_array($GLOBALS['TSFE']->JSeventFuncCalls
['onmouseup']) && count($GLOBALS['TSFE']->JSeventFuncCalls
['onmouseup'])) {
268 $functions[]=' function T3_onmouseupWrapper(e) { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls
['onmouseup']).' }';
269 $setEvents[]=' document.onmouseup=T3_onmouseupWrapper;';
271 if (is_array($GLOBALS['TSFE']->JSeventFuncCalls
['onload']) && count($GLOBALS['TSFE']->JSeventFuncCalls
['onload'])) {
272 $functions[]=' function T3_onloadWrapper() { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls
['onload']).' }';
273 $setEvents[]=' document.onload=T3_onloadWrapper;';
274 $setBody[]='onload="T3_onloadWrapper();"';
277 return Array(count($functions)?
'
278 <script type="text/javascript">
280 '.implode(chr(10),$functions).'
281 '.implode(chr(10),$setEvents).'
288 * Rendering the page content
292 function renderContent() {
294 $GLOBALS['TT']->incStackPointer();
295 $GLOBALS['TT']->push($GLOBALS['TSFE']->sPre
, 'PAGE');
296 $pageContent = $GLOBALS['TSFE']->cObj
->cObjGet($GLOBALS['TSFE']->pSetup
);
298 if ($GLOBALS['TSFE']->pSetup
['wrap']) {$pageContent = $GLOBALS['TSFE']->cObj
->wrap($pageContent, $GLOBALS['TSFE']->pSetup
['wrap']);}
299 if ($GLOBALS['TSFE']->pSetup
['stdWrap.']) {$pageContent = $GLOBALS['TSFE']->cObj
->stdWrap($pageContent, $GLOBALS['TSFE']->pSetup
['stdWrap.']);}
301 // PAGE HEADER (after content - maybe JS is inserted!
303 // if 'disableAllHeaderCode' is set, all the header-code is discarded!
304 if ($GLOBALS['TSFE']->config
['config']['disableAllHeaderCode']) {
305 $GLOBALS['TSFE']->content
= $pageContent;
307 TSpagegen
::renderContentWithHeader($pageContent);
309 $GLOBALS['TT']->pull($GLOBALS['TT']->LR?
$GLOBALS['TSFE']->content
:'');
310 $GLOBALS['TT']->decStackPointer();
314 * Rendering normal HTML-page with header by wrapping the generated content ($pageContent) in body-tags and setting the header accordingly.
316 * @param string The page content which TypoScript objects has generated
319 function renderContentWithHeader($pageContent) {
320 $customContent = $GLOBALS['TSFE']->config
['config']['headerComment'];
321 if (trim($customContent)) {
322 $customContent = chr(10).$customContent;
323 } else $customContent='';
326 $theCharset = $GLOBALS['TSFE']->metaCharset
;
328 // Reset the content variables:
329 $GLOBALS['TSFE']->content
='';
330 $htmlTagAttributes = array();
331 $htmlLang = $GLOBALS['TSFE']->config
['config']['htmlTag_langKey'] ?
$GLOBALS['TSFE']->config
['config']['htmlTag_langKey'] : 'en';
333 // Set content direction: (More info: http://www.tau.ac.il/~danon/Hebrew/HTML_and_Hebrew.html)
334 if ($GLOBALS['TSFE']->config
['config']['htmlTag_dir']) {
335 $htmlTagAttributes['dir'] = htmlspecialchars($GLOBALS['TSFE']->config
['config']['htmlTag_dir']);
338 // Setting document type:
339 $docTypeParts = array();
340 $XMLprologue = $GLOBALS['TSFE']->config
['config']['xmlprologue'] != 'none';
341 if ($GLOBALS['TSFE']->config
['config']['doctype']) {
344 switch((string)$GLOBALS['TSFE']->config
['config']['doctype']) {
346 if ($XMLprologue) $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
347 $docTypeParts[]='<!DOCTYPE html
348 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
349 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
352 if ($XMLprologue) $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
353 $docTypeParts[]='<!DOCTYPE html
354 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
355 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
358 if ($XMLprologue) $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
359 $docTypeParts[]='<!DOCTYPE html
360 PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
361 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
364 if ($XMLprologue) $docTypeParts[]='<?xml version="1.1" encoding="'.$theCharset.'"?>';
365 $docTypeParts[]='<!DOCTYPE html
366 PUBLIC "-//W3C//DTD XHTML 1.1//EN"
367 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
370 if ($XMLprologue) $docTypeParts[]='<?xml version="2.0" encoding="'.$theCharset.'"?>';
371 $docTypeParts[]='<!DOCTYPE html
372 PUBLIC "-//W3C//DTD XHTML 2.0//EN"
373 "http://www.w3.org/TR/xhtml2/DTD/xhtml2.dtd">';
378 $docTypeParts[] = $GLOBALS['TSFE']->config
['config']['doctype'];
381 // Setting <html> tag attributes:
382 switch((string)$GLOBALS['TSFE']->config
['config']['doctype']) {
386 $htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml';
387 $htmlTagAttributes['xml:lang'] = $htmlLang;
388 $htmlTagAttributes['lang'] = $htmlLang;
392 $htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml';
393 $htmlTagAttributes['xml:lang'] = $htmlLang;
397 $docTypeParts[]='<!DOCTYPE html
398 PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
401 // Swap XML and doctype order around (for MSIE / Opera standards compliance)
402 if ($GLOBALS['TSFE']->config
['config']['doctypeSwitch']) {
403 $docTypeParts = array_reverse($docTypeParts);
406 // Adding doctype parts:
407 $GLOBALS['TSFE']->content
.= count($docTypeParts) ?
implode(chr(10),$docTypeParts).chr(10) : '';
409 // Begin header section:
410 if (strcmp($GLOBALS['TSFE']->config
['config']['htmlTag_setParams'],'none')) {
411 $_attr = $GLOBALS['TSFE']->config
['config']['htmlTag_setParams'] ?
$GLOBALS['TSFE']->config
['config']['htmlTag_setParams'] : t3lib_div
::implodeAttributes($htmlTagAttributes);
415 $GLOBALS['TSFE']->content
.='<html'.($_attr ?
' '.$_attr : '').'>
417 // Setting charset meta tag:
418 $GLOBALS['TSFE']->content
.='
419 <meta http-equiv="Content-Type" content="text/html; charset='.$theCharset.'" />';
421 $GLOBALS['TSFE']->content
.='
423 <!-- '.($customContent?
$customContent.chr(10):'').'
424 This website is brought to you by TYPO3 - get.content.right
425 TYPO3 is a free open source Content Management Framework created by Kasper Skaarhoj and licensed under GNU/GPL.
426 TYPO3 is copyright 1998-2004 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
427 Information and contribution at http://www.typo3.com
432 if ($GLOBALS['TSFE']->baseUrl
) {
433 $GLOBALS['TSFE']->content
.='
434 <base href="'.htmlspecialchars($GLOBALS['TSFE']->baseUrl
).'" />';
437 if ($GLOBALS['TSFE']->pSetup
['shortcutIcon']) {
438 $ss=$path.$GLOBALS['TSFE']->tmpl
->getFileName($GLOBALS['TSFE']->pSetup
['shortcutIcon']);
439 $GLOBALS['TSFE']->content
.='
440 <link rel="SHORTCUT ICON" href="'.htmlspecialchars($ss).'" />';
443 /** CSS STYLESHEET handling: */
444 if (is_array($GLOBALS['TSFE']->tmpl
->setup
['plugin.'])) {
445 $temp_styleLines=array();
446 reset($GLOBALS['TSFE']->tmpl
->setup
['plugin.']);
447 while(list($k2,$iCSScode)=each($GLOBALS['TSFE']->tmpl
->setup
['plugin.'])) {
448 if (is_array($iCSScode) && $iCSScode['_CSS_DEFAULT_STYLE']) {
449 $temp_styleLines[]='/* default styles for extension "'.substr($k2,0,-1).'" */'.chr(10).$iCSScode['_CSS_DEFAULT_STYLE'];
452 if (count($temp_styleLines)) {
453 if ($GLOBALS['TSFE']->config
['config']['inlineStyle2TempFile']) {
454 $GLOBALS['TSFE']->content
.=TSpagegen
::inline2TempFile(implode(chr(10),$temp_styleLines),'css');
456 $GLOBALS['TSFE']->content
.='
457 <style type="text/css">
460 '.implode(chr(10),$temp_styleLines).'
468 if ($GLOBALS['TSFE']->pSetup
['stylesheet']) {
469 $ss=$GLOBALS['TSFE']->tmpl
->getFileName($GLOBALS['TSFE']->pSetup
['stylesheet']);
471 $GLOBALS['TSFE']->content
.='
472 <link rel="stylesheet" type="text/css" href="'.htmlspecialchars($ss).'" />';
475 if (is_array($GLOBALS['TSFE']->pSetup
['includeCSS.'])) {
476 reset($GLOBALS['TSFE']->pSetup
['includeCSS.']);
477 while(list($k2,$iCSSfile)=each($GLOBALS['TSFE']->pSetup
['includeCSS.'])) {
478 if (!is_array($iCSSfile)) {
479 $ss = $GLOBALS['TSFE']->tmpl
->getFileName($iCSSfile);
481 if ($GLOBALS['TSFE']->pSetup
['includeCSS.'][$k2.'.']['import']) {
482 if (substr($ss,0,1)!='/') { // To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
483 $ss = t3lib_div
::dirname(t3lib_div
::getIndpEnv('SCRIPT_NAME')).'/'.$ss;
485 $GLOBALS['TSFE']->content
.='
486 <style type="text/css">
488 @import url("'.htmlspecialchars($ss).'") '.htmlspecialchars($GLOBALS['TSFE']->pSetup
['includeCSS.'][$k2.'.']['media']).';
493 $GLOBALS['TSFE']->content
.='
494 <link rel="'.($GLOBALS['TSFE']->pSetup
['includeCSS.'][$k2.'.']['alternate'] ?
'alternate stylesheet' : 'stylesheet').'" type="text/css" href="'.htmlspecialchars($ss).'"'.
495 ($GLOBALS['TSFE']->pSetup
['includeCSS.'][$k2.'.']['title'] ?
' title="'.htmlspecialchars($GLOBALS['TSFE']->pSetup
['includeCSS.'][$k2.'.']['title']).'"' : '').
496 ($GLOBALS['TSFE']->pSetup
['includeCSS.'][$k2.'.']['media'] ?
' media="'.htmlspecialchars($GLOBALS['TSFE']->pSetup
['includeCSS.'][$k2.'.']['media']).'"' : '').
506 $style.=trim($GLOBALS['TSFE']->pSetup
['CSS_inlineStyle']).chr(10);
508 if ($GLOBALS['TSFE']->pSetup
['insertClassesFromRTE']) {
509 $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();
510 $RTEclasses = $pageTSConfig['RTE.']['classes.'];
511 if (is_array($RTEclasses)) {
513 while(list($RTEclassName,$RTEvalueArray)=each($RTEclasses)) {
514 if ($RTEvalueArray['value']) {
516 .'.substr($RTEclassName,0,-1).' {'.$RTEvalueArray['value'].'}';
521 if ($GLOBALS['TSFE']->pSetup
['insertClassesFromRTE.']['add_mainStyleOverrideDefs'] && is_array($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'])) {
522 $mSOa_tList = t3lib_div
::trimExplode(',',strtoupper($GLOBALS['TSFE']->pSetup
['insertClassesFromRTE.']['add_mainStyleOverrideDefs']),1);
523 reset($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.']);
524 while(list($mSOa_key,$mSOa_value)=each($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'])) {
525 if (!is_array($mSOa_value) && (in_array('*',$mSOa_tList)||
in_array($mSOa_key,$mSOa_tList))) {
527 '.$mSOa_key.' {'.$mSOa_value.'}';
533 // Setting body tag margins in CSS:
534 if (isset($GLOBALS['TSFE']->pSetup
['bodyTagMargins']) && $GLOBALS['TSFE']->pSetup
['bodyTagMargins.']['useCSS']) {
535 $margins = intval($GLOBALS['TSFE']->pSetup
['bodyTagMargins']);
537 BODY {margin: '.$margins.'px '.$margins.'px '.$margins.'px '.$margins.'px;}';
540 if ($GLOBALS['TSFE']->pSetup
['noLinkUnderline']) {
542 A:link {text-decoration: none}
543 A:visited {text-decoration: none}
544 A:active {text-decoration: none}';
546 if (trim($GLOBALS['TSFE']->pSetup
['hover'])) {
548 A:hover {color: '.trim($GLOBALS['TSFE']->pSetup
['hover']).';}';
550 if (trim($GLOBALS['TSFE']->pSetup
['hoverStyle'])) {
552 A:hover {'.trim($GLOBALS['TSFE']->pSetup
['hoverStyle']).'}';
554 if ($GLOBALS['TSFE']->pSetup
['smallFormFields']) {
556 SELECT { font-family: Verdana, Arial, Helvetica; font-size: 10px }
557 TEXTAREA { font-family: Verdana, Arial, Helvetica; font-size: 10px}
558 INPUT { font-family: Verdana, Arial, Helvetica; font-size: 10px }';
560 if ($GLOBALS['TSFE']->pSetup
['adminPanelStyles']) {
563 /* Default styles for the Admin Panel */
564 TABLE.typo3-adminPanel { border: 1px solid black; background-color: #F6F2E6; }
565 TABLE.typo3-adminPanel TR.typo3-adminPanel-hRow TD { background-color: #9BA1A8; }
566 TABLE.typo3-adminPanel TR.typo3-adminPanel-itemHRow TD { background-color: #ABBBB4; }
567 TABLE.typo3-adminPanel TABLE, TABLE.typo3-adminPanel TD { border: 0px; }
568 TABLE.typo3-adminPanel TD FONT { font-family: verdana; font-size: 10px; color: black; }
569 TABLE.typo3-adminPanel TD A FONT { font-family: verdana; font-size: 10px; color: black; }
570 TABLE.typo3-editPanel { border: 1px solid black; background-color: #F6F2E6; }
571 TABLE.typo3-editPanel TD { border: 0px; }
576 if ($GLOBALS['TSFE']->config
['config']['inlineStyle2TempFile']) {
577 $GLOBALS['TSFE']->content
.=TSpagegen
::inline2TempFile($style, 'css');
579 $GLOBALS['TSFE']->content
.='
580 <style type="text/css">
594 if (is_array($GLOBALS['TSFE']->pSetup
['headerData.'])) {
595 $GLOBALS['TSFE']->content
.= chr(10).$GLOBALS['TSFE']->cObj
->cObjGet($GLOBALS['TSFE']->pSetup
['headerData.'],'headerData.');
599 $titleTagContent = $GLOBALS['TSFE']->tmpl
->printTitle(
600 $GLOBALS['TSFE']->altPageTitle?
$GLOBALS['TSFE']->altPageTitle
:$GLOBALS['TSFE']->page
['title'],
601 $GLOBALS['TSFE']->config
['config']['noPageTitle'],
602 $GLOBALS['TSFE']->config
['config']['pageTitleFirst']
604 if ($GLOBALS['TSFE']->config
['config']['titleTagFunction']) {
605 $titleTagContent = $GLOBALS['TSFE']->cObj
->callUserFunction($GLOBALS['TSFE']->config
['config']['titleTagFunction'], array(), $titleTagContent);
608 if (strlen($titleTagContent) && intval($GLOBALS['TSFE']->config
['config']['noPageTitle'])!==2) {
609 $GLOBALS['TSFE']->content
.='
610 <title>'.htmlspecialchars($titleTagContent).'</title>';
612 $GLOBALS['TSFE']->content
.='
613 <meta name="generator" content="TYPO3 3.8 CMS" />';
615 $conf=$GLOBALS['TSFE']->pSetup
['meta.'];
616 if (is_array($conf)) {
618 while(list($theKey,$theValue)=each($conf)) {
619 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
620 if (strstr($theKey,'.')) {
621 $theKey = substr($theKey,0,-1);
623 $val = $GLOBALS['TSFE']->cObj
->stdWrap($conf[$theKey],$conf[$theKey.'.']);
627 if (strtolower($key)=='refresh') {$a='http-equiv';}
628 $GLOBALS['TSFE']->content
.= '
629 <meta '.$a.'="'.$key.'" content="'.htmlspecialchars(trim($val)).'" />';
635 unset($GLOBALS['TSFE']->additionalHeaderData
['JSCode']);
636 unset($GLOBALS['TSFE']->additionalHeaderData
['JSImgCode']);
638 if (is_array($GLOBALS['TSFE']->config
['INTincScript'])) {
639 // Storing the JSCode and JSImgCode vars...
640 $GLOBALS['TSFE']->additionalHeaderData
['JSCode'] = $GLOBALS['TSFE']->JSCode
;
641 $GLOBALS['TSFE']->additionalHeaderData
['JSImgCode'] = $GLOBALS['TSFE']->JSImgCode
;
642 $GLOBALS['TSFE']->config
['INTincScript_ext']['divKey']= $GLOBALS['TSFE']->uniqueHash();
643 $GLOBALS['TSFE']->config
['INTincScript_ext']['additionalHeaderData'] = $GLOBALS['TSFE']->additionalHeaderData
; // Storing the header-data array
644 $GLOBALS['TSFE']->config
['INTincScript_ext']['additionalJavaScript'] = $GLOBALS['TSFE']->additionalJavaScript
; // Storing the JS-data array
645 $GLOBALS['TSFE']->config
['INTincScript_ext']['additionalCSS'] = $GLOBALS['TSFE']->additionalCSS
; // Storing the Style-data array
647 $GLOBALS['TSFE']->additionalHeaderData
=array('<!--HD_'.$GLOBALS['TSFE']->config
['INTincScript_ext']['divKey'].'-->'); // Clearing the array
648 $GLOBALS['TSFE']->divSection
.='<!--TDS_'.$GLOBALS['TSFE']->config
['INTincScript_ext']['divKey'].'-->';
650 $GLOBALS['TSFE']->INTincScript_loadJSCode();
652 $JSef = TSpagegen
::JSeventFunctions();
654 // Adding default Java Script:
656 browserName = navigator.appName;
657 browserVer = parseInt(navigator.appVersion);
658 var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);
659 if ((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName=="Konqueror") {version = "n3";} else {version = "n2";}
661 function blurLink(theObject) { //
662 if (msie4) {theObject.blur();}
665 if (!$GLOBALS['TSFE']->config
['config']['removeDefaultJS']) {
666 // NOTICE: The following code must be kept synchronized with "tslib/default.js"!!!
667 $GLOBALS['TSFE']->content
.='
668 <script type="text/javascript">
674 } elseif ($GLOBALS['TSFE']->config
['config']['removeDefaultJS']==='external') {
675 $GLOBALS['TSFE']->content
.=TSpagegen
::inline2TempFile($_scriptCode, 'js');
678 $GLOBALS['TSFE']->content
.=chr(10).implode($GLOBALS['TSFE']->additionalHeaderData
,chr(10)).'
681 if ($GLOBALS['TSFE']->pSetup
['frameSet.']) {
682 $fs = t3lib_div
::makeInstance('tslib_frameset');
683 $GLOBALS['TSFE']->content
.=$fs->make($GLOBALS['TSFE']->pSetup
['frameSet.']);
684 $GLOBALS['TSFE']->content
.= chr(10).'<noframes>'.chr(10);
688 $defBT = $GLOBALS['TSFE']->pSetup
['bodyTagCObject'] ?
$GLOBALS['TSFE']->cObj
->cObjGetSingle($GLOBALS['TSFE']->pSetup
['bodyTagCObject'],$GLOBALS['TSFE']->pSetup
['bodyTagCObject.'],'bodyTagCObject') : '';
689 if (!$defBT) $defBT = $GLOBALS['TSFE']->defaultBodyTag
;
690 $bodyTag = $GLOBALS['TSFE']->pSetup
['bodyTag'] ?
$GLOBALS['TSFE']->pSetup
['bodyTag'] : $defBT;
691 if ($bgImg=$GLOBALS['TSFE']->cObj
->getImgResource($GLOBALS['TSFE']->pSetup
['bgImg'],$GLOBALS['TSFE']->pSetup
['bgImg.'])) {
692 $bodyTag = ereg_replace('>$','',trim($bodyTag)).' background="'.$GLOBALS["TSFE"]->absRefPrefix
.$bgImg[3].'">';
695 if (isset($GLOBALS['TSFE']->pSetup
['bodyTagMargins'])) {
696 $margins = intval($GLOBALS['TSFE']->pSetup
['bodyTagMargins']);
697 if ($GLOBALS['TSFE']->pSetup
['bodyTagMargins.']['useCSS']) {
698 // Setting margins in CSS, see above
700 $bodyTag = ereg_replace('>$','',trim($bodyTag)).' leftmargin="'.$margins.'" topmargin="'.$margins.'" marginwidth="'.$margins.'" marginheight="'.$margins.'">';
704 if (trim($GLOBALS['TSFE']->pSetup
['bodyTagAdd'])) {
705 $bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim($GLOBALS['TSFE']->pSetup
['bodyTagAdd']).'>';
708 if (count($JSef[1])) { // Event functions:
709 $bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim(implode(' ',$JSef[1])).'>';
711 $GLOBALS['TSFE']->content
.= chr(10).$bodyTag;
715 if ($GLOBALS['TSFE']->divSection
) {
716 $GLOBALS['TSFE']->content
.= chr(10).$GLOBALS['TSFE']->divSection
;
720 $GLOBALS['TSFE']->content
.=chr(10).$pageContent;
723 $GLOBALS['TSFE']->content
.= chr(10).'</body>';
724 if ($GLOBALS['TSFE']->pSetup
['frameSet.']) {
725 $GLOBALS['TSFE']->content
.= chr(10).'</noframes>';
727 $GLOBALS['TSFE']->content
.=chr(10).'</html>';
742 /*************************
745 * Remember: Calls internally must still be done on the non-instantiated class: TSpagegen::inline2TempFile()
747 *************************/
750 * Writes string to a temporary file named after the md5-hash of the string
752 * @param string CSS styles / JavaScript to write to file.
753 * @param string Extension: "css" or "js"
754 * @return string <script> or <link> tag for the file.
756 function inline2TempFile($str,$ext) {
758 // Create filename / tags:
762 $script = 'typo3temp/javascript_'.substr(md5($str),0,10).'.js';
764 <script type="text/javascript" src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix
.$script).'"></script>';
767 $script = 'typo3temp/stylesheet_'.substr(md5($str),0,10).'.css';
769 <link rel="stylesheet" type="text/css" href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix
.$script).'" />';
775 if (!@is_file
(PATH_site
.$script)) {
776 t3lib_div
::writeFile(PATH_site
.$script,$str);
784 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['tslib/class.tslib_pagegen.php']) {
785 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['tslib/class.tslib_pagegen.php']);
790 // ********************************************************
791 // Includes the search-class if $sword and $scols are set.
792 // ********************************************************
793 if (t3lib_div
::_GP('sword') && t3lib_div
::_GP('scols')) {
794 require_once(PATH_tslib
.'class.tslib_search.php');
800 require_once (PATH_t3lib
.'class.t3lib_loaddbgroup.php');
803 * Class for fetching record relations for the frontend.
805 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
808 * @see tslib_cObj::RECORDS()
810 class FE_loadDBGroup
extends t3lib_loadDBGroup
{
811 var $fromTC = 0; // Means the not only uid and label-field is returned, but everything
814 // **********************************
815 // includes stuff for graphical work
816 // **********************************
817 require_once(PATH_t3lib
.'class.t3lib_stdgraphic.php');
818 require_once(PATH_tslib
.'class.tslib_gifbuilder.php');
820 // *************************
821 // includes menu-management
822 // *************************
823 require_once(PATH_tslib
.'class.tslib_menu.php');
825 // *************************
826 // Global content object...
827 // *************************
828 require_once(PATH_tslib
.'class.tslib_content.php');