c604658bad9d4916ded2745aab40088bb7edd68a
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / class.tslib_pagegen.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@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 <kasperYYYY@typo3.com>
36 */
37 /**
38 * [CLASS/FUNCTION INDEX of SCRIPT]
39 *
40 *
41 *
42 * 88: class TSpagegen
43 * 95: function pagegenInit()
44 * 271: function getIncFiles()
45 * 304: function JSeventFunctions()
46 * 338: function renderContent()
47 * 365: function renderContentWithHeader($pageContent)
48 *
49 * SECTION: Helper functions
50 * 827: function inline2TempFile($str,$ext)
51 *
52 *
53 * 881: class FE_loadDBGroup extends t3lib_loadDBGroup
54 *
55 * TOTAL FUNCTIONS: 6
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 <kasperYYYY@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 public static function pagegenInit() {
96 if ($GLOBALS['TSFE']->page['content_from_pid']>0) {
97 $temp_copy_TSFE = clone($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 foreach ($temp_parts as $temp_p) {
106 list($temp_idP,$temp_MPp) = explode(':',$temp_p,2);
107 $temp_ids=t3lib_div::intExplode(',',$temp_idP);
108 foreach ($temp_ids as $temp_id) {
109 $GLOBALS['TSFE']->MP_defaults[$temp_id]=$temp_MPp;
110 }
111 }
112 }
113
114 // Global vars...
115 $GLOBALS['TSFE']->indexedDocTitle = $GLOBALS['TSFE']->page['title'];
116 $GLOBALS['TSFE']->debug = ''.$GLOBALS['TSFE']->config['config']['debug'];
117
118 // Base url:
119 if ($GLOBALS['TSFE']->config['config']['baseURL']) {
120 if ($GLOBALS['TSFE']->config['config']['baseURL']==='1') {
121 // Deprecated property, going to be dropped.
122 $error = 'Unsupported TypoScript property was found in this template: "config.baseURL="1"
123
124 This setting has been deprecated in TYPO 3.8.1 due to security concerns.
125 You need to change this value to the URL of your website root, otherwise TYPO3 will not work!
126
127 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.';
128
129 $GLOBALS['TSFE']->printError(nl2br($error));
130 exit;
131 } else {
132 $GLOBALS['TSFE']->baseUrl = $GLOBALS['TSFE']->config['config']['baseURL'];
133 }
134 $GLOBALS['TSFE']->anchorPrefix = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL')));
135 }
136
137 // Internal and External target defaults
138 $GLOBALS['TSFE']->intTarget = ''.$GLOBALS['TSFE']->config['config']['intTarget'];
139 $GLOBALS['TSFE']->extTarget = ''.$GLOBALS['TSFE']->config['config']['extTarget'];
140 $GLOBALS['TSFE']->fileTarget = ''.$GLOBALS['TSFE']->config['config']['fileTarget'];
141 if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'] === 'ascii') {
142 $GLOBALS['TSFE']->spamProtectEmailAddresses = 'ascii';
143 } else {
144 $GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-10,10,0);
145 }
146
147 $GLOBALS['TSFE']->absRefPrefix = ($GLOBALS['TSFE']->config['config']['absRefPrefix'] ? trim($GLOBALS['TSFE']->config['config']['absRefPrefix']) : '');
148
149 if ($GLOBALS['TSFE']->type && $GLOBALS['TSFE']->config['config']['frameReloadIfNotInFrameset']) {
150 $tdlLD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,'_top',$GLOBALS['TSFE']->no_cache,'');
151 $GLOBALS['TSFE']->JSCode = 'if(!parent.'.trim($GLOBALS['TSFE']->sPre).' && !parent.view_frame) top.location.href="'.$GLOBALS['TSFE']->baseUrlWrap($tdlLD['totalURL']).'"';
152 }
153 $GLOBALS['TSFE']->compensateFieldWidth = ''.$GLOBALS['TSFE']->config['config']['compensateFieldWidth'];
154 $GLOBALS['TSFE']->lockFilePath = ''.$GLOBALS['TSFE']->config['config']['lockFilePath'];
155 $GLOBALS['TSFE']->lockFilePath = $GLOBALS['TSFE']->lockFilePath ? $GLOBALS['TSFE']->lockFilePath : 'fileadmin/';
156 $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'];
157 $GLOBALS['TSFE']->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
158
159 $GLOBALS['TSFE']->ATagParams = trim($GLOBALS['TSFE']->config['config']['ATagParams']) ? ' '.trim($GLOBALS['TSFE']->config['config']['ATagParams']) : '';
160 if ($GLOBALS['TSFE']->config['config']['setJS_mouseOver']) $GLOBALS['TSFE']->setJS('mouseOver');
161 if ($GLOBALS['TSFE']->config['config']['setJS_openPic']) $GLOBALS['TSFE']->setJS('openPic');
162
163 $GLOBALS['TSFE']->sWordRegEx='';
164 $GLOBALS['TSFE']->sWordList = t3lib_div::_GP('sword_list');
165 if (is_array($GLOBALS['TSFE']->sWordList)) {
166 $standAlone = trim(''.$GLOBALS['TSFE']->config['config']['sword_standAlone']);
167 $noMixedCase = trim(''.$GLOBALS['TSFE']->config['config']['sword_noMixedCase']);
168
169 $space = ($standAlone) ? '[[:space:]]' : '';
170 foreach ($GLOBALS['TSFE']->sWordList as $val) {
171 if (trim($val)) {
172 if (!$noMixedCase) {
173 $GLOBALS['TSFE']->sWordRegEx.= $space.sql_regcase(quotemeta($val)).$space.'|';
174 } else {
175 $GLOBALS['TSFE']->sWordRegEx.= $space.quotemeta($val).$space.'|';
176 }
177 }
178 }
179 $GLOBALS['TSFE']->sWordRegEx = preg_replace('/\|$/','',$GLOBALS['TSFE']->sWordRegEx);
180 }
181
182 // linkVars
183 $linkVars = (string)$GLOBALS['TSFE']->config['config']['linkVars'];
184 if ($linkVars) {
185 $linkVarArr = explode(',',$linkVars);
186
187 $GLOBALS['TSFE']->linkVars='';
188 $GET = t3lib_div::_GET();
189
190 foreach ($linkVarArr as $val) {
191 $val = trim($val);
192
193 if (preg_match('/^(.*)\((.+)\)$/',$val,$match)) {
194 $val = trim($match[1]);
195 $test = trim($match[2]);
196 } else unset($test);
197
198 if ($val && isset($GET[$val])) {
199 if (!is_array($GET[$val])) {
200 $tmpVal = rawurlencode($GET[$val]);
201
202 if ($test && !TSpagegen::isAllowedLinkVarValue($tmpVal,$test)) {
203 continue; // Error: This value was not allowed for this key
204 }
205
206 $value = '&'.$val.'='.$tmpVal;
207 } else {
208 if ($test && strcmp('array',$test)) {
209 continue; // Error: This key must not be an array!
210 }
211 $value = t3lib_div::implodeArrayForUrl($val,$GET[$val]);
212 }
213 } else continue;
214
215 $GLOBALS['TSFE']->linkVars.= $value;
216 }
217 unset($GET);
218 } else {
219 $GLOBALS['TSFE']->linkVars='';
220 }
221
222 // Setting XHTML-doctype from doctype
223 if (!$GLOBALS['TSFE']->config['config']['xhtmlDoctype']) {
224 $GLOBALS['TSFE']->config['config']['xhtmlDoctype'] = $GLOBALS['TSFE']->config['config']['doctype'];
225 }
226
227 if ($GLOBALS['TSFE']->config['config']['xhtmlDoctype']) {
228 $GLOBALS['TSFE']->xhtmlDoctype = $GLOBALS['TSFE']->config['config']['xhtmlDoctype'];
229
230 // Checking XHTML-docytpe
231 switch((string)$GLOBALS['TSFE']->config['config']['xhtmlDoctype']) {
232 case 'xhtml_trans':
233 case 'xhtml_strict':
234 case 'xhtml_frames':
235 $GLOBALS['TSFE']->xhtmlVersion = 100;
236 break;
237 case 'xhtml_basic':
238 $GLOBALS['TSFE']->xhtmlVersion = 105;
239 break;
240 case 'xhtml_11':
241 $GLOBALS['TSFE']->xhtmlVersion = 110;
242 break;
243 case 'xhtml_2':
244 $GLOBALS['TSFE']->xhtmlVersion = 200;
245 break;
246 default:
247 $GLOBALS['TSFE']->xhtmlDoctype = '';
248 $GLOBALS['TSFE']->xhtmlVersion = 0;
249 }
250 }
251 }
252
253 /**
254 * Returns an array with files to include. These files are the ones set up in TypoScript config.
255 *
256 * @return array Files to include. Paths are relative to PATH_site.
257 */
258 public static function getIncFiles() {
259 $incFilesArray = array();
260 // Get files from config.includeLibrary
261 $includeLibrary = trim(''.$GLOBALS['TSFE']->config['config']['includeLibrary']);
262 if ($includeLibrary) {
263 $incFile=$GLOBALS['TSFE']->tmpl->getFileName($includeLibrary);
264 if ($incFile) {
265 $incFilesArray[] = $incFile;
266 }
267 }
268
269 if (is_array($GLOBALS['TSFE']->pSetup['includeLibs.'])) {$incLibs=$GLOBALS['TSFE']->pSetup['includeLibs.'];} else {$incLibs=array();}
270 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)
271 if (count($incLibs)) {
272 foreach ($incLibs as $theLib) {
273 if (!is_array($theLib) && $incFile=$GLOBALS['TSFE']->tmpl->getFileName($theLib)) {
274 $incFilesArray[] = $incFile;
275 }
276 }
277 }
278 // Include HTML mail library?
279 if ($GLOBALS['TSFE']->config['config']['incT3Lib_htmlmail']) {
280 $incFilesArray[] = 't3lib/class.t3lib_htmlmail.php';
281 }
282 return $incFilesArray;
283 }
284
285 /**
286 * Processing JavaScript handlers
287 *
288 * @return array Array with a) a JavaScript section with event handlers and variables set and b) an array with attributes for the body tag.
289 */
290 public static function JSeventFunctions() {
291 $functions = array();
292 $setEvents = array();
293 $setBody = array();
294
295 foreach ($GLOBALS['TSFE']->JSeventFuncCalls as $event => $handlers) {
296 if (count($handlers)) {
297 $functions[] = ' function T3_'.$event.'Wrapper(e) { '.implode(' ',$handlers).' }';
298 $setEvents[] = ' document.'.$event.'=T3_'.$event.'Wrapper;';
299 if ($event == 'onload') {
300 $setBody[]='onload="T3_onloadWrapper();"'; // dubiuos double setting breaks on some browser - do we need it?
301 }
302 }
303 }
304
305 return array(count($functions)? implode(chr(10), $functions) . chr(10) . implode(chr(10), $setEvents) : '', $setBody);
306 }
307
308 /**
309 * Rendering the page content
310 *
311 * @return void
312 */
313 public static function renderContent() {
314 // PAGE CONTENT
315 $GLOBALS['TT']->incStackPointer();
316 $GLOBALS['TT']->push($GLOBALS['TSFE']->sPre, 'PAGE');
317 $pageContent = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup);
318
319 if ($GLOBALS['TSFE']->pSetup['wrap']) {$pageContent = $GLOBALS['TSFE']->cObj->wrap($pageContent, $GLOBALS['TSFE']->pSetup['wrap']);}
320 if ($GLOBALS['TSFE']->pSetup['stdWrap.']) {$pageContent = $GLOBALS['TSFE']->cObj->stdWrap($pageContent, $GLOBALS['TSFE']->pSetup['stdWrap.']);}
321
322 // PAGE HEADER (after content - maybe JS is inserted!
323
324 // if 'disableAllHeaderCode' is set, all the header-code is discarded!
325 if ($GLOBALS['TSFE']->config['config']['disableAllHeaderCode']) {
326 $GLOBALS['TSFE']->content = $pageContent;
327 } else {
328 TSpagegen::renderContentWithHeader($pageContent);
329 }
330 $GLOBALS['TT']->pull($GLOBALS['TT']->LR?$GLOBALS['TSFE']->content:'');
331 $GLOBALS['TT']->decStackPointer();
332 }
333
334 /**
335 * Rendering normal HTML-page with header by wrapping the generated content ($pageContent) in body-tags and setting the header accordingly.
336 *
337 * @param string The page content which TypoScript objects has generated
338 * @return void
339 */
340 public static function renderContentWithHeader($pageContent) {
341
342 $GLOBALS['TSFE']->backPath = 'typo3/';
343
344 if ($GLOBALS['TSFE']->config['config']['moveJsFromHeaderToFooter']) {
345 $GLOBALS['TSFE']->enableMoveJsFromHeaderToFooter();
346 }
347
348 if ($GLOBALS['TSFE']->config['config']['pageRenderTemplateFile']) {
349 $file = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->config['config']['pageRenderTemplateFile']);
350 if ($file) {
351 $GLOBALS['TSFE']->setTemplateFile($file);
352 }
353 }
354
355 $customContent = $GLOBALS['TSFE']->config['config']['headerComment'];
356 if (trim($customContent)) {
357 $GLOBALS['TSFE']->addInlineComment($customContent);
358 }
359
360 // Setting charset:
361 $theCharset = $GLOBALS['TSFE']->metaCharset;
362
363 // Reset the content variables:
364 $GLOBALS['TSFE']->content = '';
365 $htmlTagAttributes = array ();
366 $htmlLang = $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] ? $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] : 'en';
367
368 // Set content direction: (More info: http://www.tau.ac.il/~danon/Hebrew/HTML_and_Hebrew.html)
369 if ($GLOBALS['TSFE']->config['config']['htmlTag_dir']) {
370 $htmlTagAttributes['dir'] = htmlspecialchars($GLOBALS['TSFE']->config['config']['htmlTag_dir']);
371 }
372
373 // Setting document type:
374 $docTypeParts = array ();
375 // Part 1: XML prologue
376 switch ((string) $GLOBALS['TSFE']->config['config']['xmlprologue']) {
377 case 'none' :
378 break;
379 case 'xml_10' :
380 $docTypeParts[] = '<?xml version="1.0" encoding="' . $theCharset . '"?>';
381 break;
382 case 'xml_11' :
383 $docTypeParts[] = '<?xml version="1.1" encoding="' . $theCharset . '"?>';
384 break;
385 case '' :
386 if ($GLOBALS['TSFE']->xhtmlVersion)
387 $docTypeParts[] = '<?xml version="1.0" encoding="' . $theCharset . '"?>';
388 break;
389 default :
390 $docTypeParts[] = $GLOBALS['TSFE']->config['config']['xmlprologue'];
391 }
392 // Part 2: DTD
393 if ($GLOBALS['TSFE']->config['config']['doctype']) {
394 switch ((string) $GLOBALS['TSFE']->config['config']['doctype']) {
395 case 'xhtml_trans' :
396 $docTypeParts[] = '<!DOCTYPE html
397 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
398 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
399 break;
400 case 'xhtml_strict' :
401 $docTypeParts[] = '<!DOCTYPE html
402 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
403 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
404 break;
405 case 'xhtml_frames' :
406 $docTypeParts[] = '<!DOCTYPE html
407 PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
408 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
409 break;
410 case 'xhtml_basic' :
411 $docTypeParts[] = '<!DOCTYPE html
412 PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
413 "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">';
414 break;
415 case 'xhtml_11' :
416 $docTypeParts[] = '<!DOCTYPE html
417 PUBLIC "-//W3C//DTD XHTML 1.1//EN"
418 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
419 break;
420 case 'xhtml_2' :
421 $docTypeParts[] = '<!DOCTYPE html
422 PUBLIC "-//W3C//DTD XHTML 2.0//EN"
423 "http://www.w3.org/TR/xhtml2/DTD/xhtml2.dtd">';
424 break;
425 case 'none' :
426 break;
427 default :
428 $docTypeParts[] = $GLOBALS['TSFE']->config['config']['doctype'];
429 }
430 } else {
431 $docTypeParts[] = '<!DOCTYPE html
432 PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
433 }
434
435 if ($GLOBALS['TSFE']->xhtmlVersion) {
436
437 // Setting <html> tag attributes:
438 $htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml';
439 $htmlTagAttributes['xml:lang'] = $htmlLang;
440 if ($GLOBALS['TSFE']->xhtmlVersion < 110) {
441 $htmlTagAttributes['lang'] = $htmlLang;
442 }
443 }
444
445 // Swap XML and doctype order around (for MSIE / Opera standards compliance)
446 if ($GLOBALS['TSFE']->config['config']['doctypeSwitch']) {
447 $docTypeParts = array_reverse($docTypeParts);
448 }
449
450 // Adding doctype parts:
451 if (count($docTypeParts)) {
452 $GLOBALS['TSFE']->setXmlPrologAndDocType(implode(chr(10), $docTypeParts));
453 }
454
455 // Begin header section:
456 if (strcmp($GLOBALS['TSFE']->config['config']['htmlTag_setParams'], 'none')) {
457 $_attr = $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] ? $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] : t3lib_div::implodeAttributes($htmlTagAttributes);
458 } else {
459 $_attr = '';
460 }
461 $GLOBALS['TSFE']->setHtmlTag('<html' . ($_attr ? ' ' . $_attr : '') . '>');
462
463 // Head tag:
464 $headTag = $GLOBALS['TSFE']->pSetup['headTag'] ? $GLOBALS['TSFE']->pSetup['headTag'] : '<head>';
465 $GLOBALS['TSFE']->setHeadTag($headTag);
466
467 // Setting charset meta tag:
468 $GLOBALS['TSFE']->setCharSet($theCharset);
469
470 $GLOBALS['TSFE']->addInlineComment('
471 This website is powered by TYPO3 - inspiring people to share!
472 TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
473 TYPO3 is copyright 1998-2009 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
474 Information and contribution at http://typo3.com/ and http://typo3.org/
475 ');
476
477 if ($GLOBALS['TSFE']->baseUrl) {
478 $GLOBALS['TSFE']->setBaseUrl($GLOBALS['TSFE']->baseUrl);
479 }
480
481 if ($GLOBALS['TSFE']->pSetup['shortcutIcon']) {
482 $favIcon = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['shortcutIcon']);
483 $iconMimeType = '';
484 if (function_exists('finfo_open')) {
485 if (($finfo = @finfo_open(FILEINFO_MIME))) {
486 $iconMimeType = ' type="' . finfo_file($finfo, $favIcon) . '"';
487 finfo_close($finfo);
488 $GLOBALS['TSFE']->setIconMimeType($iconMimeType);
489 }
490 }
491 $GLOBALS['TSFE']->setFavIcon($favIcon);
492
493 }
494
495 // Including CSS files
496 if (is_array($GLOBALS['TSFE']->tmpl->setup['plugin.'])) {
497 $temp_styleLines = array ();
498 foreach ($GLOBALS['TSFE']->tmpl->setup['plugin.'] as $key => $iCSScode) {
499 if (is_array($iCSScode) && $iCSScode['_CSS_DEFAULT_STYLE']) {
500 $temp_styleLines[] = '/* default styles for extension "' . substr($key, 0, - 1) . '" */' . chr(10) . $iCSScode['_CSS_DEFAULT_STYLE'];
501 }
502 }
503 if (count($temp_styleLines)) {
504 if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
505 $GLOBALS['TSFE']->addCssFile(TSpagegen::inline2TempFile(implode(chr(10), $temp_styleLines), 'css'));
506 } else {
507 $GLOBALS['TSFE']->addCssInlineBlock('TSFEinlineStyle', implode(chr(10), $temp_styleLines));
508 }
509 }
510 }
511
512 if ($GLOBALS['TSFE']->pSetup['stylesheet']) {
513 $ss = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['stylesheet']);
514 if ($ss) {
515 $GLOBALS['TSFE']->addCssFile($ss);
516 }
517 }
518
519 /**********************************************************************/
520 /* includeCSS
521 /* config.includeCSS {
522 /*
523 /* }
524 /**********************************************************************/
525
526 if (is_array($GLOBALS['TSFE']->pSetup['includeCSS.'])) {
527 foreach ($GLOBALS['TSFE']->pSetup['includeCSS.'] as $key => $CSSfile) {
528 if (! is_array($CSSfile)) {
529 $ss = $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['external'] ? $CSSfile : $GLOBALS['TSFE']->tmpl->getFileName($CSSfile);
530 if ($ss) {
531 if ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['import']) {
532 if (! $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['external'] && substr($ss, 0, 1) != '/') { // To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
533 $ss = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')) . '/' . $ss;
534 }
535 $GLOBALS['TSFE']->addCssInlineBlock(
536 'import_' . $key,
537 '@import url("' . htmlspecialchars($ss) . '") ' . htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media']) . ';',
538 $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['compressed'] ? TRUE : FALSE,
539 $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE,
540 ''
541 );
542 } else {
543 $GLOBALS['TSFE']->addCssFile(
544 htmlspecialchars($ss),
545 $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['alternate'] ? 'alternate stylesheet' : 'stylesheet',
546 $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media'] ? $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media'] : 'screen',
547 $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['title'] ? $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['title'] : '',
548 $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['compressed'] ? TRUE : FALSE,
549 $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE,
550 $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['allWrap']);
551
552 }
553 }
554 }
555 }
556 }
557
558 // Stylesheets
559 $style = '';
560 if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE']) {
561 $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();
562 $RTEclasses = $pageTSConfig['RTE.']['classes.'];
563 if (is_array($RTEclasses)) {
564 foreach ($RTEclasses as $RTEclassName => $RTEvalueArray) {
565 if ($RTEvalueArray['value']) {
566 $style .= '
567 .' . substr($RTEclassName, 0, - 1) . ' {' . $RTEvalueArray['value'] . '}';
568 }
569 }
570 }
571
572 if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs'] && is_array($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'])) {
573 $mSOa_tList = t3lib_div::trimExplode(',', strtoupper($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs']), 1);
574 foreach ($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'] as $mSOa_key => $mSOa_value) {
575 if (! is_array($mSOa_value) && (in_array('*', $mSOa_tList) || in_array($mSOa_key, $mSOa_tList))) {
576 $style .= '
577 ' . $mSOa_key . ' {' . $mSOa_value . '}';
578 }
579 }
580 }
581 }
582
583 // Setting body tag margins in CSS:
584 if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']) && $GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {
585 $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
586 $style .= '
587 BODY {margin: ' . $margins . 'px ' . $margins . 'px ' . $margins . 'px ' . $margins . 'px;}';
588 }
589
590 if ($GLOBALS['TSFE']->pSetup['noLinkUnderline']) {
591 $GLOBALS['TSFE']->logDeprecatedTyposcript('config.noLinkUnderline');
592 $style .= '
593 A:link {text-decoration: none}
594 A:visited {text-decoration: none}
595 A:active {text-decoration: none}';
596 }
597 if (trim($GLOBALS['TSFE']->pSetup['hover'])) {
598 $GLOBALS['TSFE']->logDeprecatedTyposcript('config.hover');
599 $style .= '
600 A:hover {color: ' . trim($GLOBALS['TSFE']->pSetup['hover']) . ';}';
601 }
602 if (trim($GLOBALS['TSFE']->pSetup['hoverStyle'])) {
603 $GLOBALS['TSFE']->logDeprecatedTyposcript('config.hoverStyle');
604 $style .= '
605 A:hover {' . trim($GLOBALS['TSFE']->pSetup['hoverStyle']) . '}';
606 }
607 if ($GLOBALS['TSFE']->pSetup['smallFormFields']) {
608 $GLOBALS['TSFE']->logDeprecatedTyposcript('config.smallFormFields');
609 $style .= '
610 SELECT { font-family: Verdana, Arial, Helvetica; font-size: 10px }
611 TEXTAREA { font-family: Verdana, Arial, Helvetica; font-size: 10px}
612 INPUT { font-family: Verdana, Arial, Helvetica; font-size: 10px }';
613 }
614 if ($GLOBALS['TSFE']->pSetup['adminPanelStyles']) {
615 $style .= '
616
617 /* Default styles for the Admin Panel */
618 TABLE.typo3-adminPanel { border: 1px solid black; background-color: #F6F2E6; }
619 TABLE.typo3-adminPanel TR.typo3-adminPanel-hRow TD { background-color: #9BA1A8; }
620 TABLE.typo3-adminPanel TR.typo3-adminPanel-itemHRow TD { background-color: #ABBBB4; }
621 TABLE.typo3-adminPanel TABLE, TABLE.typo3-adminPanel TD { border: 0px; }
622 TABLE.typo3-adminPanel TD FONT { font-family: verdana; font-size: 10px; color: black; }
623 TABLE.typo3-adminPanel TD A FONT { font-family: verdana; font-size: 10px; color: black; }
624 TABLE.typo3-editPanel { border: 1px solid black; background-color: #F6F2E6; }
625 TABLE.typo3-editPanel TD { border: 0px; }
626 ';
627 }
628 // CSS_inlineStyle from TS
629 $style .= trim($GLOBALS['TSFE']->pSetup['CSS_inlineStyle']);
630 $style .= $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['cssInline.'], 'cssInline.');
631
632 if (trim($style)) {
633 if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
634 $GLOBALS['TSFE']->addCssFile(TSpagegen::inline2TempFile($style, 'css'));
635 } else {
636 $GLOBALS['TSFE']->addCssInlineBlock('additionalTSFEInlineStyle', $style);
637 }
638 }
639
640 // Javascript Libraries
641 if (is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.'])) {
642 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['Prototype']) {
643 $GLOBALS['TSFE']->loadPrototype();
644 }
645 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous']) {
646 $modules = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous.']['modules'] ? $GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous.']['modules'] : '';
647 $GLOBALS['TSFE']->loadScriptaculous($modules);
648 }
649 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtCore']) {
650 $GLOBALS['TSFE']->loadExtCore();
651 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtCore.']['debug']) {
652 $GLOBALS['TSFE']->enableExtCoreDebug();
653 }
654 }
655 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs']) {
656 $css = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['css'] ? TRUE : FALSE;
657 $theme = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['theme'] ? TRUE : FALSE;
658 $adapter = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['adapter'] ? $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['adapter'] : '';
659 $GLOBALS['TSFE']->loadExtJs($css, $theme, $adapter);
660 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['debug']) {
661 $GLOBALS['TSFE']->enableExtJsDebug();
662 }
663 if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['quickTips']) {
664 $GLOBALS['TSFE']->enableExtJSQuickTips();
665 }
666 }
667 }
668
669 // JavaScript library files
670 if (is_array($GLOBALS['TSFE']->pSetup['includeJSlibs.'])) {
671 foreach ($GLOBALS['TSFE']->pSetup['includeJSlibs.'] as $key => $JSfile) {
672 $ss = $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
673 if ($ss) {
674 $type = $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['type'];
675 if (! $type) {
676 $type = 'text/javascript';
677 }
678 $GLOBALS['TSFE']->addJsLibrary(
679 htmlspecialchars($key),
680 htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . $ss),
681 htmlspecialchars($type),
682 $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['compressed'] ? TRUE : FALSE,
683 $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['forceOnTop'] ? TRUE : FALSE,
684 $GLOBALS['TSFE']->pSetup['includeJSlibs.'][$key . '.']['allWrap']
685 );
686 }
687
688 }
689 }
690
691 if (is_array($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'])) {
692 foreach ($GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'] as $key => $JSfile) {
693 $ss = $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
694 if ($ss) {
695 $type = $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['type'];
696 if (! $type) {
697 $type = 'text/javascript';
698 }
699 $GLOBALS['TSFE']->addJsFooterLibrary(
700 htmlspecialchars($key),
701 htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . $ss),
702 htmlspecialchars($type),
703 $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['compressed'] ? TRUE : FALSE,
704 $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['forceOnTop'] ? TRUE : FALSE,
705 $GLOBALS['TSFE']->pSetup['includeJSFooterlibs.'][$key . '.']['allWrap']
706 );
707 }
708
709 }
710 }
711
712 // JavaScript files
713 if (is_array($GLOBALS['TSFE']->pSetup['includeJS.'])) {
714 foreach ($GLOBALS['TSFE']->pSetup['includeJS.'] as $key => $JSfile) {
715 if (!is_array($JSfile)) {
716 $ss = $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
717 if ($ss) {
718 $type = $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['type'];
719 if (! $type) {
720 $type = 'text/javascript';
721 }
722 $GLOBALS['TSFE']->addJsFile(
723 htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . $ss),
724 htmlspecialchars($type),
725 $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['compressed'] ? TRUE : FALSE,
726 $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE,
727 $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['allWrap']
728 );
729 }
730 }
731 }
732 }
733
734 if (is_array($GLOBALS['TSFE']->pSetup['includeFooterJS.'])) {
735 foreach ($GLOBALS['TSFE']->pSetup['includeFooterJS.'] as $key => $JSfile) {
736 if (!is_array($JSfile)) {
737 $ss = $GLOBALS['TSFE']->pSetup['includeFooterJS.'][$key . '.']['external'] ? $JSfile : $GLOBALS['TSFE']->tmpl->getFileName($JSfile);
738 if ($ss) {
739 $type = $GLOBALS['TSFE']->pSetup['includeFooterJS.'][$key . '.']['type'];
740 if (! $type) {
741 $type = 'text/javascript';
742 }
743 $GLOBALS['TSFE']->addJsFooterFile(
744 htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . $ss),
745 htmlspecialchars($type),
746 $GLOBALS['TSFE']->pSetup['includeFooterJS.'][$key . '.']['compressed'] ? TRUE : FALSE,
747 $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE,
748 $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['allWrap']
749 );
750 }
751 }
752 }
753 }
754
755 // Headerdata
756 if (is_array($GLOBALS['TSFE']->pSetup['headerData.'])) {
757 $GLOBALS['TSFE']->addHeaderData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['headerData.'], 'headerData.'));
758 }
759
760 // Footerdata
761 if (is_array($GLOBALS['TSFE']->pSetup['footerData.'])) {
762 $GLOBALS['TSFE']->addFooterData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['footerData.'], 'footerData.'));
763 }
764
765 // Title
766 $titleTagContent = $GLOBALS['TSFE']->tmpl->printTitle($GLOBALS['TSFE']->altPageTitle ? $GLOBALS['TSFE']->altPageTitle : $GLOBALS['TSFE']->page['title'], $GLOBALS['TSFE']->config['config']['noPageTitle'], $GLOBALS['TSFE']->config['config']['pageTitleFirst']);
767 if ($GLOBALS['TSFE']->config['config']['titleTagFunction']) {
768 $titleTagContent = $GLOBALS['TSFE']->cObj->callUserFunction($GLOBALS['TSFE']->config['config']['titleTagFunction'], array (), $titleTagContent);
769 }
770
771 if (strlen($titleTagContent) && intval($GLOBALS['TSFE']->config['config']['noPageTitle']) !== 2) {
772 $GLOBALS['TSFE']->setTitle($titleTagContent);
773 }
774
775 $GLOBALS['TSFE']->addMetaTag('<meta name="generator" content="TYPO3 ' . TYPO3_branch . ' CMS" />');
776
777 $conf = $GLOBALS['TSFE']->pSetup['meta.'];
778 if (is_array($conf)) {
779 foreach ($conf as $theKey => $theValue) {
780 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
781 if (strstr($theKey, '.')) {
782 $theKey = substr($theKey, 0, - 1);
783 }
784 $val = $GLOBALS['TSFE']->cObj->stdWrap($conf[$theKey], $conf[$theKey . '.']);
785 $key = $theKey;
786 if (trim($val)) {
787 $a = 'name';
788 if (strtolower($key) == 'refresh') {
789 $a = 'http-equiv';
790 }
791 $GLOBALS['TSFE']->addMetaTag('<meta ' . $a . '="' . $key . '" content="' . htmlspecialchars(trim($val)) . '" />');
792 }
793 }
794 }
795 }
796
797 unset($GLOBALS['TSFE']->additionalHeaderData['JSCode']);
798 unset($GLOBALS['TSFE']->additionalHeaderData['JSImgCode']);
799
800 if (is_array($GLOBALS['TSFE']->config['INTincScript'])) {
801 // Storing the JSCode and JSImgCode vars...
802 $GLOBALS['TSFE']->additionalHeaderData['JSCode'] = $GLOBALS['TSFE']->JSCode;
803 $GLOBALS['TSFE']->additionalHeaderData['JSImgCode'] = $GLOBALS['TSFE']->JSImgCode;
804 $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] = $GLOBALS['TSFE']->uniqueHash();
805 $GLOBALS['TSFE']->config['INTincScript_ext']['additionalHeaderData'] = $GLOBALS['TSFE']->additionalHeaderData; // Storing the header-data array
806 $GLOBALS['TSFE']->config['INTincScript_ext']['additionalJavaScript'] = $GLOBALS['TSFE']->additionalJavaScript; // Storing the JS-data array
807 $GLOBALS['TSFE']->config['INTincScript_ext']['additionalCSS'] = $GLOBALS['TSFE']->additionalCSS; // Storing the Style-data array
808
809
810 $GLOBALS['TSFE']->additionalHeaderData = array ('<!--HD_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->'); // Clearing the array
811 $GLOBALS['TSFE']->divSection .= '<!--TDS_' . $GLOBALS['TSFE']->config['INTincScript_ext']['divKey'] . '-->';
812 } else {
813 $GLOBALS['TSFE']->INTincScript_loadJSCode();
814 }
815 $JSef = TSpagegen::JSeventFunctions();
816
817 // Adding default Java Script:
818 $scriptJsCode = '
819 var browserName = navigator.appName;
820 var browserVer = parseInt(navigator.appVersion);
821 var version = "";
822 var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);
823 if ((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName=="Konqueror" || browserName=="Opera") {version = "n3";} else {version = "n2";}
824 // Blurring links:
825 function blurLink(theObject) { //
826 if (msie4) {theObject.blur();}
827 }
828 ' . $JSef[0];
829
830 if ($GLOBALS['TSFE']->spamProtectEmailAddresses && $GLOBALS['TSFE']->spamProtectEmailAddresses !== 'ascii') {
831 $scriptJsCode .= '
832 // decrypt helper function
833 function decryptCharcode(n,start,end,offset) {
834 n = n + offset;
835 if (offset > 0 && n > end) {
836 n = start + (n - end - 1);
837 } else if (offset < 0 && n < start) {
838 n = end - (start - n - 1);
839 }
840 return String.fromCharCode(n);
841 }
842 // decrypt string
843 function decryptString(enc,offset) {
844 var dec = "";
845 var len = enc.length;
846 for(var i=0; i < len; i++) {
847 var n = enc.charCodeAt(i);
848 if (n >= 0x2B && n <= 0x3A) {
849 dec += decryptCharcode(n,0x2B,0x3A,offset); // 0-9 . , - + / :
850 } else if (n >= 0x40 && n <= 0x5A) {
851 dec += decryptCharcode(n,0x40,0x5A,offset); // A-Z @
852 } else if (n >= 0x61 && n <= 0x7A) {
853 dec += decryptCharcode(n,0x61,0x7A,offset); // a-z
854 } else {
855 dec += enc.charAt(i);
856 }
857 }
858 return dec;
859 }
860 // decrypt spam-protected emails
861 function linkTo_UnCryptMailto(s) {
862 location.href = decryptString(s,' . ($GLOBALS['TSFE']->spamProtectEmailAddresses * - 1) . ');
863 }
864 ';
865 }
866
867 //add inline JS
868 $inlineJS = '';
869
870 // defined in php
871 if (is_array($GLOBALS['TSFE']->inlineJS)) {
872 foreach ($GLOBALS['TSFE']->inlineJS as $key => $val) {
873 if (! is_array($val)) {
874 $inlineJS .= chr(10) . $val . chr(10);
875 }
876 }
877 }
878
879 // defined in TS with page.inlineJS
880 // Javascript inline code
881 $inline = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['jsInline.'], 'jsInline.');
882 if ($inline) {
883 $inlineJS .= chr(10) . $inline . chr(10);
884 }
885
886 // Javascript inline code for Footer
887 $inlineFooterJs = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['jsFooterInline.'], 'jsFooterInline.');
888
889 // Should minify?
890 if ($GLOBALS['TSFE']->config['config']['minifyJS']) {
891 $GLOBALS['TSFE']->enableCompressJavascript();
892 $minifyErrorScript = $minifyErrorInline = '';
893 $scriptJsCode = t3lib_div::minifyJavaScript($scriptJsCode, $minifyErrorScript);
894 if ($minifyErrorScript) {
895 $GLOBALS['TT']->setTSlogMessage($minifyErrorScript, 3);
896 }
897 if ($inlineJS) {
898 $inlineJS = t3lib_div::minifyJavaScript($inlineJS, $minifyErrorInline);
899 if ($minifyErrorInline) {
900 $GLOBALS['TT']->setTSlogMessage($minifyErrorInline, 3);
901 }
902 }
903 if ($inlineFooterJs) {
904 $inlineFooterJs = t3lib_div::minifyJavaScript($inlineFooterJs, $minifyErrorInline);
905 if ($minifyErrorInline) {
906 $GLOBALS['TT']->setTSlogMessage($minifyErrorInline, 3);
907 }
908 }
909
910 }
911
912 if (! $GLOBALS['TSFE']->config['config']['removeDefaultJS']) {
913 // inlude default and inlineJS
914 if ($scriptJsCode) {
915 $GLOBALS['TSFE']->addJsInlineCode('_scriptCode', $scriptJsCode, $GLOBALS['TSFE']->config['config']['minifyJS']);
916 }
917 if ($inlineJS) {
918 $GLOBALS['TSFE']->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['minifyJS']);
919 }
920 if ($inlineFooterJs) {
921 $GLOBALS['TSFE']->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['minifyJS']);
922 }
923 } elseif ($GLOBALS['TSFE']->config['config']['removeDefaultJS'] === 'external') {
924 // put default and inlineJS in external file
925 $GLOBALS['TSFE']->addJsFile(TSpagegen::inline2TempFile($scriptJsCode . $inlineJS, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['minifyJS']);
926 if ($inlineFooterJs) {
927 $GLOBALS['TSFE']->addJsFooterFile(TSpagegen::inline2TempFile($inlineFooterJs, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['minifyJS']);
928 }
929 } else {
930 // include only inlineJS
931 if ($inlineJS) {
932 $GLOBALS['TSFE']->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['minifyJS']);
933 }
934 if ($inlineFooterJs) {
935 $GLOBALS['TSFE']->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['minifyJS']);
936 }
937 }
938
939 // ExtJS specific code
940 if (is_array($GLOBALS['TSFE']->pSetup['inlineLanguageLabel.'])) {
941 $GLOBALS['TSFE']->addInlineLanguageLabelArray($GLOBALS['TSFE']->pSetup['inlineLanguageLabel.']);
942 }
943
944 if (is_array($GLOBALS['TSFE']->pSetup['inlineSettings.'])) {
945 $GLOBALS['TSFE']->addInlineSettingArray('TS', $GLOBALS['TSFE']->pSetup['inlineSettings.']);
946 }
947
948 if (is_array($GLOBALS['TSFE']->pSetup['extOnReady.'])) {
949 $GLOBALS['TSFE']->addExtOnReadyCode($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['extOnReady.'], 'extOnReady.'));
950 }
951
952 // compression and concatenate settings
953 if ($GLOBALS['TSFE']->config['config']['minifyCSS']) {
954 $GLOBALS['TSFE']->enableCompressCss();
955 }
956 if ($GLOBALS['TSFE']->config['config']['minifyJS']) {
957 $GLOBALS['TSFE']->enableCompressJavascript();
958 }
959 if ($GLOBALS['TSFE']->config['config']['concatenateJsAndCss']) {
960 $GLOBALS['TSFE']->enableConcatenateFiles();
961 }
962
963 // add header data block
964 if ($GLOBALS['TSFE']->additionalHeaderData) {
965 $GLOBALS['TSFE']->addHeaderData(implode(chr(10), $GLOBALS['TSFE']->additionalHeaderData));
966 }
967
968 // add footer data block
969 if ($GLOBALS['TSFE']->additionalFooterData) {
970 $GLOBALS['TSFE']->addFooterData(implode(chr(10), $GLOBALS['TSFE']->additionalFooterData));
971 }
972
973 // Header complete, now add content
974
975
976 if ($GLOBALS['TSFE']->pSetup['frameSet.']) {
977 $fs = t3lib_div::makeInstance('tslib_frameset');
978 $GLOBALS['TSFE']->addBodyContent($fs->make($GLOBALS['TSFE']->pSetup['frameSet.']));
979 $GLOBALS['TSFE']->addBodyContent(chr(10) . '<noframes>' . chr(10));
980 }
981
982 // Bodytag:
983 $defBT = $GLOBALS['TSFE']->pSetup['bodyTagCObject'] ? $GLOBALS['TSFE']->cObj->cObjGetSingle($GLOBALS['TSFE']->pSetup['bodyTagCObject'], $GLOBALS['TSFE']->pSetup['bodyTagCObject.'], 'bodyTagCObject') : '';
984 if (! $defBT)
985 $defBT = $GLOBALS['TSFE']->defaultBodyTag;
986 $bodyTag = $GLOBALS['TSFE']->pSetup['bodyTag'] ? $GLOBALS['TSFE']->pSetup['bodyTag'] : $defBT;
987 if ($bgImg = $GLOBALS['TSFE']->cObj->getImgResource($GLOBALS['TSFE']->pSetup['bgImg'], $GLOBALS['TSFE']->pSetup['bgImg.'])) {
988 $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' background="' . $GLOBALS["TSFE"]->absRefPrefix . $bgImg[3] . '">';
989 }
990
991 if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins'])) {
992 $margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
993 if ($GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS']) {
994 // Setting margins in CSS, see above
995 } else {
996 $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' leftmargin="' . $margins . '" topmargin="' . $margins . '" marginwidth="' . $margins . '" marginheight="' . $margins . '">';
997 }
998 }
999
1000 if (trim($GLOBALS['TSFE']->pSetup['bodyTagAdd'])) {
1001 $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' ' . trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']) . '>';
1002 }
1003
1004 if (count($JSef[1])) { // Event functions:
1005 $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' ' . trim(implode(' ', $JSef[1])) . '>';
1006 }
1007 $GLOBALS['TSFE']->addBodyContent(chr(10) . $bodyTag);
1008
1009 // Div-sections
1010 if ($GLOBALS['TSFE']->divSection) {
1011 $GLOBALS['TSFE']->addBodyContent(chr(10) . $GLOBALS['TSFE']->divSection);
1012 }
1013
1014 // Page content
1015 $GLOBALS['TSFE']->addBodyContent(chr(10) . $pageContent);
1016
1017 // Render complete page
1018 $GLOBALS['TSFE']->content = $GLOBALS['TSFE']->render();
1019
1020 // Ending page
1021 if ($GLOBALS['TSFE']->pSetup['frameSet.']) {
1022 $GLOBALS['TSFE']->content .= chr(10) . '</noframes>';
1023 }
1024
1025 }
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039 /*************************
1040 *
1041 * Helper functions
1042 * Remember: Calls internally must still be done on the non-instantiated class: TSpagegen::inline2TempFile()
1043 *
1044 *************************/
1045
1046 /**
1047 * Writes string to a temporary file named after the md5-hash of the string
1048 *
1049 * @param string CSS styles / JavaScript to write to file.
1050 * @param string Extension: "css" or "js"
1051 * @return string <script> or <link> tag for the file.
1052 */
1053 public static function inline2TempFile($str, $ext) {
1054
1055 // Create filename / tags:
1056 $script = '';
1057 switch ($ext) {
1058 case 'js' :
1059 $script = 'typo3temp/javascript_' . substr(md5($str), 0, 10) . '.js';
1060 $output = $GLOBALS['TSFE']->absRefPrefix . $script;
1061 break;
1062 case 'css' :
1063 $script = 'typo3temp/stylesheet_' . substr(md5($str), 0, 10) . '.css';
1064 $output = $GLOBALS['TSFE']->absRefPrefix . $script;
1065 break;
1066 }
1067
1068 // Write file:
1069 if ($script) {
1070 if (! @is_file(PATH_site . $script)) {
1071 t3lib_div::writeFile(PATH_site . $script, $str);
1072 }
1073 }
1074
1075 return $output;
1076 }
1077
1078 /**
1079 * Checks if the value defined in "config.linkVars" contains an allowed value. Otherwise, return false which means the value will not be added to any links.
1080 *
1081 * @param string The string in which to find $needle
1082 * @param string The string to find in $haystack
1083 * @return boolean Returns true if $needle matches or is found in $haystack
1084 */
1085 public static function isAllowedLinkVarValue($haystack,$needle) {
1086 $OK = false;
1087
1088 if ($needle=='int' || $needle=='integer') { // Integer
1089
1090 if (t3lib_div::testInt($haystack)) {
1091 $OK = true;
1092 }
1093
1094 } elseif (preg_match('/^\/.+\/[imsxeADSUXu]*$/', $needle)) { // Regular expression, only "//" is allowed as delimiter
1095
1096 if (@preg_match($needle, $haystack)) {
1097 $OK = true;
1098 }
1099
1100 } elseif (strstr($needle,'-')) { // Range
1101
1102 if (t3lib_div::testInt($haystack)) {
1103 $range = explode('-',$needle);
1104 if ($range[0] <= $haystack && $range[1] >= $haystack) {
1105 $OK = true;
1106 }
1107 }
1108
1109 } elseif (strstr($needle,'|')) { // List
1110
1111 $haystack = str_replace(' ','',$haystack); // Trim the input
1112 if (strstr('|'.$needle.'|', '|'.$haystack.'|')) {
1113 $OK = true;
1114 }
1115
1116 } elseif (!strcmp($needle,$haystack)) { // String comparison
1117 $OK = true;
1118 }
1119
1120 return $OK;
1121 }
1122 }
1123
1124 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_pagegen.php']) {
1125 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_pagegen.php']);
1126 }
1127
1128
1129
1130 /**
1131 * Class for fetching record relations for the frontend.
1132 *
1133 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
1134 * @package TYPO3
1135 * @subpackage tslib
1136 * @see tslib_cObj::RECORDS()
1137 */
1138 class FE_loadDBGroup extends t3lib_loadDBGroup {
1139 var $fromTC = 0; // Means that everything is returned instead of only uid and label-field
1140 }
1141
1142 ?>