Feature #19178 » 20080908_simulatestatic_as_sysext.patch

Administrator Admin, 2008-09-08 22:03

View differences:

t3lib/config_default.php (working copy)
212 212
		'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)
213 213
		'allowedTempPaths' => '',				// Additional paths allowed for temporary images. Used with imgResource. Eg. 'alttypo3temp/,another_temp_dir/';
214 214
		'debug' => 0,							// Boolean. If set, some debug HTML-comments may be output somewhere. Can also be set by TypoScript.
215
		'simulateStaticDocuments' => 0,			// Boolean. This is the default value for simulateStaticDocuments (configurable with TypoScript which overrides this, if the TypoScript value is present)
215
		'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.
216 216
		'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
217 217
		'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.
218 218
		'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.org)
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.org>
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['config']['simulateStaticDocuments_addTitle'] ? $TSconf['config']['simulateStaticDocuments_addTitle'] : $TSconf['config']['simulateStaticDocuments.']['addTitle']),
71
			'noTypeIfNoTitle' => ($TSconf['config']['simulateStaticDocuments_noTypeIfNoTitle'] ? $TSconf['config']['simulateStaticDocuments_noTypeIfNoTitle'] : $TSconf['config']['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
			$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 logfile!; no practical use of the title for TYPO3.
176
	 * 2:      '[id].[type].html'					- above, but title is omitted; no practical use of the title for TYPO3.
177
	 * 3:      '[id].html'							- only id, type is set to the default, zero!
178
	 * NOTE: In all case 'id' may be the uid-number OR the page alias (if any)
179
	 * 
180
	 * @param	array		includes a reference to the parent Object (which is the global TSFE)
181
	 * @param	tslib_fe	is a reference to the global TSFE
182
	 * @return	void
183
	 */
184
	public function hookCheckAlternativeIDMethods(&$params, &$ref) {
185

  
186
		// If there has been a redirect (basically; we arrived here otherwise than via "index.php" in the URL)
187
		// this can happend either due to a CGI-script or because of reWrite rule. Earlier we used $_SERVER['REDIRECT_URL'] to check
188
		if ($ref->siteScript && substr($ref->siteScript, 0, 9) != 'index.php') {
189
			$uParts = parse_url($ref->siteScript);
190
			$fI = t3lib_div::split_fileref($uParts['path']);
191

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

  
206

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

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

  
236

  
237

  
238

  
239
	/********************************************
240
	 *
241
	 * Various internal API functions
242
	 *
243
	 *******************************************/
244

  
245
	/**
246
	 * 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
247
	 * @deprecated: Will be deleted in TYPO3 4.5
248
	 * @see makeSimulatedFileName()
249
	 */
250
	public function makeSimulatedFileNameCompat(&$params, &$ref) {
251
		return $this->makeSimulatedFileName($params['inTitle'], $params['page'], $params['type'], $params['addParams'], $params['no_cache']);
252
	}
253

  
254

  
255
	/**
256
	 * Make simulation filename (without the ".html" ending, only body of filename)
257
	 *
258
	 * @param	string		The page title to use
259
	 * @param	mixed		The page id (integer) or alias (string)
260
	 * @param	integer		The type number
261
	 * @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...)
262
	 * @param	boolean		The "no_cache" status of the link.
263
	 * @return	string		The body of the filename.
264
	 * @see getSimulFileName(), t3lib_tstemplate::linkData(), tslib_frameset::frameParams()
265
	 */
266
	public function makeSimulatedFileName($inTitle, $page, $type, $addParams = '', $no_cache = false) {
267

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

  
274
		$out = ($titleChars ? $this->fileNameASCIIPrefix($inTitle, $titleChars) : '');
275
		$enc = '';
276

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

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

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

  
304

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

  
319

  
320
	/**
321
	 * 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)
322
	 *
323
	 * @param	string		Query string to analyse
324
	 * @return	array		Two num keys returned, first is the parameters that MAY be encoded, second is the non-encodable parameters.
325
	 * @see makeSimulatedFileName(), t3lib_tstemplate::linkData()
326
	 */
327
	public function processEncodedQueryString($linkVars) {
328
		$remainingLinkVars = '';
329
		if (strcmp($linkVars, '')) {
330
			$p = explode('&', $linkVars);
331
			// 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?
332
			sort($p);	
333
			$rem = array();
334
			foreach ($p as $k => $v) {
335
				if (strlen($v)) {
336
					list($pName) = explode('=', $v, 2);
337
					$pName = rawurldecode($pName);
338
					if (!$this->pEncodingAllowedParamNames[$pName]) {
339
						unset($p[$k]);
340
						$rem[] = $v;
341
					}
342
				} else {
343
					unset($p[$k]);
344
				}
345
			}
346
			$linkVars = (count($p) ? '&' . implode('&', $p) : '');
347
			$remainingLinkVars = (count($rem) ? '&' . implode('&', $rem) : '');
348
		}
349
		return array($linkVars, $remainingLinkVars);
350
	}
351

  
352

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

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

  
372
		return (strlen($out) ? $out . $mergeChar : '');
373
	}
374
}
375

  
376
if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:simulatestatic/class.tx_simulatestatic.php']) {
377
	include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:simulatestatic/class.tx_simulatestatic.php']);
378
}
379
?>
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

  
......
3771 3723
	 * @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...)
3772 3724
	 * @param	boolean		The "no_cache" status of the link.
3773 3725
	 * @return	string		The body of the filename.
3774
	 * @see getSimulFileName(), t3lib_tstemplate::linkData(), tslib_frameset::frameParams()
3726
	 * @see getSimulFileName(), t3lib_tstemplate::linkData(), tslib_frameset::frameParams(), tx_
3727
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3775 3728
	 */
3776
	function makeSimulFileName($inTitle,$page,$type,$addParams='',$no_cache=false)	{
3777
		$titleChars = intval($this->config['config']['simulateStaticDocuments_addTitle']);
3778
			// Default value is 30 but values > 1 will be override this
3779
		if($titleChars==1)	{ $titleChars = 30; }
3780

  
3781
		$out = '';
3782
		if ($titleChars)	{
3783
			$out = $this->fileNameASCIIPrefix($inTitle, $titleChars);
3729
	function makeSimulFileName($inTitle, $page, $type, $addParams = '', $no_cache = false) {
3730
		if (t3lib_extMgm::isLoaded('simulatestatic')) {
3731
			return t3lib_div::callUserFunc(
3732
				'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->makeSimulatedFileNameCompat',
3733
				array(
3734
					'inTitle' => $inTitle,
3735
					'page' => $page,
3736
					'type' => $type,
3737
					'addParams' => $addParams,
3738
					'no_cache' => $no_cache
3739
				), $this);
3740
		} else {
3741
			return false;
3784 3742
		}
3785
		$enc = '';
3786

  
3787
		if (strcmp($addParams,'') && !$no_cache)	{
3788
			switch ((string)$this->config['config']['simulateStaticDocuments_pEnc'])	{
3789
				case 'md5':
3790
					$md5 = substr(md5($addParams),0,10);
3791
					$enc = '+M5'.$md5;
3792

  
3793
					$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('md5hash', 'cache_md5params', 'md5hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($md5, 'cache_md5params'));
3794
					if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res))	{
3795
						$insertFields = array(
3796
							'md5hash' => $md5,
3797
							'tstamp' => time(),
3798
							'type' => 1,
3799
							'params' => $addParams
3800
						);
3801

  
3802
						$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_md5params', $insertFields);
3803
					}
3804
				break;
3805
				case 'base64':
3806
					$enc = '+B6'.str_replace('=','_',str_replace('/','-',base64_encode($addParams)));
3807
				break;
3808
			}
3809
		}
3810
			// Setting page and type number:
3811
		$url = $out.$page.$enc;
3812
		$url.= ($type || $out || !$this->config['config']['simulateStaticDocuments_noTypeIfNoTitle']) ? '.'.$type : '';
3813
		return $url;
3814 3743
	}
3815 3744

  
3816 3745
	/**
......
3819 3748
	 * @param	string		Query string to analyse
3820 3749
	 * @return	array		Two num keys returned, first is the parameters that MAY be encoded, second is the non-encodable parameters.
3821 3750
	 * @see makeSimulFileName(), t3lib_tstemplate::linkData()
3751
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3822 3752
	 */
3823 3753
	function simulateStaticDocuments_pEnc_onlyP_proc($linkVars)	{
3824
		$remainLinkVars = '';
3825
		if (strcmp($linkVars,''))	{
3826
			$p = explode('&',$linkVars);
3827
			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?
3828
			$rem = array();
3829
			foreach($p as $k => $v)	{
3830
				if (strlen($v))	{
3831
					list($pName) = explode('=',$v,2);
3832
					$pName = rawurldecode($pName);
3833
					if (!$this->pEncAllowedParamNames[$pName])	{
3834
						unset($p[$k]);
3835
						$rem[] = $v;
3836
					}
3837
				} else unset($p[$k]);
3838
			}
3839

  
3840
			$linkVars = count($p) ? '&'.implode('&',$p) : '';
3841
			$remainLinkVars = count($rem) ? '&'.implode('&',$rem) : '';
3754
		if (t3lib_extMgm::isLoaded('simulatestatic')) {
3755
			return t3lib_div::callUserFunc(
3756
				'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->processEncodedQueryString',
3757
				$linkVars, $this);
3758
		} else {
3759
			return false;
3842 3760
		}
3843
		return array($linkVars, $remainLinkVars);
3844 3761
	}
3845 3762

  
3846 3763
	/**
......
3848 3765
	 *
3849 3766
	 * @return	string		The filename (without path)
3850 3767
	 * @see makeSimulFileName(), publish.php
3768
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3851 3769
	 */
3852 3770
	function getSimulFileName()	{
3853
		$url = '';
3854
		$url.= $this->makeSimulFileName($this->page['title'], $this->page['alias']?$this->page['alias']:$this->id, $this->type).'.html';
3855
		return $url;
3771
		return $this->makeSimulFileName($this->page['title'], $this->page['alias']?$this->page['alias']:$this->id, $this->type).'.html';
3856 3772
	}
3857 3773

  
3858 3774
	/**
3859 3775
	 * Checks and sets replacement character for simulateStaticDocuments. Default is underscore.
3860 3776
	 *
3861 3777
	 * @return	void
3778
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3862 3779
	 */
3863 3780
	function setSimulReplacementChar() {
3864 3781
		$replacement = $defChar = t3lib_div::compat_version('4.0') ? '-' : '_';
......
3879 3796
	 * @param	integer		Number of characters in the string
3880 3797
	 * @param	string		Character to put in the end of string to merge it with the next value.
3881 3798
	 * @return	string		String
3799
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3882 3800
	 */
3883 3801
	function fileNameASCIIPrefix($inTitle,$titleChars,$mergeChar='.')	{
3884 3802
		$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
?>
(3-3/5)