Feature #19178 » 0009094_v5.patch

Administrator Admin, 2008-10-31 22:12

View differences:

t3lib/config_default.php (Arbeitskopie)
257 257
		'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)
258 258
		'allowedTempPaths' => '',				// Additional paths allowed for temporary images. Used with imgResource. Eg. 'alttypo3temp/,another_temp_dir/';
259 259
		'debug' => 0,							// Boolean. If set, some debug HTML-comments may be output somewhere. Can also be set by TypoScript.
260
		'simulateStaticDocuments' => 0,			// Boolean. This is the default value for simulateStaticDocuments (configurable with TypoScript which overrides this, if the TypoScript value is present)
260
		'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.
261 261
		'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
262 262
		'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.
263 263
		'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 (Arbeitskopie)
1366 1366
	/**
1367 1367
	 * The mother of all functions creating links/URLs etc in a TypoScript environment.
1368 1368
	 * See the references below.
1369
	 * Basically this function takes care of issues such as type,id,alias and Mount Points, simulate static documents, M5/B6 encoded parameters etc.
1369
	 * Basically this function takes care of issues such as type,id,alias and Mount Points, URL rewriting (through hooks), M5/B6 encoded parameters etc.
1370 1370
	 * 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.
1371 1371
	 *
1372 1372
	 * @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.
......
1425 1425
		} else {
1426 1426
			$LD['type'] = '';
1427 1427
		}
1428
		$LD['orig_type'] = $LD['type'];		// Preserving the type number. Will not be cleared if simulateStaticDocuments.
1428
		$LD['orig_type'] = $LD['type'];		// Preserving the type number.
1429 1429

  
1430 1430
			// noCache
1431 1431
		$LD['no_cache'] = (trim($page['no_cache']) || $no_cache) ? '&no_cache=1' : '';
......
1441 1441
			$LD['linkVars'] = $GLOBALS['TSFE']->linkVars.$addParams;
1442 1442
		}
1443 1443

  
1444
			// If simulateStaticDocuments is enabled:
1445
		if ($GLOBALS['TSFE']->config['config']['simulateStaticDocuments'])	{
1446
			$LD['type'] = '';
1447
			$LD['url'] = '';
1448

  
1449
				// MD5/base64 method limitation:
1450
			$remainLinkVars='';
1451
			$flag_simulateStaticDocuments_pEnc = t3lib_div::inList('md5,base64',$GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc']) && !$LD['no_cache'];
1452
			if ($flag_simulateStaticDocuments_pEnc)	{
1453
				list($LD['linkVars'], $remainLinkVars) = $GLOBALS['TSFE']->simulateStaticDocuments_pEnc_onlyP_proc($LD['linkVars']);
1454
			}
1455

  
1456
			$LD['url'].=$GLOBALS['TSFE']->makeSimulFileName(
1457
							$page['title'],
1458
							$page['alias'] ? $page['alias'] : $page['uid'],
1459
							intval($typeNum),
1460
							$LD['linkVars'],
1461
							$LD['no_cache'] ? true : false
1462
						);
1463

  
1464
			if ($flag_simulateStaticDocuments_pEnc)	{
1465
				$LD['linkVars']=$remainLinkVars;
1466
			}
1467
			if ($GLOBALS['TSFE']->config['config']['simulateStaticDocuments']=='PATH_INFO')	{
1468
				$LD['url'] = str_replace('.','/',$LD['url']);
1469
				$LD['url'] = 'index.php/'.$LD['url'].'/?';
1470
			} else {
1471
				$LD['url'].= '.html?';
1472
			}
1473
		}
1474

  
1475 1444
			// Add absRefPrefix if exists.
1476 1445
		$LD['url'] = $GLOBALS['TSFE']->absRefPrefix.$LD['url'];
1477 1446

  
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
 * @author	Kasper Skaarhoj <kasperYYYY@typo3.com>
33
 * @author	Benjamin Mack <benni . typo3 . o)rg>
34
 */
35
class tx_simulatestatic {
36
	public $enabled = false;
37
	public $replacementChar = '';
38
	public $conf = array();
39
	public $pEncodingAllowedParamNames = array();
40

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

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

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

  
61
		$this->enabled = true;
62

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

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

  
81

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

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

  
97

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

  
120

  
121
	/**
122
	 * Hook for creating a speaking URL when using the generic linkData function
123
	 *
124
	 * @param	array				holds all the information about the link that is about to be created
125
	 * @param	t3lib_TStemplate	is a reference to the parent object that calls the hook
126
	 * @return	void
127
	 */
128
	public function hookLinkDataPostProc(array &$parameters, t3lib_TStemplate &$parentObject) {
129
		if (!$this->enabled) {
130
			return;
131
		}
132

  
133
		$LD = &$parameters['LD'];
134
		$page = &$parameters['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(
145
			$page['title'],
146
			($page['alias'] ? $page['alias'] : $page['uid']),
147
			intval($parameters['typeNum']),
148
			$LD['linkVars'],
149
			($LD['no_cache'] ? true : false)
150
		);
151
		if ($this->conf['mode'] == 'PATH_INFO') {
152
			$url = 'index.php/' . str_replace('.', '/', $url) . '/';
153
		} else {
154
			$url .= '.html';
155
		}
156
		$LD['url'] = $GLOBALS['TSFE']->absRefPrefix . $url . '?';
157

  
158
		if ($flag_pEncoding) {
159
			$LD['linkVars'] = $remainLinkVars;
160
		}
161

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

  
166
			// Compile the normal total url
167
		$LD['totalURL'] = $parentObject->removeQueryString($LD['url'] . $LD['type'] . $LD['no_cache'] . $LD['linkVars'] . $GLOBALS['TSFE']->getMethodUrlIdToken) . $LD['sectionIndex'];
168
	}
169

  
170

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

  
201
			if (!$fI['path'] && $fI['file'] && substr($fI['file'], -5) == '.html') {
202
				$parts = explode('.', $fI['file']);
203
				$pCount = count($parts);
204
				if ($pCount > 2) {
205
					$parentObject->type = intval($parts[$pCount-2]);
206
					$parentObject->id = $parts[$pCount-3];
207
				} else {
208
					$parentObject->type = 0;
209
					$parentObject->id = $parts[0];
210
				}
211
			}
212
		}
213
	}
214

  
215

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

  
237
				$GLOBALS['TSFE']->updateMD5paramsRecord(substr($string, 2));
238
				parse_str($row['params'], $getVars);
239
			break;
240
		}
241
		$GLOBALS['TSFE']->mergingWithGetVars($getVars);
242
	}
243

  
244

  
245

  
246

  
247
	/********************************************
248
	 *
249
	 * Various internal API functions
250
	 *
251
	 *******************************************/
252

  
253
	/**
254
	 * 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
255
	 *
256
	 * @param	array		Parameter array delivered from tslib_fe::makeSimulFileName
257
	 * @param	tslib_fe	Reference to the calling TSFE instance
258
	 * @return	string		The body of the filename.
259
	 * @see makeSimulatedFileName()
260
	 * @deprecated: Will be deleted in TYPO3 4.5
261
	 */
262
	public function makeSimulatedFileNameCompat(array &$parameters, tslib_fe &$parentObject) {
263
		return $this->makeSimulatedFileName(
264
			$parameters['inTitle'],
265
			$parameters['page'],
266
			$parameters['type'],
267
			$parameters['addParams'],
268
			$parameters['no_cache']
269
		);
270
	}
271

  
272

  
273
	/**
274
	 * Make simulation filename (without the ".html" ending, only body of filename)
275
	 *
276
	 * @param	string		The page title to use
277
	 * @param	mixed		The page id (integer) or alias (string)
278
	 * @param	integer		The type number
279
	 * @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...)
280
	 * @param	boolean		The "no_cache" status of the link.
281
	 * @return	string		The body of the filename.
282
	 * @see getSimulFileName(), t3lib_tstemplate::linkData(), tslib_frameset::frameParams()
283
	 */
284
	public function makeSimulatedFileName($inTitle, $page, $type, $addParams = '', $no_cache = false) {
285
			// Default value is 30 but values > 1 will be override this
286
		$titleChars = intval($this->conf['addTitle']);
287
		if ($titleChars == 1) {
288
			$titleChars = 30;
289
		}
290

  
291
		$out = ($titleChars ? $this->fileNameASCIIPrefix($inTitle, $titleChars) : '');
292
		$enc = '';
293

  
294
		if (strcmp($addParams, '') && !$no_cache) {
295
			switch ((string)$this->conf['pEncoding']) {
296
				case 'md5':
297
					$md5 = substr(md5($addParams), 0, 10);
298
					$enc = '+M5'.$md5;
299

  
300
					$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
301
						'md5hash',
302
						'cache_md5params',
303
						'md5hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($md5, 'cache_md5params')
304
					);
305
					if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
306
						$insertFields = array(
307
							'md5hash' => $md5,
308
							'tstamp'  => time(),
309
							'type'    => 1,
310
							'params'  => $addParams
311
						);
312

  
313
						$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_md5params', $insertFields);
314
					}
315
					$GLOBALS['TYPO3_DB']->sql_free_result($res);
316
				break;
317
				case 'base64':
318
					$enc = '+B6' . str_replace('=', '_', str_replace('/', '-', base64_encode($addParams)));
319
				break;
320
			}
321
		}
322
			// Setting page and type number:
323
		return $out . $page . $enc . (($type || $out || !$this->conf['noTypeIfNoTitle']) ? '.' . $type : '');
324
	}
325

  
326

  
327
	/**
328
	 * Returns the simulated static file name (*.html) for the current page (using the page record in $this->page)
329
	 *
330
	 * @return	string		The filename (without path)
331
	 * @see makeSimulatedFileName(), publish.php
332
	 */
333
	public function getSimulatedFileName() {
334
		return $this->makeSimulatedFileName(
335
			$GLOBALS['TSFE']->page['title'],
336
			($GLOBALS['TSFE']->page['alias'] ? $GLOBALS['TSFE']->page['alias'] : $GLOBALS['TSFE']->id),
337
			$GLOBALS['TSFE']->type
338
		) . '.html';
339
	}
340

  
341

  
342
	/**
343
	 * 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)
344
	 *
345
	 * @param	string		Query string to analyse
346
	 * @return	array		Two num keys returned, first is the parameters that MAY be encoded, second is the non-encodable parameters.
347
	 * @see makeSimulatedFileName(), t3lib_tstemplate::linkData()
348
	 */
349
	public function processEncodedQueryString($linkVars) {
350
		$remainingLinkVars = '';
351
		if (strcmp($linkVars, '')) {
352
			$parts = t3lib_div::trimExplode('&', $linkVars);
353
			// This sorts the parameters - and may not be needed and further
354
			// it will generate new MD5 hashes in many cases. Maybe not so smart. Hmm?
355
			sort($parts);	
356
			$remainingParts = array();
357
			foreach ($parts as $index => $value) {
358
				if (strlen($value)) {
359
					list($parameterName) = explode('=', $value, 2);
360
					$parameterName = rawurldecode($parameterName);
361
					if (!$this->pEncodingAllowedParamNames[$parameterName]) {
362
						unset($parts[$index]);
363
						$remainingParts[] = $value;
364
					}
365
				} else {
366
					unset($parts[$index]);
367
				}
368
			}
369
			$linkVars = (count($parts) ? '&' . implode('&', $parts) : '');
370
			$remainingLinkVars = (count($remainingParts) ? '&' . implode('&', $remainingParts) : '');
371
		}
372
		return array($linkVars, $remainingLinkVars);
373
	}
374

  
375

  
376
	/**
377
	 * Converts input string to an ASCII based file name prefix
378
	 *
379
	 * @param	string		String to base output on
380
	 * @param	integer		Number of characters in the string
381
	 * @param	string		Character to put in the end of string to merge it with the next value.
382
	 * @return	string		Converted string
383
	 */
384
	public function fileNameASCIIPrefix($inTitle, $maxTitleChars, $mergeChar = '.') {
385
		$out = $GLOBALS['TSFE']->csConvObj->specCharsToASCII($GLOBALS['TSFE']->renderCharset, $inTitle);
386

  
387
		// Get replacement character
388
		$replacementChar = $this->conf['replacementChar'];
389
		$replacementChars = '_\-' . ($replacementChar != '_' && $replacementChar != '-' ? $replacementChar : '');
390
		$out = preg_replace('/[^A-Za-z0-9_-]/', $replacementChar, trim(substr($out, 0, $maxTitleChars)));
391
		$out = preg_replace('/([' . $replacementChars . ']){2,}/', '\1', $out);
392
		$out = preg_replace('/['  . $replacementChars . ']?$/', '', $out);
393
		$out = preg_replace('/^[' . $replacementChars . ']?/', '', $out);
394

  
395
		return (strlen($out) ? $out . $mergeChar : '');
396
	}
397
}
398

  
399
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/simulatestatic/class.tx_simulatestatic.php']) {
400
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/simulatestatic/class.tx_simulatestatic.php']);
401
}
402
?>
typo3/sysext/simulatestatic/ext_localconf.php (Revision 0)
1
<?php
2
if (!defined('TYPO3_MODE')) {
3
	die('Access denied.');
4
}
5

  
6
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['configArrayPostProc'][$_EXTKEY] = 'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->hookInitConfig';
7
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc'][$_EXTKEY] = 'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->hookLinkDataPostProc';
8
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['checkAlternativeIdMethods-PostProc'][$_EXTKEY] = 'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->hookCheckAlternativeIDMethods';
9
?>
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 31-10-2008 22:05
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:2:{s:27:"class.tx_simulatestatic.php";s:4:"055c";s:17:"ext_localconf.php";s:4:"eace";}',
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 (Arbeitskopie)
353 353
	var $uniqueString='';
354 354
	var $indexedDocTitle='';			// This value will be used as the title for the page in the indexer (if indexing happens)
355 355
	var $altPageTitle='';				// Alternative page title (normally the title of the page record). Can be set from applications you make.
356
	var $pEncAllowedParamNames=array();	// An array that holds parameter names (keys) of GET parameters which MAY be MD5/base64 encoded with simulate_static_documents method.
356
	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
357 357
	var $baseUrl='';					// The base URL set for the page header.
358 358
	var $anchorPrefix='';				// The proper anchor prefix needed when using speaking urls. (only set if baseUrl is set)
359 359

  
......
696 696
	/**
697 697
	 * Provides ways to bypass the '?id=[xxx]&type=[xx]' format, using either PATH_INFO or virtual HTML-documents (using Apache mod_rewrite)
698 698
	 *
699
	 * Three options:
700
	 * 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")
701
	 * 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)
702
	 * 3) Using hook which enables features like those provided from "realurl" extension (AKA "Speaking URLs")
699
	 * Two options:
700
	 * 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)
701
	 * 2) Using hook which enables features like those provided from "simulatestatic" or "realurl" extension (AKA "Speaking URLs")
703 702
	 *
704
	 * Support for RewriteRule to generate   (simulateStaticDocuments)
705
	 * With the mod_rewrite compiled into apache, put these lines into a .htaccess in this directory:
706
	 * RewriteEngine On
707
	 * RewriteRule   ^[^/]*\.html$  index.php
708
	 * The url must end with '.html' and the format must comply with either of these:
709
	 * 1:      '[title].[id].[type].html'			- title is just for easy recognition in the logfile!; no practical use of the title for TYPO3.
710
	 * 2:      '[id].[type].html'					- above, but title is omitted; no practical use of the title for TYPO3.
711
	 * 3:      '[id].html'							- only id, type is set to the default, zero!
712
	 * NOTE: In all case 'id' may be the uid-number OR the page alias (if any)
713
	 *
714 703
	 * @return	void
715 704
	 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&cHash=4ad9d7acb4
716 705
	 */
717 706
	function checkAlternativeIdMethods()	{
718

  
719 707
		$this->siteScript = t3lib_div::getIndpEnv('TYPO3_SITE_SCRIPT');
720 708

  
721
			// Resolving of "simulateStaticDocuments" URLs:
722
		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
723
			$uParts = parse_url($this->siteScript);	// Parse the path:
724
			$fI = t3lib_div::split_fileref($uParts['path']);
725

  
726
			if (!$fI['path'] && $fI['file'] && substr($fI['file'],-5)=='.html')	{
727
				$parts = explode('.',$fI['file']);
728
				$pCount = count($parts);
729
				if ($pCount>2)	{
730
					$this->type = intval($parts[$pCount-2]);
731
					$this->id = $parts[$pCount-3];
732
				} else {
733
					$this->type = 0;
734
					$this->id = $parts[0];
735
				}
736
			}
737
		}
738

  
739 709
			// If PATH_INFO
740 710
		if (t3lib_div::getIndpEnv('PATH_INFO'))	{		// If pathinfo contains stuff...
741 711
			$parts=t3lib_div::trimExplode('/',t3lib_div::getIndpEnv('PATH_INFO'),1);
......
1608 1578
	 * @param	string		String to analyze
1609 1579
	 * @return	void
1610 1580
	 * @access private
1581
	 * @deprecated since TYPO3 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
1611 1582
	 */
1612 1583
	function idPartsAnalyze($str)	{
1613 1584
		$GET_VARS = '';
......
2049 2020
						$this->config['config'] = t3lib_div::array_merge_recursive_overrule($this->config['config'], $this->pSetup['config.']);
2050 2021
					}
2051 2022

  
2052
						// if .simulateStaticDocuments was not present, the default value will rule.
2053
					if (!isset($this->config['config']['simulateStaticDocuments']))	{
2054
						$this->config['config']['simulateStaticDocuments'] = trim($this->TYPO3_CONF_VARS['FE']['simulateStaticDocuments']);
2055
					}
2056
					if ($this->config['config']['simulateStaticDocuments']) {
2057
							// Set replacement char only if it is needed
2058
						$this->setSimulReplacementChar();
2059
					}
2060

  
2061 2023
					if ($this->config['config']['typolinkEnableLinksAcrossDomains']) {
2062 2024
						$this->config['config']['typolinkCheckRootline'] = true;
2063 2025
					}
......
2110 2072
			// No cache
2111 2073
		if ($this->config['config']['no_cache'])	{ $this->set_no_cache(); }		// Set $this->no_cache true if the config.no_cache value is set!
2112 2074

  
2113
			// Check PATH_INFO url
2114
		if ($this->absRefPrefix_force && strcmp($this->config['config']['simulateStaticDocuments'],'PATH_INFO'))	{
2115
			$redirectUrl = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR').'index.php?id='.$this->id.'&type='.$this->type;
2116
			if ($this->config['config']['simulateStaticDocuments_dontRedirectPathInfoError'])	{
2117
				if ($this->checkPageUnavailableHandler())	{
2118
					$this->pageUnavailableAndExit('PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!');
2119
				} else {
2120
					$message = 'PATH_INFO was not configured for this website, and the URL tries to find the page by PATH_INFO!';
2121
					header('HTTP/1.0 503 Service Temporarily Unavailable');
2122
					t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
2123
					$this->printError($message.'<br /><br /><a href="'.htmlspecialchars($redirectUrl).'">Click here to get to the right page.</a>','Error: PATH_INFO not configured');
2124
				}
2125
			} else {
2126
				header('Location: '.t3lib_div::locationHeaderUrl($redirectUrl));
2075

  
2076
			// Hook for postProcessing the configuration array
2077
		if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['configArrayPostProc'])) {
2078
			$params = array('config' => &$this->config['config']);
2079
			foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['configArrayPostProc'] as $funcRef) {
2080
				t3lib_div::callUserFunction($funcRef, $params, $this);
2127 2081
			}
2128
			exit;
2129
//			$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.
2130 2082
		}
2131 2083
	}
2132 2084

  
......
3795 3747
	 * @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...)
3796 3748
	 * @param	boolean		The "no_cache" status of the link.
3797 3749
	 * @return	string		The body of the filename.
3798
	 * @see getSimulFileName(), t3lib_tstemplate::linkData(), tslib_frameset::frameParams()
3750
	 * @see getSimulFileName(), t3lib_tstemplate::linkData(), tslib_frameset::frameParams(), tx_
3751
	 * @deprecated since TYPO3 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3799 3752
	 */
3800
	function makeSimulFileName($inTitle,$page,$type,$addParams='',$no_cache=false)	{
3801
		$titleChars = intval($this->config['config']['simulateStaticDocuments_addTitle']);
3802
			// Default value is 30 but values > 1 will be override this
3803
		if($titleChars==1)	{ $titleChars = 30; }
3804

  
3805
		$out = '';
3806
		if ($titleChars)	{
3807
			$out = $this->fileNameASCIIPrefix($inTitle, $titleChars);
3753
	function makeSimulFileName($inTitle, $page, $type, $addParams = '', $no_cache = false) {
3754
		if (t3lib_extMgm::isLoaded('simulatestatic')) {
3755
			return t3lib_div::callUserFunc(
3756
				'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->makeSimulatedFileNameCompat',
3757
				array(
3758
					'inTitle' => $inTitle,
3759
					'page' => $page,
3760
					'type' => $type,
3761
					'addParams' => $addParams,
3762
					'no_cache' => $no_cache
3763
				), $this);
3764
		} else {
3765
			return false;
3808 3766
		}
3809
		$enc = '';
3810

  
3811
		if (strcmp($addParams,'') && !$no_cache)	{
3812
			switch ((string)$this->config['config']['simulateStaticDocuments_pEnc'])	{
3813
				case 'md5':
3814
					$md5 = substr(md5($addParams),0,10);
3815
					$enc = '+M5'.$md5;
3816

  
3817
					$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('md5hash', 'cache_md5params', 'md5hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($md5, 'cache_md5params'));
3818
					if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res))	{
3819
						$insertFields = array(
3820
							'md5hash' => $md5,
3821
							'tstamp' => time(),
3822
							'type' => 1,
3823
							'params' => $addParams
3824
						);
3825

  
3826
						$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_md5params', $insertFields);
3827
					}
3828
				break;
3829
				case 'base64':
3830
					$enc = '+B6'.str_replace('=','_',str_replace('/','-',base64_encode($addParams)));
3831
				break;
3832
			}
3833
		}
3834
			// Setting page and type number:
3835
		$url = $out.$page.$enc;
3836
		$url.= ($type || $out || !$this->config['config']['simulateStaticDocuments_noTypeIfNoTitle']) ? '.'.$type : '';
3837
		return $url;
3838 3767
	}
3839 3768

  
3840 3769
	/**
......
3843 3772
	 * @param	string		Query string to analyse
3844 3773
	 * @return	array		Two num keys returned, first is the parameters that MAY be encoded, second is the non-encodable parameters.
3845 3774
	 * @see makeSimulFileName(), t3lib_tstemplate::linkData()
3775
	 * @deprecated since TYPO3 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3846 3776
	 */
3847 3777
	function simulateStaticDocuments_pEnc_onlyP_proc($linkVars)	{
3848
		$remainLinkVars = '';
3849
		if (strcmp($linkVars,''))	{
3850
			$p = explode('&',$linkVars);
3851
			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?
3852
			$rem = array();
3853
			foreach($p as $k => $v)	{
3854
				if (strlen($v))	{
3855
					list($pName) = explode('=',$v,2);
3856
					$pName = rawurldecode($pName);
3857
					if (!$this->pEncAllowedParamNames[$pName])	{
3858
						unset($p[$k]);
3859
						$rem[] = $v;
3860
					}
3861
				} else unset($p[$k]);
3862
			}
3863

  
3864
			$linkVars = count($p) ? '&'.implode('&',$p) : '';
3865
			$remainLinkVars = count($rem) ? '&'.implode('&',$rem) : '';
3778
		if (t3lib_extMgm::isLoaded('simulatestatic')) {
3779
			return t3lib_div::callUserFunc(
3780
				'EXT:simulatestatic/class.tx_simulatestatic.php:&tx_simulatestatic->processEncodedQueryString',
3781
				$linkVars,
3782
				$this
3783
			);
3784
		} else {
3785
			return false;
3866 3786
		}
3867
		return array($linkVars, $remainLinkVars);
3868 3787
	}
3869 3788

  
3870 3789
	/**
......
3872 3791
	 *
3873 3792
	 * @return	string		The filename (without path)
3874 3793
	 * @see makeSimulFileName(), publish.php
3794
	 * @deprecated since TYPO3 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3875 3795
	 */
3876 3796
	function getSimulFileName()	{
3877
		$url = '';
3878
		$url.= $this->makeSimulFileName($this->page['title'], $this->page['alias']?$this->page['alias']:$this->id, $this->type).'.html';
3879
		return $url;
3797
		return $this->makeSimulFileName(
3798
			$this->page['title'],
3799
			($this->page['alias'] ? $this->page['alias'] : $this->id),
3800
			$this->type
3801
		) . '.html';
3880 3802
	}
3881 3803

  
3882 3804
	/**
3883 3805
	 * Checks and sets replacement character for simulateStaticDocuments. Default is underscore.
3884 3806
	 *
3885 3807
	 * @return	void
3808
	 * @deprecated since TYPO3 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3886 3809
	 */
3887 3810
	function setSimulReplacementChar() {
3888 3811
		$replacement = $defChar = t3lib_div::compat_version('4.0') ? '-' : '_';
......
3903 3826
	 * @param	integer		Number of characters in the string
3904 3827
	 * @param	string		Character to put in the end of string to merge it with the next value.
3905 3828
	 * @return	string		String
3829
	 * @deprecated since TYPO3, 4.3, will be removed in TYPO3 4.5, please use the "simulatestatic" sysext directly
3906 3830
	 */
3907 3831
	function fileNameASCIIPrefix($inTitle,$titleChars,$mergeChar='.')	{
3908 3832
		$out = $this->csConvObj->specCharsToASCII($this->renderCharset, $inTitle);
typo3/sysext/cms/tslib/class.tslib_pagegen.php (Arbeitskopie)
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 (Arbeitskopie)
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
	public $versionNumber;	// version number coming from t3lib_div::int_from_ver()
35

  
36
	/**
37
	 * parent object
38
	 *
39
	 * @var tx_install
40
	 */
41
	public $pObj;
42
	public $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
			// Get list of installed extensions and add this one.
89
		$listArr = array_keys($GLOBALS['TYPO3_LOADED_EXT']);
90
		$listArr[] = $extKey;
91

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

  
96

  
97
	/**
98
	 * Writes the extension list to "localconf.php" file
99
	 * Removes the temp_CACHED* files before return.
100
	 *
101
	 * @param	string		List of extensions
102
	 * @return	void
103
	 */
104
	protected function writeNewExtensionList($newExtList)	{
105
			// Instance of install tool
106
		$instObj = new t3lib_install;
107
		$instObj->allowUpdateLocalConf = 1;
108
		$instObj->updateIdentity = 'TYPO3 Core Update Manager';
109

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

  
115
		$GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList;
116
		t3lib_extMgm::removeCacheFiles();
117
	}
118
}
119
?>
typo3/sysext/install/ext_localconf.php (Arbeitskopie)
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

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