bc9654019d16230be8649fb86da4e4a8d1a1ae9c
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / class.tslib_pagegen.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
6 * All rights reserved
7 *
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.
13 *
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.
18 *
19 *
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.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
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.
30 *
31 * $Id$
32 * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
33 * XHTML compliant
34 *
35 * @author Kasper Skaarhoj <kasper@typo3.com>
36 */
37 /**
38 * [CLASS/FUNCTION INDEX of SCRIPT]
39 *
40 *
41 *
42 * 85: class TSpagegen
43 * 92: function pagegenInit()
44 * 216: function getIncFiles()
45 * 249: function JSeventFunctions()
46 * 283: function renderContent()
47 * 310: function renderContentWithHeader($pageContent)
48 *
49 *
50 * 672: class FE_loadDBGroup extends t3lib_loadDBGroup
51 *
52 * TOTAL FUNCTIONS: 5
53 * (This index is automatically created/updated by the extension "extdeveval")
54 *
55 */
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75 /**
76 * Class for starting TypoScript page generation
77 *
78 * The class is not instantiated as an objects but called directly with the "::" operator.
79 * eg: TSpagegen::pagegenInit()
80 *
81 * @author Kasper Skaarhoj <kasper@typo3.com>
82 * @package TYPO3
83 * @subpackage tslib
84 */
85 class TSpagegen {
86
87 /**
88 * Setting some vars in TSFE, primarily based on TypoScript config settings.
89 *
90 * @return void
91 */
92 function pagegenInit() {
93 if ($GLOBALS['TSFE']->page['content_from_pid']>0) {
94 $temp_copy_TSFE = $GLOBALS['TSFE']; // make REAL copy of TSFE object - not reference!
95 $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!
96 $temp_copy_TSFE->getPageAndRootlineWithDomain($GLOBALS['TSFE']->config['config']['content_from_pid_allowOutsideDomain']?0:$GLOBALS['TSFE']->domainStartPage);
97 $GLOBALS['TSFE']->contentPid = intval($temp_copy_TSFE->id);
98 unset($temp_copy_TSFE);
99 }
100 if ($GLOBALS['TSFE']->config['config']['MP_defaults']) {
101 $temp_parts = t3lib_div::trimExplode('|',$GLOBALS['TSFE']->config['config']['MP_defaults'],1);
102 reset($temp_parts);
103 while(list(,$temp_p)=each($temp_parts)) {
104 list($temp_idP,$temp_MPp) = explode(':',$temp_p,2);
105 $temp_ids=t3lib_div::intExplode(',',$temp_idP);
106 reset($temp_ids);
107 while(list(,$temp_id)=each($temp_ids)) {
108 $GLOBALS['TSFE']->MP_defaults[$temp_id]=$temp_MPp;
109 }
110 }
111 }
112 if ($GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP']) {
113 $temp_parts = t3lib_div::trimExplode(',',$GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP'],1);
114 foreach ($temp_parts as $temp_p) {
115 $GLOBALS['TSFE']->pEncAllowedParamNames[$temp_p]=1;
116 }
117 }
118
119
120 // Global vars...
121 $GLOBALS['TSFE']->indexedDocTitle = $GLOBALS['TSFE']->page['title'];
122 $GLOBALS['TSFE']->debug = ''.$GLOBALS['TSFE']->config['config']['debug'];
123
124 // Internal and External target defaults
125 $GLOBALS['TSFE']->intTarget = ''.$GLOBALS['TSFE']->config['config']['intTarget'];
126 $GLOBALS['TSFE']->extTarget = ''.$GLOBALS['TSFE']->config['config']['extTarget'];
127 $GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-5,5,0);
128 if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
129 $GLOBALS['TSFE']->additionalJavaScript['UnCryptMailto()']='
130 // JS function for uncrypting spam-protected emails:
131 function UnCryptMailto(s) { //
132 var n=0;
133 var r="";
134 for(var i=0; i < s.length; i++) {
135 n=s.charCodeAt(i);
136 if (n>=8364) {n = 128;}
137 r += String.fromCharCode(n-('.$GLOBALS['TSFE']->spamProtectEmailAddresses.'));
138 }
139 return r;
140 }
141 // JS function for uncrypting spam-protected emails:
142 function linkTo_UnCryptMailto(s) { //
143 location.href=UnCryptMailto(s);
144 }
145 ';
146 }
147
148
149 $GLOBALS['TSFE']->absRefPrefix = trim(''.$GLOBALS['TSFE']->config['config']['absRefPrefix']);
150 if ((!strcmp($GLOBALS['TSFE']->config['config']['simulateStaticDocuments'],'PATH_INFO') || $GLOBALS['TSFE']->absRefPrefix_force)
151 && !$GLOBALS['TSFE']->absRefPrefix) {
152 $GLOBALS['TSFE']->absRefPrefix=t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/';
153 } // Force absRefPrefix to this value is PATH_INFO is used.
154
155 if ($GLOBALS['TSFE']->type && $GLOBALS['TSFE']->config['config']['frameReloadIfNotInFrameset']) {
156 $tdlLD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,'_top',$GLOBALS['TSFE']->no_cache,'');
157 $GLOBALS['TSFE']->JSCode = 'if(!parent.'.trim($GLOBALS['TSFE']->sPre).' && !parent.view_frame) top.document.location="'.$tdlLD['totalURL'].'"';
158 }
159 $GLOBALS['TSFE']->compensateFieldWidth = ''.$GLOBALS['TSFE']->config['config']['compensateFieldWidth'];
160 $GLOBALS['TSFE']->lockFilePath = ''.$GLOBALS['TSFE']->config['config']['lockFilePath'];
161 $GLOBALS['TSFE']->lockFilePath = $GLOBALS['TSFE']->lockFilePath ? $GLOBALS['TSFE']->lockFilePath : 'fileadmin/';
162 $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'];
163 $GLOBALS['TSFE']->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
164
165 $GLOBALS['TSFE']->ATagParams = trim($GLOBALS['TSFE']->config['config']['ATagParams']) ? ' '.trim($GLOBALS['TSFE']->config['config']['ATagParams']) : '';
166 if ($GLOBALS['TSFE']->config['config']['setJS_mouseOver']) $GLOBALS['TSFE']->setJS('mouseOver');
167 if ($GLOBALS['TSFE']->config['config']['setJS_openPic']) $GLOBALS['TSFE']->setJS('openPic');
168
169 $GLOBALS['TSFE']->sWordRegEx='';
170 $GLOBALS['TSFE']->sWordList = t3lib_div::_GP('sword_list');
171 if (is_array($GLOBALS['TSFE']->sWordList)) {
172 $standAlone = trim(''.$GLOBALS['TSFE']->config['config']['sword_standAlone']);
173 $noMixedCase = trim(''.$GLOBALS['TSFE']->config['config']['sword_noMixedCase']);
174
175 $space = ($standAlone) ? '[[:space:]]' : '';
176 reset($GLOBALS['TSFE']->sWordList);
177 while (list($key,$val) = each($GLOBALS['TSFE']->sWordList)) {
178 if (trim($val)) {
179 if (!$noMixedCase) {
180 $GLOBALS['TSFE']->sWordRegEx.= $space.sql_regcase(quotemeta($val)).$space.'|';
181 } else {
182 $GLOBALS['TSFE']->sWordRegEx.= $space.quotemeta($val).$space.'|';
183 }
184 }
185 }
186 $GLOBALS['TSFE']->sWordRegEx = ereg_replace('\|$','',$GLOBALS['TSFE']->sWordRegEx);
187 }
188
189 // linkVars
190 $GLOBALS['TSFE']->linkVars = ''.$GLOBALS['TSFE']->config['config']['linkVars'];
191 if ($GLOBALS['TSFE']->linkVars) {
192 $linkVarArr = explode(',',$GLOBALS['TSFE']->linkVars);
193 $GLOBALS['TSFE']->linkVars='';
194 reset($linkVarArr);
195 while(list(,$val)=each($linkVarArr)) {
196 $val=trim($val);
197 $GET = t3lib_div::_GET();
198 if ($val && isset($GET[$val])) {
199 if (!is_array($GET[$val])) {
200 $GLOBALS['TSFE']->linkVars.='&'.$val.'='.rawurlencode($GET[$val]);
201 } else {
202 $GLOBALS['TSFE']->linkVars.=t3lib_div::implodeArrayForUrl($val,$GET[$val]);
203 }
204 }
205 }
206 } else {
207 $GLOBALS['TSFE']->linkVars='';
208 }
209 }
210
211 /**
212 * Returns an array with files to include. These files are the ones set up in TypoScript config.
213 *
214 * @return array Files to include. Paths are relative to PATH_site.
215 */
216 function getIncFiles() {
217 $incFilesArray = array();
218 // Get files from config.includeLibrary
219 $includeLibrary = trim(''.$GLOBALS['TSFE']->config['config']['includeLibrary']);
220 if ($includeLibrary) {
221 $incFile=$GLOBALS['TSFE']->tmpl->getFileName($includeLibrary);
222 if ($incFile) {
223 $incFilesArray[] = $incFile;
224 }
225 }
226
227 if (is_array($GLOBALS['TSFE']->pSetup['includeLibs.'])) {$incLibs=$GLOBALS['TSFE']->pSetup['includeLibs.'];} else {$incLibs=array();}
228 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)
229 if (count($incLibs)) {
230 reset($incLibs);
231 while(list(,$theLib)=each($incLibs)) {
232 if (!is_array($theLib) && $incFile=$GLOBALS['TSFE']->tmpl->getFileName($theLib)) {
233 $incFilesArray[] = $incFile;
234 }
235 }
236 }
237 // Include HTML mail library?
238 if ($GLOBALS['TSFE']->config['config']['incT3Lib_htmlmail']) {
239 $incFilesArray[] = 't3lib/class.t3lib_htmlmail.php';
240 }
241 return $incFilesArray;
242 }
243
244 /**
245 * Processing JavaScript handlers
246 *
247 * @return array Array with a) a JavaScript section with event handlers and variables set and b) an array with attributes for the body tag.
248 */
249 function JSeventFunctions() {
250 $functions=array();
251 $setEvents=array();
252 $setBody=array();
253
254 if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onmousemove'])) {
255 $functions[]=' function T3_onmousemoveWrapper(e) { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']).' }';
256 $setEvents[]=' document.onmousemove=T3_onmousemoveWrapper;';
257 }
258 if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onmouseup'])) {
259 $functions[]=' function T3_onmouseupWrapper(e) { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']).' }';
260 $setEvents[]=' document.onmouseup=T3_onmouseupWrapper;';
261 }
262 if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onload']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onload'])) {
263 $functions[]=' function T3_onloadWrapper() { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls['onload']).' }';
264 $setEvents[]=' document.onload=T3_onloadWrapper;';
265 $setBody[]='onload="T3_onloadWrapper();"';
266 }
267
268 return Array(count($functions)?'
269 <script type="text/javascript">
270 /*<![CDATA[*/
271 '.implode(chr(10),$functions).'
272 '.implode(chr(10),$setEvents).'
273 /*]]>*/
274 </script>
275 ':'',$setBody);
276 }
277
278 /**
279 * Rendering the page content
280 *
281 * @return void
282 */
283 function renderContent() {
284 // PAGE CONTENT
285 $GLOBALS['TT']->incStackPointer();
286 $GLOBALS['TT']->push($GLOBALS['TSFE']->sPre, 'PAGE');
287 $pageContent = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup);
288
289 if ($GLOBALS['TSFE']->pSetup['wrap']) {$pageContent = $GLOBALS['TSFE']->cObj->wrap($pageContent, $GLOBALS['TSFE']->pSetup['wrap']);}
290 if ($GLOBALS['TSFE']->pSetup['stdWrap.']) {$pageContent = $GLOBALS['TSFE']->cObj->stdWrap($pageContent, $GLOBALS['TSFE']->pSetup['stdWrap.']);}
291
292 // PAGE HEADER (after content - maybe JS is inserted!
293
294 // if 'disableAllHeaderCode' is set, all the header-code is discarded!
295 if ($GLOBALS['TSFE']->config['config']['disableAllHeaderCode']) {
296 $GLOBALS['TSFE']->content=$pageContent;
297 } else {
298 TSpagegen::renderContentWithHeader($pageContent);
299 }
300 $GLOBALS['TT']->pull($GLOBALS['TT']->LR?$GLOBALS['TSFE']->content:'');
301 $GLOBALS['TT']->decStackPointer();
302 }
303
304 /**
305 * Rendering normal HTML-page with header by wrapping the generated content ($pageContent) in body-tags and setting the header accordingly.
306 *
307 * @param string The page content which TypoScript objects has generated
308 * @return void
309 */
310 function renderContentWithHeader($pageContent) {
311 $customContent = $GLOBALS['TSFE']->config['config']['headerComment'];
312 if (trim($customContent)) {
313 $customContent = chr(10).$customContent;
314 } else $customContent='';
315
316 // Setting charset:
317 $theCharset = ($GLOBALS['TSFE']->config['config']['metaCharset'] ? $GLOBALS['TSFE']->config['config']['metaCharset'] : $GLOBALS['TSFE']->defaultCharSet);
318
319 // Reset the content variables:
320 $GLOBALS['TSFE']->content='';
321
322 // Setting document type:
323 $docTypeParts=array();
324 if ($GLOBALS['TSFE']->config['config']['doctype']) {
325 switch((string)$GLOBALS['TSFE']->config['config']['doctype']) {
326 case 'xhtml_trans':
327 $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
328 $docTypeParts[]='<!DOCTYPE html
329 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
330 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
331 break;
332 case 'xhtml_strict':
333 $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
334 $docTypeParts[]='<!DOCTYPE html
335 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
336 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
337 break;
338 case 'xhtml_frames':
339 $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
340 $docTypeParts[]='<!DOCTYPE html
341 PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
342 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
343 break;
344 default:
345 $docTypeParts[]=$GLOBALS['TSFE']->config['config']['doctype'];
346 break;
347 }
348 } else {
349 $docTypeParts[]='<!DOCTYPE html
350 PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
351 }
352
353 // Swap XML and doctype order around (for MSIE / Opera standards compliance)
354 if ($GLOBALS['TSFE']->config['config']['doctypeSwitch']) {
355 $docTypeParts = array_reverse($docTypeParts);
356 }
357
358 // Adding doctype parts:
359 $GLOBALS['TSFE']->content.=implode(chr(10),$docTypeParts).chr(10);
360
361 $GLOBALS['TSFE']->content.='
362 <html>
363 <head>
364 <!-- '.($customContent?$customContent.chr(10):'').'
365 This website is brought to you by TYPO3 - get.content.right
366 TYPO3 is a free open source Content Management Framework created by Kasper Skaarhoj and licensed under GNU/GPL.
367 TYPO3 is copyright 1998-2004 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
368 Information and contribution at http://www.typo3.com
369 -->
370 ';
371
372
373 if ($GLOBALS['TSFE']->config['config']['baseURL']) {
374 $ss = intval($GLOBALS['TSFE']->config['config']['baseURL']) ? t3lib_div::getIndpEnv('TYPO3_SITE_URL') : $GLOBALS['TSFE']->config['config']['baseURL'];
375 $GLOBALS['TSFE']->content.='
376 <base href="'.htmlspecialchars($ss).'" />';
377 }
378
379 if ($GLOBALS['TSFE']->pSetup['shortcutIcon']) {
380 $ss=$path.$GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['shortcutIcon']);
381 $GLOBALS['TSFE']->content.='
382 <link rel="SHORTCUT ICON" href="'.htmlspecialchars($ss).'" />';
383 }
384
385 /** CSS STYLESHEET handling: */
386 if (is_array($GLOBALS['TSFE']->tmpl->setup['plugin.'])) {
387 $temp_styleLines=array();
388 reset($GLOBALS['TSFE']->tmpl->setup['plugin.']);
389 while(list($k2,$iCSScode)=each($GLOBALS['TSFE']->tmpl->setup['plugin.'])) {
390 if (is_array($iCSScode) && $iCSScode['_CSS_DEFAULT_STYLE']) {
391 $temp_styleLines[]='/* default styles for extension "'.substr($k2,0,-1).'" */'.chr(10).$iCSScode['_CSS_DEFAULT_STYLE'];
392 }
393 }
394 if (count($temp_styleLines)) {
395 $GLOBALS['TSFE']->content.='
396 <style type="text/css">
397 /*<![CDATA[*/
398 <!--
399 '.implode(chr(10),$temp_styleLines).'
400 -->
401 /*]]>*/
402 </style>';
403 }
404 }
405
406 if ($GLOBALS['TSFE']->pSetup['stylesheet']) {
407 $ss=$GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['stylesheet']);
408 if ($ss) {
409 $GLOBALS['TSFE']->content.='
410 <link rel="stylesheet" href="'.htmlspecialchars($ss).'" />';
411 }
412 }
413 if (is_array($GLOBALS['TSFE']->pSetup['includeCSS.'])) {
414 reset($GLOBALS['TSFE']->pSetup['includeCSS.']);
415 while(list($k2,$iCSSfile)=each($GLOBALS['TSFE']->pSetup['includeCSS.'])) {
416 if (!is_array($iCSSfile)) {
417 $ss=$GLOBALS['TSFE']->tmpl->getFileName($iCSSfile);
418 if ($ss) {
419 $GLOBALS['TSFE']->content.='
420 <link rel="stylesheet" href="'.htmlspecialchars($ss).'"'.
421 ($GLOBALS['TSFE']->pSetup['includeCSS.'][$k2.'.']['title'] ? ' title="'.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$k2.'.']['title']).'"' : '').
422 ($GLOBALS['TSFE']->pSetup['includeCSS.'][$k2.'.']['media'] ? ' media="'.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$k2.'.']['media']).'"' : '').
423 ' />';
424 }
425 }
426 }
427 }
428
429 // Stylesheets
430 $style='';
431 $style.=trim($GLOBALS['TSFE']->pSetup['CSS_inlineStyle']).chr(10);
432
433 if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE']) {
434 $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();
435 $RTEclasses = $pageTSConfig['RTE.']['classes.'];
436 if (is_array($RTEclasses)) {
437 reset($RTEclasses);
438 while(list($RTEclassName,$RTEvalueArray)=each($RTEclasses)) {
439 if ($RTEvalueArray['value']) {
440 $style.='
441 .'.substr($RTEclassName,0,-1).' {'.$RTEvalueArray['value'].'}';
442 }
443 }
444 }
445
446 if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs'] && is_array($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'])) {
447 $mSOa_tList = t3lib_div::trimExplode(',',strtoupper($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs']),1);
448 reset($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.']);
449 while(list($mSOa_key,$mSOa_value)=each($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'])) {
450 if (!is_array($mSOa_value) && (in_array('*',$mSOa_tList)||in_array($mSOa_key,$mSOa_tList))) {
451 $style.='
452 '.$mSOa_key.' {'.$mSOa_value.'}';
453 }
454 }
455 }
456 }
457
458 // Setting body tag margins in CSS:
459 if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']) && $GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {
460 $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
461 $style.='
462 BODY {margin: '.$margins.'px '.$margins.'px '.$margins.'px '.$margins.'px;}';
463 }
464
465 if ($GLOBALS['TSFE']->pSetup['noLinkUnderline']) {
466 $style.='
467 A:link {text-decoration: none}
468 A:visited {text-decoration: none}
469 A:active {text-decoration: none}';
470 }
471 if (trim($GLOBALS['TSFE']->pSetup['hover'])) {
472 $style.='
473 A:hover {color: '.trim($GLOBALS['TSFE']->pSetup['hover']).';}';
474 }
475 if (trim($GLOBALS['TSFE']->pSetup['hoverStyle'])) {
476 $style.='
477 A:hover {'.trim($GLOBALS['TSFE']->pSetup['hoverStyle']).'}';
478 }
479 if ($GLOBALS['TSFE']->pSetup['smallFormFields']) {
480 $style.='
481 SELECT { font-family: Verdana, Arial, Helvetica; font-size: 10px }
482 TEXTAREA { font-family: Verdana, Arial, Helvetica; font-size: 10px}
483 INPUT { font-family: Verdana, Arial, Helvetica; font-size: 10px }';
484 }
485 if ($GLOBALS['TSFE']->pSetup['adminPanelStyles']) {
486 $style.='
487
488 /* Default styles for the Admin Panel */
489 TABLE.typo3-adminPanel { border: 1px solid black; background-color: #F6F2E6; }
490 TABLE.typo3-adminPanel TR.typo3-adminPanel-hRow TD { background-color: #9BA1A8; }
491 TABLE.typo3-adminPanel TR.typo3-adminPanel-itemHRow TD { background-color: #ABBBB4; }
492 TABLE.typo3-adminPanel TABLE, TABLE.typo3-adminPanel TD { border: 0px; }
493 TABLE.typo3-adminPanel TD FONT { font-family: verdana; font-size: 10px; color: black; }
494 TABLE.typo3-adminPanel TD A FONT { font-family: verdana; font-size: 10px; color: black; }
495 TABLE.typo3-editPanel { border: 1px solid black; background-color: #F6F2E6; }
496 TABLE.typo3-editPanel TD { border: 0px; }
497 ';
498 }
499
500 if (trim($style)) {
501 $GLOBALS['TSFE']->content.='
502 <style type="text/css">
503 /*<![CDATA[*/
504 <!--'.$style.'
505 -->
506 /*]]>*/
507 </style>';
508 }
509
510
511
512
513
514 // Headerdata
515 if (is_array($GLOBALS['TSFE']->pSetup['headerData.'])) {
516 $GLOBALS['TSFE']->content.= chr(10).$GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['headerData.'],'headerData.');
517 }
518
519 // <title></title> :
520 $titleTagContent = $GLOBALS['TSFE']->tmpl->printTitle(
521 $GLOBALS['TSFE']->altPageTitle?$GLOBALS['TSFE']->altPageTitle:$GLOBALS['TSFE']->page['title'],
522 $GLOBALS['TSFE']->config['config']['noPageTitle'],
523 $GLOBALS['TSFE']->config['config']['pageTitleFirst']
524 );
525 if ($GLOBALS['TSFE']->config['config']['titleTagFunction']) {
526 $titleTagContent = $GLOBALS['TSFE']->cObj->callUserFunction($GLOBALS['TSFE']->config['config']['titleTagFunction'], array(), $titleTagContent);
527 }
528
529 $GLOBALS['TSFE']->content.='
530 <title>'.htmlspecialchars($titleTagContent).'</title>';
531 $GLOBALS['TSFE']->content.='
532 <meta http-equiv="Content-Type" content="text/html; charset='.$theCharset.'" />';
533 $GLOBALS['TSFE']->content.='
534 <meta name="generator" content="TYPO3 3.6 CMS" />';
535
536 $conf=$GLOBALS['TSFE']->pSetup['meta.'];
537 if (is_array($conf)) {
538 reset($conf);
539 while(list($theKey,$theValue)=each($conf)) {
540 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
541 if (strstr($theKey,'.')) {
542 $theKey = substr($theKey,0,-1);
543 }
544 $val = $GLOBALS['TSFE']->cObj->stdWrap($conf[$theKey],$conf[$theKey.'.']);
545 $key = $theKey;
546 if (trim($val)) {
547 $a='name';
548 if (strtolower($key)=='refresh') {$a='http-equiv';}
549 $GLOBALS['TSFE']->content.= '
550 <meta '.$a.'="'.$key.'" content="'.htmlspecialchars(trim($val)).'" />';
551 }
552 }
553 }
554 }
555
556 unset($GLOBALS['TSFE']->additionalHeaderData['JSCode']);
557 unset($GLOBALS['TSFE']->additionalHeaderData['JSImgCode']);
558
559 if (is_array($GLOBALS['TSFE']->config['INTincScript'])) {
560 // Storing the JSCode and JSImgCode vars...
561 $GLOBALS['TSFE']->additionalHeaderData['JSCode'] = $GLOBALS['TSFE']->JSCode;
562 $GLOBALS['TSFE']->additionalHeaderData['JSImgCode'] = $GLOBALS['TSFE']->JSImgCode;
563 $GLOBALS['TSFE']->config['INTincScript_ext']['divKey']= $GLOBALS['TSFE']->uniqueHash();
564 $GLOBALS['TSFE']->config['INTincScript_ext']['additionalHeaderData'] = $GLOBALS['TSFE']->additionalHeaderData; // Storing the header-data array
565 $GLOBALS['TSFE']->config['INTincScript_ext']['additionalJavaScript'] = $GLOBALS['TSFE']->additionalJavaScript; // Storing the JS-data array
566 $GLOBALS['TSFE']->config['INTincScript_ext']['additionalCSS'] = $GLOBALS['TSFE']->additionalCSS; // Storing the Style-data array
567
568 $GLOBALS['TSFE']->additionalHeaderData=array('<!--HD_'.$GLOBALS['TSFE']->config['INTincScript_ext']['divKey'].'-->'); // Clearing the array
569 $GLOBALS['TSFE']->divSection.='<!--TDS_'.$GLOBALS['TSFE']->config['INTincScript_ext']['divKey'].'-->';
570 } else {
571 $GLOBALS['TSFE']->INTincScript_loadJSCode();
572 }
573 $JSef = TSpagegen::JSeventFunctions();
574
575 if (!$GLOBALS['TSFE']->config['config']['removeDefaultJS']) {
576 $GLOBALS['TSFE']->content.='
577 <script type="text/javascript">
578 /*<![CDATA[*/
579 <!--
580 browserName = navigator.appName;
581 browserVer = parseInt(navigator.appVersion);
582 var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);
583 if ((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName=="Konqueror") {version = "n3";} else {version = "n2";}
584 // Blurring links:
585 function blurLink(theObject) { //
586 if (msie4) {theObject.blur();}
587 }
588 // -->
589 /*]]>*/
590 </script>';
591 }
592
593 $GLOBALS['TSFE']->content.=implode($GLOBALS['TSFE']->additionalHeaderData,chr(10)).'
594 '.$JSef[0].'
595 </head>';
596 if ($GLOBALS['TSFE']->pSetup['frameSet.']) {
597 $fs = t3lib_div::makeInstance('tslib_frameset');
598 $GLOBALS['TSFE']->content.=$fs->make($GLOBALS['TSFE']->pSetup['frameSet.']);
599 $GLOBALS['TSFE']->content.= chr(10).'<noframes>'.chr(10);
600 }
601
602 // Bodytag:
603 $defBT = $GLOBALS['TSFE']->pSetup['bodyTagCObject'] ? $GLOBALS['TSFE']->cObj->cObjGetSingle($GLOBALS['TSFE']->pSetup['bodyTagCObject'],$GLOBALS['TSFE']->pSetup['bodyTagCObject.'],'bodyTagCObject') : '';
604 if (!$defBT) $defBT = $GLOBALS['TSFE']->defaultBodyTag;
605 $bodyTag = $GLOBALS['TSFE']->pSetup['bodyTag'] ? $GLOBALS['TSFE']->pSetup['bodyTag'] : $defBT;
606 if ($bgImg=$GLOBALS['TSFE']->cObj->getImgResource($GLOBALS['TSFE']->pSetup['bgImg'],$GLOBALS['TSFE']->pSetup['bgImg.'])) {
607 $bodyTag = ereg_replace('>$','',trim($bodyTag)).' background="'.$GLOBALS["TSFE"]->absRefPrefix.$bgImg[3].'">';
608 }
609
610 if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins'])) {
611 $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
612 if ($GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {
613 // Setting margins in CSS, see above
614 } else {
615 $bodyTag = ereg_replace('>$','',trim($bodyTag)).' leftmargin="'.$margins.'" topmargin="'.$margins.'" marginwidth="'.$margins.'" marginheight="'.$margins.'">';
616 }
617 }
618
619 if (trim($GLOBALS['TSFE']->pSetup['bodyTagAdd'])) {
620 $bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']).'>';
621 }
622
623 if (count($JSef[1])) { // Event functions:
624 $bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim(implode(' ',$JSef[1])).'>';
625 }
626
627
628 // Div-sections
629 $GLOBALS['TSFE']->content.= chr(10).$bodyTag;
630 if ($GLOBALS['TSFE']->divSection) {
631 $GLOBALS['TSFE']->content.= chr(10).$GLOBALS['TSFE']->divSection;
632 }
633
634 // Page content
635 $GLOBALS['TSFE']->content.=chr(10).$pageContent;
636
637 // Ending page
638 $GLOBALS['TSFE']->content.= chr(10).'</body>';
639 if ($GLOBALS['TSFE']->pSetup['frameSet.']) {
640 $GLOBALS['TSFE']->content.= chr(10).'</noframes>';
641 }
642 $GLOBALS['TSFE']->content.=chr(10).'</html>';
643 }
644 }
645
646 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_pagegen.php']) {
647 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_pagegen.php']);
648 }
649
650
651
652 // ********************************************************
653 // Includes the search-class if $sword and $scols are set.
654 // ********************************************************
655 if (t3lib_div::_GP('sword') && t3lib_div::_GP('scols')) {
656 require_once(PATH_tslib.'class.tslib_search.php');
657 }
658
659 // ************
660 // LoadDBGroup
661 // ************
662 require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');
663
664 /**
665 * Class for fetching record relations for the frontend.
666 *
667 * @author Kasper Skaarhoj <kasper@typo3.com>
668 * @package TYPO3
669 * @subpackage tslib
670 * @see tslib_cObj::RECORDS()
671 */
672 class FE_loadDBGroup extends t3lib_loadDBGroup {
673 var $fromTC = 0; // Means the not only uid and label-field is returned, but everything
674 }
675
676 // **********************************
677 // includes stuff for graphical work
678 // **********************************
679 require_once(PATH_t3lib.'class.t3lib_stdgraphic.php');
680 require_once(PATH_tslib.'class.tslib_gifbuilder.php');
681
682 // *************************
683 // includes menu-management
684 // *************************
685 require_once(PATH_tslib.'class.tslib_menu.php');
686
687 // *************************
688 // Global content object...
689 // *************************
690 require_once(PATH_tslib.'class.tslib_content.php');
691
692 ?>