Added feature #16457: em: add possibility to install extension from t3x (used by...
[Packages/TYPO3.CMS.git] / typo3 / sysext / em / classes / extensions / class.tx_em_extensions_list.php
1 <?php
2 /* **************************************************************
3 * Copyright notice
4 *
5 * (c) webservices.nl
6 * (c) 2006-2010 Karsten Dambekalns <karsten@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 /* $Id: class.tx_em_extensions_list.php 2084 2010-03-22 01:46:37Z steffenk $ */
29
30 /**
31 * This class handles extension listings
32 *
33 */
34 class tx_em_Extensions_List {
35
36
37 protected $parentObject;
38
39 protected $categories;
40 protected $types;
41
42 /**
43 * Constructor
44 *
45 * @param object $parentObject
46 * @return void
47 */
48 public function __construct($parentObject = NULL) {
49 $this->parentObject = $parentObject;
50 $this->install = t3lib_div::makeInstance('tx_em_Install', $this);
51
52 $this->categories = array(
53 'be' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_BE'),
54 'module' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_BE_modules'),
55 'fe' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_FE'),
56 'plugin' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_FE_plugins'),
57 'misc' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_miscellanous'),
58 'services' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_services'),
59 'templates' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_templates'),
60 'example' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_examples'),
61 'doc' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_documentation')
62 );
63 $this->types = array(
64 'S' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:type_system'),
65 'G' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:type_global'),
66 'L' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:type_local'),
67 );
68 }
69
70
71 /**
72 * Returns the list of available (installed) extensions
73 *
74 * @return array Array with two arrays, list array (all extensions with info) and category index
75 * @see getInstExtList()
76 */
77 function getInstalledExtensions($new = FALSE) {
78 $list = array();
79
80 if (!$new) {
81 $cat = $this->parentObject->defaultCategories;
82
83 $path = PATH_typo3 . 'sysext/';
84 $this->getInstExtList($path, $list, $cat, 'S');
85
86 $path = PATH_typo3 . 'ext/';
87 $this->getInstExtList($path, $list, $cat, 'G');
88
89 $path = PATH_typo3conf . 'ext/';
90 $this->getInstExtList($path, $list, $cat, 'L');
91
92 return array($list, $cat);
93 } else {
94 $path = PATH_typo3 . 'sysext/';
95 $this->getFlatInstExtList($path, $list, 'S');
96
97 $path = PATH_typo3 . 'ext/';
98 $this->getFlatInstExtList($path, $list, 'G');
99
100 $path = PATH_typo3conf . 'ext/';
101 $this->getFlatInstExtList($path, $list, 'L');
102
103 return $list;
104 }
105 }
106
107 /**
108 * Gathers all extensions in $path
109 *
110 * @param string Absolute path to local, global or system extensions
111 * @param array Array with information for each extension key found. Notice: passed by reference
112 * @param array Categories index: Contains extension titles grouped by various criteria.
113 * @param string Path-type: L, G or S
114 * @return void "Returns" content by reference
115 * @see getInstalledExtensions()
116 */
117 function getInstExtList($path, &$list, &$cat, $type) {
118
119 if (@is_dir($path)) {
120 $extList = t3lib_div::get_dirs($path);
121 if (is_array($extList)) {
122 foreach ($extList as $extKey) {
123 if (@is_file($path . $extKey . '/ext_emconf.php')) {
124 $emConf = tx_em_Tools::includeEMCONF($path . $extKey . '/ext_emconf.php', $extKey);
125 if (is_array($emConf)) {
126 if (is_array($list[$extKey])) {
127 $list[$extKey] = array('doubleInstall' => $list[$extKey]['doubleInstall']);
128 }
129 $list[$extKey]['extkey'] = $extKey;
130 $list[$extKey]['doubleInstall'] .= $type;
131 $list[$extKey]['type'] = $type;
132 $list[$extKey]['installed'] = t3lib_extMgm::isLoaded($extKey);
133 $list[$extKey]['EM_CONF'] = $emConf;
134 $list[$extKey]['files'] = t3lib_div::getFilesInDir($path . $extKey, '', 0, '', $this->excludeForPackaging);
135
136 tx_em_Tools::setCat($cat, $list[$extKey], $extKey);
137 }
138 }
139 }
140 }
141 }
142 }
143
144 /**
145 * Gathers all extensions in $path
146 *
147 * @param string Absolute path to local, global or system extensions
148 * @param array Array with information for each extension key found. Notice: passed by reference
149 * @param array Categories index: Contains extension titles grouped by various criteria.
150 * @param string Path-type: L, G or S
151 * @return void "Returns" content by reference
152 * @access private
153 * @see getInstalledExtensions()
154 */
155 function getFlatInstExtList($path, &$list, $type) {
156
157
158 if (@is_dir($path)) {
159 $extList = t3lib_div::get_dirs($path);
160 if (is_array($extList)) {
161 foreach ($extList as $extKey) {
162 $this->singleExtInfo($extKey, $path, $list, $type);
163 }
164 }
165 }
166 }
167
168 /**
169 * Gets a single extension info
170 *
171 * @param $extKey
172 * @param $path
173 * @param $list
174 * @param string $type
175 * @return void
176 */
177 public function singleExtInfo($extKey, $path, &$list, $type = '') {
178 if (@is_file($path . $extKey . '/ext_emconf.php')) {
179 $relPath = '../../../../' . substr($path, strlen(PATH_site));
180 $emConf = tx_em_Tools::includeEMCONF($path . $extKey . '/ext_emconf.php', $extKey);
181 $manual = $path . $extKey . '/doc/manual.sxw';
182 if ($type === '') {
183 $type = tx_em_Tools::getExtTypeFromPath($path);
184 }
185 if (is_array($emConf)) {
186 $key = count($list);
187 $loaded = t3lib_extMgm::isLoaded($extKey);
188 if (is_array($list[$key])) {
189 $list[$key] = array('doubleInstall' => $list[$key]['doubleInstall']);
190 }
191 $list[$key]['extkey'] = $extKey;
192 $list[$key]['path'] = $path . $extKey;
193 $list[$key]['nodePath'] = substr($path . $extKey, strlen(PATH_site));
194 $list[$key]['doubleInstall'] .= $this->types[$type];
195
196 $list[$key]['type'] = $this->types[$type];
197 $list[$key]['typeShort'] = $type;
198 $list[$key]['installed'] = $loaded ? 1 : 0;
199 // FIXME: raises PHP warning
200 // "Core: Error handler (BE): PHP Warning: htmlspecialchars() expects parameter 1 to be string, array given in [...]/typo3/mod/tools/em/classes/class.tx_em_extensions_list.php line 185
201 $list[$key] = t3lib_div::array_merge_recursive_overrule($list[$key], $emConf);
202 $list[$key]['title'] = htmlspecialchars($list[$key]['title']);
203 $list[$key]['description'] = htmlspecialchars($list[$key]['description']);
204 $list[$key]['files'] = t3lib_div::getFilesInDir($path . $extKey, '', 0, '', $this->excludeForPackaging);
205 $list[$key]['install'] = $loaded ? '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
206 'CMD[showExt]' => $extKey,
207 'CMD[remove]' => 1,
208 'CMD[clrCmd]' => 1,
209 'SET[singleDetails]' => 'info'
210 ))) . '">' . tx_em_Tools::removeButton() . '</a>' :
211 '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
212 'CMD[showExt]' => $extKey,
213 'CMD[load]' => 1,
214 'CMD[clrCmd]' => 1,
215 'SET[singleDetails]' => 'info'
216 ))) . '">' . tx_em_Tools::installButton() . '</a>';
217
218 $list[$key]['install'] = $loaded ? tx_em_Tools::removeButton() : tx_em_Tools::installButton();
219
220 $list[$key]['download'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
221 'CMD[doBackup]' => 1,
222 'SET[singleDetails]' => 'backup',
223 'CMD[showExt]' => $extKey
224 ))) . '">' .
225 t3lib_iconWorks::getSpriteIcon('actions-system-extension-download') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:download') . '" alt=""></a>';
226
227 $list[$key]['doc'] = '';
228 if (@is_file($manual)) {
229 $list[$key]['doc'] = '<a href="' . htmlspecialchars($relPath . $extKey . '/doc/manual.sxw') . '" target="_blank">
230 <img src="res/icons/oodoc.gif" width="13" height="16" title="' . $GLOBALS['LANG']->getLL('listRow_local_manual') . '" alt="" /></a>';
231 }
232 $list[$key]['icon'] = @is_file($path . $extKey . '/ext_icon.gif') ? '<img src="' . $relPath . $extKey . '/ext_icon.gif" alt="" width="16" height="16" />' : '<img src="clear.gif" alt="" width="16" height="16" />';
233
234 $list[$key]['categoryShort'] = $list[$key]['category'];
235 $list[$key]['category'] = $this->categories[$list[$key]['category']];
236
237 unset($list[$key]['_md5_values_when_last_written']);
238 }
239 }
240 }
241
242
243 /**
244 * Listing of loaded (installed) extensions
245 *
246 * @return void
247 */
248 function extensionList_loaded() {
249 global $TYPO3_LOADED_EXT;
250
251 list($list, $cat) = $this->getInstalledExtensions();
252
253 // Loaded extensions
254 $content = '';
255 $lines = array();
256
257 // Available extensions
258 if (is_array($cat[$this->parentObject->MOD_SETTINGS['listOrder']])) {
259 $content = '';
260 $lines = array();
261 $lines[] = $this->extensionListRowHeader(' class="t3-row-header"', array('<td><img src="clear.gif" width="1" height="1" alt="" /></td>'));
262
263 foreach ($cat[$this->parentObject->MOD_SETTINGS['listOrder']] as $catName => $extEkeys) {
264
265 natcasesort($extEkeys);
266 $extensions = array();
267 foreach ($extEkeys as $extKey => $data) {
268 if (array_key_exists($extKey, $TYPO3_LOADED_EXT) && ($this->parentObject->MOD_SETTINGS['display_shy'] || !$list[$extKey]['EM_CONF']['shy']) && $this->parentObject->searchExtension($extKey, $list[$extKey])) {
269 if (in_array($extKey, $this->parentObject->requiredExt)) {
270 $loadUnloadLink = '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
271 } else {
272 $loadUnloadLink = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
273 'CMD[showExt]' => $extKey,
274 'CMD[remove]' => 1
275 ))) . '">' . tx_em_Tools::removeButton() . '</a>';
276 }
277
278 $extensions[] = $this->extensionListRow($extKey, $list[$extKey], array('<td class="bgColor">' . $loadUnloadLink . '</td>'));
279
280 }
281 }
282 if (count($extensions)) {
283 $lines[] = '<tr><td colspan="' . (3 + $this->parentObject->detailCols[$this->parentObject->MOD_SETTINGS['display_details']]) . '"><br /></td></tr>';
284 $lines[] = '<tr><td colspan="' . (3 + $this->parentObject->detailCols[$this->parentObject->MOD_SETTINGS['display_details']]) . '">' . t3lib_iconWorks::getSpriteIcon('apps-filetree-folder-default') . '<strong>' . htmlspecialchars($this->parentObject->listOrderTitle($this->parentObject->MOD_SETTINGS['listOrder'], $catName)) . '</strong></td></tr>';
285 $lines[] = implode(LF, $extensions);
286 }
287 }
288 }
289
290 $content .= '<form action="' . $this->parentObject->script . '" method="post" name="lookupform">';
291 $content .= '<label for="lookUp">' . $GLOBALS['LANG']->getLL('look_up') . '</label> <input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->lookUpStr) . '" /><input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" /><br /><br />';
292
293 $content .= '</form>
294
295 <!-- Loaded Extensions List -->
296 <table border="0" cellpadding="2" cellspacing="1">' . implode('', $lines) . '</table>';
297
298 return $content;
299 }
300
301 /**
302 * Listing of available (installed) extensions
303 *
304 * @return void
305 */
306 function extensionList_installed() {
307
308 list($list, $cat) = $this->getInstalledExtensions();
309
310 // Available extensions
311 if (is_array($cat[$this->parentObject->MOD_SETTINGS['listOrder']])) {
312 $content = '';
313 $lines = array();
314 $lines[] = $this->extensionListRowHeader(' class="t3-row-header"', array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>'));
315
316 $allKeys = array();
317 foreach ($cat[$this->parentObject->MOD_SETTINGS['listOrder']] as $catName => $extEkeys) {
318 if (!$this->parentObject->MOD_SETTINGS['display_obsolete'] && $catName == 'obsolete') {
319 continue;
320 }
321
322 $allKeys[] = '';
323 $allKeys[] = 'TYPE: ' . $catName;
324
325 natcasesort($extEkeys);
326 $extensions = array();
327 foreach ($extEkeys as $extKey => $value) {
328 $allKeys[] = $extKey;
329 if ((!$list[$extKey]['EM_CONF']['shy'] || $this->parentObject->MOD_SETTINGS['display_shy']) &&
330 ($list[$extKey]['EM_CONF']['state'] != 'obsolete' || $this->parentObject->MOD_SETTINGS['display_obsolete'])
331 && $this->parentObject->searchExtension($extKey, $list[$extKey])) {
332 $loadUnloadLink = t3lib_extMgm::isLoaded($extKey) ?
333 '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
334 'CMD[showExt]' => $extKey,
335 'CMD[remove]' => 1,
336 'CMD[clrCmd]' => 1,
337 'SET[singleDetails]' => 'info'
338 ))) . '">' . tx_em_Tools::removeButton() . '</a>' :
339 '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
340 'CMD[showExt]' => $extKey,
341 'CMD[load]' => 1,
342 'CMD[clrCmd]' => 1,
343 'SET[singleDetails]' => 'info'
344 ))) . '">' . tx_em_Tools::installButton() . '</a>';
345 if (in_array($extKey, $this->parentObject->requiredExt)) {
346 $loadUnloadLink = '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
347 }
348 $theRowClass = t3lib_extMgm::isLoaded($extKey) ? 'em-listbg1' : 'em-listbg2';
349 $extensions[] = $this->extensionListRow($extKey, $list[$extKey], array('<td class="bgColor">' . $loadUnloadLink . '</td>'), $theRowClass);
350 }
351 }
352 if (count($extensions)) {
353 $lines[] = '<tr><td colspan="' . (3 + $this->parentObject->detailCols[$this->parentObject->MOD_SETTINGS['display_details']]) . '"><br /></td></tr>';
354 $lines[] = '<tr><td colspan="' . (3 + $this->parentObject->detailCols[$this->parentObject->MOD_SETTINGS['display_details']]) . '">' . t3lib_iconWorks::getSpriteIcon('apps-filetree-folder-default') . '<strong>' . htmlspecialchars($this->parentObject->listOrderTitle($this->parentObject->MOD_SETTINGS['listOrder'], $catName)) . '</strong></td></tr>';
355 $lines[] = implode(LF, $extensions);
356 }
357 }
358
359 $content .= '
360
361
362 <!--
363 EXTENSION KEYS:
364
365 ' . trim(implode(LF, $allKeys)) . '
366
367 -->
368
369 ';
370
371 $content .= sprintf($GLOBALS['LANG']->getLL('how_to_install'), tx_em_Tools::installButton()) . ' <br />' .
372 sprintf($GLOBALS['LANG']->getLL('how_to_uninstall'), tx_em_Tools::removeButton()) . ' <br /><br />';
373 $content .= '<form action="' . $this->parentObject->script . '" method="post" name="lookupform">';
374 $content .= '<label for="lookUp">' . $GLOBALS['LANG']->getLL('look_up') . '</label> <input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->parentObject->lookUpStr) . '" /><input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" /></form><br /><br />';
375 $content .= $this->securityHint . '<br /><br />';
376
377 $content .= '<table border="0" cellpadding="2" cellspacing="1">' . implode('', $lines) . '</table>';
378
379 return $content;
380 }
381 }
382
383
384 /**
385 * Prints the header row for the various listings
386 *
387 * @param string Attributes for the <tr> tag
388 * @param array Preset cells in the beginning of the row. Typically a blank cell with a clear-gif
389 * @param boolean If set, the list is coming from remote server.
390 * @return string HTML <tr> table row
391 */
392 function extensionListRowHeader($trAttrib, $cells, $import = 0) {
393 $cells[] = '<td></td>';
394 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_title') . '</td>';
395
396 if (!$this->parentObject->MOD_SETTINGS['display_details']) {
397 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_description') . '</td>';
398 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_author') . '</td>';
399 } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 2) {
400 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_priority') . '</td>';
401 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_modifies_tables_short') . '</td>';
402 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_modules') . '</td>';
403 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_clear_cache_short') . '</td>';
404 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_internal') . '</td>';
405 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_shy') . '</td>';
406 } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 3) {
407 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_tables_fields') . '</td>';
408 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_ts_files') . '</td>';
409 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_affects') . '</td>';
410 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_modules') . '</td>';
411 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_config') . '</td>';
412 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_code_warnings') . '</td>';
413 } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 4) {
414 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_locallang') . '</td>';
415 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_classes') . '</td>';
416 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_code_warnings') . '</td>';
417 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_annoyances') . '</td>';
418 } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 5) {
419 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_changed_files') . '</td>';
420 } else {
421 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_ext_key') . '</td>';
422 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_version') . '</td>';
423 if (!$import) {
424 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_download_short') . '</td>';
425 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_documentation_short') . '</td>';
426 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('listRowHeader_type') . '</td>';
427 } else {
428 $cells[] = '<td' . tx_em_Tools::labelInfo($GLOBALS['LANG']->getLL('listRowHeader_title_upload_date')) . '>' .
429 $GLOBALS['LANG']->getLL('listRowHeader_upload_date') . '</td>';
430 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_author') . '</td>';
431 $cells[] = '<td' . tx_em_Tools::labelInfo($GLOBALS['LANG']->getLL('listRowHeader_title_current_version')) . '>' .
432 $GLOBALS['LANG']->getLL('listRowHeader_current_version') . '</td>';
433 $cells[] = '<td' . tx_em_Tools::labelInfo($GLOBALS['LANG']->getLL('listRowHeader_title_current_type')) . '>' .
434 $GLOBALS['LANG']->getLL('listRowHeader_current_type') . '</td>';
435 $cells[] = '<td' . tx_em_Tools::labelInfo($GLOBALS['LANG']->getLL('listRowHeader_title_number_of_downloads')) . '>' .
436 $GLOBALS['LANG']->getLL('listRowHeader_download_short') . '</td>';
437 }
438 $cells[] = '<td>' . $GLOBALS['LANG']->getLL('extInfoArray_state') . '</td>';
439 }
440 return '
441 <tr' . $trAttrib . '>
442 ' . implode('
443 ', $cells) . '
444 </tr>';
445 }
446
447
448 /**
449 * Prints a row with data for the various extension listings
450 *
451 * @param string Extension key
452 * @param array Extension information array
453 * @param array Preset table cells, eg. install/uninstall icons.
454 * @param string <tr> tag class
455 * @param array Array with installed extension keys (as keys)
456 * @param boolean If set, the list is coming from remote server.
457 * @param string Alternative link URL
458 * @return string HTML <tr> content
459 */
460 function extensionListRow($extKey, $extInfo, $cells, $bgColorClass = '', $inst_list = array(), $import = 0, $altLinkUrl = '') {
461 // Icon:
462 $imgInfo = @getImageSize(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . '/ext_icon.gif');
463 if (is_array($imgInfo)) {
464 $cells[] = '<td><img src="' . $GLOBALS['BACK_PATH'] . $this->parentObject->typeRelPaths[$extInfo['type']] . $extKey . '/ext_icon.gif' . '" ' . $imgInfo[3] . ' alt="" /></td>';
465 } elseif ($extInfo['_ICON']) {
466 $cells[] = '<td>' . $extInfo['_ICON'] . '</td>';
467 } else {
468 $cells[] = '<td><img src="clear.gif" width="1" height="1" alt="" /></td>';
469 }
470
471 // Extension title:
472 $cells[] = '<td nowrap="nowrap"><a href="' . htmlspecialchars($altLinkUrl ? $altLinkUrl : t3lib_div::linkThisScript(array(
473 'CMD[showExt]' => $extKey,
474 'SET[singleDetails]' => 'info'
475 ))) . '" title="' . htmlspecialchars($extInfo['EM_CONF']['description']) . '">'
476 . t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['title'] ? htmlspecialchars($extInfo['EM_CONF']['title']) : '<em>' . $extKey . '</em>', 40) . '</a></td>';
477
478 // Based on the display mode you will see more or less details:
479 if (!$this->parentObject->MOD_SETTINGS['display_details']) {
480 $cells[] = '<td>' . htmlspecialchars(t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['description'], 400)) . '<br /><img src="clear.gif" width="300" height="1" alt="" /></td>';
481 $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['author_email'] ? '<a href="mailto:' . htmlspecialchars($extInfo['EM_CONF']['author_email']) . '">' : '') . htmlspecialchars($extInfo['EM_CONF']['author']) . (htmlspecialchars($extInfo['EM_CONF']['author_email']) ? '</a>' : '') . ($extInfo['EM_CONF']['author_company'] ? '<br />' . htmlspecialchars($extInfo['EM_CONF']['author_company']) : '') . '</td>';
482 } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 2) {
483 $cells[] = '<td nowrap="nowrap">' . $extInfo['EM_CONF']['priority'] . '</td>';
484 $cells[] = '<td nowrap="nowrap">' . implode('<br />', t3lib_div::trimExplode(',', $extInfo['EM_CONF']['modify_tables'], 1)) . '</td>';
485 $cells[] = '<td nowrap="nowrap">' . $extInfo['EM_CONF']['module'] . '</td>';
486 $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['clearCacheOnLoad'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>';
487 $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['internal'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>';
488 $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['shy'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>';
489 } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 3) {
490 $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $extInfo);
491
492 $cells[] = '<td>' . $this->parentObject->extensionDetails->extInformationArray_dbReq($techInfo) .
493 '</td>';
494 $cells[] = '<td nowrap="nowrap">' . (is_array($techInfo['TSfiles']) ? implode('<br />', $techInfo['TSfiles']) : '') . '</td>';
495 $cells[] = '<td nowrap="nowrap">' . (is_array($techInfo['flags']) ? implode('<br />', $techInfo['flags']) : '') . '</td>';
496 $cells[] = '<td nowrap="nowrap">' . (is_array($techInfo['moduleNames']) ? implode('<br />', $techInfo['moduleNames']) : '') . '</td>';
497 $cells[] = '<td nowrap="nowrap">' . ($techInfo['conf'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>';
498 $cells[] = '<td>' .
499 $GLOBALS['TBE_TEMPLATE']->rfw((t3lib_extMgm::isLoaded($extKey) && $techInfo['tables_error'] ?
500 '<strong>' . $GLOBALS['LANG']->getLL('extInfoArray_table_error') . '</strong><br />' .
501 $GLOBALS['LANG']->getLL('extInfoArray_missing_fields') : '') .
502 (t3lib_extMgm::isLoaded($extKey) && $techInfo['static_error'] ?
503 '<strong>' . $GLOBALS['LANG']->getLL('extInfoArray_static_table_error') . '</strong><br />' .
504 $GLOBALS['LANG']->getLL('extInfoArray_static_tables_missing_empty') : '')) .
505 '</td>';
506 } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 4) {
507 $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $extInfo, 1);
508
509 $cells[] = '<td>' . (is_array($techInfo['locallang']) ? implode('<br />', $techInfo['locallang']) : '') . '</td>';
510 $cells[] = '<td>' . (is_array($techInfo['classes']) ? implode('<br />', $techInfo['classes']) : '') . '</td>';
511 $cells[] = '<td>' . (is_array($techInfo['errors']) ? $GLOBALS['TBE_TEMPLATE']->rfw(implode('<hr />', $techInfo['errors'])) : '') . '</td>';
512 $cells[] = '<td>' . (is_array($techInfo['NSerrors']) ?
513 (!t3lib_div::inList($this->parentObject->nameSpaceExceptions, $extKey) ?
514 t3lib_utility_Debug::viewarray($techInfo['NSerrors']) :
515 $GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('extInfoArray_exception'))) : '') . '</td>';
516 } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 5) {
517 $currentMd5Array = $this->parentObject->extensionDetails->serverExtensionMD5array($extKey, $extInfo);
518 $affectedFiles = '';
519 $msgLines = array();
520 $msgLines[] = $GLOBALS['LANG']->getLL('listRow_files') . ' ' . count($currentMd5Array);
521 if (strcmp($extInfo['EM_CONF']['_md5_values_when_last_written'], serialize($currentMd5Array))) {
522 $msgLines[] = $GLOBALS['TBE_TEMPLATE']->rfw('<br /><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_difference_detected') . '</strong>');
523 $affectedFiles = tx_em_Tools::findMD5ArrayDiff($currentMd5Array, unserialize($extInfo['EM_CONF']['_md5_values_when_last_written']));
524 if (count($affectedFiles)) {
525 $msgLines[] = '<br /><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_modified_files') . '</strong><br />' .
526 $GLOBALS['TBE_TEMPLATE']->rfw(implode('<br />', $affectedFiles));
527 }
528 }
529 $cells[] = '<td>' . implode('<br />', $msgLines) . '</td>';
530 } else {
531 // Default view:
532 $verDiff = $inst_list[$extKey] && tx_em_Tools::versionDifference($extInfo['EM_CONF']['version'], $inst_list[$extKey]['EM_CONF']['version'], $this->parentObject->versionDiffFactor);
533
534 $cells[] = '<td nowrap="nowrap"><em>' . $extKey . '</em></td>';
535 $cells[] = '<td nowrap="nowrap">' . ($verDiff ? '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw(htmlspecialchars($extInfo['EM_CONF']['version'])) . '</strong>' : $extInfo['EM_CONF']['version']) . '</td>';
536 if (!$import) { // Listing extension on LOCAL server:
537 // Extension Download:
538 $cells[] = '<td nowrap="nowrap"><a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
539 'CMD[doBackup]' => 1,
540 'SET[singleDetails]' => 'backup',
541 'CMD[showExt]' => $extKey
542 ))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:download') . '">' .
543 t3lib_iconWorks::getSpriteIcon('actions-system-extension-download') .
544 '</a></td>';
545
546 // Manual download
547 $fileP = PATH_site . tx_em_Tools::typePath($extInfo['type']) . $extKey . '/doc/manual.sxw';
548 $cells[] = '<td nowrap="nowrap">' .
549 (tx_em_Tools::typePath($extInfo['type']) && @is_file($fileP) ?
550 '<a href="' . htmlspecialchars(t3lib_div::resolveBackPath($this->parentObject->doc->backPath . '../' .
551 tx_em_Tools::typePath($extInfo['type']) . $extKey . '/doc/manual.sxw')) . '" target="_blank" title="' . $GLOBALS['LANG']->getLL('listRow_local_manual') . '">' .
552 t3lib_iconWorks::getSpriteIcon('actions-system-extension-documentation') . '</a>' : '') .
553 '</td>';
554
555 // Double installation (inclusion of an extension in more than one of system, global or local scopes)
556 $doubleInstall = '';
557 if (strlen($extInfo['doubleInstall']) > 1) {
558 // Separate the "SL" et al. string into an array and replace L by Local, G by Global etc.
559 $doubleInstallations = str_replace(
560 array('S', 'G', 'L'),
561 array(
562 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:sysext'),
563 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:globalext'),
564 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:localext')
565 ),
566 str_split($extInfo['doubleInstall'])
567 );
568 // Last extension is the one actually used
569 $usedExtension = array_pop($doubleInstallations);
570 // Next extension is overridden
571 $overriddenExtensions = array_pop($doubleInstallations);
572 // If the array is not yet empty, the extension is actually installed 3 times (SGL)
573 if (count($doubleInstallations) > 0) {
574 $lastExtension = array_pop($doubleInstallations);
575 $overriddenExtensions .= ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:and') . ' ' . $lastExtension;
576 }
577 $doubleInstallTitle = sprintf(
578 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:double_inclusion'),
579 $usedExtension,
580 $overriddenExtensions
581 );
582 $doubleInstall = ' <strong><abbr title="' . $doubleInstallTitle . '">' . $GLOBALS['TBE_TEMPLATE']->rfw($extInfo['doubleInstall']) . '</abbr></strong>';
583 }
584 $cells[] = '<td nowrap="nowrap">' . $this->parentObject->typeLabels[$extInfo['type']] . $doubleInstall . '</td>';
585 } else { // Listing extensions from REMOTE repository:
586 $inst_curVer = $inst_list[$extKey]['EM_CONF']['version'];
587 if (isset($inst_list[$extKey])) {
588 if ($verDiff) {
589 $inst_curVer = '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw($inst_curVer) . '</strong>';
590 }
591 }
592 $cells[] = '<td nowrap="nowrap">' . t3lib_befunc::date($extInfo['EM_CONF']['lastuploaddate']) . '</td>';
593 $cells[] = '<td nowrap="nowrap">' . htmlspecialchars(t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['author'], $GLOBALS['BE_USER']->uc[titleLen])) . '</td>';
594 $cells[] = '<td nowrap="nowrap">' . $inst_curVer . '</td>';
595 $cells[] = '<td nowrap="nowrap">' . $this->parentObject->typeLabels[$inst_list[$extKey]['type']] . (strlen($inst_list[$extKey]['doubleInstall']) > 1 ? '<strong> ' . $GLOBALS['TBE_TEMPLATE']->rfw($inst_list[$extKey]['doubleInstall']) . '</strong>' : '') . '</td>';
596 $cells[] = '<td nowrap="nowrap">' . ($extInfo['downloadcounter_all'] ? $extInfo['downloadcounter_all'] : '&nbsp;&nbsp;') . '/' . ($extInfo['downloadcounter'] ? $extInfo['downloadcounter'] : '&nbsp;') . '</td>';
597 }
598 $cells[] = '<td nowrap="nowrap" class="extstate" style="background-color:' . $this->parentObject->stateColors[$extInfo['EM_CONF']['state']] . ';">' . $this->parentObject->states[$extInfo['EM_CONF']['state']] . '</td>';
599 }
600
601 // show a different background through a different class for insecure (-1) extensions,
602 // for unreviewed (0) and reviewed extensions (1), just use the regular class
603 if ($this->parentObject->xmlhandler->getReviewState($extKey, $extInfo['EM_CONF']['version']) < 0) {
604 $bgclass = ' class="unsupported-ext"';
605 } else {
606 $bgclass = ' class="' . ($bgColorClass ? $bgColorClass : 'em-listbg1') . '"';
607 }
608
609 return '
610 <tr' . $bgclass . '>
611 ' . implode('
612 ', $cells) . '
613 </tr>';
614 }
615
616
617 /**
618 * Displays a list of extensions where a newer version is available
619 * in the TER than the one that is installed right now
620 * integrated from the extension "ter_update_check" for TYPO3 4.2 by Christian Welzel
621 *
622 * @return string
623 */
624 function showExtensionsToUpdate() {
625 global $LANG;
626 $extList = $this->getInstalledExtensions();
627
628 $content = '<table border="0" cellpadding="2" cellspacing="1">' .
629 '<tr class="t3-row-header">' .
630 '<td></td>' .
631 '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_name') . '</td>' .
632 '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_key') . '</td>' .
633 '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_loc_ver') . '</td>' .
634 '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_rem_ver') . '</td>' .
635 '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_location') . '</td>' .
636 '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_comment') . '</td>' .
637 '</tr>';
638
639 foreach ($extList[0] as $name => $data) {
640 $this->parentObject->xmlhandler->searchExtensionsXMLExact($name, '', '', TRUE, TRUE);
641 if (!is_array($this->parentObject->xmlhandler->extensionsXML[$name])) {
642 continue;
643 }
644
645 $v = $this->parentObject->xmlhandler->extensionsXML[$name]['versions'];
646 $versions = array_keys($v);
647 natsort($versions);
648 $lastversion = end($versions);
649
650 if ((t3lib_extMgm::isLoaded($name) || $this->parentObject->MOD_SETTINGS['display_installed']) &&
651 ($data['EM_CONF']['shy'] == 0 || $this->parentObject->MOD_SETTINGS['display_shy']) &&
652 tx_em_Tools::versionDifference($lastversion, $data['EM_CONF']['version'], 1)) {
653
654 $imgInfo = @getImageSize(tx_em_Tools::getExtPath($name, $data['type']) . '/ext_icon.gif');
655 if (is_array($imgInfo)) {
656 $icon = '<img src="' . $GLOBALS['BACK_PATH'] . $this->parentObject->typeRelPaths[$data['type']] . $name . '/ext_icon.gif' . '" ' . $imgInfo[3] . ' alt="" />';
657 } elseif ($data['_ICON']) { //TODO: see if this can be removed, seems to be wrong in this context
658 $icon = $data['_ICON'];
659 } else {
660 $icon = '<img src="clear.gif" width="1" height="1" alt="" />';
661 }
662 $comment = '<table cellpadding="0" cellspacing="0" width="100%">';
663 foreach ($versions as $vk) {
664 $va = & $v[$vk];
665 if (t3lib_div::int_from_ver($vk) <= t3lib_div::int_from_ver($data['EM_CONF']['version'])) {
666 continue;
667 }
668 $comment .= '<tr><td valign="top" style="padding-right:2px;border-bottom:1px dotted gray">' . $vk . '</td>' . '<td valign="top" style="border-bottom:1px dotted gray">' . nl2br($va[uploadcomment]) . '</td></tr>';
669 }
670 $comment .= '</table>';
671
672 $serverMD5Array = $this->parentObject->extensionDetails->serverExtensionMD5array($name, $data);
673 if (is_array($serverMD5Array)) {
674 ksort($serverMD5Array);
675 }
676 $currentMD5Array = unserialize($data['EM_CONF']['_md5_values_when_last_written']);
677 if (is_array($currentMD5Array)) {
678 @ksort($currentMD5Array);
679 }
680 $warn = '';
681 if (strcmp(serialize($currentMD5Array), serialize($serverMD5Array))) {
682 $warn = '<tr class="bgColor4" style="color:red"><td colspan="7">' . $GLOBALS['TBE_TEMPLATE']->rfw('<br /><strong>' . $name . ': ' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:msg_warn_diff') . '</strong>') . '</td></tr>' . LF;
683 if ($this->parentObject->MOD_SETTINGS['display_files'] == 1) {
684 $affectedFiles = tx_em_Tools::findMD5ArrayDiff($serverMD5Array, $currentMD5Array);
685 if (count($affectedFiles)) {
686 $warn .= '<tr class="bgColor4"><td colspan="7"><strong>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:msg_modified') . '</strong><br />' . $GLOBALS['TBE_TEMPLATE']->rfw(implode('<br />', $affectedFiles)) . '</td></tr>' . LF;
687 }
688 }
689 }
690 //TODO: $extInfo is unknown in this context
691 $content .= '<tr class="bgColor4"><td valign="top">' . $icon . '</td>' .
692 '<td valign="top">' . ($data['EM_CONF']['state'] == 'excludeFromUpdates'
693 ? '<span style="color:#cf7307">' . $data['EM_CONF']['title'] . ' ' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:write_protected') . '</span>'
694 : '<a href="' . t3lib_div::linkThisScript(array(
695 'CMD[importExtInfo]' => $name
696 )) . '">' . $data[EM_CONF][title] . '</a>') . '</td>' .
697 '<td valign="top">' . $name . '</td>' .
698 '<td valign="top" align="right">' . $data[EM_CONF][version] . '</td>' .
699 '<td valign="top" align="right">' . $lastversion . '</td>' .
700 '<td valign="top" nowrap="nowrap">' . $this->parentObject->typeLabels[$data['type']] . (strlen($data['doubleInstall']) > 1 ? '<strong> ' . $GLOBALS['TBE_TEMPLATE']->rfw($extInfo['doubleInstall']) . '</strong>' : '') . '</td>' .
701 '<td valign="top">' . $comment . '</td></tr>' . LF .
702 $warn .
703 '<tr class="bgColor4"><td colspan="7"><hr style="margin:0px" /></td></tr>' . LF;
704 }
705 }
706
707 return $content . '</table><br />';
708 }
709
710 /**
711 * Maps remote extensions information into $cat/$list arrays for listing
712 *
713 * @param boolean If set the info in the internal extensionsXML array will be unset before returning the result.
714 * @return array List array and category index as key 0 / 1 in an array.
715 */
716 function prepareImportExtList($unsetProc = false) {
717 $list = array();
718 $cat = $this->parentObject->defaultCategories;
719 $filepath = $this->parentObject->getMirrorURL();
720
721 foreach ($this->parentObject->xmlhandler->extensionsXML as $extKey => $data) {
722 $GLOBALS['LANG']->csConvObj->convarray($data, 'utf-8', $GLOBALS['LANG']->charSet); // is there a better place for conversion?
723 $list[$extKey]['type'] = '_';
724 $version = array_keys($data['versions']);
725 $extPath = t3lib_div::strtolower($extKey);
726 $list[$extKey]['_ICON'] = '<img alt="" src="' . $filepath . $extPath{0} . '/' . $extPath{1} . '/' . $extPath . '_' . end($version) . '.gif" />';
727 $list[$extKey]['downloadcounter'] = $data['downloadcounter'];
728
729 foreach (array_keys($data['versions']) as $version) {
730 $list[$extKey]['versions'][$version]['downloadcounter'] = $data['versions'][$version]['downloadcounter'];
731
732 $list[$extKey]['versions'][$version]['EM_CONF'] = array(
733 'version' => $version,
734 'title' => $data['versions'][$version]['title'],
735 'description' => $data['versions'][$version]['description'],
736 'category' => $data['versions'][$version]['category'],
737 'constraints' => $data['versions'][$version]['dependencies'],
738 'state' => $data['versions'][$version]['state'],
739 'reviewstate' => $data['versions'][$version]['reviewstate'],
740 'lastuploaddate' => $data['versions'][$version]['lastuploaddate'],
741 'author' => $data['versions'][$version]['authorname'],
742 'author_email' => $data['versions'][$version]['authoremail'],
743 'author_company' => $data['versions'][$version]['authorcompany'],
744 );
745 }
746 tx_em_Tools::setCat($cat, $list[$extKey]['versions'][$version], $extKey);
747 if ($unsetProc) {
748 unset($this->parentObject->xmlhandler->extensionsXML[$extKey]);
749 }
750 }
751
752 return array($list, $cat);
753 }
754
755
756 /**
757 * Adds extension to extension list and returns new list. If -1 is returned, an error happend.
758 * Checks dependencies etc.
759 *
760 * @param string Extension key
761 * @param array Extension information array - information about installed extensions
762 * @return string New list of installed extensions or -1 if error
763 * @see showExtDetails()
764 */
765 function addExtToList($extKey, $instExtInfo) {
766 global $TYPO3_LOADED_EXT;
767
768 // ext_emconf.php information:
769 $conf = $instExtInfo[$extKey]['EM_CONF'];
770
771 // Get list of installed extensions and add this one.
772 $listArr = array_keys($TYPO3_LOADED_EXT);
773 if ($conf['priority'] == 'top') {
774 array_unshift($listArr, $extKey);
775 } else {
776 $listArr[] = $extKey;
777 }
778
779 // Manage other circumstances:
780 $listArr = tx_em_Tools::managesPriorities($listArr, $instExtInfo);
781 $listArr = $this->removeRequiredExtFromListArr($listArr);
782
783 // Implode unique list of extensions to load and return:
784 $list = implode(',', array_unique($listArr));
785
786 return $list;
787 }
788
789 /**
790 * Remove extension key from the list of currently installed extensions and return list. If -1 is returned, an error happend.
791 * Checks dependencies etc.
792 *
793 * @param string Extension key
794 * @param array Extension information array - information about installed extensions
795 * @return string New list of installed extensions or -1 if error
796 * @see showExtDetails()
797 */
798 function removeExtFromList($extKey, $instExtInfo) {
799 global $TYPO3_LOADED_EXT;
800
801 // Initialize:
802 $depList = array();
803 $listArr = array_keys($TYPO3_LOADED_EXT);
804
805 // Traverse all installed extensions to check if any of them have this extension as dependency since if that is the case it will not work out!
806 foreach ($listArr as $k => $ext) {
807 if ($instExtInfo[$ext]['EM_CONF']['dependencies']) {
808 $dep = t3lib_div::trimExplode(',', $instExtInfo[$ext]['EM_CONF']['dependencies'], 1);
809 if (in_array($extKey, $dep)) {
810 $depList[] = $ext;
811 }
812 }
813 if (!strcmp($ext, $extKey)) {
814 unset($listArr[$k]);
815 }
816 }
817
818 // Returns either error or the new list
819 if (count($depList)) {
820 $msg = sprintf($GLOBALS['LANG']->getLL('removeExtFromList_dependency'),
821 implode(', ', $depList)
822 );
823 $this->parentObject->content .= $this->parentObject->doc->section($GLOBALS['LANG']->getLL('removeExtFromList_dependency_error'), $msg, 0, 1, 2);
824 return -1;
825 } else {
826 $listArr = $this->removeRequiredExtFromListArr($listArr);
827 $list = implode(',', array_unique($listArr));
828 return $list;
829 }
830 }
831
832 /**
833 * This removes any required extensions from the $listArr - they should NOT be added to the common extension list, because they are found already in "requiredExt" list
834 *
835 * @param array Array of extension keys as values
836 * @return array Modified array
837 * @see removeExtFromList(), addExtToList()
838 */
839 function removeRequiredExtFromListArr($listArr) {
840 $requiredExtensions = t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXT']['requiredExt'], 1);
841 foreach ($listArr as $k => $ext) {
842 if (in_array($ext, $requiredExtensions) || !strcmp($ext, '_CACHEFILE')) {
843 unset($listArr[$k]);
844 }
845 }
846 return $listArr;
847 }
848
849
850 }
851
852 ?>