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