Feature #19178 » 20080921_simulatestatic.patch

Administrator Admin, 2008-10-31 20:42

View differences:

t3lib/config_default.php (working copy)
224 224
		'addAllowedPaths' => '',				// Additional relative paths (comma-list) to allow TypoScript resources be in. Should be prepended with '/'. If not, then any path where the first part is like this path will match. That is: 'myfolder/ , myarchive' will match eg. 'myfolder/', 'myarchive/', 'myarchive_one/', 'myarchive_2/' ... No check is done to see if this directory actually exists in the root of the site. Paths are matched by simply checking if these strings equals the first part of any TypoScript resource filepath. (See class template, function init() in t3lib/class.t3lib_tsparser.php)
225 225
		'allowedTempPaths' => '',				// Additional paths allowed for temporary images. Used with imgResource. Eg. 'alttypo3temp/,another_temp_dir/';
226 226
		'debug' => 0,							// Boolean. If set, some debug HTML-comments may be output somewhere. Can also be set by TypoScript.
227
		'simulateStaticDocuments' => 0,			// Boolean. This is the default value for simulateStaticDocuments (configurable with TypoScript which overrides this, if the TypoScript value is present)
227
		'simulateStaticDocuments' => 0,			// Boolean. This is the default value for simulateStaticDocuments (configurable with TypoScript which overrides this, if the TypoScript value is present), since TYPO3 4.3 you also need to install the system extension "simulatestatic" to get this to work.
228 228
		'noPHPscriptInclude' => 0,				// Boolean. If set, PHP-scripts are not included by TypoScript configurations, unless they reside in 'media/scripts/'-folder. This is a security option to ensure that users with template-access do not terrorize
229 229
		'strictFormmail' => TRUE,				// Boolean. If set, the internal "formmail" feature in TYPO3 will send mail ONLY to recipients which has been encoded by the system itself. This protects against spammers misusing the formmailer.
230 230
		'secureFormmail' => TRUE,				// Boolean. If set, the internal "formmail" feature in TYPO3 will send mail ONLY to the recipients that are defined in the form CE record. This protects against spammers misusing the formmailer.
t3lib/class.t3lib_tstemplate.php (working copy)
1346 1346
	/**
1347 1347
	 * The mother of all functions creating links/URLs etc in a TypoScript environment.
1348 1348
	 * See the references below.
1349
	 * Basically this function takes care of issues such as type,id,alias and Mount Points, simulate static documents, M5/B6 encoded parameters etc.
1349
	 * Basically this function takes care of issues such as type,id,alias and Mount Points, URL rewriting (through hooks), M5/B6 encoded parameters etc.
1350 1350
	 * It is important to pass all links created through this function since this is the guarantee that globally configured settings for link creating are observed and that your applications will conform to the various/many configuration options in TypoScript Templates regarding this.
1351 1351
	 *
1352 1352
	 * @param	array		The page record of the page to which we are creating a link. Needed due to fields like uid, alias, target, no_cache, title and sectionIndex_uid.
......
1405 1405
		} else {
1406 1406
			$LD['type'] = '';
1407 1407
		}
1408
		$LD['orig_type'] = $LD['type'];		// Preserving the type number. Will not be cleared if simulateStaticDocuments.
1408
		$LD['orig_type'] = $LD['type'];		// Preserving the type number.
1409 1409

  
1410 1410
			// noCache
1411 1411
		$LD['no_cache'] = (trim($page['no_cache']) || $no_cache) ? '&no_cache=1' : '';
......
1421 1421
			$LD['linkVars'] = $GLOBALS['TSFE']->linkVars.$addParams;
1422 1422
		}
1423 1423

  
1424
			// If simulateStaticDocuments is enabled:
1425
		if ($GLOBALS['TSFE']->config['config']['simulateStaticDocuments'])	{
1426
			$LD['type'] = '';
1427
			$LD['url'] = '';
1428

  
1429
				// MD5/base64 method limitation:
1430
			$remainLinkVars='';
1431
			$flag_simulateStaticDocuments_pEnc = t3lib_div::inList('md5,base64',$GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc']) && !$LD['no_cache'];
1432
			if ($flag_simulateStaticDocuments_pEnc)	{
1433
				list($LD['linkVars'], $remainLinkVars) = $GLOBALS['TSFE']->simulateStaticDocuments_pEnc_onlyP_proc($LD['linkVars']);
1434
			}
1435

  
1436
			$LD['url'].=$GLOBALS['TSFE']->makeSimulFileName(
1437
							$page['title'],
1438
							$page['alias'] ? $page['alias'] : $page['uid'],
1439
							intval($typeNum),
1440
							$LD['linkVars'],
1441
							$LD['no_cache'] ? true : false
1442
						);
1443

  
1444
			if ($flag_simulateStaticDocuments_pEnc)	{
1445
				$LD['linkVars']=$remainLinkVars;
1446
			}
1447
			if ($GLOBALS['TSFE']->config['config']['simulateStaticDocuments']=='PATH_INFO')	{
1448
				$LD['url'] = str_replace('.','/',$LD['url']);
1449
				$LD['url'] = 'index.php/'.$LD['url'].'/?';
1450
			} else {
1451
				$LD['url'].= '.html?';
1452
			}
1453
		}
1454

  
1455 1424
			// Add absRefPrefix if exists.
1456 1425
		$LD['url'] = $GLOBALS['TSFE']->absRefPrefix.$LD['url'];
1457 1426

  
typo3/sysext/simulatestatic/class.tx_simulatestatic.php (revision 0)
1
<?php
2
/***************************************************************
3
*  Copyright notice
4
*
5
*  (c) 1999-2008 Kasper Skaarhoj <kasperYYYY@typo3.com>
6
*  (c) 2008 Benjamin Mack <benni . typo3 . o)rg>
7
*  All rights reserved
8
*
9
*  This script is part of the TYPO3 project. The TYPO3 project is
10
*  free software; you can redistribute it and/or modify
11
*  it under the terms of the GNU General Public License as published by
12
*  the Free Software Foundation; either version 2 of the License, or
13
*  (at your option) any later version.
14
*
15
*  The GNU General Public License can be found at
16
*  http://www.gnu.org/copyleft/gpl.html.
17
*  A copy is found in the textfile GPL.txt and important notices to the license
18
*  from the author is found in LICENSE.txt distributed with these scripts.
19
*
20
*
21
*  This script is distributed in the hope that it will be useful,
22
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
23
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
*  GNU General Public License for more details.
25
*
26
*  This copyright notice MUST APPEAR in all copies of the script!
27
***************************************************************/
28
/**
29
 * Class that does the simulatestatic feature (Speaking URLs)
30
 * Was extracted for TYPO3 4.3 from the core
31
 * 
32
 *
33
 * @author	Kasper Skaarhoj <kasperYYYY@typo3.com>
34
 * @author	Benjamin Mack <benni . typo3 . o)rg>
35
 */
36
class tx_simulatestatic {
37
	public $enabled = false;
38
	public $replacementChar = '';
39
	public $conf = array();
40
	public $pEncodingAllowedParamNames = array();
41

  
42
	/**
43
	 * Initializes the extension, sets some configuration options and does some basic checks
44
	 * 
45
	 * @param	array		holds all the information about the link that is about to be created
46
	 * @param	tslib_fe	is a reference to the parent object that calls the hook
47
	 * @return	void
48
	 */
49
	public function hookInitConfig(&$params, &$ref) {
50
		$TSconf = &$params['config'];
51

  
52
		// if .simulateStaticDocuments was not present, the installation-wide default value will be used
53
		if (!isset($TSconf['simulateStaticDocuments']))	{
54
			$TSconf['simulateStaticDocuments'] = trim($ref->TYPO3_CONF_VARS['FE']['simulateStaticDocuments']);
55
		}
56

  
57
		// simulateStatic was not activated
58
		if (!$TSconf['simulateStaticDocuments']) {
59
			return;
60
		}
61

  
62
		$this->enabled = true;
63

  
64
		// setting configuration options
65
		$this->conf = array(
66
			'mode' => $TSconf['simulateStaticDocuments'],
67
			'dontRedirectPathInfoError' => ($TSconf['simulateStaticDocuments_dontRedirectPathInfoError'] ? $TSconf['simulateStaticDocuments_dontRedirectPathInfoError'] : $TSconf['simulateStaticDocuments.']['dontRedirectPathInfoError']),
68
			'pEncoding' => ($TSconf['simulateStaticDocuments_pEnc'] ? $TSconf['simulateStaticDocuments_pEnc'] : $TSconf['simulateStaticDocuments.']['pEncoding']),
69
			'pEncodingOnlyP' => ($TSconf['simulateStaticDocuments_pEnc_onlyP'] ? $TSconf['simulateStaticDocuments_pEnc_onlyP'] : $TSconf['simulateStaticDocuments.']['pEncoding_onlyP']),
70
			'addTitle'  => ($TSconf['simulateStaticDocuments_addTitle'] ? $TSconf['simulateStaticDocuments_addTitle'] : $TSconf['simulateStaticDocuments.']['addTitle']),
71
			'noTypeIfNoTitle' => ($TSconf['simulateStaticDocuments_noTypeIfNoTitle'] ? $TSconf['simulateStaticDocuments_noTypeIfNoTitle'] : $TSconf['simulateStaticDocuments.']['noTypeIfNoTitle']),
72
			'replacementChar' => (t3lib_div::compat_version('4.0') ? '-' : '_')
73
		);
74

  
75
		if ($this->conf['pEncodingOnlyP']) {
76
			$tempParts = t3lib_div::trimExplode(',', $this->conf['pEncodingOnlyP'], 1);
77
			foreach ($tempParts as $tempPart) {
78
				$this->pEncodingAllowedParamNames[$tempPart] = 1;
79
			}
80
		}
81

  
82

  
83
	 	// Checks and sets replacement character for simulateStaticDocuments.
84
		$replacement = trim($TSconf['simulateStaticDocuments_replacementChar'] ? $TSconf['simulateStaticDocuments_replacementChar'] : $TSconf['simulateStaticDocuments.']['replacementChar']);
85
		if ($replacement && (urlencode($replacement) == $replacement)) {
86
			$this->conf['replacementChar'] = $replacement;
87
		}
88

  
89
		// Force absRefPrefix to this value is PATH_INFO is used.
90
		$absRefPrefix = $TSconf['absRefPrefix'];
91
		$absRefPrefix = trim($absRefPrefix);
92
		if ((!strcmp($mode['conf'], 'PATH_INFO') || $ref->absRefPrefix_force) && !$absRefPrefix) {
93
			$absRefPrefix = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')) . '/';
94
		}
95
		$ref->absRefPrefix = $absRefPrefix;
96
		$ref->config['config']['absRefPrefix'] = $absRefPrefix;
97

  
98

  
99
			// Check PATH_INFO url
100
		if ($ref->absRefPrefix_force && strcmp($this->conf['mode'], 'PATH_INFO')) {
101
			$redirectUrl = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR') . 'index.php?id=' . $ref->id . '&type='.$ref->type;
102
			if ($this->conf['dontRedirectPathInfoError']) {
103
				if ($ref->checkPageUnavailableHandler()) {
104
					$ref->pageUnavailableAndExit('PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!');
105
				} else {
106
					$message = 'PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!';
107
					header('HTTP/1.0 503 Service Temporarily Unavailable');
108
					t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
109
					$ref->printError($message.'<br /><br /><a href="'.htmlspecialchars($redirectUrl).'">Click here to get to the right page.</a>','Error: PATH_INFO not configured');
110
				}
111
			} else {
112
				header('Location: '.t3lib_div::locationHeaderUrl($redirectUrl));
113
			}
114
			exit;
115
			// Set no_cache if PATH_INFO is NOT used as simulateStaticDoc. 
116
			// and if absRefPrefix_force shows that such an URL has been passed along.
117
			// $this->set_no_cache();
118
		}
119
	}
120

  
121

  
122
	/**
123
	 * Hook for creating a speaking URL when using the generic linkData function
124
	 * 
125
	 * @param	array		holds all the information about the link that is about to be created
126
	 * @param	tslib_fe	is a reference to the parent object that calls the hook
127
	 * @return	void
128
	 */
129
	public function hookLinkDataPostProc(&$params, &$ref) {
130
		if (!$this->enabled) {
131
			return;
132
		}
133
		$LD = &$params['LD'];
134
		$page = &$params['args']['page'];
135
		$LD['type'] = '';
136

  
137
		// MD5/base64 method limitation
138
		$remainLinkVars = '';
139
		$flag_pEncoding = (t3lib_div::inList('md5,base64', $this->conf['pEncoding']) && !$LD['no_cache']);
140
		if ($flag_pEncoding) {
141
			list($LD['linkVars'], $remainLinkVars) = $this->processEncodedQueryString($LD['linkVars']);
142
		}
143

  
144
		$url = $this->makeSimulatedFileName($page['title'], ($page['alias'] ? $page['alias'] : $page['uid']), intval($params['typeNum']), $LD['linkVars'], ($LD['no_cache'] ? true : false));
145
		if ($this->conf['mode'] == 'PATH_INFO') {
146
			$url = 'index.php/' . str_replace('.', '/', $url) . '/';
147
		} else {
148
			$url .= '.html';
149
		}
150
		$LD['url'] = $GLOBALS['TSFE']->absRefPrefix . $url . '?';
151

  
152
		if ($flag_pEncoding) {
153
			$LD['linkVars'] = $remainLinkVars;
154
		}
155

  
156
		// If the special key 'sectionIndex_uid' (added 'manually' in tslib/menu.php to the page-record) is set,
157
		// then the link jumps directly to a section on the page.
158
		$LD['sectionIndex'] = ($page['sectionIndex_uid'] ? '#c'.$page['sectionIndex_uid'] : '');
159

  
160
			// Compile the normal total url
161
		$LD['totalURL'] = $ref->removeQueryString($LD['url'] . $LD['type'] . $LD['no_cache'] . $LD['linkVars'] . $GLOBALS['TSFE']->getMethodUrlIdToken) . $LD['sectionIndex'];
162
	}
163

  
164

  
165
	/**
166
	 * Hook for checking to see if the URL is a speaking URL
167
	 * 
168
	 * Here a .htaccess file maps all .html-files to index.php and
169
	 *  then we extract the id and type from the name of that HTML-file. (AKA "simulateStaticDocuments")
170
	 * Support for RewriteRule to generate   (simulateStaticDocuments)
171
	 * With the mod_rewrite compiled into apache, put these lines into a .htaccess in this directory:
172
	 * RewriteEngine On
173
	 * RewriteRule   ^[^/]*\.html$  index.php
174
	 * The url must end with '.html' and the format must comply with either of these:
175
	 * 1:      '[title].[id].[type].html'  - title is just for easy recognition in the
176
	 *                                       logfile!; no practical use of the title for TYPO3.
177
	 * 2:      '[id].[type].html'          - above, but title is omitted; no practical use of
178
	 *                                       the title for TYPO3.
179
	 * 3:      '[id].html'                 - only id, type is set to the default, zero!
180
	 * NOTE: In all case 'id' may be the uid-number OR the page alias (if any)
181
	 * 
182
	 * @param	array		includes a reference to the parent Object (which is the global TSFE)
183
	 * @param	tslib_fe	is a reference to the global TSFE
184
	 * @return	void
185
	 */
186
	public function hookCheckAlternativeIDMethods(&$params, &$ref) {
187
		// If there has been a redirect (basically; we arrived here otherwise
188
		// than via "index.php" in the URL)
189
		// this can happend either due to a CGI-script or because of reWrite rule.
190
		// Earlier we used $_SERVER['REDIRECT_URL'] to check
191
		if ($ref->siteScript && substr($ref->siteScript, 0, 9) != 'index.php') {
192
			$uParts = parse_url($ref->siteScript);
193
			$fI = t3lib_div::split_fileref($uParts['path']);
194

  
195
			if (!$fI['path'] && $fI['file'] && substr($fI['file'], -5) == '.html') {
196
				$parts = explode('.', $fI['file']);
197
				$pCount = count($parts);
198
				if ($pCount > 2) {
199
					$ref->type = intval($parts[$pCount-2]);
200
					$ref->id = $parts[$pCount-3];
201
				} else {
202
					$ref->type = 0;
203
					$ref->id = $parts[0];
204
				}
205
			}
206
		}
207
	}
208

  
209

  
210
	/**
211
	 * => Not yet used, could be ported from tslib_fe as well
212
	 * Analyzes the second part of a id-string (after the "+"), looking for B6 or M5 encoding
213
	 *  and if found it will resolve it and restore the variables in global $_GET. 
214
	 * If values for ->cHash, ->no_cache, ->jumpurl and ->MP is found,
215
	 * they are also loaded into the internal vars of this class.
216
	 *
217
	 * @param	string		String to analyze
218
	 * @return	void
219
	 * @access protected
220
	 */
221
	protected function idPartsAnalyze($str) {
222
		$getVars = '';
223
		switch (substr($str, 0, 2)) {
224
			case 'B6':
225
				$addParams = base64_decode(str_replace('_', '=', str_replace('-', '/', substr($str, 2))));
226
				parse_str($addParams, $getVars);
227
			break;
228
			case 'M5':
229
				$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('params', 'cache_md5params', 'md5hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr(substr($str, 2), 'cache_md5params'));
230
				$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
231

  
232
				$GLOBALS['TSFE']->updateMD5paramsRecord(substr($str, 2));
233
				parse_str($row['params'], $getVars);
234
			break;
235
		}
236
		$GLOBALS['TSFE']->mergingWithGetVars($getVars);
237
	}
238

  
239

  
240

  
241

  
242
	/********************************************
243
	 *
244
	 * Various internal API functions
245
	 *
246
	 *******************************************/
247

  
248
	/**
249
	 * This is just a wrapper function to use the params from the array split up. Can be deleted once the function in class.t3lib_fe.php is deleted
250
	 * @deprecated: Will be deleted in TYPO3 4.5
251
	 * @see makeSimulatedFileName()
252
	 */
253
	public function makeSimulatedFileNameCompat(&$params, &$ref) {
254
		return $this->makeSimulatedFileName($params['inTitle'], $params['page'], $params['type'], $params['addParams'], $params['no_cache']);
255
	}
256

  
257

  
258
	/**
259
	 * Make simulation filename (without the ".html" ending, only body of filename)
260
	 *
261
	 * @param	string		The page title to use
262
	 * @param	mixed		The page id (integer) or alias (string)
263
	 * @param	integer		The type number
264
	 * @param	string		Query-parameters to encode (will be done only if caching is enabled and TypoScript configured for it. I don't know it this makes much sense in fact...)
265
	 * @param	boolean		The "no_cache" status of the link.
266
	 * @return	string		The body of the filename.
267
	 * @see getSimulFileName(), t3lib_tstemplate::linkData(), tslib_frameset::frameParams()
268
	 */
269
	public function makeSimulatedFileName($inTitle, $page, $type, $addParams = '', $no_cache = false) {
270

  
271
			// Default value is 30 but values > 1 will be override this
272
		$titleChars = intval($this->conf['addTitle']);
273
		if ($titleChars == 1) {
274
			$titleChars = 30;
275
		}
276

  
277
		$out = ($titleChars ? $this->fileNameASCIIPrefix($inTitle, $titleChars) : '');
278
		$enc = '';
279

  
280
		if (strcmp($addParams, '') && !$no_cache) {
281
			switch ((string)$this->conf['pEncoding']) {
282
				case 'md5':
283
					$md5 = substr(md5($addParams), 0, 10);
284
					$enc = '+M5'.$md5;
285

  
286
					$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('md5hash', 'cache_md5params', 'md5hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($md5, 'cache_md5params'));
287
					if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
288
						$insertFields = array(
289
							'md5hash' => $md5,
290
							'tstamp'  => time(),
291
							'type'    => 1,
292
							'params'  => $addParams
293
						);
294

  
295
						$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_md5params', $insertFields);
296
					}
297
				break;
298
				case 'base64':
299
					$enc = '+B6' . str_replace('=', '_', str_replace('/', '-', base64_encode($addParams)));
300
				break;
301
			}
302
		}
303
			// Setting page and type number:
304
		return $out . $page . $enc . (($type || $out || !$this->conf['noTypeIfNoTitle']) ? '.' . $type : '');
305
	}
306

  
307

  
308
	/**
309
	 * Returns the simulated static file name (*.html) for the current page (using the page record in $this->page)
310
	 *
311
	 * @return	string		The filename (without path)
312
	 * @see makeSimulatedFileName(), publish.php
313
	 */
314
	public function getSimulatedFileName()	{
315
		return $this->makeSimulatedFileName(
316
			 $GLOBALS['TSFE']->page['title'],
317
			($GLOBALS['TSFE']->page['alias'] ? $GLOBALS['TSFE']->page['alias'] : $GLOBALS['TSFE']->id),
318
			 $GLOBALS['TSFE']->type
319
		).'.html';
320
	}
321

  
322

  
323
	/**
324
	 * Processes a query-string with GET-parameters and returns two strings, one with the parameters that CAN be encoded and one array with those which can't be encoded (encoded by the M5 or B6 methods)
325
	 *
326
	 * @param	string		Query string to analyse
327
	 * @return	array		Two num keys returned, first is the parameters that MAY be encoded, second is the non-encodable parameters.
328
	 * @see makeSimulatedFileName(), t3lib_tstemplate::linkData()
329
	 */
330
	public function processEncodedQueryString($linkVars) {
331
		$remainingLinkVars = '';
332
		if (strcmp($linkVars, '')) {
333
			$p = explode('&', $linkVars);
334
			// This sorts the parameters - and may not be needed and further 
335
			// it will generate new MD5 hashes in many cases. Maybe not so smart. Hmm?
336
			sort($p);	
337
			$rem = array();
338
			foreach ($p as $k => $v) {
339
				if (strlen($v)) {
340
					list($pName) = explode('=', $v, 2);
341
					$pName = rawurldecode($pName);
342
					if (!$this->pEncodingAllowedParamNames[$pName]) {
343
						unset($p[$k]);
344
						$rem[] = $v;
345
					}
346
				} else {
347
					unset($p[$k]);
348
				}
349
			}
350
			$linkVars = (count($p) ? '&' . implode('&', $p) : '');
351
			$remainingLinkVars = (count($rem) ? '&' . implode('&', $rem) : '');
352
		}
353
		return array($linkVars, $remainingLinkVars);
354
	}
355

  
356

  
357
	/**
358
	 * Converts input string to an ASCII based file name prefix
359
	 *
360
	 * @param	string		String to base output on
361
	 * @param	integer		Number of characters in the string
362
	 * @param	string		Character to put in the end of string to merge it with the next value.
363
	 * @return	string		String
364
	 */
365
	public function fileNameASCIIPrefix($inTitle, $maxTitleChars, $mergeChar = '.') {
366
		$out = $GLOBALS['TSFE']->csConvObj->specCharsToASCII($GLOBALS['TSFE']->renderCharset, $inTitle);
367

  
368
		// Get replacement character
369
		$replacementChar = $this->conf['replacementChar'];
370
		$replacementChars = '_\-' . ($replacementChar != '_' && $replacementChar != '-' ? $replacementChar : '');
371
		$out = preg_replace('/[^A-Za-z0-9_-]/', $replacementChar, trim(substr($out, 0, $maxTitleChars)));
372
		$out = preg_replace('/([' . $replacementChars . ']){2,}/', '\1', $out);
373
		$out = preg_replace('/['  . $replacementChars . ']?$/', '', $out);
374
		$out = preg_replace('/^[' . $replacementChars . ']?/', '', $out);
375

  
376
		return (strlen($out) ? $out . $mergeChar : '');
377
	}
378
}
379

  
380
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/simulatestatic/class.tx_simulatestatic.php']) {
381
	include_once($TYPO3_CONF_VARS][TYPO3_MODE]['XCLASS']['ext/simulatestatic/class.tx_simulatestatic.php']);
382
}
383
?>
typo3/sysext/simulatestatic/ext_localconf.php (revision 0)
1
<?php
2

  
3
if (!defined('TYPO3_MODE')) 	die('Access denied.');
4

  
5

  
6
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['configArrayPostProc']['simulateStatic'] = 'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->hookInitConfig';
7
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc']['simulateStatic'] = 'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->hookLinkDataPostProc';
8
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['checkAlternativeIdMethods-PostProc']['simulateStatic'] = 'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->hookCheckAlternativeIDMethods';
9

  
10
?>
typo3/sysext/simulatestatic/ext_emconf.php (revision 0)
1
<?php
2

  
3
########################################################################
4
# Extension Manager/Repository config file for ext: "simulatestatic"
5
#
6
# Auto generated 23-04-2008 10:59
7
#
8
# Manual updates:
9
# Only the data in the array - anything else is removed by next write.
10
# "version" and "dependencies" must not be touched!
11
########################################################################
12

  
13
$EM_CONF[$_EXTKEY] = array(
14
	'title' => 'Simulate Static URLs',
15
	'description' => 'Adds the possibility to have Speaking URLs in the TYPO3 Frontend pages.',
16
	'category' => 'fe',
17
	'shy' => 0,
18
	'dependencies' => '',
19
	'conflicts' => '',
20
	'priority' => '',
21
	'loadOrder' => '',
22
	'module' => '',
23
	'state' => 'stable',
24
	'internal' => 0,
25
	'uploadfolder' => 0,
26
	'createDirs' => '',
27
	'modify_tables' => '',
28
	'clearCacheOnLoad' => 1,
29
	'lockType' => '',
30
	'author' => 'Benjamin Mack',
31
	'author_email' => 'benni@typo3.org',
32
	'author_company' => '',
33
	'CGLcompliance' => '',
34
	'CGLcompliance_note' => '',
35
	'version' => '1.0.0',
36
	'_md5_values_when_last_written' => 'a:13:{s:21:"class.tx_simulatestatic.php";s:4:"8e87";s:21:"ext_conf_template.txt";s:4:"967e";s:12:"ext_icon.gif";s:4:"fdf4";s:14:"ext_tables.php";s:4:"f56d";s:22:"locallang_simulatestatic.xml";s:4:"0326";s:12:"simulatestatic.css";s:4:"1e57";s:11:"simulatestatic.js";s:4:"787b";s:12:"simulatestatic.png";s:4:"917a";s:23:"registerToolbarItem.php";s:4:"439c";s:26:"toolbar_item_active_bg.png";s:4:"c036";s:12:"mod/conf.php";s:4:"a8fe";s:16:"mod/document.gif";s:4:"fdf4";s:21:"mod/locallang_mod.xml";s:4:"7240";}',
37
	'constraints' => array(
38
		'depends' => array(
39
			'php' => '5.1.0-0.0.0',
40
			'typo3' => '4.3.0-4.3.99',
41
		),
42
		'conflicts' => array(
43
		),
44
		'suggests' => array(
45
		),
46
	),
47
	'suggests' => array(
48
	),
49
);
50

  
51
?>
typo3/sysext/cms/tslib/class.tslib_fe.php (working copy)
354 354
	var $uniqueString='';
355 355
	var $indexedDocTitle='';			// This value will be used as the title for the page in the indexer (if indexing happens)
356 356
	var $altPageTitle='';				// Alternative page title (normally the title of the page record). Can be set from applications you make.
357
	var $pEncAllowedParamNames=array();	// An array that holds parameter names (keys) of GET parameters which MAY be MD5/base64 encoded with simulate_static_documents method.
357
	var $pEncAllowedParamNames=array();	// An array that holds parameter names (keys) of GET parameters which MAY be MD5/base64 encoded with simulate_static_documents method. @deprecated since TYPO3 4.3, remove in TYPO3 4.5
358 358
	var $baseUrl='';					// The base URL set for the page header.
359 359
	var $anchorPrefix='';				// The proper anchor prefix needed when using speaking urls. (only set if baseUrl is set)
360 360

  
......
669 669
	/**
670 670
	 * Provides ways to bypass the '?id=[xxx]&type=[xx]' format, using either PATH_INFO or virtual HTML-documents (using Apache mod_rewrite)
671 671
	 *
672
	 * Three options:
673
	 * 1) Apache mod_rewrite: Here a .htaccess file maps all .html-files to index.php and then we extract the id and type from the name of that HTML-file. (AKA "simulateStaticDocuments")
674
	 * 2) Use PATH_INFO (also Apache) to extract id and type from that var. Does not require any special modules compiled with apache. (less typical)
675
	 * 3) Using hook which enables features like those provided from "realurl" extension (AKA "Speaking URLs")
672
	 * Two options:
673
	 * 1) Use PATH_INFO (also Apache) to extract id and type from that var. Does not require any special modules compiled with apache. (less typical)
674
	 * 2) Using hook which enables features like those provided from "simulatestatic" or "realurl" extension (AKA "Speaking URLs")
676 675
	 *
677
	 * Support for RewriteRule to generate   (simulateStaticDocuments)
678
	 * With the mod_rewrite compiled into apache, put these lines into a .htaccess in this directory:
679
	 * RewriteEngine On
680
	 * RewriteRule   ^[^/]*\.html$  index.php
681
	 * The url must end with '.html' and the format must comply with either of these:
682
	 * 1:      '[title].[id].[type].html'			- title is just for easy recognition in the logfile!; no practical use of the title for TYPO3.
683
	 * 2:      '[id].[type].html'					- above, but title is omitted; no practical use of the title for TYPO3.
684
	 * 3:      '[id].html'							- only id, type is set to the default, zero!
685
	 * NOTE: In all case 'id' may be the uid-number OR the page alias (if any)
686
	 *
687 676
	 * @return	void
688 677
	 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&cHash=4ad9d7acb4
689 678
	 */
690 679
	function checkAlternativeIdMethods()	{
691

  
692 680
		$this->siteScript = t3lib_div::getIndpEnv('TYPO3_SITE_SCRIPT');
693 681

  
694
			// Resolving of "simulateStaticDocuments" URLs:
695
		if ($this->siteScript && substr($this->siteScript,0,9)!='index.php')	{		// If there has been a redirect (basically; we arrived here otherwise than via "index.php" in the URL) this can happend either due to a CGI-script or because of reWrite rule. Earlier we used $_SERVER['REDIRECT_URL'] to check but
696
			$uParts = parse_url($this->siteScript);	// Parse the path:
697
			$fI = t3lib_div::split_fileref($uParts['path']);
698

  
699
			if (!$fI['path'] && $fI['file'] && substr($fI['file'],-5)=='.html')	{
700
				$parts = explode('.',$fI['file']);
701
				$pCount = count($parts);
702
				if ($pCount>2)	{
703
					$this->type = intval($parts[$pCount-2]);
704
					$this->id = $parts[$pCount-3];
705
				} else {
706
					$this->type = 0;
707
					$this->id = $parts[0];
708
				}
709
			}
710
		}
711

  
712 682
			// If PATH_INFO
713 683
		if (t3lib_div::getIndpEnv('PATH_INFO'))	{		// If pathinfo contains stuff...
714 684
			$parts=t3lib_div::trimExplode('/',t3lib_div::getIndpEnv('PATH_INFO'),1);
......
1581 1551
	 * @param	string		String to analyze
1582 1552
	 * @return	void
1583 1553
	 * @access private
1554
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
1584 1555
	 */
1585 1556
	function idPartsAnalyze($str)	{
1586 1557
		$GET_VARS = '';
......
2033 2004
						$this->config['config'] = t3lib_div::array_merge_recursive_overrule($this->config['config'], $this->pSetup['config.']);
2034 2005
					}
2035 2006

  
2036
						// if .simulateStaticDocuments was not present, the default value will rule.
2037
					if (!isset($this->config['config']['simulateStaticDocuments']))	{
2038
						$this->config['config']['simulateStaticDocuments'] = trim($this->TYPO3_CONF_VARS['FE']['simulateStaticDocuments']);
2039
					}
2040
					if ($this->config['config']['simulateStaticDocuments']) {
2041
							// Set replacement char only if it is needed
2042
						$this->setSimulReplacementChar();
2043
					}
2044

  
2045 2007
					if ($this->config['config']['typolinkEnableLinksAcrossDomains']) {
2046 2008
						$this->config['config']['typolinkCheckRootline'] = true;
2047 2009
					}
......
2094 2056
			// No cache
2095 2057
		if ($this->config['config']['no_cache'])	{ $this->set_no_cache(); }		// Set $this->no_cache true if the config.no_cache value is set!
2096 2058

  
2097
			// Check PATH_INFO url
2098
		if ($this->absRefPrefix_force && strcmp($this->config['config']['simulateStaticDocuments'],'PATH_INFO'))	{
2099
			$redirectUrl = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR').'index.php?id='.$this->id.'&type='.$this->type;
2100
			if ($this->config['config']['simulateStaticDocuments_dontRedirectPathInfoError'])	{
2101
				if ($this->checkPageUnavailableHandler())	{
2102
					$this->pageUnavailableAndExit('PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!');
2103
				} else {
2104
					$message = 'PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!';
2105
					header('HTTP/1.0 503 Service Temporarily Unavailable');
2106
					t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
2107
					$this->printError($message.'<br /><br /><a href="'.htmlspecialchars($redirectUrl).'">Click here to get to the right page.</a>','Error: PATH_INFO not configured');
2108
				}
2109
			} else {
2110
				header('Location: '.t3lib_div::locationHeaderUrl($redirectUrl));
2059

  
2060
			// Hook for postProcessing the configuration array
2061
		if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['configArrayPostProc'])) {
2062
			$params = array('config' => &$this->config['config']);
2063
			foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['configArrayPostProc'] as $funcRef) {
2064
				t3lib_div::callUserFunction($funcRef, $params, $this);
2111 2065
			}
2112
			exit;
2113
//			$this->set_no_cache();	// Set no_cache if PATH_INFO is NOT used as simulateStaticDoc. and if absRefPrefix_force shows that such an URL has been passed along.
2114 2066
		}
2115 2067
	}
2116 2068

  
......
3777 3729
	 * @param	string		Query-parameters to encode (will be done only if caching is enabled and TypoScript configured for it. I don't know it this makes much sense in fact...)
3778 3730
	 * @param	boolean		The "no_cache" status of the link.
3779 3731
	 * @return	string		The body of the filename.
3780
	 * @see getSimulFileName(), t3lib_tstemplate::linkData(), tslib_frameset::frameParams()
3732
	 * @see getSimulFileName(), t3lib_tstemplate::linkData(), tslib_frameset::frameParams(), tx_
3733
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3781 3734
	 */
3782
	function makeSimulFileName($inTitle,$page,$type,$addParams='',$no_cache=false)	{
3783
		$titleChars = intval($this->config['config']['simulateStaticDocuments_addTitle']);
3784
			// Default value is 30 but values > 1 will be override this
3785
		if($titleChars==1)	{ $titleChars = 30; }
3786

  
3787
		$out = '';
3788
		if ($titleChars)	{
3789
			$out = $this->fileNameASCIIPrefix($inTitle, $titleChars);
3735
	function makeSimulFileName($inTitle, $page, $type, $addParams = '', $no_cache = false) {
3736
		if (t3lib_extMgm::isLoaded('simulatestatic')) {
3737
			return t3lib_div::callUserFunc(
3738
				'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->makeSimulatedFileNameCompat',
3739
				array(
3740
					'inTitle' => $inTitle,
3741
					'page' => $page,
3742
					'type' => $type,
3743
					'addParams' => $addParams,
3744
					'no_cache' => $no_cache
3745
				), $this);
3746
		} else {
3747
			return false;
3790 3748
		}
3791
		$enc = '';
3792

  
3793
		if (strcmp($addParams,'') && !$no_cache)	{
3794
			switch ((string)$this->config['config']['simulateStaticDocuments_pEnc'])	{
3795
				case 'md5':
3796
					$md5 = substr(md5($addParams),0,10);
3797
					$enc = '+M5'.$md5;
3798

  
3799
					$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('md5hash', 'cache_md5params', 'md5hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($md5, 'cache_md5params'));
3800
					if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res))	{
3801
						$insertFields = array(
3802
							'md5hash' => $md5,
3803
							'tstamp' => time(),
3804
							'type' => 1,
3805
							'params' => $addParams
3806
						);
3807

  
3808
						$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_md5params', $insertFields);
3809
					}
3810
				break;
3811
				case 'base64':
3812
					$enc = '+B6'.str_replace('=','_',str_replace('/','-',base64_encode($addParams)));
3813
				break;
3814
			}
3815
		}
3816
			// Setting page and type number:
3817
		$url = $out.$page.$enc;
3818
		$url.= ($type || $out || !$this->config['config']['simulateStaticDocuments_noTypeIfNoTitle']) ? '.'.$type : '';
3819
		return $url;
3820 3749
	}
3821 3750

  
3822 3751
	/**
......
3825 3754
	 * @param	string		Query string to analyse
3826 3755
	 * @return	array		Two num keys returned, first is the parameters that MAY be encoded, second is the non-encodable parameters.
3827 3756
	 * @see makeSimulFileName(), t3lib_tstemplate::linkData()
3757
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3828 3758
	 */
3829 3759
	function simulateStaticDocuments_pEnc_onlyP_proc($linkVars)	{
3830
		$remainLinkVars = '';
3831
		if (strcmp($linkVars,''))	{
3832
			$p = explode('&',$linkVars);
3833
			sort($p);	// This sorts the parameters - and may not be needed and further it will generate new MD5 hashes in many cases. Maybe not so smart. Hmm?
3834
			$rem = array();
3835
			foreach($p as $k => $v)	{
3836
				if (strlen($v))	{
3837
					list($pName) = explode('=',$v,2);
3838
					$pName = rawurldecode($pName);
3839
					if (!$this->pEncAllowedParamNames[$pName])	{
3840
						unset($p[$k]);
3841
						$rem[] = $v;
3842
					}
3843
				} else unset($p[$k]);
3844
			}
3845

  
3846
			$linkVars = count($p) ? '&'.implode('&',$p) : '';
3847
			$remainLinkVars = count($rem) ? '&'.implode('&',$rem) : '';
3760
		if (t3lib_extMgm::isLoaded('simulatestatic')) {
3761
			return t3lib_div::callUserFunc(
3762
				'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->processEncodedQueryString',
3763
				$linkVars, $this);
3764
		} else {
3765
			return false;
3848 3766
		}
3849
		return array($linkVars, $remainLinkVars);
3850 3767
	}
3851 3768

  
3852 3769
	/**
......
3854 3771
	 *
3855 3772
	 * @return	string		The filename (without path)
3856 3773
	 * @see makeSimulFileName(), publish.php
3774
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3857 3775
	 */
3858 3776
	function getSimulFileName()	{
3859
		$url = '';
3860
		$url.= $this->makeSimulFileName($this->page['title'], $this->page['alias']?$this->page['alias']:$this->id, $this->type).'.html';
3861
		return $url;
3777
		return $this->makeSimulFileName($this->page['title'], $this->page['alias']?$this->page['alias']:$this->id, $this->type).'.html';
3862 3778
	}
3863 3779

  
3864 3780
	/**
3865 3781
	 * Checks and sets replacement character for simulateStaticDocuments. Default is underscore.
3866 3782
	 *
3867 3783
	 * @return	void
3784
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3868 3785
	 */
3869 3786
	function setSimulReplacementChar() {
3870 3787
		$replacement = $defChar = t3lib_div::compat_version('4.0') ? '-' : '_';
......
3885 3802
	 * @param	integer		Number of characters in the string
3886 3803
	 * @param	string		Character to put in the end of string to merge it with the next value.
3887 3804
	 * @return	string		String
3805
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3888 3806
	 */
3889 3807
	function fileNameASCIIPrefix($inTitle,$titleChars,$mergeChar='.')	{
3890 3808
		$out = $this->csConvObj->specCharsToASCII($this->renderCharset, $inTitle);
typo3/sysext/cms/tslib/class.tslib_pagegen.php (working copy)
112 112
				}
113 113
			}
114 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 115

  
122

  
123 116
			// Global vars...
124 117
		$GLOBALS['TSFE']->indexedDocTitle = $GLOBALS['TSFE']->page['title'];
125 118
		$GLOBALS['TSFE']->debug = ''.$GLOBALS['TSFE']->config['config']['debug'];
......
152 145
			$GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-10,10,0);
153 146
		}
154 147

  
148
		$GLOBALS['TSFE']->absRefPrefix = ($GLOBALS['TSFE']->config['config']['absRefPrefix'] ? trim($GLOBALS['TSFE']->config['config']['absRefPrefix']) : '');
155 149

  
156
		$GLOBALS['TSFE']->absRefPrefix = trim(''.$GLOBALS['TSFE']->config['config']['absRefPrefix']);
157
		if ((!strcmp($GLOBALS['TSFE']->config['config']['simulateStaticDocuments'],'PATH_INFO') || $GLOBALS['TSFE']->absRefPrefix_force)
158
				&& !$GLOBALS['TSFE']->absRefPrefix)	{
159
			$GLOBALS['TSFE']->absRefPrefix=t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/';
160
		}		// Force absRefPrefix to this value is PATH_INFO is used.
161

  
162 150
		if ($GLOBALS['TSFE']->type && $GLOBALS['TSFE']->config['config']['frameReloadIfNotInFrameset'])	{
163 151
			$tdlLD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,'_top',$GLOBALS['TSFE']->no_cache,'');
164 152
			$GLOBALS['TSFE']->JSCode = 'if(!parent.'.trim($GLOBALS['TSFE']->sPre).' && !parent.view_frame) top.location.href="'.$GLOBALS['TSFE']->baseUrlWrap($tdlLD['totalURL']).'"';
typo3/sysext/install/mod/class.tx_install.php (working copy)
155 155
require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_compatversion.php');
156 156
require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_notinmenu.php');
157 157
require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_mergeadvanced.php');
158
require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_installsysexts.php');
158 159

  
159 160

  
160 161
/**
typo3/sysext/install/updates/class.tx_coreupdates_installsysexts.php (revision 0)
1
<?php
2
/***************************************************************
3
*  Copyright notice
4
*
5
*  (c) 2008 Benjamin Mack <benni@typo3.org>
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
/**
29
 * Contains the update class for adding the system extension "simulate static".
30
 * 
31
 * @author Benjamin Mack <benni@typo3.org>
32
 */
33
class tx_coreupdates_installsysexts {
34
	var $versionNumber;	// version number coming from t3lib_div::int_from_ver()
35

  
36
	/**
37
	 * parent object
38
	 *
39
	 * @var tx_install
40
	 */
41
	var $pObj;
42
	var $userInput;	// user input
43

  
44

  
45
	/**
46
	 * Checks if an update is needed
47
	 *
48
	 * @param	string		&$description: The description for the update
49
	 * @return	boolean		whether an update is needed (true) or not (false)
50
	 */
51
	public function checkForUpdate(&$description) {
52
		$result = false;
53
		$description = 'Installs the System Extension "simulatestatic" if you do not want to use RealURL or CoolURI but still want the Speaking URL feature. This feature was moved from the core to an extension and can be installed if used. If you used "config.simulatestaticdocuments = 1" in this installation before, you should install this system extension. Be sure to read the manual of "simulatestatic".';
54

  
55
		if (!t3lib_extMgm::isLoaded('simulatestatic')) {
56
			$result = true;
57
		}
58
		return $result;
59
	}
60

  
61

  
62
	/**
63
	 * Adds the extension "simulate static" to the extList in TYPO3_CONF_VARS
64
	 *
65
	 * @param	array		&$dbQueries: queries done in this update
66
	 * @param	mixed		&$customMessages: custom messages
67
	 * @return	boolean		whether it worked (true) or not (false)
68
	 */
69
	public function performUpdate(&$dbQueries, &$customMessages) {
70
		$result = false;
71
		$extList = $this->addExtToList('simulatestatic');
72
		if ($extList) {
73
			$this->writeNewExtensionList($extList);
74
			$result = true;
75
		}
76
		return $result;
77
	}
78

  
79

  
80
	/**
81
	 * Adds extension to extension list and returns new list. If -1 is returned, an error happend.
82
	 * Does NOT check dependencies yet.
83
	 *
84
	 * @param	string		Extension key
85
	 * @return	string		New list of installed extensions or -1 if error
86
	 */
87
	function addExtToList($extKey) {
88

  
89
			// Get list of installed extensions and add this one.
90
		$listArr = array_keys($GLOBALS['TYPO3_LOADED_EXT']);
91
		$listArr[] = $extKey;
92

  
93
			// Implode unique list of extensions to load and return:
94
		return implode(',', array_unique($listArr));
95
	}
96

  
97

  
98
	/**
99
	 * Writes the extension list to "localconf.php" file
100
	 * Removes the temp_CACHED* files before return.
101
	 *
102
	 * @param	string		List of extensions
103
	 * @return	void
104
	 */
105
	protected function writeNewExtensionList($newExtList)	{
106

  
107
		// Instance of install tool
108
		$instObj = new t3lib_install;
109
		$instObj->allowUpdateLocalConf = 1;
110
		$instObj->updateIdentity = 'TYPO3 Core Update Manager';
111

  
112
		// Get lines from localconf file
113
		$lines = $instObj->writeToLocalconf_control();
114
		$instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList);
115
		$instObj->writeToLocalconf_control($lines);
116

  
117
		$GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList;
118
		t3lib_extMgm::removeCacheFiles();
119
	}
120
}
121
?>
typo3/sysext/install/ext_localconf.php (working copy)
10 10
	// remove pagetype "advanced" since TYPO3 4.2
11 11
	// this is merged with doctype "standard" with tab view to edit
12 12
$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['mergeAdvancedDoktypeConversion'] = 'tx_coreupdates_mergeadvanced';
13
?>
13

  
14
	// add outsourced system extensions since TYPO3 4.3
15
$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['installSystemExtensions'] = 'tx_coreupdates_installsysexts';
16
?>
(4-4/5)