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