class.tslib_pagegen.php 31.3 KB
Newer Older
Kasper Skårhøj's avatar
Kasper Skårhøj committed
1
2
3
<?php
/***************************************************************
*  Copyright notice
4
*
5
*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
Kasper Skårhøj's avatar
Kasper Skårhøj committed
6
7
*  All rights reserved
*
8
*  This script is part of the TYPO3 project. The TYPO3 project is
Kasper Skårhøj's avatar
Kasper Skårhøj committed
9
10
11
12
*  free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
13
*
Kasper Skårhøj's avatar
Kasper Skårhøj committed
14
15
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
16
*  A copy is found in the textfile GPL.txt and important notices to the license
Kasper Skårhøj's avatar
Kasper Skårhøj committed
17
18
*  from the author is found in LICENSE.txt distributed with these scripts.
*
19
*
Kasper Skårhøj's avatar
Kasper Skårhøj committed
20
21
22
23
24
25
26
*  This script is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
27
/**
Kasper Skårhøj's avatar
Kasper Skårhøj committed
28
29
30
 * Libraries for pagegen.php
 * The script "pagegen.php" is included by "index_ts.php" when a page is not cached but needs to be rendered.
 *
31
32
 * $Id$
 * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
Kasper Skårhøj's avatar
Kasper Skårhøj committed
33
34
 * XHTML compliant
 *
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
35
 * @author	Kasper Skaarhoj <kasperYYYY@typo3.com>
Kasper Skårhøj's avatar
Kasper Skårhøj committed
36
37
38
39
40
41
 */
/**
 * [CLASS/FUNCTION INDEX of SCRIPT]
 *
 *
 *
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
42
43
 *   88: class TSpagegen
 *   95:     function pagegenInit()
44
45
46
47
 *  229:     function getIncFiles()
 *  262:     function JSeventFunctions()
 *  296:     function renderContent()
 *  323:     function renderContentWithHeader($pageContent)
Kasper Skårhøj's avatar
Kasper Skårhøj committed
48
 *
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
49
 *              SECTION: Helper functions
50
 *  760:     function inline2TempFile($str,$ext)
Kasper Skårhøj's avatar
Kasper Skårhøj committed
51
52
 *
 *
53
 *  814: class FE_loadDBGroup extends t3lib_loadDBGroup
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
54
55
 *
 * TOTAL FUNCTIONS: 6
Kasper Skårhøj's avatar
Kasper Skårhøj committed
56
57
58
59
 * (This index is automatically created/updated by the extension "extdeveval")
 *
 */

60

Kasper Skårhøj's avatar
Kasper Skårhøj committed
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
 *
Kasper Skårhøj's avatar
Kasper Skårhøj committed
81
82
 * The class is not instantiated as an objects but called directly with the "::" operator.
 * eg: TSpagegen::pagegenInit()
83
 *
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
84
 * @author	Kasper Skaarhoj <kasperYYYY@typo3.com>
85
86
 * @package TYPO3
 * @subpackage tslib
Kasper Skårhøj's avatar
Kasper Skårhøj committed
87
88
89
90
91
 */
class TSpagegen {

	/**
	 * Setting some vars in TSFE, primarily based on TypoScript config settings.
92
93
	 *
	 * @return	void
Kasper Skårhøj's avatar
Kasper Skårhøj committed
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
	 */
	function pagegenInit()	{
		if ($GLOBALS['TSFE']->page['content_from_pid']>0)	{
			$temp_copy_TSFE = $GLOBALS['TSFE'];	// make REAL copy of TSFE object - not reference!
			$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!
			$temp_copy_TSFE->getPageAndRootlineWithDomain($GLOBALS['TSFE']->config['config']['content_from_pid_allowOutsideDomain']?0:$GLOBALS['TSFE']->domainStartPage);
			$GLOBALS['TSFE']->contentPid = intval($temp_copy_TSFE->id);
			unset($temp_copy_TSFE);
		}
		if ($GLOBALS['TSFE']->config['config']['MP_defaults'])	{
			$temp_parts = t3lib_div::trimExplode('|',$GLOBALS['TSFE']->config['config']['MP_defaults'],1);
			reset($temp_parts);
			while(list(,$temp_p)=each($temp_parts))	{
				list($temp_idP,$temp_MPp) = explode(':',$temp_p,2);
				$temp_ids=t3lib_div::intExplode(',',$temp_idP);
				reset($temp_ids);
				while(list(,$temp_id)=each($temp_ids))	{
					$GLOBALS['TSFE']->MP_defaults[$temp_id]=$temp_MPp;
				}
			}
		}
		if ($GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP'])	{
			$temp_parts = t3lib_div::trimExplode(',',$GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP'],1);
			foreach ($temp_parts as $temp_p)	{
				$GLOBALS['TSFE']->pEncAllowedParamNames[$temp_p]=1;
			}
		}
121

Kasper Skårhøj's avatar
Kasper Skårhøj committed
122
123
124
125
126

			// Global vars...
		$GLOBALS['TSFE']->indexedDocTitle = $GLOBALS['TSFE']->page['title'];
		$GLOBALS['TSFE']->debug = ''.$GLOBALS['TSFE']->config['config']['debug'];

Kasper Skårhøj's avatar
Kasper Skårhøj committed
127
128
129
			// Base url:
		if ($GLOBALS['TSFE']->config['config']['baseURL']) {
			$GLOBALS['TSFE']->baseUrl = (intval($GLOBALS['TSFE']->config['config']['baseURL']) ? t3lib_div::getIndpEnv('TYPO3_SITE_URL') : $GLOBALS['TSFE']->config['config']['baseURL']);
130
			$GLOBALS['TSFE']->anchorPrefix = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL')));
Kasper Skårhøj's avatar
Kasper Skårhøj committed
131
132
		}

Kasper Skårhøj's avatar
Kasper Skårhøj committed
133
134
135
			// Internal and External target defaults
		$GLOBALS['TSFE']->intTarget = ''.$GLOBALS['TSFE']->config['config']['intTarget'];
		$GLOBALS['TSFE']->extTarget = ''.$GLOBALS['TSFE']->config['config']['extTarget'];
136
		if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'] === 'ascii') {
137
138
			$GLOBALS['TSFE']->spamProtectEmailAddresses = 'ascii';
		} else {
Kasper Skårhøj's avatar
Kasper Skårhøj committed
139
			$GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-5,5,0);
140
141
			if ($GLOBALS['TSFE']->spamProtectEmailAddresses)	{
				$GLOBALS['TSFE']->additionalJavaScript['UnCryptMailto()']='
Kasper Skårhøj's avatar
Kasper Skårhøj committed
142
  // JS function for uncrypting spam-protected emails:
143
function UnCryptMailto(s) {	//
Kasper Skårhøj's avatar
Kasper Skårhøj committed
144
145
	var n=0;
	var r="";
146
147
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
Kasper Skårhøj's avatar
Kasper Skårhøj committed
148
		if (n>=8364) {n = 128;}
149
		r += String.fromCharCode(n-('.$GLOBALS['TSFE']->spamProtectEmailAddresses.'));
Kasper Skårhøj's avatar
Kasper Skårhøj committed
150
151
152
153
	}
	return r;
}
  // JS function for uncrypting spam-protected emails:
154
function linkTo_UnCryptMailto(s)	{	//
Kasper Skårhøj's avatar
Kasper Skårhøj committed
155
156
157
	location.href=UnCryptMailto(s);
}
		';
158
			}
Kasper Skårhøj's avatar
Kasper Skårhøj committed
159
160
		}

161

Kasper Skårhøj's avatar
Kasper Skårhøj committed
162
		$GLOBALS['TSFE']->absRefPrefix = trim(''.$GLOBALS['TSFE']->config['config']['absRefPrefix']);
163
		if ((!strcmp($GLOBALS['TSFE']->config['config']['simulateStaticDocuments'],'PATH_INFO') || $GLOBALS['TSFE']->absRefPrefix_force)
Kasper Skårhøj's avatar
Kasper Skårhøj committed
164
				&& !$GLOBALS['TSFE']->absRefPrefix)	{
165
			$GLOBALS['TSFE']->absRefPrefix=t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
166
		}		// Force absRefPrefix to this value is PATH_INFO is used.
167

Kasper Skårhøj's avatar
Kasper Skårhøj committed
168
169
		if ($GLOBALS['TSFE']->type && $GLOBALS['TSFE']->config['config']['frameReloadIfNotInFrameset'])	{
			$tdlLD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,'_top',$GLOBALS['TSFE']->no_cache,'');
Kasper Skårhøj's avatar
Kasper Skårhøj committed
170
			$GLOBALS['TSFE']->JSCode = 'if(!parent.'.trim($GLOBALS['TSFE']->sPre).' && !parent.view_frame) top.document.location="'.$GLOBALS['TSFE']->baseUrlWrap($tdlLD['totalURL']).'"';
171
172
173
		}
		$GLOBALS['TSFE']->compensateFieldWidth = ''.$GLOBALS['TSFE']->config['config']['compensateFieldWidth'];
		$GLOBALS['TSFE']->lockFilePath = ''.$GLOBALS['TSFE']->config['config']['lockFilePath'];
Kasper Skårhøj's avatar
Kasper Skårhøj committed
174
175
176
		$GLOBALS['TSFE']->lockFilePath = $GLOBALS['TSFE']->lockFilePath ? $GLOBALS['TSFE']->lockFilePath : 'fileadmin/';
		$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'];
		$GLOBALS['TSFE']->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
177

Kasper Skårhøj's avatar
Kasper Skårhøj committed
178
179
180
		$GLOBALS['TSFE']->ATagParams = trim($GLOBALS['TSFE']->config['config']['ATagParams']) ? ' '.trim($GLOBALS['TSFE']->config['config']['ATagParams']) : '';
		if ($GLOBALS['TSFE']->config['config']['setJS_mouseOver'])	$GLOBALS['TSFE']->setJS('mouseOver');
		if ($GLOBALS['TSFE']->config['config']['setJS_openPic'])	$GLOBALS['TSFE']->setJS('openPic');
181

Kasper Skårhøj's avatar
Kasper Skårhøj committed
182
		$GLOBALS['TSFE']->sWordRegEx='';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
183
		$GLOBALS['TSFE']->sWordList = t3lib_div::_GP('sword_list');
Kasper Skårhøj's avatar
Kasper Skårhøj committed
184
185
186
		if (is_array($GLOBALS['TSFE']->sWordList))	{
			$standAlone = trim(''.$GLOBALS['TSFE']->config['config']['sword_standAlone']);
			$noMixedCase = trim(''.$GLOBALS['TSFE']->config['config']['sword_noMixedCase']);
187

Kasper Skårhøj's avatar
Kasper Skårhøj committed
188
189
190
191
192
193
194
195
196
197
198
199
200
			$space = ($standAlone) ? '[[:space:]]' : '';
			reset($GLOBALS['TSFE']->sWordList);
			while (list($key,$val) = each($GLOBALS['TSFE']->sWordList))	{
				if (trim($val)) {
					if (!$noMixedCase) {
						$GLOBALS['TSFE']->sWordRegEx.= $space.sql_regcase(quotemeta($val)).$space.'|';
					} else {
						$GLOBALS['TSFE']->sWordRegEx.= $space.quotemeta($val).$space.'|';
					}
				}
			}
			$GLOBALS['TSFE']->sWordRegEx = ereg_replace('\|$','',$GLOBALS['TSFE']->sWordRegEx);
		}
201

Kasper Skårhøj's avatar
Kasper Skårhøj committed
202
203
204
205
206
			// linkVars
		$GLOBALS['TSFE']->linkVars = ''.$GLOBALS['TSFE']->config['config']['linkVars'];
		if ($GLOBALS['TSFE']->linkVars)	{
			$linkVarArr = explode(',',$GLOBALS['TSFE']->linkVars);
			$GLOBALS['TSFE']->linkVars='';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
207
			reset($linkVarArr);
Kasper Skårhøj's avatar
Kasper Skårhøj committed
208
209
			while(list(,$val)=each($linkVarArr))	{
				$val=trim($val);
Kasper Skårhøj's avatar
Kasper Skårhøj committed
210
211
212
213
				$GET = t3lib_div::_GET();
				if ($val && isset($GET[$val]))	{
					if (!is_array($GET[$val]))	{
						$GLOBALS['TSFE']->linkVars.='&'.$val.'='.rawurlencode($GET[$val]);
Kasper Skårhøj's avatar
Kasper Skårhøj committed
214
					} else {
Kasper Skårhøj's avatar
Kasper Skårhøj committed
215
						$GLOBALS['TSFE']->linkVars.=t3lib_div::implodeArrayForUrl($val,$GET[$val]);
Kasper Skårhøj's avatar
Kasper Skårhøj committed
216
217
218
219
220
221
222
223
224
225
					}
				}
			}
		} else {
			$GLOBALS['TSFE']->linkVars='';
		}
	}

	/**
	 * Returns an array with files to include. These files are the ones set up in TypoScript config.
226
	 *
Kasper Skårhøj's avatar
Kasper Skårhøj committed
227
228
229
230
231
232
233
234
235
236
237
238
	 * @return	array		Files to include. Paths are relative to PATH_site.
	 */
	function getIncFiles()	{
		$incFilesArray = array();
			// Get files from config.includeLibrary
		$includeLibrary = trim(''.$GLOBALS['TSFE']->config['config']['includeLibrary']);
		if ($includeLibrary)	{
			$incFile=$GLOBALS['TSFE']->tmpl->getFileName($includeLibrary);
			if ($incFile)	{
				$incFilesArray[] = $incFile;
			}
		}
239

Kasper Skårhøj's avatar
Kasper Skårhøj committed
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
		if (is_array($GLOBALS['TSFE']->pSetup['includeLibs.']))	{$incLibs=$GLOBALS['TSFE']->pSetup['includeLibs.'];} else {$incLibs=array();}
		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)
		if (count($incLibs))	{
			reset($incLibs);
			while(list(,$theLib)=each($incLibs))	{
				if (!is_array($theLib) && $incFile=$GLOBALS['TSFE']->tmpl->getFileName($theLib))	{
					$incFilesArray[] = $incFile;
				}
			}
		}
			// Include HTML mail library?
		if ($GLOBALS['TSFE']->config['config']['incT3Lib_htmlmail'])	{
			$incFilesArray[] = 't3lib/class.t3lib_htmlmail.php';
		}
		return $incFilesArray;
	}
256

Kasper Skårhøj's avatar
Kasper Skårhøj committed
257
258
	/**
	 * Processing JavaScript handlers
259
	 *
Kasper Skårhøj's avatar
Kasper Skårhøj committed
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
	 * @return	array		Array with a) a JavaScript section with event handlers and variables set and b) an array with attributes for the body tag.
	 */
	function JSeventFunctions()	{
		$functions=array();
		$setEvents=array();
		$setBody=array();

		if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']))	{
			$functions[]='	function T3_onmousemoveWrapper(e)	{	'.implode('   ',$GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']).'	}';
			$setEvents[]='	document.onmousemove=T3_onmousemoveWrapper;';
		}
		if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']))	{
			$functions[]='	function T3_onmouseupWrapper(e)	{	'.implode('   ',$GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']).'	}';
			$setEvents[]='	document.onmouseup=T3_onmouseupWrapper;';
		}
		if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onload']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onload']))	{
			$functions[]='	function T3_onloadWrapper()	{	'.implode('   ',$GLOBALS['TSFE']->JSeventFuncCalls['onload']).'	}';
			$setEvents[]='	document.onload=T3_onloadWrapper;';
			$setBody[]='onload="T3_onloadWrapper();"';
		}

		return Array(count($functions)?'
<script type="text/javascript">
	/*<![CDATA[*/
'.implode(chr(10),$functions).'
'.implode(chr(10),$setEvents).'
	/*]]>*/
</script>
			':'',$setBody);
	}

	/**
	 * Rendering the page content
293
294
	 *
	 * @return	void
Kasper Skårhøj's avatar
Kasper Skårhøj committed
295
296
297
298
299
300
301
302
303
	 */
	function renderContent()	{
		// PAGE CONTENT
		$GLOBALS['TT']->incStackPointer();
		$GLOBALS['TT']->push($GLOBALS['TSFE']->sPre, 'PAGE');
			$pageContent = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup);

			if ($GLOBALS['TSFE']->pSetup['wrap'])	{$pageContent = $GLOBALS['TSFE']->cObj->wrap($pageContent, $GLOBALS['TSFE']->pSetup['wrap']);}
			if ($GLOBALS['TSFE']->pSetup['stdWrap.'])	{$pageContent = $GLOBALS['TSFE']->cObj->stdWrap($pageContent, $GLOBALS['TSFE']->pSetup['stdWrap.']);}
304

Kasper Skårhøj's avatar
Kasper Skårhøj committed
305
			// PAGE HEADER (after content - maybe JS is inserted!
306

Kasper Skårhøj's avatar
Kasper Skårhøj committed
307
308
			// if 'disableAllHeaderCode' is set, all the header-code is discarded!
		if ($GLOBALS['TSFE']->config['config']['disableAllHeaderCode'])	{
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
309
			$GLOBALS['TSFE']->content = $pageContent;
310
		} else {
Kasper Skårhøj's avatar
Kasper Skårhøj committed
311
312
313
314
315
			TSpagegen::renderContentWithHeader($pageContent);
		}
		$GLOBALS['TT']->pull($GLOBALS['TT']->LR?$GLOBALS['TSFE']->content:'');
		$GLOBALS['TT']->decStackPointer();
	}
316

Kasper Skårhøj's avatar
Kasper Skårhøj committed
317
318
	/**
	 * Rendering normal HTML-page with header by wrapping the generated content ($pageContent) in body-tags and setting the header accordingly.
319
	 *
Kasper Skårhøj's avatar
Kasper Skårhøj committed
320
	 * @param	string		The page content which TypoScript objects has generated
321
	 * @return	void
Kasper Skårhøj's avatar
Kasper Skårhøj committed
322
323
324
325
326
327
328
	 */
	function renderContentWithHeader($pageContent)	{
		$customContent = $GLOBALS['TSFE']->config['config']['headerComment'];
		if (trim($customContent))	{
			$customContent = chr(10).$customContent;
		} else $customContent='';

329
			// Setting charset:
330
		$theCharset = $GLOBALS['TSFE']->metaCharset;
331

Kasper Skårhøj's avatar
Kasper Skårhøj committed
332
333
			// Reset the content variables:
		$GLOBALS['TSFE']->content='';
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
334
335
336
337
338
339
340
		$htmlTagAttributes = array();
		$htmlLang = $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] ? $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] : 'en';

			// Set content direction: (More info: http://www.tau.ac.il/~danon/Hebrew/HTML_and_Hebrew.html)
		if ($GLOBALS['TSFE']->config['config']['htmlTag_dir'])	{
			$htmlTagAttributes['dir'] = htmlspecialchars($GLOBALS['TSFE']->config['config']['htmlTag_dir']);
		}
Kasper Skårhøj's avatar
Kasper Skårhøj committed
341
342

			// Setting document type:
Kasper Skårhøj's avatar
Kasper Skårhøj committed
343
344
		$docTypeParts = array();
		$XMLprologue = $GLOBALS['TSFE']->config['config']['xmlprologue'] != 'none';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
345
		if ($GLOBALS['TSFE']->config['config']['doctype'])	{
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
346
347

				// Setting doctypes:
Kasper Skårhøj's avatar
Kasper Skårhøj committed
348
349
			switch((string)$GLOBALS['TSFE']->config['config']['doctype'])	{
				case 'xhtml_trans':
Kasper Skårhøj's avatar
Kasper Skårhøj committed
350
351
		 			if ($XMLprologue) $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
					$docTypeParts[]='<!DOCTYPE html
Kasper Skårhøj's avatar
Kasper Skårhøj committed
352
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
Kasper Skårhøj's avatar
Kasper Skårhøj committed
353
354
355
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
				break;
				case 'xhtml_strict':
Kasper Skårhøj's avatar
Kasper Skårhøj committed
356
357
		 			if ($XMLprologue) $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
					$docTypeParts[]='<!DOCTYPE html
Kasper Skårhøj's avatar
Kasper Skårhøj committed
358
359
360
361
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
				break;
				case 'xhtml_frames':
Kasper Skårhøj's avatar
Kasper Skårhøj committed
362
363
		 			if ($XMLprologue) $docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';
					$docTypeParts[]='<!DOCTYPE html
Kasper Skårhøj's avatar
Kasper Skårhøj committed
364
     PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
Kasper Skårhøj's avatar
Kasper Skårhøj committed
365
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
366
367
368
369
370
371
372
373
374
375
376
377
				break;
				case 'xhtml_11':
		 			if ($XMLprologue) $docTypeParts[]='<?xml version="1.1" encoding="'.$theCharset.'"?>';
					$docTypeParts[]='<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.1//EN"
     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
				break;
				case 'xhtml_2':
		 			if ($XMLprologue) $docTypeParts[]='<?xml version="2.0" encoding="'.$theCharset.'"?>';
					$docTypeParts[]='<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 2.0//EN"
	"http://www.w3.org/TR/xhtml2/DTD/xhtml2.dtd">';
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
378
379
				break;
				case 'none':
Kasper Skårhøj's avatar
Kasper Skårhøj committed
380
381
				break;
				default:
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
					$docTypeParts[] = $GLOBALS['TSFE']->config['config']['doctype'];
				break;
			}
				// Setting <html> tag attributes:
			switch((string)$GLOBALS['TSFE']->config['config']['doctype'])	{
				case 'xhtml_trans':
				case 'xhtml_strict':
				case 'xhtml_frames':
	 				$htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml';
					$htmlTagAttributes['xml:lang'] = $htmlLang;
					$htmlTagAttributes['lang'] = $htmlLang;
				break;
				case 'xhtml_11':
				case 'xhtml_2':
	 				$htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml';
					$htmlTagAttributes['xml:lang'] = $htmlLang;
Kasper Skårhøj's avatar
Kasper Skårhøj committed
398
399
400
				break;
			}
		} else {
Kasper Skårhøj's avatar
Kasper Skårhøj committed
401
			$docTypeParts[]='<!DOCTYPE html
Kasper Skårhøj's avatar
Kasper Skårhøj committed
402
	PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
403
		}
Kasper Skårhøj's avatar
Kasper Skårhøj committed
404

Kasper Skårhøj's avatar
Kasper Skårhøj committed
405
406
407
408
			// Swap XML and doctype order around (for MSIE / Opera standards compliance)
		if ($GLOBALS['TSFE']->config['config']['doctypeSwitch'])	{
			$docTypeParts = array_reverse($docTypeParts);
		}
Kasper Skårhøj's avatar
Kasper Skårhøj committed
409

Kasper Skårhøj's avatar
Kasper Skårhøj committed
410
			// Adding doctype parts:
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
411
412
		$GLOBALS['TSFE']->content.= count($docTypeParts) ? implode(chr(10),$docTypeParts).chr(10) : '';

Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
413
414
			// Begin header section:
		if (strcmp($GLOBALS['TSFE']->config['config']['htmlTag_setParams'],'none'))	{
415
			$_attr = $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] ? $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] : t3lib_div::implodeAttributes($htmlTagAttributes);
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
416
417
418
		} else {
			$_attr = '';
		}
419
420
421
422
423
424
		$GLOBALS['TSFE']->content.='<html'.($_attr ? ' '.$_attr : '').'>';

			// Head tag:
		$headTag = $GLOBALS['TSFE']->pSetup['headTag'] ? $GLOBALS['TSFE']->pSetup['headTag'] : '<head>';
		$GLOBALS['TSFE']->content.= chr(10).$headTag;

425
426
427
428
429
430
			// Setting charset meta tag:
		$GLOBALS['TSFE']->content.='
	<meta http-equiv="Content-Type" content="text/html; charset='.$theCharset.'" />';

$GLOBALS['TSFE']->content.='

Kasper Skårhøj's avatar
Kasper Skårhøj committed
431
432
<!-- '.($customContent?$customContent.chr(10):'').'
	This website is brought to you by TYPO3 - get.content.right
Kasper Skårhøj's avatar
Kasper Skårhøj committed
433
	TYPO3 is a free open source Content Management Framework created by Kasper Skaarhoj and licensed under GNU/GPL.
434
	TYPO3 is copyright 1998-2005 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
Kasper Skårhøj's avatar
Kasper Skårhøj committed
435
436
437
	Information and contribution at http://www.typo3.com
-->
';
438

Kasper Skårhøj's avatar
Kasper Skårhøj committed
439

Kasper Skårhøj's avatar
Kasper Skårhøj committed
440
		if ($GLOBALS['TSFE']->baseUrl) {
Kasper Skårhøj's avatar
Kasper Skårhøj committed
441
			$GLOBALS['TSFE']->content.='
Kasper Skårhøj's avatar
Kasper Skårhøj committed
442
	<base href="'.htmlspecialchars($GLOBALS['TSFE']->baseUrl).'" />';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
443
		}
444

Kasper Skårhøj's avatar
Kasper Skårhøj committed
445
446
447
		if ($GLOBALS['TSFE']->pSetup['shortcutIcon']) {
			$ss=$path.$GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['shortcutIcon']);
			$GLOBALS['TSFE']->content.='
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
448
	<link rel="SHORTCUT ICON" href="'.htmlspecialchars($ss).'" />';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
449
		}
450

Kasper Skårhøj's avatar
Kasper Skårhøj committed
451
452
453
454
455
456
457
458
459
460
		/** CSS STYLESHEET handling: */
		if (is_array($GLOBALS['TSFE']->tmpl->setup['plugin.'])) {
			$temp_styleLines=array();
			reset($GLOBALS['TSFE']->tmpl->setup['plugin.']);
			while(list($k2,$iCSScode)=each($GLOBALS['TSFE']->tmpl->setup['plugin.']))	{
				if (is_array($iCSScode) && $iCSScode['_CSS_DEFAULT_STYLE'])	{
					$temp_styleLines[]='/* default styles for extension "'.substr($k2,0,-1).'" */'.chr(10).$iCSScode['_CSS_DEFAULT_STYLE'];
				}
			}
			if (count($temp_styleLines))	{
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
461
462
463
464
465
466
467
468
469
470
471
472
				if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile'])	{
					$GLOBALS['TSFE']->content.=TSpagegen::inline2TempFile(implode(chr(10),$temp_styleLines),'css');
				} else {
					$GLOBALS['TSFE']->content.='
	<style type="text/css">
		/*<![CDATA[*/
	<!--
	'.implode(chr(10),$temp_styleLines).'
	-->
		/*]]>*/
	</style>';
				}
Kasper Skårhøj's avatar
Kasper Skårhøj committed
473
474
475
476
477
478
479
			}
		}

		if ($GLOBALS['TSFE']->pSetup['stylesheet']) {
			$ss=$GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['stylesheet']);
			if ($ss) {
				$GLOBALS['TSFE']->content.='
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
480
	<link rel="stylesheet" type="text/css" href="'.htmlspecialchars($ss).'" />';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
481
482
483
484
485
486
			}
		}
		if (is_array($GLOBALS['TSFE']->pSetup['includeCSS.'])) {
			reset($GLOBALS['TSFE']->pSetup['includeCSS.']);
			while(list($k2,$iCSSfile)=each($GLOBALS['TSFE']->pSetup['includeCSS.']))	{
				if (!is_array($iCSSfile))	{
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
487
					$ss = $GLOBALS['TSFE']->tmpl->getFileName($iCSSfile);
Kasper Skårhøj's avatar
Kasper Skårhøj committed
488
					if ($ss) {
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
489
						if ($GLOBALS['TSFE']->pSetup['includeCSS.'][$k2.'.']['import'])	{
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
490
491
492
							if (substr($ss,0,1)!='/')	{	// To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
								$ss = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/'.$ss;
							}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
493
494
495
496
497
498
499
500
501
502
							$GLOBALS['TSFE']->content.='
	<style type="text/css">
	<!--
	@import url("'.htmlspecialchars($ss).'") '.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$k2.'.']['media']).';
	-->
	</style>
							';
						} else {
							$GLOBALS['TSFE']->content.='
	<link rel="'.($GLOBALS['TSFE']->pSetup['includeCSS.'][$k2.'.']['alternate'] ? 'alternate stylesheet' : 'stylesheet').'" type="text/css" href="'.htmlspecialchars($ss).'"'.
503
504
505
			($GLOBALS['TSFE']->pSetup['includeCSS.'][$k2.'.']['title'] ? ' title="'.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$k2.'.']['title']).'"' : '').
			($GLOBALS['TSFE']->pSetup['includeCSS.'][$k2.'.']['media'] ? ' media="'.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$k2.'.']['media']).'"' : '').
			' />';
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
506
						}
Kasper Skårhøj's avatar
Kasper Skårhøj committed
507
508
509
510
511
512
513
514
					}
				}
			}
		}

		// Stylesheets
		$style='';
		$style.=trim($GLOBALS['TSFE']->pSetup['CSS_inlineStyle']).chr(10);
515

Kasper Skårhøj's avatar
Kasper Skårhøj committed
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
		if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE'])	{
			$pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();
			$RTEclasses = $pageTSConfig['RTE.']['classes.'];
			if (is_array($RTEclasses))	{
				reset($RTEclasses);
				while(list($RTEclassName,$RTEvalueArray)=each($RTEclasses))	{
					if ($RTEvalueArray['value'])	{
						$style.='
.'.substr($RTEclassName,0,-1).' {'.$RTEvalueArray['value'].'}';
					}
				}
			}

			if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs'] && is_array($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.']))	{
				$mSOa_tList = t3lib_div::trimExplode(',',strtoupper($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs']),1);
				reset($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.']);
				while(list($mSOa_key,$mSOa_value)=each($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.']))	{
					if (!is_array($mSOa_value) && (in_array('*',$mSOa_tList)||in_array($mSOa_key,$mSOa_tList)))	{
						$style.='
'.$mSOa_key.' {'.$mSOa_value.'}';
					}
				}
			}
		}
540

Kasper Skårhøj's avatar
Kasper Skårhøj committed
541
542
543
544
			// Setting body tag margins in CSS:
		if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']) && $GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS'])	{
			$margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
			$style.='
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
545
	BODY {margin: '.$margins.'px '.$margins.'px '.$margins.'px '.$margins.'px;}';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
546
547
		}

Kasper Skårhøj's avatar
Kasper Skårhøj committed
548
549
		if ($GLOBALS['TSFE']->pSetup['noLinkUnderline'])	{
			$style.='
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
550
551
552
	A:link {text-decoration: none}
	A:visited {text-decoration: none}
	A:active {text-decoration: none}';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
553
554
555
		}
		if (trim($GLOBALS['TSFE']->pSetup['hover']))	{
			$style.='
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
556
	A:hover {color: '.trim($GLOBALS['TSFE']->pSetup['hover']).';}';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
557
558
559
		}
		if (trim($GLOBALS['TSFE']->pSetup['hoverStyle']))	{
			$style.='
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
560
	A:hover {'.trim($GLOBALS['TSFE']->pSetup['hoverStyle']).'}';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
561
562
563
		}
		if ($GLOBALS['TSFE']->pSetup['smallFormFields'])	{
			$style.='
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
564
565
566
	SELECT {  font-family: Verdana, Arial, Helvetica; font-size: 10px }
	TEXTAREA  {  font-family: Verdana, Arial, Helvetica; font-size: 10px}
	INPUT   {  font-family: Verdana, Arial, Helvetica; font-size: 10px }';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
567
		}
Kasper Skårhøj's avatar
Kasper Skårhøj committed
568
569
570
		if ($GLOBALS['TSFE']->pSetup['adminPanelStyles'])	{
			$style.='

Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
571
572
573
574
575
576
577
578
579
	/* Default styles for the Admin Panel */
	TABLE.typo3-adminPanel { border: 1px solid black; background-color: #F6F2E6; }
	TABLE.typo3-adminPanel TR.typo3-adminPanel-hRow TD { background-color: #9BA1A8; }
	TABLE.typo3-adminPanel TR.typo3-adminPanel-itemHRow TD { background-color: #ABBBB4; }
	TABLE.typo3-adminPanel TABLE, TABLE.typo3-adminPanel TD { border: 0px; }
	TABLE.typo3-adminPanel TD FONT { font-family: verdana; font-size: 10px; color: black; }
	TABLE.typo3-adminPanel TD A FONT { font-family: verdana; font-size: 10px; color: black; }
	TABLE.typo3-editPanel { border: 1px solid black; background-color: #F6F2E6; }
	TABLE.typo3-editPanel TD { border: 0px; }
Kasper Skårhøj's avatar
Kasper Skårhøj committed
580
581
			';
		}
582

Kasper Skårhøj's avatar
Kasper Skårhøj committed
583
		if (trim($style))	{
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
584
585
586
587
588
589
590
591
592
593
594
			if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile'])	{
				$GLOBALS['TSFE']->content.=TSpagegen::inline2TempFile($style, 'css');
			} else {
				$GLOBALS['TSFE']->content.='
	<style type="text/css">
		/*<![CDATA[*/
	<!--'.$style.'
	-->
		/*]]>*/
	</style>';
			}
Kasper Skårhøj's avatar
Kasper Skårhøj committed
595
		}
596

Kasper Skårhøj's avatar
Kasper Skårhøj committed
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614




		// Headerdata
		if (is_array($GLOBALS['TSFE']->pSetup['headerData.']))	{
			$GLOBALS['TSFE']->content.= chr(10).$GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['headerData.'],'headerData.');
		}

			// <title></title> :
		$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']
		);
		if ($GLOBALS['TSFE']->config['config']['titleTagFunction'])	{
			$titleTagContent = $GLOBALS['TSFE']->cObj->callUserFunction($GLOBALS['TSFE']->config['config']['titleTagFunction'], array(), $titleTagContent);
		}
615

Kasper Skårhøj's avatar
Kasper Skårhøj committed
616
		if (strlen($titleTagContent) && intval($GLOBALS['TSFE']->config['config']['noPageTitle'])!==2)	{
617
			$GLOBALS['TSFE']->content.='
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
618
	<title>'.htmlspecialchars($titleTagContent).'</title>';
619
		}
Kasper Skårhøj's avatar
Kasper Skårhøj committed
620
		$GLOBALS['TSFE']->content.='
621
	<meta name="generator" content="TYPO3 '.TYPO3_branch.' CMS" />';
622

Kasper Skårhøj's avatar
Kasper Skårhøj committed
623
624
625
626
627
628
629
630
631
632
633
634
635
636
		$conf=$GLOBALS['TSFE']->pSetup['meta.'];
		if (is_array($conf))	{
			reset($conf);
			while(list($theKey,$theValue)=each($conf))	{
				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
					if (strstr($theKey,'.'))	{
						$theKey = substr($theKey,0,-1);
					}
					$val = $GLOBALS['TSFE']->cObj->stdWrap($conf[$theKey],$conf[$theKey.'.']);
					$key = $theKey;
					if (trim($val))	{
						$a='name';
						if (strtolower($key)=='refresh')	{$a='http-equiv';}
						$GLOBALS['TSFE']->content.= '
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
637
	<meta '.$a.'="'.$key.'" content="'.htmlspecialchars(trim($val)).'" />';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
638
639
640
641
					}
				}
			}
		}
642

Kasper Skårhøj's avatar
Kasper Skårhøj committed
643
644
		unset($GLOBALS['TSFE']->additionalHeaderData['JSCode']);
		unset($GLOBALS['TSFE']->additionalHeaderData['JSImgCode']);
645

Kasper Skårhøj's avatar
Kasper Skårhøj committed
646
647
		if (is_array($GLOBALS['TSFE']->config['INTincScript']))	{
				// Storing the JSCode and JSImgCode vars...
648
			$GLOBALS['TSFE']->additionalHeaderData['JSCode'] = $GLOBALS['TSFE']->JSCode;
Kasper Skårhøj's avatar
Kasper Skårhøj committed
649
650
651
652
653
654
655
656
657
658
659
660
661
			$GLOBALS['TSFE']->additionalHeaderData['JSImgCode'] = $GLOBALS['TSFE']->JSImgCode;
			$GLOBALS['TSFE']->config['INTincScript_ext']['divKey']= $GLOBALS['TSFE']->uniqueHash();
			$GLOBALS['TSFE']->config['INTincScript_ext']['additionalHeaderData']	= $GLOBALS['TSFE']->additionalHeaderData;	// Storing the header-data array
			$GLOBALS['TSFE']->config['INTincScript_ext']['additionalJavaScript']	= $GLOBALS['TSFE']->additionalJavaScript;	// Storing the JS-data array
			$GLOBALS['TSFE']->config['INTincScript_ext']['additionalCSS']	= $GLOBALS['TSFE']->additionalCSS;	// Storing the Style-data array

			$GLOBALS['TSFE']->additionalHeaderData=array('<!--HD_'.$GLOBALS['TSFE']->config['INTincScript_ext']['divKey'].'-->');	// Clearing the array
			$GLOBALS['TSFE']->divSection.='<!--TDS_'.$GLOBALS['TSFE']->config['INTincScript_ext']['divKey'].'-->';
		} else {
			$GLOBALS['TSFE']->INTincScript_loadJSCode();
		}
		$JSef = TSpagegen::JSeventFunctions();

Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
662
663
664
665
666
667
668
669
670
671
672
			// Adding default Java Script:
		$_scriptCode = '
		browserName = navigator.appName;
		browserVer = parseInt(navigator.appVersion);
		var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);
		if ((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName=="Konqueror") {version = "n3";} else {version = "n2";}
			// Blurring links:
		function blurLink(theObject)	{	//
			if (msie4)	{theObject.blur();}
		}
		';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
673
		if (!$GLOBALS['TSFE']->config['config']['removeDefaultJS']) {
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
674
				// NOTICE: The following code must be kept synchronized with "tslib/default.js"!!!
Kasper Skårhøj's avatar
Kasper Skårhøj committed
675
			$GLOBALS['TSFE']->content.='
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
676
677
678
679
680
681
682
683
	<script type="text/javascript">
		/*<![CDATA[*/
	<!--'.$_scriptCode.'
	// -->
		/*]]>*/
	</script>';
		} elseif ($GLOBALS['TSFE']->config['config']['removeDefaultJS']==='external')	{
			$GLOBALS['TSFE']->content.=TSpagegen::inline2TempFile($_scriptCode, 'js');
Kasper Skårhøj's avatar
Kasper Skårhøj committed
684
685
		}

Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
686
		$GLOBALS['TSFE']->content.=chr(10).implode($GLOBALS['TSFE']->additionalHeaderData,chr(10)).'
Kasper Skårhøj's avatar
Kasper Skårhøj committed
687
688
689
690
691
692
693
'.$JSef[0].'
</head>';
		if ($GLOBALS['TSFE']->pSetup['frameSet.'])	{
			$fs = t3lib_div::makeInstance('tslib_frameset');
			$GLOBALS['TSFE']->content.=$fs->make($GLOBALS['TSFE']->pSetup['frameSet.']);
			$GLOBALS['TSFE']->content.= chr(10).'<noframes>'.chr(10);
		}
694

Kasper Skårhøj's avatar
Kasper Skårhøj committed
695
			// Bodytag:
Kasper Skårhøj's avatar
Kasper Skårhøj committed
696
		$defBT = $GLOBALS['TSFE']->pSetup['bodyTagCObject'] ? $GLOBALS['TSFE']->cObj->cObjGetSingle($GLOBALS['TSFE']->pSetup['bodyTagCObject'],$GLOBALS['TSFE']->pSetup['bodyTagCObject.'],'bodyTagCObject') : '';
Kasper Skårhøj's avatar
Kasper Skårhøj committed
697
		if (!$defBT)	$defBT = $GLOBALS['TSFE']->defaultBodyTag;
Kasper Skårhøj's avatar
Kasper Skårhøj committed
698
699
700
701
		$bodyTag = $GLOBALS['TSFE']->pSetup['bodyTag'] ? $GLOBALS['TSFE']->pSetup['bodyTag'] : $defBT;
		if ($bgImg=$GLOBALS['TSFE']->cObj->getImgResource($GLOBALS['TSFE']->pSetup['bgImg'],$GLOBALS['TSFE']->pSetup['bgImg.']))	{
			$bodyTag = ereg_replace('>$','',trim($bodyTag)).' background="'.$GLOBALS["TSFE"]->absRefPrefix.$bgImg[3].'">';
		}
702

Kasper Skårhøj's avatar
Kasper Skårhøj committed
703
		if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']))	{
Kasper Skårhøj's avatar
Kasper Skårhøj committed
704
705
706
707
708
709
			$margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);
			if ($GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS'])	{
				// Setting margins in CSS, see above
			} else {
				$bodyTag = ereg_replace('>$','',trim($bodyTag)).' leftmargin="'.$margins.'" topmargin="'.$margins.'" marginwidth="'.$margins.'" marginheight="'.$margins.'">';
			}
Kasper Skårhøj's avatar
Kasper Skårhøj committed
710
		}
711

Kasper Skårhøj's avatar
Kasper Skårhøj committed
712
713
714
		if (trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']))	{
			$bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim($GLOBALS['TSFE']->pSetup['bodyTagAdd']).'>';
		}
715

Kasper Skårhøj's avatar
Kasper Skårhøj committed
716
717
718
		if (count($JSef[1]))	{	// Event functions:
			$bodyTag = ereg_replace('>$','',trim($bodyTag)).' '.trim(implode(' ',$JSef[1])).'>';
		}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
719
		$GLOBALS['TSFE']->content.= chr(10).$bodyTag;
Kasper Skårhøj's avatar
Kasper Skårhøj committed
720

721
722

		// Div-sections
Kasper Skårhøj's avatar
Kasper Skårhøj committed
723
724
725
		if ($GLOBALS['TSFE']->divSection)	{
			$GLOBALS['TSFE']->content.=	chr(10).$GLOBALS['TSFE']->divSection;
		}
726

Kasper Skårhøj's avatar
Kasper Skårhøj committed
727
728
		// Page content
		$GLOBALS['TSFE']->content.=chr(10).$pageContent;
729

Kasper Skårhøj's avatar
Kasper Skårhøj committed
730
731
732
733
734
735
736
		// Ending page
		$GLOBALS['TSFE']->content.= chr(10).'</body>';
		if ($GLOBALS['TSFE']->pSetup['frameSet.'])	{
			$GLOBALS['TSFE']->content.= chr(10).'</noframes>';
		}
		$GLOBALS['TSFE']->content.=chr(10).'</html>';
	}
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776













	/*************************
	 *
	 * Helper functions
	 * Remember: Calls internally must still be done on the non-instantiated class: TSpagegen::inline2TempFile()
	 *
	 *************************/

	/**
	 * Writes string to a temporary file named after the md5-hash of the string
	 *
	 * @param	string		CSS styles / JavaScript to write to file.
	 * @param	string		Extension: "css" or "js"
	 * @return	string		<script> or <link> tag for the file.
	 */
	function inline2TempFile($str,$ext)	{

			// Create filename / tags:
		$script = '';
		switch($ext)	{
			case 'js':
				$script = 'typo3temp/javascript_'.substr(md5($str),0,10).'.js';
				$output = '
	<script type="text/javascript" src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$script).'"></script>';
			break;
			case 'css':
				$script = 'typo3temp/stylesheet_'.substr(md5($str),0,10).'.css';
				$output = '
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
777
	<link rel="stylesheet" type="text/css" href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$script).'" />';
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
778
779
780
781
782
783
784
785
786
787
788
789
			break;
		}

			// Write file:
		if ($script)	{
			if (!@is_file(PATH_site.$script))	{
				t3lib_div::writeFile(PATH_site.$script,$str);
			}
		}

		return $output;
	}
Kasper Skårhøj's avatar
Kasper Skårhøj committed
790
791
792
793
794
795
796
797
798
799
800
}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_pagegen.php'])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_pagegen.php']);
}



// ********************************************************
// Includes the search-class if $sword and $scols are set.
// ********************************************************
Kasper Skårhøj's avatar
Kasper Skårhøj committed
801
if (t3lib_div::_GP('sword') && t3lib_div::_GP('scols'))	{
Kasper Skårhøj's avatar
Kasper Skårhøj committed
802
803
804
805
806
807
808
	require_once(PATH_tslib.'class.tslib_search.php');
}

// ************
// LoadDBGroup
// ************
require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');
809
810
811

/**
 * Class for fetching record relations for the frontend.
812
 *
Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
813
 * @author	Kasper Skaarhoj <kasperYYYY@typo3.com>
814
815
816
817
 * @package TYPO3
 * @subpackage tslib
 * @see tslib_cObj::RECORDS()
 */
Kasper Skårhøj's avatar
Kasper Skårhøj committed
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
class FE_loadDBGroup extends t3lib_loadDBGroup	{
	var $fromTC = 0;		// Means the not only uid and label-field is returned, but everything
}

// **********************************
// includes stuff for graphical work
// **********************************
require_once(PATH_t3lib.'class.t3lib_stdgraphic.php');
require_once(PATH_tslib.'class.tslib_gifbuilder.php');

// *************************
// includes menu-management
// *************************
require_once(PATH_tslib.'class.tslib_menu.php');

// *************************
// Global content object...
// *************************
require_once(PATH_tslib.'class.tslib_content.php');

Kasper Skårhøj's avatar
   
Kasper Skårhøj committed
838
?>