[TASK] Use t3lib_BEfunc instead of date()
[Packages/TYPO3.CMS.git] / typo3 / sysext / em / classes / index.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * (c) 2005-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 /**
29 * Module: Extension manager
30 *
31 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
32 * @author Karsten Dambekalns <karsten@typo3.org>
33 * @author Steffen Kamper <info@sk-typo3.de>
34 */
35
36 $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath('em') . 'language/locallang.xml');
37
38 // from tx_ter by Robert Lemke
39 define('TX_TER_RESULT_EXTENSIONSUCCESSFULLYUPLOADED', '10504');
40
41 define('EM_INSTALL_VERSION_MIN', 1);
42 define('EM_INSTALL_VERSION_MAX', 2);
43 define('EM_INSTALL_VERSION_STRICT', 3);
44
45 unset($MCONF);
46 require('conf.php');
47
48 $BE_USER->modAccess($MCONF, 1);
49
50
51 /**
52 * Module: Extension manager
53 *
54 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
55 * @author Karsten Dambekalns <karsten@typo3.org>
56 * @package TYPO3
57 * @subpackage core
58 */
59 class SC_mod_tools_em_index extends t3lib_SCbase {
60
61 // Internal, static:
62 var $versionDiffFactor = 1; // This means that version difference testing for import is detected for sub-versions only, not dev-versions. Default: 1000
63 var $systemInstall = 0; // If "1" then installs in the sysext directory is allowed. Default: 0
64 var $requiredExt = ''; // List of required extension (from TYPO3_CONF_VARS)
65 var $maxUploadSize = 31457280; // Max size in bytes of extension upload to repository
66 var $kbMax = 500; // Max size in kilobytes for files to be edited.
67 var $doPrintContent = TRUE; // If set (default), the function printContent() will echo the content which was collected in $this->content. You can set this to FALSE in order to echo content from elsewhere, fx. when using outbut buffering
68 var $listingLimit = 500; // List that many extension maximally at one time (fixing memory problems)
69 var $listingLimitAuthor = 250; // List that many extension maximally at one time (fixing memory problems)
70 var $script = ''; //URL to this script
71
72
73 var $categories = array(); // Extension Categories (static var); see init()
74
75 var $states = array(); // Extension States; see init()
76
77 var $typeDescr = array();
78
79 var $detailCols = array(
80 0 => 2,
81 1 => 5,
82 2 => 6,
83 3 => 6,
84 4 => 4,
85 5 => 1
86 );
87
88 var $fe_user = array(
89 'username' => '',
90 'password' => '',
91 );
92
93 var $privacyNotice; // Set in init()
94 var $securityHint; // Set in init()
95 var $editTextExtensions = 'html,htm,txt,css,tmpl,inc,php,sql,conf,cnf,pl,pm,sh,xml,ChangeLog';
96 var $nameSpaceExceptions = 'beuser_tracking,design_components,impexp,static_file_edit,cms,freesite,quickhelp,classic_welcome,indexed_search,sys_action,sys_workflows,sys_todos,sys_messages,direct_mail,sys_stat,tt_address,tt_board,tt_calender,tt_guest,tt_links,tt_news,tt_poll,tt_rating,tt_products,setup,taskcenter,tsconfig_help,context_help,sys_note,tstemplate,lowlevel,install,belog,beuser,phpmyadmin,aboutmodules,imagelist,setup,taskcenter,sys_notepad,viewpage,adodb';
97
98
99 // Default variables for backend modules
100 var $MCONF = array(); // Module configuration
101 var $MOD_MENU = array(); // Module menu items
102 var $MOD_SETTINGS = array(); // Module session settings
103 /**
104 * Document Template Object
105 *
106 * @var noDoc
107 */
108 var $doc;
109 var $content; // Accumulated content
110
111 var $inst_keys = array(); // Storage of installed extensions
112 var $gzcompress = 0; // Is set TRUE, if system support compression.
113
114 /**
115 * Instance of EM API
116 *
117 * @var tx_em_API
118 */
119 protected $api;
120
121 /**
122 * Instance of TER connection handler
123 *
124 * @var tx_em_Connection_Ter
125 */
126 public $terConnection;
127
128 /**
129 * XML handling class for the TYPO3 Extension Manager
130 *
131 * @var tx_em_Tools_XmlHandler
132 */
133 public $xmlHandler;
134
135 /**
136 * Class for printing extension lists
137 *
138 * @var tx_em_Extensions_List
139 */
140 public $extensionList;
141
142 /**
143 * Class for extension details
144 *
145 * @var tx_em_Extensions_Details
146 */
147 public $extensionDetails;
148
149 /**
150 * Class for new ExtJs Extension Manager
151 *
152 * @var tx_em_ExtensionManager
153 */
154 public $extensionmanager;
155
156 /**
157 * Class for translation handling
158 *
159 * @var tx_em_Translations
160 */
161 public $translations;
162
163 /**
164 * Class for install extensions
165 *
166 * @var tx_em_Install
167 */
168 public $install;
169
170 /**
171 * Settings object
172 *
173 * @var tx_em_Settings
174 */
175 public $settings;
176
177 /**
178 * @var string
179 */
180 protected $excludeForPackaging;
181
182 /**
183 * @var string
184 */
185 protected $listRemote_search;
186
187 /**
188 * @var string
189 */
190 protected $descrTable;
191
192 var $JScode; // JavaScript code to be forwarded to $this->doc->JScode
193
194 // GPvars:
195 var $CMD = array(); // CMD array
196 var $listRemote; // If set, connects to remote repository
197 var $lookUpStr; // Search string when listing local extensions
198
199
200 protected $noDocHeader = 0;
201
202 /*********************************
203 *
204 * Standard module initialization
205 *
206 *********************************/
207
208 /**
209 * Standard init function of a module.
210 *
211 * @return void
212 */
213 function init() {
214 /**
215 * Extension Categories (static var)
216 * Content must be redundant with the same internal variable as in class.tx_extrep.php!
217 */
218 $this->categories = array(
219 'be' => $GLOBALS['LANG']->getLL('category_BE'),
220 'module' => $GLOBALS['LANG']->getLL('category_BE_modules'),
221 'fe' => $GLOBALS['LANG']->getLL('category_FE'),
222 'plugin' => $GLOBALS['LANG']->getLL('category_FE_plugins'),
223 'misc' => $GLOBALS['LANG']->getLL('category_miscellanous'),
224 'services' => $GLOBALS['LANG']->getLL('category_services'),
225 'templates' => $GLOBALS['LANG']->getLL('category_templates'),
226 'example' => $GLOBALS['LANG']->getLL('category_examples'),
227 'doc' => $GLOBALS['LANG']->getLL('category_documentation')
228 );
229
230 /**
231 * Extension States
232 * Content must be redundant with the same internal variable as in class.tx_extrep.php!
233 */
234 $this->states = tx_em_Tools::getStates();
235
236 $this->script = 'mod.php?M=tools_em';
237 $this->privacyNotice = $GLOBALS['LANG']->getLL('privacy_notice');
238 $securityMessage = $GLOBALS['LANG']->getLL('security_warning_extensions') .
239 '<br /><br />' . sprintf($GLOBALS['LANG']->getLL('security_descr'),
240 '<a href="http://typo3.org/teams/security/" target="_blank">', '</a>'
241 );
242 /** @var $flashMessage t3lib_FlashMessage */
243 $flashMessage = t3lib_div::makeInstance(
244 't3lib_FlashMessage',
245 $securityMessage,
246 $GLOBALS['LANG']->getLL('security_header'),
247 t3lib_FlashMessage::INFO
248 );
249 $this->securityHint = $flashMessage->render();
250
251 $this->excludeForPackaging = $GLOBALS['TYPO3_CONF_VARS']['EXT']['excludeForPackaging'];
252
253 // Setting module configuration:
254 $this->MCONF = $GLOBALS['MCONF'];
255
256 // Setting GPvars:
257 $this->CMD = is_array(t3lib_div::_GP('CMD')) ? t3lib_div::_GP('CMD') : array();
258 $this->lookUpStr = trim(t3lib_div::_GP('lookUp'));
259 $this->listRemote = t3lib_div::_GP('ter_connect');
260 $this->listRemote_search = trim(t3lib_div::_GP('ter_search'));
261 $this->noDocHeader = intval(t3lib_div::_GP('nodoc') > 0);
262
263 $this->settings = t3lib_div::makeInstance('tx_em_Settings');
264 $this->install = t3lib_div::makeInstance('tx_em_Install', $this);
265
266 if (t3lib_div::_GP('silentMode') || $this->noDocHeader) {
267 $this->CMD['silentMode'] = 1;
268 $this->noDocHeader = 1;
269 }
270
271 if ($this->CMD['silentMode']) {
272 $this->install->setSilentMode(TRUE);
273 }
274
275 // Configure menu
276 $this->menuConfig();
277
278 // Setting internal static:
279
280 $this->requiredExt = t3lib_div::trimExplode(',', t3lib_extMgm::getRequiredExtensionList(), TRUE);
281
282 // Initialize Document Template object:
283 $this->doc = t3lib_div::makeInstance('template');
284 $this->doc->backPath = $GLOBALS['BACK_PATH'];
285 $this->doc->setModuleTemplate('templates/em_index.html');
286
287 // Initialize helper objects
288 $this->api = t3lib_div::makeInstance('tx_em_API');
289 $this->terConnection = t3lib_div::makeInstance('tx_em_Connection_Ter', $this);
290 $this->terConnection->wsdlURL = $GLOBALS['TYPO3_CONF_VARS']['EXT']['em_wsdlURL'];
291
292
293 $this->xmlHandler = t3lib_div::makeInstance('tx_em_Tools_XmlHandler');
294 $this->xmlHandler->useObsolete = $this->MOD_SETTINGS['display_obsolete'];
295
296
297 // Initialize newListing
298 if (isset($this->MOD_MENU['function']['extensionmanager'])) {
299 $this->extensionmanager = t3lib_div::makeInstance('tx_em_ExtensionManager', $this);
300 } else {
301 $this->extensionmanager = &$this;
302 }
303
304
305 // Output classes
306 $this->extensionList = t3lib_div::makeInstance('tx_em_Extensions_List', $this);
307 $this->extensionDetails = t3lib_div::makeInstance('tx_em_Extensions_Details', $this);
308 $this->translations = t3lib_div::makeInstance('tx_em_Translations', $this);
309
310
311 // the id is needed for getting same styles TODO: general table styles
312 $this->doc->bodyTagId = 'typo3-mod-tools-em-index-php';
313
314 // JavaScript
315 $this->doc->JScode = $this->doc->wrapScriptTags('
316 script_ended = 0;
317 function jumpToUrl(URL) { //
318 window.location.href = URL;
319 }
320 ');
321
322 // Reload left frame menu
323 if ($this->CMD['refreshMenu']) {
324 $this->doc->JScode .= $this->doc->wrapScriptTags('
325 if(top.refreshMenu) {
326 top.refreshMenu();
327 } else {
328 top.TYPO3ModuleMenu.refreshMenu();
329 }
330 ');
331 }
332
333
334 // Descriptions:
335 $this->descrTable = '_MOD_' . $this->MCONF['name'];
336 if ($GLOBALS['BE_USER']->uc['edit_showFieldHelp']) {
337 $GLOBALS['LANG']->loadSingleTableDescription($this->descrTable);
338 }
339
340 // Setting username/password etc. for upload-user:
341 $this->fe_user['username'] = $this->MOD_SETTINGS['fe_u'];
342 $this->fe_user['password'] = $this->MOD_SETTINGS['fe_p'];
343 parent::init();
344 $this->handleExternalFunctionValue('singleDetails');
345 }
346
347 /**
348 * This function is a copy of the same function in t3lib_SCbase with one modification:
349 * In contrast to t3lib_SCbase::handleExternalFunctionValue() this function merges the $this->extClassConf array
350 * instead of overwriting it. That was necessary for including the Kickstarter as a submodule into the 'singleDetails'
351 * selectorbox as well as in the main 'function' selectorbox.
352 *
353 * @param string Mod-setting array key
354 * @param string Mod setting value, overriding the one in the key
355 * @return void
356 * @see t3lib_SCbase::handleExternalFunctionValue()
357 */
358 function handleExternalFunctionValue($MM_key = 'function', $MS_value = NULL) {
359 $MS_value = is_null($MS_value) ? $this->MOD_SETTINGS[$MM_key] : $MS_value;
360 $externalItems = $this->getExternalItemConfig($this->MCONF['name'], $MM_key, $MS_value);
361 if (is_array($externalItems)) {
362 $this->extClassConf = array_merge($externalItems, is_array($this->extClassConf) ? $this->extClassConf : array());
363 }
364 if (is_array($this->extClassConf) && $this->extClassConf['path']) {
365 $this->include_once[] = $this->extClassConf['path'];
366 }
367 }
368
369 /**
370 * Configuration of which mod-menu items can be used
371 *
372 * @return void
373 */
374 function menuConfig() {
375 // MENU-ITEMS:
376 $this->MOD_MENU = $this->settings->MOD_MENU;
377 $globalSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['em']);
378
379 if (!is_array($globalSettings)) {
380 // no settings saved yet, set default values
381 $globalSettings['inlineToWindow'] = 1;
382 $globalSettings['displayMyExtensions'] = 0;
383 }
384
385 unset(
386 $this->MOD_MENU['function']['loaded_list'],
387 $this->MOD_MENU['function']['installed_list'],
388 $this->MOD_MENU['function']['import'],
389 $this->MOD_MENU['function']['translations'],
390 $this->MOD_MENU['function']['settings'],
391 $this->MOD_MENU['function']['updates']
392 );
393 $this->MOD_MENU['singleDetails'] = $this->mergeExternalItems($this->MCONF['name'], 'singleDetails', $this->MOD_MENU['singleDetails']);
394 $this->MOD_MENU['extensionInfo'] = $this->mergeExternalItems($this->MCONF['name'], 'singleDetails', array());
395
396
397 // page/be_user TSconfig settings and blinding of menu-items
398 if (!$GLOBALS['BE_USER']->getTSConfigVal('mod.' . $this->MCONF['name'] . '.allowTVlisting')) {
399 unset($this->MOD_MENU['display_details'][3]);
400 unset($this->MOD_MENU['display_details'][4]);
401 unset($this->MOD_MENU['display_details'][5]);
402 }
403
404 // CLEANSE SETTINGS
405 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
406
407
408 if ($this->MOD_SETTINGS['function'] == 2) {
409 // If listing from online repository, certain items are removed though:
410 unset($this->MOD_MENU['listOrder']['type']);
411 unset($this->MOD_MENU['display_details'][2]);
412 unset($this->MOD_MENU['display_details'][3]);
413 unset($this->MOD_MENU['display_details'][4]);
414 unset($this->MOD_MENU['display_details'][5]);
415 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
416 }
417
418 $this->settings->saveSettings($this->MOD_SETTINGS);
419 parent::menuConfig();
420
421 $this->settings->saveSettings($this->MOD_SETTINGS);
422 }
423
424 /**
425 * Main function for Extension Manager module.
426 *
427 * @return void
428 */
429 public function main() {
430
431 $menu = '';
432
433 if (empty($this->MOD_SETTINGS['mirrorListURL'])) {
434 $this->MOD_SETTINGS['mirrorListURL'] = $GLOBALS['TYPO3_CONF_VARS']['EXT']['em_mirrorListURL'];
435 }
436
437 // Starting page:
438 $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('header'));
439
440 // Command given which is executed regardless of main menu setting:
441 if ($this->CMD['showExt']) { // Show details for a single extension
442 $this->showExtDetails($this->CMD['showExt']);
443 } elseif ($this->CMD['requestInstallExtensions']) { // Show details for a single extension
444 $this->requestInstallExtensions($this->CMD['requestInstallExtensions']);
445 } elseif ($this->CMD['importExt'] || $this->CMD['uploadExt']) { // Imports an extension from online rep.
446 $err = $this->importExtFromRep($this->CMD['importExt'], $this->CMD['extVersion'], $this->CMD['loc'], $this->CMD['uploadExt']);
447 if ($err) {
448 $this->content .= $this->doc->section('', tx_em_Tools::rfw($err));
449 }
450 if (!$err && $this->CMD['importExt']) {
451 $this->translations->installTranslationsForExtension($this->CMD['importExt'], $this->getMirrorURL());
452 }
453 } elseif ($this->CMD['importExtInfo']) { // Gets detailed information of an extension from online rep.
454 $this->importExtInfo($this->CMD['importExtInfo'], $this->CMD['extVersion']);
455 } elseif ($this->CMD['downloadExtFile']) {
456 tx_em_Tools::sendFile($this->CMD['downloadExtFile']);
457 } else { // No command - we show what the menu setting tells us:
458 if (t3lib_div::inList('loaded_list,installed_list,import', $this->MOD_SETTINGS['function'])) {
459 $menu .= '&nbsp;' . $GLOBALS['LANG']->getLL('group_by') . '&nbsp;' . t3lib_BEfunc::getFuncMenu(0, 'SET[listOrder]', $this->MOD_SETTINGS['listOrder'], $this->MOD_MENU['listOrder']) .
460 '&nbsp;&nbsp;' . $GLOBALS['LANG']->getLL('show') . '&nbsp;' . t3lib_BEfunc::getFuncMenu(0, 'SET[display_details]', $this->MOD_SETTINGS['display_details'], $this->MOD_MENU['display_details']) . '<br />';
461 }
462 if (t3lib_div::inList('loaded_list,installed_list,updates', $this->MOD_SETTINGS['function'])) {
463 $menu .= '<label for="checkDisplayShy">' . $GLOBALS['LANG']->getLL('display_shy') . '</label>&nbsp;&nbsp;' . t3lib_BEfunc::getFuncCheck(0, 'SET[display_shy]', $this->MOD_SETTINGS['display_shy'], '', '', 'id="checkDisplayShy"');
464 }
465 if (t3lib_div::inList('import', $this->MOD_SETTINGS['function']) && strlen($this->fe_user['username'])) {
466 $menu .= '<label for="checkDisplayOwn">' . $GLOBALS['LANG']->getLL('only_my_ext') . '</label>&nbsp;&nbsp;' . t3lib_BEfunc::getFuncCheck(0, 'SET[display_own]', $this->MOD_SETTINGS['display_own'], '', '', 'id="checkDisplayOwn"');
467 }
468 if (t3lib_div::inList('loaded_list,installed_list,import', $this->MOD_SETTINGS['function'])) {
469 $menu .= '&nbsp;&nbsp;<label for="checkDisplayObsolete">' . $GLOBALS['LANG']->getLL('show_obsolete') . '</label>&nbsp;&nbsp;' . t3lib_BEfunc::getFuncCheck(0, 'SET[display_obsolete]', $this->MOD_SETTINGS['display_obsolete'], '', '', 'id="checkDisplayObsolete"');
470 }
471
472 $this->content .= $menu ? $this->doc->section('', '<form action="' . $this->script . '" method="post" name="pageform"><span class="nobr">' . $menu . '</span></form>') : '';
473
474
475 $view = $this->MOD_SETTINGS['function'];
476 if (t3lib_div::_GP('view')) {
477 // temporary overwrite the view with GP var. Used from ExtJS without changing the submodule
478 $view = t3lib_div::_GP('view');
479 }
480
481 switch ($view) {
482 case 'loaded_list':
483 // Lists loaded (installed) extensions
484 $headline = $GLOBALS['LANG']->getLL('loaded_exts');
485 $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'loaded', $headline);
486 $content = $this->extensionList->extensionList_loaded();
487
488 $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE);
489 break;
490 case 'installed_list':
491 // Lists the installed (available) extensions
492 $headline = sprintf($GLOBALS['LANG']->getLL('available_extensions'), $this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']]);
493 $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'avail', $headline);
494 $content = $this->extensionList->extensionList_installed();
495
496 $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE);
497 break;
498 case 'import':
499 // Lists the extensions available from online rep.
500 $this->extensionList_import();
501 break;
502 case 'settings':
503 // Shows the settings screen
504 $headline = $GLOBALS['LANG']->getLL('repository_settings');
505 $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'settings', $headline);
506 $content = $this->alterSettings();
507
508 $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE);
509 break;
510 case 'translations':
511 // Allows to set the translation preferences and check the status
512 $this->translations->translationHandling();
513 break;
514 case 'updates':
515 // Shows a list of extensions with updates in TER
516 $this->checkForUpdates();
517 break;
518 case 'extensionmanager':
519 $this->content .= $this->extensionmanager->render();
520 break;
521 default:
522 $this->extObjContent();
523 break;
524 }
525 }
526
527 // closing any form?
528 $formTags = substr_count($this->content, '<form') + substr_count($this->content, '</form');
529 if ($formTags % 2 > 0) {
530 $this->content .= '</form>';
531 }
532
533 if (!$this->noDocHeader) {
534 // Setting up the buttons and markers for docheader
535 $docHeaderButtons = $this->getButtons();
536 $markers = array(
537 'CSH' => $docHeaderButtons['csh'],
538 'FUNC_MENU' => $this->getFuncMenu(),
539 'CONTENT' => $this->content
540 );
541
542 // Build the <body> for the module
543 $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
544 }
545 // Renders the module page
546 $this->content = $this->doc->render(
547 'Extension Manager',
548 $this->content
549 );
550
551 }
552
553 /**
554 * Print module content. Called as last thing in the global scope.
555 *
556 * @return void
557 */
558 function printContent() {
559 if ($this->doPrintContent) {
560 echo $this->content;
561 }
562 }
563
564 /**
565 * Create the function menu
566 *
567 * @return string HTML of the function menu
568 */
569 public function getFuncMenu() {
570 $funcMenu = '';
571 if (!$this->CMD['showExt'] && !$this->CMD['requestInstallExtensions'] && !$this->CMD['importExt'] && !$this->CMD['uploadExt'] && !$this->CMD['importExtInfo']) {
572 $funcMenu = t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
573 } elseif ($this->CMD['showExt'] && (!$this->CMD['standAlone'] && !t3lib_div::_GP('standAlone'))) {
574 $funcMenu = t3lib_BEfunc::getFuncMenu(0, 'SET[singleDetails]', $this->MOD_SETTINGS['singleDetails'], $this->MOD_MENU['singleDetails'], '', '&CMD[showExt]=' . $this->CMD['showExt']);
575 }
576 return $funcMenu;
577 }
578
579 /**
580 * Create the panel of buttons for submitting the form or otherwise perform operations.
581 *
582 * @return array all available buttons as an assoc. array
583 */
584 public function getButtons() {
585
586 $buttons = array(
587 'csh' => '',
588 'back' => '',
589 'shortcut' => ''
590 );
591
592 // Shortcut
593 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
594 $buttons['shortcut'] = $this->doc->makeShortcutIcon('CMD', 'function', $this->MCONF['name']);
595 }
596 // Back
597 if (($this->CMD['showExt'] && (!$this->CMD['standAlone'] && !t3lib_div::_GP('standAlone'))) || ($this->CMD['importExt'] || $this->CMD['uploadExt'] && (!$this->CMD['standAlone'])) || $this->CMD['importExtInfo']) {
598 $buttons['back'] = '<a href="' . t3lib_div::linkThisScript(array(
599 'CMD' => ''
600 )) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->getLL('go_back') . '">' .
601 t3lib_iconWorks::getSpriteIcon('actions-view-go-back') .
602 '</a>';
603 }
604
605 return $buttons;
606 }
607
608
609 /*********************************
610 *
611 * Function Menu Applications
612 *
613 *********************************/
614
615
616 /**
617 * Listing remote extensions from online repository
618 *
619 * @return void
620 */
621 function extensionList_import() {
622 $content = '';
623
624 // Listing from online repository:
625 if ($this->listRemote) {
626 list($inst_list,) = $this->extensionList->getInstalledExtensions();
627 $this->inst_keys = array_flip(array_keys($inst_list));
628
629 $this->detailCols[1] += 6;
630
631 // see if we have an extensionlist at all
632 $this->extensionCount = $this->xmlHandler->countExtensions();
633 if (!$this->extensionCount) {
634 $content .= $this->fetchMetaData('extensions');
635 }
636
637 if ($this->MOD_SETTINGS['listOrder'] == 'author_company') {
638 $this->listingLimit = $this->listingLimitAuthor;
639 }
640
641 $this->pointer = intval(t3lib_div::_GP('pointer'));
642 $offset = $this->listingLimit * $this->pointer;
643
644 if ($this->MOD_SETTINGS['display_own'] && strlen($this->fe_user['username'])) {
645 $this->xmlHandler->searchExtensionsXML($this->listRemote_search, $this->fe_user['username'], $this->MOD_SETTINGS['listOrder'], TRUE);
646 } else {
647 $this->xmlHandler->searchExtensionsXML($this->listRemote_search, '', $this->MOD_SETTINGS['listOrder'], TRUE, FALSE, $offset, $this->listingLimit);
648 }
649 if (count($this->xmlHandler->extensionsXML)) {
650 list($list, $cat) = $this->extensionList->prepareImportExtList(TRUE);
651
652 // Available extensions
653 if (is_array($cat[$this->MOD_SETTINGS['listOrder']])) {
654 $lines = array();
655 $lines[] = $this->extensionList->extensionListRowHeader(' class="t3-row-header"', array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>'), 1);
656
657 foreach ($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys) {
658 if (count($extEkeys)) {
659 $lines[] = '<tr><td colspan="' . (3 + $this->detailCols[$this->MOD_SETTINGS['display_details']]) . '"><br /></td></tr>';
660 $lines[] = '<tr><td colspan="' . (3 + $this->detailCols[$this->MOD_SETTINGS['display_details']]) . '">' . t3lib_iconWorks::getSpriteIcon('apps-filetree-folder-default') . '<strong>' . htmlspecialchars($this->listOrderTitle($this->MOD_SETTINGS['listOrder'], $catName)) . '</strong></td></tr>';
661 natcasesort($extEkeys);
662 foreach ($extEkeys as $extKey => $value) {
663 $version = array_keys($list[$extKey]['versions']);
664 $version = end($version);
665 $ext = $list[$extKey]['versions'][$version];
666 $ext['downloadcounter_all'] = $list[$extKey]['downloadcounter'];
667 $ext['_ICON'] = $list[$extKey]['_ICON'];
668 $loadUnloadLink = '';
669 if ($inst_list[$extKey]['type'] != 'S' && (!isset($inst_list[$extKey]) || tx_em_Tools::versionDifference($version, $inst_list[$extKey]['EM_CONF']['version'], $this->versionDiffFactor))) {
670 if (isset($inst_list[$extKey])) {
671 // update
672 if ($inst_list[$extKey]['EM_CONF']['state'] != 'excludeFromUpdates') {
673 $loc = ($inst_list[$extKey]['type'] == 'G' ? 'G' : 'L');
674 $aUrl = t3lib_div::linkThisScript(array(
675 'CMD[importExt]' => $extKey,
676 'CMD[extVersion]' => $version,
677 'CMD[loc]' => $loc
678 ));
679 $loadUnloadLink .= '<a href="' . htmlspecialchars($aUrl) . '" title="' . sprintf($GLOBALS['LANG']->getLL('do_update'), ($loc == 'G' ? $GLOBALS['LANG']->getLL('global') : $GLOBALS['LANG']->getLL('local'))) . '">' .
680 t3lib_iconWorks::getSpriteIcon('actions-system-extension-update') .
681 '</a>';
682 } else {
683 // extension is marked as "excludeFromUpdates"
684 $loadUnloadLink .= t3lib_iconWorks::getSpriteIcon('status-dialog-warning', $GLOBALS['LANG']->getLL('excluded_from_updates'));
685 }
686 } else {
687 // import
688 $aUrl = t3lib_div::linkThisScript(array(
689 'CMD[importExt]' => $extKey,
690 'CMD[extVersion]' => $version,
691 'CMD[loc]' => 'L'
692 ));
693 $loadUnloadLink .= '<a href="' . htmlspecialchars($aUrl) . '" title="' . $GLOBALS['LANG']->getLL('import_to_local_dir') . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-extension-import') . '</a>';
694 }
695 } else {
696 $loadUnloadLink = '&nbsp;';
697 }
698
699 if (isset($inst_list[$extKey])) {
700 $theRowClass = t3lib_extMgm::isLoaded($extKey) ? 'em-listbg1' : 'em-listbg2';
701 } else {
702 $theRowClass = 'em-listbg3';
703 }
704
705 $lines[] = $this->extensionList->extensionListRow(
706 $extKey, $ext, array(
707 '<td class="bgColor">' . $loadUnloadLink . '</td>'
708 ), $theRowClass, $inst_list, 1, t3lib_div::linkThisScript(array(
709 'CMD[importExtInfo]' => rawurlencode($extKey)
710 )));
711 unset($list[$extKey]);
712 }
713 }
714 }
715 unset($list);
716
717 // headline and CSH
718 $headline = $GLOBALS['LANG']->getLL('extensions_repository_group_by') . ' ' .
719 $this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']];
720 $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'import_ter', $headline);
721
722 $onsubmit = "window.location.href='" . $this->script . "&ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
723 $content .= '<form action="' . $this->script . '" method="post" onsubmit="' . htmlspecialchars($onsubmit) .
724 '"><label for="lookUp">' . $GLOBALS['LANG']->getLL('list_or_look_up_extensions') . '</label><br />
725 <input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->listRemote_search) .
726 '" /> <input type="submit" value="' . $GLOBALS['LANG']->getLL('look_up_button') . '" /></form><br /><br />';
727
728 $content .= $this->browseLinks();
729
730 $content .= '
731
732 <!-- TER Extensions list -->
733 <table border="0" cellpadding="2" cellspacing="1">' . implode(LF, $lines) . '</table>';
734 $content .= '<br />' . $this->browseLinks();
735 $content .= '<br /><br />' . $this->securityHint;
736 $content .= '<br /><br /><strong>' . $GLOBALS['LANG']->getLL('privacy_notice_header') .
737 '</strong><br /> ' . $this->privacyNotice;
738
739 $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE);
740
741 // Plugins which are NOT uploaded to repository but present on this server.
742 $content = '';
743 $lines = array();
744 if (count($this->inst_keys)) {
745 foreach ($this->inst_keys as $extKey => $value) {
746 $this->xmlHandler->searchExtensionsXMLExact($extKey, '', '', TRUE, TRUE);
747 if ((strlen($this->listRemote_search) && !stristr($extKey, $this->listRemote_search)) || isset($this->xmlHandler->extensionsXML[$extKey])) {
748 continue;
749 }
750
751 $loadUnloadLink = t3lib_extMgm::isLoaded($extKey) ?
752 '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
753 'CMD[showExt]' => $extKey,
754 'CMD[remove]' => 1,
755 'CMD[clrCmd]' => 1,
756 'SET[singleDetails]' => 'info'
757 ))) . '">' . tx_em_Tools::removeButton() . '</a>' :
758 '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
759 'CMD[showExt]' => $extKey,
760 'CMD[load]' => 1,
761 'CMD[clrCmd]' => 1,
762 'SET[singleDetails]' => 'info'
763 ))) . '">' . tx_em_Tools::installButton() . '</a>';
764 if (in_array($extKey, $this->requiredExt)) {
765 $loadUnloadLink = '<strong>' . tx_em_Tools::rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
766 }
767 $lines[] = $this->extensionList->extensionListRow($extKey, $inst_list[$extKey], array('<td class="bgColor">' . $loadUnloadLink . '</td>'), t3lib_extMgm::isLoaded($extKey) ? 'em-listbg1' : 'em-listbg2');
768 }
769 }
770 if (count($lines)) {
771 $content .= $GLOBALS['LANG']->getLL('list_of_local_extensions') .
772 '<br />' . $GLOBALS['LANG']->getLL('might_be_user_defined') . '<br /><br />';
773 $content .= '<table border="0" cellpadding="2" cellspacing="1">' .
774 $this->extensionList->extensionListRowHeader(' class="t3-row-header"', array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>')) .
775 implode('', $lines) . '</table>';
776 $this->content .= $this->doc->spacer(20);
777 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('only_on_this_server'), $content, 0, 1);
778 }
779 }
780 } else {
781 // headline and CSH
782 $headline = $GLOBALS['LANG']->getLL('extensions_repository_group_by') . ' ' .
783 $this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']];
784 $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'import_ter', $headline);
785
786 $onsubmit = "window.location.href='" . $this->script . "&ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
787 $content .= '<form action="' . $this->script . '" method="post" onsubmit="' . htmlspecialchars($onsubmit) .
788 '"><label for="lookUp">' .
789 $GLOBALS['LANG']->getLL('list_or_look_up_extensions') . '</label><br />
790 <input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->listRemote_search) .
791 '" /> <input type="submit" value="' . $GLOBALS['LANG']->getLL('look_up_button') . '" /></form><br /><br />';
792
793 $content .= '<p><strong>' . $GLOBALS['LANG']->getLL('no_matching_extensions') . '</strong></p>';
794
795 $content .= '<br /><br /><strong>' . $GLOBALS['LANG']->getLL('privacy_notice_header') .
796 '</strong><br /> ' . $this->privacyNotice;
797 $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, 0, TRUE);
798 }
799 } else {
800 // section headline and CSH
801 $headline = $GLOBALS['LANG']->getLL('in_repository');
802 $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'import', $headline);
803
804 $onsubmit = "window.location.href='" . $this->script . "&ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
805 $content .= '<form action="' . $this->script . '" method="post" onsubmit="' . htmlspecialchars($onsubmit) .
806 '"><label for="lookUp">' .
807 $GLOBALS['LANG']->getLL('list_or_look_up_extensions') . '</label><br />
808 <input type="text" id="lookUp" name="lookUp" value="" /> <input type="submit" value="' .
809 $GLOBALS['LANG']->getLL('look_up_button') . '" /><br /><br />';
810
811 if ($this->CMD['fetchMetaData']) { // fetches mirror/extension data from online rep.
812 $content .= $this->fetchMetaData($this->CMD['fetchMetaData']);
813 } else {
814 $onCLick = 'window.location.href="' . t3lib_div::linkThisScript(array(
815 'CMD[fetchMetaData]' => 'extensions'
816 )) . '";return false;';
817 $content .= $GLOBALS['LANG']->getLL('connect_to_ter') . '<br />
818 <input type="submit" value="' . $GLOBALS['LANG']->getLL('retrieve_update') .
819 '" onclick="' . htmlspecialchars($onCLick) . '" />';
820 if (is_file(PATH_site . 'typo3temp/extensions.xml.gz')) {
821 $content .= ' ' . sprintf($GLOBALS['LANG']->getLL('ext_list_last_updated') . ' ',
822 t3lib_BEfunc::datetime(filemtime(PATH_site . 'typo3temp/extensions.xml.gz')),
823 tx_em_Database::getExtensionCountFromRepository()
824 );
825 }
826 }
827 $content .= '</form><br /><br />' . $this->securityHint;
828 $content .= '<br /><br /><strong>' . $GLOBALS['LANG']->getLL('privacy_notice_header') .
829 '</strong><br />' . $this->privacyNotice;
830
831 $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE);
832 }
833
834 // Upload:
835 if ($this->importAtAll()) {
836 $content = '<form action="' . $this->script . '" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" method="post">
837 <label for="upload_ext_file">' . $GLOBALS['LANG']->getLL('upload_t3x') . '</label><br />
838 <input type="file" size="60" id="upload_ext_file" name="upload_ext_file" /><br />' .
839 $GLOBALS['LANG']->getLL('upload_to_location') . '<br />
840 <select name="CMD[loc]">';
841 if (tx_em_Tools::importAsType('L')) {
842 $content .= '<option value="L">' . $GLOBALS['LANG']->getLL('local_folder') . '</option>';
843 }
844 if (tx_em_Tools::importAsType('G')) {
845 $content .= '<option value="G">' . $GLOBALS['LANG']->getLL('global_folder') . '</option>';
846 }
847 if (tx_em_Tools::importAsType('S')) {
848 $content .= '<option value="S">' . $GLOBALS['LANG']->getLL('system_folder') . '</option>';
849 }
850 $content .= '</select><br />
851 <input type="checkbox" value="1" name="CMD[uploadOverwrite]" id="checkUploadOverwrite" /> <label for="checkUploadOverwrite">' .
852 $GLOBALS['LANG']->getLL('overwrite_ext') . '</label><br />
853 <input type="submit" name="CMD[uploadExt]" value="' . $GLOBALS['LANG']->getLL('upload_ext_file') . '" /></form><br />
854 ';
855 } else {
856 $content = tx_em_Tools::noImportMsg();
857 }
858
859 $this->content .= $this->doc->spacer(20);
860 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('upload_ext_directly'), $content, 0, 1);
861 }
862
863 /**
864 * Generates a link to the next page of extensions
865 *
866 * @return string
867 */
868 function browseLinks() {
869 $content = '';
870 if ($this->pointer) {
871 $content .= '<a href="' . t3lib_div::linkThisScript(array('pointer' => $this->pointer - 1)) .
872 '" class="typo3-prevPage"><img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],
873 'gfx/pilleft_n.gif', 'width="14" height="14"') .
874 ' alt="' . $GLOBALS['LANG']->getLL('previous_page') . '" /> ' .
875 $GLOBALS['LANG']->getLL('previous_page') . '</a>';
876 }
877 if ($content) {
878 $content .= '&nbsp;&nbsp;&nbsp;';
879 }
880 if (intval($this->xmlHandler->matchingCount / $this->listingLimit) > $this->pointer) {
881 $content .= '<a href="' . t3lib_div::linkThisScript(array('pointer' => $this->pointer + 1)) .
882 '" class="typo3-nextPage"><img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],
883 'gfx/pilright_n.gif', 'width="14" height="14"') .
884 ' alt="' . $GLOBALS['LANG']->getLL('next_page') . '" /> ' .
885 $GLOBALS['LANG']->getLL('next_page') . '</a>';
886 }
887 $upper = (($this->pointer + 1) * $this->listingLimit);
888 if ($upper > $this->xmlHandler->matchingCount) {
889 $upper = $this->xmlHandler->matchingCount;
890 }
891 if ($content) {
892 $content .= '<br /><br />' .
893 sprintf($GLOBALS['LANG']->getLL('showing_extensions_from_to'),
894 '<strong>' . ($this->pointer * $this->listingLimit + 1) . '</strong>',
895 '<strong>' . $upper . '</strong>'
896 );
897 }
898 if ($content) {
899 $content .= '<br /><br />';
900 }
901 return $content;
902 }
903
904 /**
905 * Allows changing of settings
906 *
907 * @return string
908 */
909 function alterSettings() {
910 $content = '';
911 // Prepare the HTML output:
912 $content .= '
913 <form action="' . $this->script . '" method="post" name="altersettings">
914 <fieldset><legend>' . $GLOBALS['LANG']->getLL('user_settings') . '</legend>
915 <table border="0" cellpadding="2" cellspacing="2">
916 <tr class="bgColor4">
917 <td><label for="set_fe_u">' . $GLOBALS['LANG']->getLL('enter_repository_username') . '</label></td>
918 <td><input type="text" id="set_fe_u" name="SET[fe_u]" value="' . htmlspecialchars($this->MOD_SETTINGS['fe_u']) . '" /></td>
919 </tr>
920 <tr class="bgColor4">
921 <td><label for="set_fe_p">' . $GLOBALS['LANG']->getLL('enter_repository_password') . '</label></td>
922 <td><input type="password" id="set_fe_p" name="SET[fe_p]" value="' . htmlspecialchars($this->MOD_SETTINGS['fe_p']) . '" /></td>
923 </tr>
924 </table>
925 <strong>' . $GLOBALS['LANG']->getLL('notice') . '</strong> ' .
926 $GLOBALS['LANG']->getLL('repository_password_info') . '
927 </fieldset>
928 <br />
929 <br />
930 <fieldset><legend>' . $GLOBALS['LANG']->getLL('mirror_selection') . '</legend>
931 <table border="0" cellpadding="2" cellspacing="2">
932 <tr class="bgColor4">
933 <td><label for="set_mirror_list_url">' . $GLOBALS['LANG']->getLL('mirror_list_url') . '</label></td>
934 <td><input type="text" size="50" id="set_mirror_list_url" name="SET[mirrorListURL]" value="' . htmlspecialchars($this->MOD_SETTINGS['mirrorListURL']) . '" /></td>
935 </tr>
936 </table>
937 </fieldset>
938 <br />
939 <p>' . $GLOBALS['LANG']->getLL('mirror_select') . '<br /><br /></p>
940 <fieldset><legend>' . $GLOBALS['LANG']->getLL('mirror_list') . '</legend>';
941 if (!empty($this->MOD_SETTINGS['mirrorListURL'])) {
942 if ($this->CMD['fetchMetaData']) { // fetches mirror/extension data from online rep.
943 $content .= $this->fetchMetaData($this->CMD['fetchMetaData']);
944 } else {
945 $content .= '<a href="' . t3lib_div::linkThisScript(array(
946 'CMD[fetchMetaData]' => 'mirrors'
947 )) . '">' . $GLOBALS['LANG']->getLL('mirror_list_reload') . '</a>';
948 }
949 }
950 $content .= '<br />
951 <table cellspacing="4" style="text-align:left; vertical-alignment:top;">
952 <tr>
953 <td>' . $GLOBALS['LANG']->getLL('mirror_use') . '</td>
954 <td>' . $GLOBALS['LANG']->getLL('mirror_name') . '</td>
955 <td>' . $GLOBALS['LANG']->getLL('mirror_url') . '</td>
956 <td>' . $GLOBALS['LANG']->getLL('mirror_country') . '</td>
957 <td>' . $GLOBALS['LANG']->getLL('mirror_sponsored_by') . '</td>
958 </tr>
959 ';
960
961 if (!strlen($this->MOD_SETTINGS['extMirrors'])) {
962 $this->fetchMetaData('mirrors');
963 }
964 $extMirrors = unserialize($this->MOD_SETTINGS['extMirrors']);
965 $extMirrors[''] = array('title' => $GLOBALS['LANG']->getLL('mirror_use_random'));
966 ksort($extMirrors);
967 if (is_array($extMirrors)) {
968 foreach ($extMirrors as $k => $v) {
969 if (isset($v['sponsor'])) {
970 $sponsor = '<a href="' . htmlspecialchars($v['sponsor']['link']) . '" target="_blank"><img src="' . $v['sponsor']['logo'] . '" title="' . htmlspecialchars($v['sponsor']['name']) . '" alt="' . htmlspecialchars($v['sponsor']['name']) . '" /></a>';
971 }
972 $selected = ($this->MOD_SETTINGS['selectedMirror'] == $k) ? 'checked="checked"' : '';
973 $content .= '<tr class="bgColor4">
974 <td><input type="radio" name="SET[selectedMirror]" id="selectedMirror' . $k . '" value="' . $k . '" ' . $selected . '/></td><td><label for="selectedMirror' . $k . '">' . htmlspecialchars($v['title']) . '</label></td><td>' . htmlspecialchars($v['host'] . $v['path']) . '</td><td>' . $v['country'] . '</td><td>' . $sponsor . '</td></tr>';
975 }
976 }
977 $content .= '
978 </table>
979 </fieldset>
980 <fieldset>
981 <br />
982 <table border="0" cellpadding="2" cellspacing="2">
983 <tr class="bgColor4">
984 <td><label for="set_rep_url">' . $GLOBALS['LANG']->getLL('enter_repository_url') . '</label></td>
985 <td><input type="text" size="50" id="set_rep_url" name="SET[rep_url]" value="' . htmlspecialchars($this->MOD_SETTINGS['rep_url']) . '" /></td>
986 </tr>
987 </table>
988
989 ' . $GLOBALS['LANG']->getLL('repository_url_hint') . '<br />
990 </fieldset>
991 <br />
992 <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tsfe.xml:update') . '" />
993 </form>
994 ';
995
996 return $content;
997 }
998
999 /*********************************
1000 *
1001 * Command Applications (triggered by GET var)
1002 *
1003 *********************************/
1004
1005 /**
1006 * Returns detailed info about an extension in the online repository
1007 *
1008 * @param string Extension repository uid + optional "private key": [uid]-[key].
1009 * @param [type] $version: ...
1010 * @return void
1011 */
1012 function importExtInfo($extKey, $version = '') {
1013
1014 $content = '<form action="' . $this->script . '" method="post" name="pageform">';
1015 $addUrl = '';
1016 if ($this->noDocHeader) {
1017 $content .= '<input type="hidden" name="nodoc" value="1" />';
1018 $addUrl = '&nodoc=1';
1019 }
1020 // Fetch remote data:
1021 $this->xmlHandler->searchExtensionsXMLExact($extKey, '', '', TRUE, TRUE);
1022 list($fetchData,) = $this->extensionList->prepareImportExtList(TRUE);
1023
1024 $versions = array_keys($fetchData[$extKey]['versions']);
1025 natsort($versions);
1026 $version = ($version == '') ? end($versions) : $version;
1027
1028 $opt = array();
1029 foreach ($versions as $ver) {
1030 $opt[] = '<option value="' . $ver . '"' . (($version == $ver) ? ' selected="selected"' : '') . '>' . $ver . '</option>';
1031 }
1032
1033 // "Select version" box:
1034 $onClick = 'window.location.href="' . $this->script . $addUrl . '&CMD[importExtInfo]=' . $extKey . '&CMD[extVersion]="+document.pageform.extVersion.options[document.pageform.extVersion.selectedIndex].value; return false;';
1035 $select = '<select name="extVersion">' . implode('', $opt) .
1036 '</select> <input type="submit" value="' . $GLOBALS['LANG']->getLL('ext_load_details_button') .
1037 '" onclick="' . htmlspecialchars($onClick) . '" />';
1038
1039 if ($this->importAtAll()) {
1040 // Check for write-protected extension
1041 list($inst_list,) = $this->extensionList->getInstalledExtensions();
1042 if ($inst_list[$extKey]['EM_CONF']['state'] != 'excludeFromUpdates') {
1043 $onClick = '
1044 window.location.href="' . $this->script . $addUrl . '&CMD[importExt]=' . $extKey . '"
1045 +"&CMD[extVersion]="+document.pageform.extVersion.options[document.pageform.extVersion.selectedIndex].value
1046 +"&CMD[loc]="+document.pageform.loc.options[document.pageform.loc.selectedIndex].value;
1047 return false;';
1048 $select .= ' ' . $GLOBALS['LANG']->getLL('ext_or') . '<br /><br />
1049 <input type="submit" value="' . $GLOBALS['LANG']->getLL('ext_import_update_button') .
1050 '" onclick="' . htmlspecialchars($onClick) . '" /> ' . $GLOBALS['LANG']->getLL('ext_import_update_to') . '
1051 <select name="loc">' .
1052 (tx_em_Tools::importAsType('G', $fetchData['emconf_lockType']) ?
1053 '<option value="G">' . $GLOBALS['LANG']->getLL('ext_import_global') . ' ' . tx_em_Tools::typePath('G') . $extKey . '/' .
1054 (@is_dir(tx_em_Tools::typePath('G') . $extKey) ?
1055 ' ' . $GLOBALS['LANG']->getLL('ext_import_overwrite') :
1056 ' ' . $GLOBALS['LANG']->getLL('ext_import_folder_empty')
1057 ) . '</option>' : ''
1058 ) .
1059 (tx_em_Tools::importAsType('L', $fetchData['emconf_lockType']) ?
1060 '<option value="L">' . $GLOBALS['LANG']->getLL('ext_import_local') . ' ' . tx_em_Tools::typePath('L') . $extKey . '/' .
1061 (@is_dir(tx_em_Tools::typePath('L') . $extKey) ?
1062 ' ' . $GLOBALS['LANG']->getLL('ext_import_overwrite') :
1063 ' ' . $GLOBALS['LANG']->getLL('ext_import_folder_empty')
1064 ) . '</option>' : ''
1065 ) .
1066 (tx_em_Tools::importAsType('S', $fetchData['emconf_lockType']) ?
1067 '<option value="S">' . $GLOBALS['LANG']->getLL('ext_import_system') . ' ' . tx_em_Tools::typePath('S') . $extKey . '/' .
1068 (@is_dir(tx_em_Tools::typePath('S') . $extKey) ?
1069 ' ' . $GLOBALS['LANG']->getLL('ext_import_overwrite') :
1070 ' ' . $GLOBALS['LANG']->getLL('ext_import_folder_empty')
1071 ) . '</option>' : ''
1072 ) .
1073 '</select>
1074 </form>';
1075 } else {
1076 $select .= '<br /><br />' . $GLOBALS['LANG']->getLL('ext_import_excluded_from_updates');
1077 }
1078 } else {
1079 $select .= '<br /><br />' . tx_em_Tools::noImportMsg();
1080 }
1081 $content .= $select;
1082 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_import_select_command'), $content, 0, 1);
1083
1084 // Details:
1085 $eInfo = $fetchData[$extKey]['versions'][$version];
1086 $content = '<strong>' . $fetchData[$extKey]['_ICON'] . ' &nbsp;' . $eInfo['EM_CONF']['title'] . ' (' . $extKey . ', ' . $version . ')</strong><br /><br />';
1087 $content .= $this->extensionDetails->extInformationarray($extKey, $eInfo, 1);
1088 $this->content .= $this->doc->spacer(10);
1089 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_import_remote_ext_details'), $content, 0, 1);
1090 }
1091
1092 /**
1093 * Fetches metadata and stores it to the corresponding place. This includes the mirror list,
1094 * extension XML files.
1095 *
1096 * @param string Type of data to fetch: (mirrors)
1097 * @param boolean If TRUE the method doesn't produce any output
1098 * @return string
1099 */
1100 function fetchMetaData($metaType) {
1101 $content = '';
1102 switch ($metaType) {
1103 case 'mirrors':
1104 $mfile = t3lib_div::tempnam('mirrors');
1105 $mirrorsFile = t3lib_div::getUrl($this->MOD_SETTINGS['mirrorListURL'], 0, array(TYPO3_user_agent));
1106 if ($mirrorsFile===FALSE) {
1107 t3lib_div::unlink_tempfile($mfile);
1108 $content = '<p>' .
1109 sprintf($GLOBALS['LANG']->getLL('ext_import_list_not_updated'),
1110 $this->MOD_SETTINGS['mirrorListURL']
1111 ) . ' ' .
1112 $GLOBALS['LANG']->getLL('translation_problems') . '</p>';
1113 } else {
1114 t3lib_div::writeFile($mfile, $mirrorsFile);
1115 $mirrors = implode('', gzfile($mfile));
1116 t3lib_div::unlink_tempfile($mfile);
1117
1118 $mirrors = $this->xmlHandler->parseMirrorsXML($mirrors);
1119 if (is_array($mirrors) && count($mirrors)) {
1120 t3lib_BEfunc::getModuleData($this->MOD_MENU, array('extMirrors' => serialize($mirrors)), $this->MCONF['name'], '', 'extMirrors');
1121 $this->MOD_SETTINGS['extMirrors'] = serialize($mirrors);
1122 $content = '<p>' .
1123 sprintf($GLOBALS['LANG']->getLL('ext_import_list_updated'),
1124 count($mirrors)
1125 ) . '</p>';
1126 }
1127 else {
1128 $content = '<p>' . $mirrors . '<br />' . $GLOBALS['LANG']->getLL('ext_import_list_empty') . '</p>';
1129 }
1130 }
1131 break;
1132 case 'extensions':
1133 $this->fetchMetaData('mirrors'); // if we fetch the extensions anyway, we can as well keep this up-to-date
1134
1135 $mirror = $this->getMirrorURL();
1136 $extfile = $mirror . 'extensions.xml.gz';
1137 $extmd5 = t3lib_div::getUrl($mirror . 'extensions.md5', 0, array(TYPO3_user_agent));
1138 $localmd5 = '';
1139 if (is_file(PATH_site . 'typo3temp/extensions.xml.gz')) {
1140 $localmd5 = md5_file(PATH_site . 'typo3temp/extensions.xml.gz');
1141 }
1142
1143 // count cached extensions. If cache is empty re-fill it
1144 $cacheCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('extkey', 'cache_extensions');
1145
1146 if ($extmd5 === FALSE) {
1147 $content .= '<p>' .
1148 sprintf($GLOBALS['LANG']->getLL('ext_import_md5_not_updated'),
1149 $mirror . 'extensions.md5'
1150 ) .
1151 $GLOBALS['LANG']->getLL('translation_problems') . '</p>';
1152 } elseif ($extmd5 == $localmd5 && $cacheCount) {
1153 /** @var $flashMessage t3lib_FlashMessage */
1154 $flashMessage = t3lib_div::makeInstance(
1155 't3lib_FlashMessage',
1156 $GLOBALS['LANG']->getLL('ext_import_list_unchanged'),
1157 $GLOBALS['LANG']->getLL('ext_import_list_unchanged_header'),
1158 t3lib_FlashMessage::INFO
1159 );
1160 $content .= $flashMessage->render();
1161 } else {
1162 $extXML = t3lib_div::getUrl($extfile, 0, array(TYPO3_user_agent));
1163 if ($extXML === FALSE) {
1164 $content .= '<p>' .
1165 sprintf($GLOBALS['LANG']->getLL('ext_import_list_unchanged'),
1166 $extfile
1167 ) . ' ' .
1168 $GLOBALS['LANG']->getLL('translation_problems') . '</p>';
1169 } else {
1170 t3lib_div::writeFile(PATH_site . 'typo3temp/extensions.xml.gz', $extXML);
1171 $content .= $this->xmlHandler->parseExtensionsXML(PATH_site . 'typo3temp/extensions.xml.gz');
1172 }
1173 }
1174 break;
1175 }
1176
1177 return $content;
1178 }
1179
1180 /**
1181 * Returns the base URL for the selected or a random mirror.
1182 *
1183 * @return string The URL for the selected or a random mirror
1184 */
1185 function getMirrorURL() {
1186 if (strlen($this->MOD_SETTINGS['rep_url'])) {
1187 return $this->MOD_SETTINGS['rep_url'];
1188 }
1189
1190 $mirrors = unserialize($this->MOD_SETTINGS['extMirrors']);
1191 if (!is_array($mirrors)) {
1192 $this->fetchMetaData('mirrors');
1193 $mirrors = unserialize($this->MOD_SETTINGS['extMirrors']);
1194 if (!is_array($mirrors)) {
1195 return FALSE;
1196 }
1197 }
1198 if ($this->MOD_SETTINGS['selectedMirror'] == '') {
1199 $rand = array_rand($mirrors);
1200 $url = 'http://' . $mirrors[$rand]['host'] . $mirrors[$rand]['path'];
1201 }
1202 else {
1203 $selectedMirror = NULL;
1204 foreach ($mirrors as $mirror) {
1205 if ($mirror['host'] === $this->MOD_SETTINGS['selectedMirror']) {
1206 $selectedMirror = $mirror;
1207 break;
1208 }
1209 }
1210 $url = 'http://' . $selectedMirror['host'] . $selectedMirror['path'];
1211 }
1212
1213 return $url;
1214 }
1215
1216
1217 /**
1218 * Installs (activates) an extension
1219 *
1220 * For $mode use the three constants EM_INSTALL_VERSION_MIN, EM_INSTALL_VERSION_MAX, EM_INSTALL_VERSION_STRICT
1221 *
1222 * If an extension is loaded or imported already and the version requirement is matched, it will not be
1223 * fetched from the repository. This means, if you use EM_INSTALL_VERSION_MIN, you will not always get the latest
1224 * version of an extension!
1225 *
1226 * @param string $extKey The extension key to install
1227 * @param string $version A version number that should be installed
1228 * @param int $mode If a version is requested, this determines if it is the min, max or strict version requested
1229 * @return [type] ...
1230 * @todo Make the method able to handle needed interaction somehow (unmatched dependencies)
1231 */
1232 function installExtension($extKey, $version = NULL, $mode = EM_INSTALL_VERSION_MIN) {
1233 list($inst_list,) = $this->extensionList->getInstalledExtensions();
1234
1235 // check if it is already installed and loaded with sufficient version
1236 if (isset($inst_list[$extKey])) {
1237 $currentVersion = $inst_list[$extKey]['EM_CONF']['version'];
1238
1239 if (t3lib_extMgm::isLoaded($extKey)) {
1240 if ($version===NULL) {
1241 return array(TRUE, $GLOBALS['LANG']->getLL('ext_import_ext_already_installed_loaded'));
1242 } else {
1243 switch ($mode) {
1244 case EM_INSTALL_VERSION_STRICT:
1245 if ($currentVersion == $version) {
1246 return array(TRUE, $GLOBALS['LANG']->getLL('ext_import_ext_already_installed_loaded'));
1247 }
1248 break;
1249 case EM_INSTALL_VERSION_MIN:
1250 if (version_compare($currentVersion, $version, '>=')) {
1251 return array(TRUE, $GLOBALS['LANG']->getLL('ext_import_ext_already_installed_loaded'));
1252 }
1253 break;
1254 case EM_INSTALL_VERSION_MAX:
1255 if (version_compare($currentVersion, $version, '<=')) {
1256 return array(TRUE, $GLOBALS['LANG']->getLL('ext_import_ext_already_installed_loaded'));
1257 }
1258 break;
1259 }
1260 }
1261 } else {
1262 if (!t3lib_extMgm::isLocalconfWritable()) {
1263 return array(FALSE, $GLOBALS['LANG']->getLL('ext_import_p_localconf'));
1264 }
1265 $newExtList = -1;
1266 switch ($mode) {
1267 case EM_INSTALL_VERSION_STRICT:
1268 if ($currentVersion == $version) {
1269 $newExtList = $this->extensionList->addExtToList($extKey, $inst_list);
1270 }
1271 break;
1272 case EM_INSTALL_VERSION_MIN:
1273 if (version_compare($currentVersion, $version, '>=')) {
1274 $newExtList = $this->extensionList->addExtToList($extKey, $inst_list);
1275 }
1276 break;
1277 case EM_INSTALL_VERSION_MAX:
1278 if (version_compare($currentVersion, $version, '<=')) {
1279 $newExtList = $this->extensionList->addExtToList($extKey, $inst_list);
1280 }
1281 break;
1282 }
1283 if ($newExtList != -1) {
1284 $this->install->writeNewExtensionList($newExtList);
1285 tx_em_Tools::refreshGlobalExtList();
1286 $this->install->forceDBupdates($extKey, $inst_list[$extKey]);
1287 return array(TRUE, $GLOBALS['LANG']->getLL('ext_import_ext_loaded'));
1288 }
1289 }
1290 }
1291
1292 // at this point we know we need to import (a matching version of) the extension from TER2
1293
1294 // see if we have an extension list at all
1295 if (!$this->xmlHandler->countExtensions()) {
1296 $this->fetchMetaData('extensions');
1297 }
1298 $this->xmlHandler->searchExtensionsXMLExact($extKey, '', '', TRUE);
1299
1300 // check if extension can be fetched
1301 if (isset($this->xmlHandler->extensionsXML[$extKey])) {
1302 $versions = array_keys($this->xmlHandler->extensionsXML[$extKey]['versions']);
1303 $latestVersion = end($versions);
1304 switch ($mode) {
1305 case EM_INSTALL_VERSION_STRICT:
1306 if (!isset($this->xmlHandler->extensionsXML[$extKey]['versions'][$version])) {
1307 return array(FALSE, $GLOBALS['LANG']->getLL('ext_import_ext_n_a'));
1308 }
1309 break;
1310 case EM_INSTALL_VERSION_MIN:
1311 if (version_compare($latestVersion, $version, '>=')) {
1312 $version = $latestVersion;
1313 } else {
1314 return array(FALSE, $GLOBALS['LANG']->getLL('ext_import_ext_n_a'));
1315 }
1316 break;
1317 case EM_INSTALL_VERSION_MAX:
1318 while (($v = array_pop($versions)) && version_compare($v, $version, '>=')) {
1319 // Loop until a version is found
1320 }
1321
1322 if ($v !== NULL && version_compare($v, $version, '<=')) {
1323 $version = $v;
1324 } else {
1325 return array(FALSE, $GLOBALS['LANG']->getLL('ext_import_ext_n_a'));
1326 }
1327 break;
1328 }
1329 $this->importExtFromRep($extKey, $version, 'L');
1330 $newExtList = $this->extensionList->addExtToList($extKey, $inst_list);
1331 if ($newExtList != -1) {
1332 $this->install->writeNewExtensionList($newExtList);
1333 tx_em_Tools::refreshGlobalExtList();
1334 $this->install->forceDBupdates($extKey, $inst_list[$extKey]);
1335 $this->translations->installTranslationsForExtension($extKey, $this->getMirrorURL());
1336 return array(TRUE, $GLOBALS['LANG']->getLL('ext_import_ext_imported'));
1337 } else {
1338 return array(FALSE, $GLOBALS['LANG']->getLL('ext_import_ext_not_loaded'));
1339 }
1340 } else {
1341 return array(FALSE, $GLOBALS['LANG']->getLL('ext_import_ext_n_a_rep'));
1342 }
1343 }
1344
1345
1346 /**
1347 * Imports an extensions from the online repository
1348 * NOTICE: in version 4.0 this changed from "importExtFromRep_old($extRepUid,$loc,$uploadFlag=0,$directInput='',$recentTranslations=0,$incManual=0,$dontDelete=0)"
1349 *
1350 * @param string Extension key
1351 * @param string Version
1352 * @param string Install scope: "L" or "G" or "S"
1353 * @param boolean If TRUE, extension is uploaded as file
1354 * @param boolean If TRUE, extension directory+files will not be deleted before writing the new ones. That way custom files stored in the extension folder will be kept.
1355 * @param array Direct input array (like from kickstarter)
1356 * @return string Return FALSE on success, returns error message if error.
1357 */
1358 function importExtFromRep($extKey, $version, $loc, $uploadFlag = 0, $dontDelete = 0, $directInput = '') {
1359
1360 $uploadSucceed = FALSE;
1361 $uploadedTempFile = '';
1362 if (is_array($directInput)) {
1363 $fetchData = array($directInput, '');
1364 $loc = ($loc==='G' || $loc==='S') ? $loc : 'L';
1365 } elseif ($uploadFlag) {
1366 if (($uploadedTempFile = $this->CMD['alreadyUploaded']) || $_FILES['upload_ext_file']['tmp_name']) {
1367
1368 // Read uploaded file:
1369 if (!$uploadedTempFile) {
1370 if (!is_uploaded_file($_FILES['upload_ext_file']['tmp_name'])) {
1371 t3lib_div::sysLog('Possible file upload attack: ' . $_FILES['upload_ext_file']['tmp_name'], 'Extension Manager', 3);
1372
1373 /** @var $flashMessage t3lib_FlashMessage */
1374 $flashMessage = t3lib_div::makeInstance(
1375 't3lib_FlashMessage',
1376 $GLOBALS['LANG']->getLL('ext_import_file_not_uploaded'),
1377 '',
1378 t3lib_FlashMessage::ERROR
1379 );
1380 return $flashMessage->render();
1381 }
1382
1383 $uploadedTempFile = t3lib_div::upload_to_tempfile($_FILES['upload_ext_file']['tmp_name']);
1384 }
1385 $fileContent = t3lib_div::getUrl($uploadedTempFile);
1386
1387 if (!$fileContent) {
1388 $flashMessage = t3lib_div::makeInstance(
1389 't3lib_FlashMessage',
1390 $GLOBALS['LANG']->getLL('ext_import_file_empty'),
1391 '',
1392 t3lib_FlashMessage::ERROR
1393 );
1394 return $flashMessage->render();
1395 }
1396
1397 // Decode file data:
1398 $fetchData = $this->terConnection->decodeExchangeData($fileContent);
1399
1400 if (is_array($fetchData)) {
1401 $extKey = $fetchData[0]['extKey'];
1402 if ($extKey) {
1403 if (!$this->CMD['uploadOverwrite']) {
1404 $loc = ($loc==='G' || $loc==='S') ? $loc : 'L';
1405 $comingExtPath = tx_em_Tools::typePath($loc) . $extKey . '/';
1406 if (@is_dir($comingExtPath)) {
1407 $flashMessage = t3lib_div::makeInstance(
1408 't3lib_FlashMessage',
1409 sprintf($GLOBALS['LANG']->getLL('ext_import_ext_present_no_overwrite'), $comingExtPath) .
1410 '<br />' . $GLOBALS['LANG']->getLL('ext_import_ext_present_nothing_done'),
1411 '',
1412 t3lib_FlashMessage::ERROR
1413 );
1414 return $flashMessage->render();
1415 } // ... else go on, install...
1416 } // ... else go on, install...
1417 } else {
1418 $flashMessage = t3lib_div::makeInstance(
1419 't3lib_FlashMessage',
1420 $GLOBALS['LANG']->getLL('ext_import_no_key'),
1421 '',
1422 t3lib_FlashMessage::ERROR
1423 );
1424 return $flashMessage->render();
1425 }
1426 } else {
1427 $flashMessage = t3lib_div::makeInstance(
1428 't3lib_FlashMessage',
1429 sprintf($GLOBALS['LANG']->getLL('ext_import_wrong_file_format'), $fetchData),
1430 '',
1431 t3lib_FlashMessage::ERROR
1432 );
1433 return $flashMessage->render();
1434 }
1435 } else {
1436 $flashMessage = t3lib_div::makeInstance(
1437 't3lib_FlashMessage',
1438 $GLOBALS['LANG']->getLL('ext_import_no_file'),
1439 '',
1440 t3lib_FlashMessage::ERROR
1441 );
1442 return $flashMessage->render();
1443 }
1444 } else {
1445 $this->xmlHandler->searchExtensionsXMLExact($extKey, '', '', TRUE, TRUE);
1446
1447 // Fetch extension from TER:
1448 if (!strlen($version)) {
1449 $versions = array_keys($this->xmlHandler->extensionsXML[$extKey]['versions']);
1450 // sort version numbers ascending to pick the highest version
1451 natsort($versions);
1452 $version = end($versions);
1453 }
1454 $fetchData = $this->terConnection->fetchExtension($extKey, $version, $this->xmlHandler->extensionsXML[$extKey]['versions'][$version]['t3xfilemd5'], $this->getMirrorURL());
1455 }
1456
1457 // At this point the extension data should be present; so we want to write it to disc:
1458 $content = $this->install->installExtension($fetchData, $loc, $version, $uploadedTempFile, $dontDelete);
1459
1460 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_import_results'), $content, 0, 1);
1461
1462 if ($uploadSucceed && $uploadedTempFile) {
1463 t3lib_div::unlink_tempfile($uploadedTempFile);
1464 }
1465
1466 return FALSE;
1467 }
1468
1469 /**
1470 * Display extensions details.
1471 *
1472 * @param string Extension key
1473 * @return void Writes content to $this->content
1474 */
1475 function showExtDetails($extKey) {
1476 $theOutput = '';
1477 $dependencyUpdates = '';
1478 list($list,) = $this->extensionList->getInstalledExtensions();
1479 $absPath = tx_em_Tools::getExtPath($extKey, $list[$extKey]['type']);
1480
1481 // Check updateModule:
1482 if (isset($list[$extKey]) && @is_file($absPath . 'class.ext_update.php')) {
1483 require_once($absPath . 'class.ext_update.php');
1484 $updateObj = new ext_update;
1485 if (!$updateObj->access()) {
1486 unset($this->MOD_MENU['singleDetails']['updateModule']);
1487 }
1488 } else {
1489 unset($this->MOD_MENU['singleDetails']['updateModule']);
1490 }
1491
1492 if ($this->CMD['doDelete']) {
1493 $this->MOD_MENU['singleDetails'] = array();
1494 }
1495
1496 // Function menu here:
1497 if (!$this->CMD['standAlone'] && !t3lib_div::_GP('standAlone')) {
1498 $content = $GLOBALS['LANG']->getLL('ext_details_ext') . '&nbsp;<strong>' .
1499 $this->extensionTitleIconHeader($extKey, $list[$extKey]) . '</strong> (' . htmlspecialchars($extKey) . ')';
1500 $this->content .= $this->doc->section('', $content);
1501 }
1502
1503 // Show extension details:
1504 if ($list[$extKey]) {
1505
1506 // Checking if a command for install/uninstall is executed:
1507 if (($this->CMD['remove'] || $this->CMD['load']) && !in_array($extKey, $this->requiredExt)) {
1508
1509 // Install / Uninstall extension here:
1510 if (t3lib_extMgm::isLocalconfWritable()) {
1511 // Check dependencies:
1512 $depStatus = $this->install->checkDependencies($extKey, $list[$extKey]['EM_CONF'], $list);
1513
1514 if (!$this->CMD['remove'] && !$depStatus['returnCode']) {
1515 $this->content .= $depStatus['html'];
1516 $newExtList = -1;
1517 } elseif ($this->CMD['remove']) {
1518 $newExtList = $this->extensionList->removeExtFromList($extKey, $list);
1519 } else {
1520 $newExtList = $this->extensionList->addExtToList($extKey, $list);
1521 }
1522
1523 // Successful installation:
1524 if ($newExtList != -1) {
1525 $updates = '';
1526 if ($this->CMD['load']) {
1527 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1528 $script = t3lib_div::linkThisScript(array(
1529 'CMD[showExt]' => $extKey,
1530 'CMD[load]' => 1,
1531 'CMD[clrCmd]' => $this->CMD['clrCmd'],
1532 'SET[singleDetails]' => 'info'
1533 ));
1534 } else {
1535 $script = '';
1536 }
1537 $standaloneUpdates = '';
1538 if ($this->CMD['standAlone']) {
1539 $standaloneUpdates .= '<input type="hidden" name="standAlone" value="1" />';
1540 }
1541 if ($this->CMD['silendMode']) {
1542 $standaloneUpdates .= '<input type="hidden" name="silendMode" value="1" />';
1543 }
1544 $depsolver = t3lib_div::_POST('depsolver');
1545 if (is_array($depsolver['ignore'])) {
1546 foreach ($depsolver['ignore'] as $depK => $depV) {
1547 $dependencyUpdates .= '<input type="hidden" name="depsolver[ignore][' . $depK . ']" value="1" />';
1548 }
1549 }
1550 $updatesForm = $this->install->updatesForm(
1551 $extKey,
1552 $list[$extKey],
1553 1,
1554 $script,
1555 $dependencyUpdates . $standaloneUpdates . '<input type="hidden" name="_do_install" value="1" /><input type="hidden" name="_clrCmd" value="' . $this->CMD['clrCmd'] . '" />',
1556 TRUE
1557 );
1558 if ($updatesForm) {
1559 $updates = $GLOBALS['LANG']->getLL('ext_details_new_tables_fields') . '<br />' .
1560 $GLOBALS['LANG']->getLL('ext_details_new_tables_fields_select') . $updatesForm;
1561 $labelDBUpdate = $GLOBALS['LANG']->csConvObj->conv_case(
1562 $GLOBALS['LANG']->charSet,
1563 $GLOBALS['LANG']->getLL('ext_details_db_needs_update'),
1564 'toUpper'
1565 );
1566 $this->content .= $this->doc->section(
1567 sprintf($GLOBALS['LANG']->getLL('ext_details_installing') . ' ',
1568 $this->extensionTitleIconHeader($extKey, $list[$extKey])
1569 ) . ' ' .
1570 $labelDBUpdate,
1571 $updates, 1, 1, 1, 1
1572 );
1573 }
1574 } elseif ($this->CMD['remove']) {
1575 $updates .= $this->install->checkClearCache($list[$extKey]);
1576 if ($updates) {
1577 $updates = '
1578 <form action="' . $this->script . '" method="post">' . $updates . '
1579 <br /><input type="submit" name="write" value="' .
1580 $GLOBALS['LANG']->getLL('ext_details_remove_ext') . '" />
1581 <input type="hidden" name="_do_install" value="1" />
1582 <input type="hidden" name="_clrCmd" value="' . $this->CMD['clrCmd'] . '" />
1583 <input type="hidden" name="CMD[showExt]" value="' . $this->CMD['showExt'] . '" />
1584 <input type="hidden" name="CMD[remove]" value="' . $this->CMD['remove'] . '" />
1585 <input type="hidden" name="standAlone" value="' . $this->CMD['standAlone'] . '" />
1586 <input type="hidden" name="silentMode" value="' . $this->CMD['silentMode'] . '" />
1587 ' . ($this->noDocHeader ? '<input type="hidden" name="nodoc" value="1" />' : '') . '
1588 </form>';
1589 $labelDBUpdate = $GLOBALS['LANG']->csConvObj->conv_case(
1590 $GLOBALS['LANG']->charSet,
1591 $GLOBALS['LANG']->getLL('ext_details_db_needs_update'),
1592 'toUpper'
1593 );
1594 $this->content .= $this->doc->section(
1595 sprintf($GLOBALS['LANG']->getLL('ext_details_removing') . ' ',
1596 $this->extensionTitleIconHeader($extKey, $list[$extKey])
1597 ) . ' ' .
1598 $labelDBUpdate,
1599 $updates, 1, 1, 1, 1
1600 );
1601 }
1602 }
1603 if (!$updates || t3lib_div::_GP('_do_install') || ($this->noDocHeader && $this->CMD['remove'])) {
1604 $this->install->writeNewExtensionList($newExtList);
1605 $action = $this->CMD['load'] ? 'installed' : 'removed';
1606 $GLOBALS['BE_USER']->writelog(5, 1, 0, 0, 'Extension list has been changed, extension %s has been %s', array($extKey, $action));
1607
1608 if (!t3lib_div::_GP('silentMode') && !$this->CMD['standAlone']) {
1609 $messageLabel = 'ext_details_ext_' . $action . '_with_key';
1610 $flashMessage = t3lib_div::makeInstance(
1611 't3lib_FlashMessage',
1612 sprintf($GLOBALS['LANG']->getLL($messageLabel), $extKey),
1613 '',
1614 t3lib_FlashMessage::OK,
1615 TRUE
1616 );
1617 t3lib_FlashMessageQueue::addMessage($flashMessage);
1618 }
1619 $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $list[$extKey]);
1620 if ($this->CMD['clrCmd'] || t3lib_div::_GP('_clrCmd')) {
1621 if ($this->CMD['load'] && @is_file($absPath . 'ext_conf_template.txt')) {
1622 $vA = array('CMD' => array('showExt' => $extKey));
1623 } elseif ($this->CMD['load'] && $techInfo['hasCacheConfiguration']) {
1624 $vA = array('CMD' => array('showExt' => $extKey));
1625 } else {
1626 $vA = array('CMD' => '');
1627 }
1628 } else {
1629 $vA = array('CMD' => array('showExt' => $extKey));
1630 }
1631
1632 if ($this->CMD['standAlone'] || t3lib_div::_GP('standAlone')) {
1633 $this->content .= sprintf($GLOBALS['LANG']->getLL('ext_details_ext_installed_removed'),
1634 ($this->CMD['load'] ?
1635 $GLOBALS['LANG']->getLL('ext_details_installed') :
1636 $GLOBALS['LANG']->getLL('ext_details_removed')
1637 )
1638 ) .
1639 '<br /><br />' . $this->getSubmitAndOpenerCloseLink();
1640 } else {
1641 // Determine if new modules were installed:
1642 if (($this->CMD['load'] || $this->CMD['remove']) && is_array($techInfo['flags']) && in_array('Module', $techInfo['flags'], TRUE)) {
1643 $vA['CMD']['refreshMenu'] = 1;
1644 }
1645 t3lib_utility_Http::redirect(t3lib_div::linkThisScript($vA));
1646 exit;
1647 }
1648 }
1649 }
1650 } else {
1651 $writeAccessError = $GLOBALS['LANG']->csConvObj->conv_case(
1652 $GLOBALS['LANG']->charSet,
1653 $GLOBALS['LANG']->getLL('ext_details_write_access_error'),
1654 'toUpper'
1655 );
1656 $this->content .= $this->doc->section(
1657 sprintf($GLOBALS['LANG']->getLL('ext_details_installing') . ' ',
1658 $this->extensionTitleIconHeader($extKey, $list[$extKey])
1659 ) . ' ' .
1660 $writeAccessError,
1661 $GLOBALS['LANG']->getLL('ext_details_write_error_localconf'),
1662 1, 1, 2, 1
1663 );
1664 }
1665
1666 } elseif ($this->CMD['downloadFile'] && !in_array($extKey, $this->requiredExt)) {
1667
1668 // Link for downloading extension has been clicked - deliver content stream:
1669 $dlFile = urldecode($this->CMD['downloadFile']);
1670 if (t3lib_div::isAllowedAbsPath($dlFile) && t3lib_div::isFirstPartOfStr($dlFile, PATH_site) && t3lib_div::isFirstPartOfStr($dlFile, $absPath) && @is_file($dlFile)) {
1671 $mimeType = 'application/octet-stream';
1672 Header('Content-Type: ' . $mimeType);
1673 Header('Content-Disposition: attachment; filename=' . basename($dlFile));
1674 echo t3lib_div::getUrl($dlFile);
1675 exit;
1676 } else {
1677 throw new RuntimeException(
1678 'TYPO3 Fatal Error: ' . $GLOBALS['LANG']->getLL('ext_details_error_downloading'),
1679 1270853980
1680 );
1681 }
1682
1683 } elseif ($this->CMD['editFile'] && !in_array($extKey, $this->requiredExt)) {
1684
1685 // Editing extension file:
1686 $editFile = rawurldecode($this->CMD['editFile']);
1687 if (t3lib_div::isAllowedAbsPath($editFile) && t3lib_div::isFirstPartOfStr($editFile, $absPath)) {
1688
1689 $fI = t3lib_div::split_fileref($editFile);
1690 if (@is_file($editFile) && t3lib_div::inList($this->editTextExtensions, ($fI['fileext'] ? $fI['fileext'] : $fI['filebody']))) {
1691 if (filesize($editFile) < ($this->kbMax * 1024)) {
1692 $outCode = '<form action="' . $this->script . '" method="post" name="editfileform">';
1693 $info = '';
1694 $submittedContent = t3lib_div::_POST('edit');
1695 $saveFlag = 0;
1696
1697 if (isset($submittedContent['file']) && !$GLOBALS['TYPO3_CONF_VARS']['EXT']['noEdit']) { // Check referer here?
1698 $oldFileContent = t3lib_div::getUrl($editFile);
1699 if ($oldFileContent != $submittedContent['file']) {
1700 $oldMD5 = md5(str_replace(CR, '', $oldFileContent));
1701 $info .= sprintf(
1702 $GLOBALS['LANG']->getLL('ext_details_md5_previous'),
1703 '<strong>' . $oldMD5 . '</strong>'
1704 ) . '<br />';
1705 t3lib_div::writeFile($editFile, $submittedContent['file']);
1706 $saveFlag = 1;
1707 } else {
1708 $info .= $GLOBALS['LANG']->getLL('ext_details_no_changes') . '<br />';
1709 }
1710 }
1711
1712 $fileContent = t3lib_div::getUrl($editFile);
1713
1714 $outCode .= sprintf(
1715 $GLOBALS['LANG']->getLL('ext_details_file'),
1716 '<strong>' . substr($editFile, strlen($absPath)) . '</strong> (' .
1717 t3lib_div::formatSize(filesize($editFile)) . ')<br />'
1718 );
1719 $fileMD5 = md5(str_replace(CR, '', $fileContent));
1720 $info .= sprintf(
1721 $GLOBALS['LANG']->getLL('ext_details_md5_current'),
1722 '<strong>' . $fileMD5 . '</strong>'
1723 ) . '<br />';
1724 if ($saveFlag) {
1725 $saveMD5 = md5(str_replace(CR, '', $submittedContent['file']));
1726 $info .= sprintf(
1727 $GLOBALS['LANG']->getLL('ext_details_md5_submitted'),
1728 '<strong>' . $saveMD5 . '</strong>'
1729 ) . '<br />';
1730 if ($fileMD5 != $saveMD5) {
1731 $info .= tx_em_Tools::rfw(
1732 '<br /><strong>' . $GLOBALS['LANG']->getLL('ext_details_saving_failed_changes_lost') . '</strong>'
1733 ) . '<br />';
1734 }
1735 else {
1736 $info .= tx_em_Tools::rfw(
1737 '<br /><strong>' . $GLOBALS['LANG']->getLL('ext_details_file_saved') . '</strong>'
1738 ) . '<br />';
1739 }
1740 }
1741
1742 $outCode .= '<textarea name="edit[file]" rows="35" wrap="off"' . $this->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font enable-tab">' . t3lib_div::formatForTextarea($fileContent) . '</textarea>';
1743 $outCode .= '<input type="hidden" name="edit[filename]" value="' . $editFile . '" />';
1744 $outCode .= '<input type="hidden" name="CMD[editFile]" value="' . htmlspecialchars($editFile) . '" />';
1745 $outCode .= '<input type="hidden" name="CMD[showExt]" value="' . $extKey . '" />';
1746 $outCode .= $info;
1747
1748 if (!$GLOBALS['TYPO3_CONF_VARS']['EXT']['noEdit']) {
1749 $outCode .= '<br /><input type="submit" name="save_file" value="' .
1750 $GLOBALS['LANG']->getLL('ext_details_file_save_button') . '" />';
1751 }
1752 else {
1753 $outCode .= tx_em_Tools::rfw(
1754 '<br />' . $GLOBALS['LANG']->getLL('ext_details_saving_disabled') . ' '
1755 );
1756 }
1757
1758 $onClick = 'window.location.href="' . t3lib_div::linkThisScript(array(
1759 'CMD[showExt]' => $extKey
1760 )) . '";return false;';
1761 $outCode .= '<input type="submit" name="cancel" value="' .
1762 $GLOBALS['LANG']->getLL('ext_details_cancel_button') . '" onclick="' .
1763 htmlspecialchars($onClick) . '" /></form>';
1764
1765 $theOutput .= $this->doc->spacer(15);
1766 $theOutput .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_edit_file'), '', 0, 1);
1767 $theOutput .= $this->doc->sectionEnd() . $outCode;
1768 $this->content .= $theOutput;
1769 } else {
1770 $theOutput .= $this->doc->spacer(15);
1771 $theOutput .= $this->doc->section(
1772 sprintf(
1773 $GLOBALS['LANG']->getLL('ext_details_filesize_exceeded_kb'),
1774 $this->kbMax
1775 ),
1776 sprintf(
1777 $GLOBALS['LANG']->getLL('ext_details_file_too_large'),
1778 $this->kbMax
1779 )
1780 );
1781 $this->content .= $theOutput;
1782 }
1783 }
1784 } else {
1785 die (sprintf($GLOBALS['LANG']->getLL('ext_details_fatal_edit_error'),
1786 htmlspecialchars($editFile)
1787 )
1788 );
1789 }
1790 } else {
1791
1792 // MAIN:
1793 switch ((string) $this->MOD_SETTINGS['singleDetails']) {
1794 case 'info':
1795 // Loaded / Not loaded:
1796 if (!in_array($extKey, $this->requiredExt)) {
1797 if ($GLOBALS['TYPO3_LOADED_EXT'][$extKey]) {
1798 $content = '<strong>' . $GLOBALS['LANG']->getLL('ext_details_loaded_and_running') . '</strong><br />' .
1799 '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
1800 'CMD[showExt]' => $extKey,
1801 'CMD[remove]' => 1
1802 ))) .
1803 '">' . $GLOBALS['LANG']->getLL('ext_details_remove_button') . ' ' . tx_em_Tools::removeButton() . '</a>';
1804 } else {
1805 $content = $GLOBALS['LANG']->getLL('ext_details_not_loaded') . '<br />' .
1806 '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
1807 'CMD[showExt]' => $extKey,
1808 'CMD[load]' => 1
1809 ))) .
1810 '">' . $GLOBALS['LANG']->getLL('ext_details_install_button') . ' ' . tx_em_Tools::installButton() . '</a>';
1811 }
1812 } else {
1813 $content = $GLOBALS['LANG']->getLL('ext_details_always_loaded');
1814 }
1815 $this->content .= $this->doc->spacer(10);
1816 $this->content .= $this->doc->section(
1817 $GLOBALS['LANG']->getLL('ext_details_current_status'), $content, 0, 1
1818 );
1819
1820 if (t3lib_extMgm::isLoaded($extKey)) {
1821 $updates = $this->install->updatesForm($extKey, $list[$extKey]);
1822 if ($updates) {
1823 $this->content .= $this->doc->spacer(10);
1824 $this->content .= $this->doc->section(
1825 $GLOBALS['LANG']->getLL('ext_details_update_needed'),
1826 $updates . '<br /><br />' . $GLOBALS['LANG']->getLL('ext_details_notice_static_data'),
1827 0, 1
1828 );
1829 }
1830 }
1831
1832 // Config:
1833 if (@is_file($absPath . 'ext_conf_template.txt')) {
1834 $this->content .= $this->doc->spacer(10);
1835 $this->content .= $this->doc->section(
1836 $GLOBALS['LANG']->getLL('ext_details_configuration'),
1837 $GLOBALS['LANG']->getLL('ext_details_notice_clear_cache') . '<br /><br />',
1838 0, 1
1839 );
1840
1841 $this->content .= $this->install->tsStyleConfigForm($extKey, $list[$extKey]);
1842 }
1843
1844 // Show details:
1845 $headline = $GLOBALS['LANG']->getLL('ext_details_details');
1846 $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'info', $headline);
1847 $content = $this->extensionDetails->extInformationarray($extKey, $list[$extKey]);
1848
1849
1850 $this->content .= $this->doc->spacer(10);
1851 $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE);
1852 break;
1853 case 'upload':
1854 $em = t3lib_div::_POST('em');
1855 $headline = '';
1856 $eC = 0;
1857 if ($em['action'] == 'doUpload') {
1858 $em['extKey'] = $extKey;
1859 $em['extInfo'] = $list[$extKey];
1860 $content = $this->extensionDetails->uploadExtensionToTER($em);
1861 $content .= $this->doc->spacer(10);
1862 // Must reload this, because EM_CONF information has been updated!
1863 list($list,) = $this->extensionList->getInstalledExtensions();
1864 } else {
1865 // headline and CSH
1866 $headline = $GLOBALS['LANG']->getLL('ext_details_upload_to_ter');
1867 $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'upload', $headline);
1868
1869 // Upload:
1870 if (substr($extKey, 0, 5) != 'user_') {
1871 $content = $this->getRepositoryUploadForm($extKey, $list[$extKey]);
1872 $eC = 0;
1873 } else {
1874 $content = $GLOBALS['LANG']->getLL('ext_details_no_unique_ext');
1875 $eC = 2;
1876 }
1877 if (!$this->fe_user['username']) {
1878 /** @var $flashMessage t3lib_FlashMessage */
1879 $flashMessage = t3lib_div::makeInstance(
1880 't3lib_FlashMessage',
1881 sprintf($GLOBALS['LANG']->getLL('ext_details_no_username'),
1882 '<a href="' . t3lib_div::linkThisScript(array(
1883 'SET[function]' => 3
1884 )) . '">', '</a>'
1885 ),
1886 '',
1887 t3lib_FlashMessage::INFO
1888 );
1889 $content .= '<br />' . $flashMessage->render();
1890
1891 }
1892 }
1893 $this->content .= $this->doc->section($headline, $content, 0, 1, $eC, TRUE);
1894 break;
1895 case 'backup':
1896 if ($this->CMD['doDelete']) {
1897 $content = $this->install->extDelete($extKey, $list[$extKey], $this->CMD);
1898 $this->content .= $this->doc->section(
1899 $GLOBALS['LANG']->getLL('ext_details_delete'),
1900 $GLOBALS['LANG']->getLL('ext_details_delete'),
1901 $content, 0, 1
1902 );
1903 } else {
1904 // headline and CSH
1905 $headline = $GLOBALS['LANG']->getLL('ext_details_backup');
1906 $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'backup_delete', $headline);
1907
1908 $content = $this->extBackup($extKey, $list[$extKey]);
1909 $this->content .= $this->doc->section($headline, $content, 0, 1, 0, 1);
1910
1911 $content = $this->install->extDelete($extKey, $list[$extKey], $this->CMD);
1912 $this->content .= $this->doc->section(
1913 $GLOBALS['LANG']->getLL('ext_details_delete'),
1914 $content, 0, 1
1915 );
1916
1917 $content = $this->extUpdateEMCONF($extKey, $list[$extKey]);
1918 $this->content .= $this->doc->section(
1919 $GLOBALS['LANG']->getLL('ext_details_update_em_conf'),
1920 $content, 0, 1
1921 );
1922 }
1923 break;
1924 case 'dump':
1925 $this->extDumpTables($extKey, $list[$extKey]);
1926 break;
1927 case 'edit':
1928 // headline and CSH
1929 $headline = $GLOBALS['LANG']->getLL('ext_details_ext_files');
1930 $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'editfiles', $headline);
1931
1932 $content = $this->getFileListOfExtension($extKey, $list[$extKey]);
1933
1934 $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE);
1935 break;
1936 case 'updateModule':
1937 $this->content .= $this->doc->section(
1938 $GLOBALS['LANG']->getLL('ext_details_update'),
1939 is_object($updateObj) ?
1940 $updateObj->main() :
1941 $GLOBALS['LANG']->getLL('ext_details_no_update_object'),
1942 0, 1
1943 );
1944 break;
1945 default:
1946 $this->extObjContent();
1947 break;
1948 }
1949 }
1950 }
1951 }
1952
1953 /**
1954 * Outputs a screen from where you can install multiple extensions in one go
1955 * This can be called from external modules with "...index.php?CMD[requestInstallExtensions]=
1956 *
1957 * @param string Comma list of extension keys to install. Renders a screen with checkboxes for all extensions not already imported or installed
1958 * @return void
1959 */
1960 function requestInstallExtensions($extList) {
1961
1962 // Return URL:
1963 $returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
1964 $installOrImportExtension = t3lib_div::_POST('installOrImportExtension');
1965
1966 // Extension List:
1967 $extArray = explode(',', $extList);
1968 $outputRow = array();
1969 $outputRow[] = '
1970 <tr class="t3-row-header tableheader">
1971 <td>' . $GLOBALS['LANG']->getLL('reqInstExt_install_import') . '</td>
1972 <td>' . $GLOBALS['LANG']->getLL('reqInstExt_ext_key') . '</td>
1973 </tr>
1974 ';
1975
1976 foreach ($extArray as $extKey) {
1977
1978 // Check for the request:
1979 if ($installOrImportExtension[$extKey]) {
1980 $this->installExtension($extKey);
1981 }
1982
1983 // Display:
1984 if (!t3lib_extMgm::isLoaded($extKey)) {
1985 $outputRow[] = '
1986 <tr class="bgColor4">
1987 <td><input type="checkbox" name="' . htmlspecialchars('installOrImportExtension[' . $extKey . ']') . '" value="1" checked="checked" id="check_' . $extKey . '" /></td>
1988 <td><label for="check_' . $extKey . '">' . htmlspecialchars($extKey) . '</label></td>
1989 </tr>
1990 ';
1991 }
1992 }
1993
1994 if (count($outputRow) > 1 || !$returnUrl) {
1995 $content = '
1996 <!-- ending page form ... -->
1997 <form action="' . htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')) . '" method="post">
1998 <table border="0" cellpadding="1" cellspacing="1">' . implode('', $outputRow) . '</table>
1999 <input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('reqInstExt_import_install_selected') . '" />
2000 </form>';
2001
2002 if ($returnUrl) {
2003 $content .= '
2004 <br />
2005 <br />
2006 <a href="' . htmlspecialchars($returnUrl) . '">' . $GLOBALS['LANG']->getLL('reqInstExt_return') . '</a>
2007 ';
2008 }
2009
2010 $this->content .= $this->doc->section(
2011 $GLOBALS['LANG']->getLL('reqInstExt_imp_inst_ext'), $content, 0, 1
2012 );
2013 } else {
2014 t3lib_utility_Http::redirect($returnUrl);
2015 }
2016 }
2017
2018
2019 /***********************************
2020 *
2021 * Application Sub-functions (HTML parts)
2022 *
2023 **********************************/
2024
2025
2026 /**
2027 * Creates view for dumping static tables and table/fields structures...
2028 *
2029 * @param string Extension key
2030 * @param array Extension information array
2031 * @return void
2032 */
2033 function extDumpTables($extKey, $extInfo) {
2034
2035 // Get dbInfo which holds the structure known from the tables.sql file
2036 $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $extInfo);
2037 $absPath = tx_em_Tools::getExtPath($extKey, $extInfo['type']);
2038
2039 // Static tables:
2040 if (is_array($techInfo['static'])) {
2041 if ($this->CMD['writeSTATICdump']) { // Writing static dump:
2042 $writeFile = $absPath . 'ext_tables_static+adt.sql';
2043 if (@is_file($writeFile)) {
2044 $dump_static = tx_em_Database::dumpStaticTables(implode(',', $techInfo['static']));
2045 t3lib_div::writeFile($writeFile, $dump_static);
2046 $this->content .= $this->doc->section(
2047 $GLOBALS['LANG']->getLL('extDumpTables_tables_fields'),
2048 sprintf($GLOBALS['LANG']->getLL('extDumpTables_bytes_written_to'),
2049 t3lib_div::formatSize(strlen($dump_static)),
2050 substr($writeFile, strlen(PATH_site))
2051 ),
2052 0, 1
2053 );
2054 }
2055 } else { // Showing info about what tables to dump - and giving the link to execute it.
2056 $msg = $GLOBALS['LANG']->getLL('extDumpTables_dumping_content') . '<br />';
2057 $msg .= '<br />' . implode('<br />', $techInfo['static']) . '<br />';
2058
2059 // ... then feed that to this function which will make new CREATE statements of the same fields but based on the current database content.
2060 $this->content .= $this->doc->section(
2061 $GLOBALS['LANG']->getLL('extDumpTables_static_tables'),
2062 $msg . '<hr /><strong><a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
2063 'CMD[showExt]' => $extKey,
2064 'CMD[writeSTATICdump]' => 1
2065 ))) . '">' . $GLOBALS['LANG']->getLL('extDumpTables_write_static') . '</a></strong>',
2066 0, 1
2067 );
2068 $this->content .= $this->doc->spacer(20);
2069 }
2070 }
2071
2072 // Table and field definitions:
2073 if (is_array($techInfo['dump_tf'])) {
2074 $dump_tf_array = tx_em_Database::getTableAndFieldStructure($techInfo['dump_tf']);
2075 $dump_tf = tx_em_Database::dumpTableAndFieldStructure($dump_tf_array);
2076 if ($this->CMD['writeTFdump']) {
2077 $writeFile = $absPath . 'ext_tables.sql';
2078 if (@is_file($writeFile)) {
2079 t3lib_div::writeFile($writeFile, $dump_tf);
2080 $this->content .= $this->doc->section(
2081 $GLOBALS['LANG']->getLL('extDumpTables_tables_fields'),
2082 sprintf($GLOBALS['LANG']->getLL('extDumpTables_bytes_written_to'),
2083 t3lib_div::formatSize(strlen($dump_tf)),
2084 substr($writeFile, strlen(PATH_site))
2085 ),
2086 0, 1
2087 );
2088 }
2089 } else {
2090 $msg = $GLOBALS['LANG']->getLL('extDumpTables_dumping_db_structure') . '<br />';
2091 if (is_array($techInfo['tables'])) {
2092 $msg .= '<br /><strong>' . $GLOBALS['LANG']->getLL('extDumpTables_tables') . '</strong><br />' .
2093 implode('<br />', $techInfo['tables']) . '<br />';
2094 }
2095 if (is_array($techInfo['fields'])) {
2096 $msg .= '<br /><strong>' . $GLOBALS['LANG']->getLL('extDumpTables_solo_fields') . '</strong><br />' .
2097 implode('<br />', $techInfo['fields']) . '<br />';
2098 }
2099
2100 // ... then feed that to this function which will make new CREATE statements of the same fields but based on the current database content.
2101 $this->content .= $this->doc->section(
2102 $GLOBALS['LANG']->getLL('extDumpTables_tables_fields'),
2103 $msg . '<hr /><strong><a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
2104 'CMD[showExt]' => $extKey,
2105 'CMD[writeTFdump]' => 1
2106 ))) .
2107 '">' . $GLOBALS['LANG']->getLL('extDumpTables_write_dump') . '</a></strong><hr />
2108 <pre>' . htmlspecialchars($dump_tf) . '</pre>',
2109 0, 1
2110 );
2111
2112
2113 $details = ' ' . $GLOBALS['LANG']->getLL('extDumpTables_based_on') . '<br />
2114 <ul>
2115 <li>' . $GLOBALS['LANG']->getLL('extDumpTables_based_on_one') . '</li>
2116 <li>' . $GLOBALS['LANG']->getLL('extDumpTables_based_on_two') . '</li>
2117 </ul>
2118 ' . $GLOBALS['LANG']->getLL('extDumpTables_bottomline') . '<br />';
2119 $this->content .= $this->doc->section('', $details);
2120 }
2121 }
2122 }
2123
2124 /**
2125 * Returns file-listing of an extension
2126 *
2127 * @param string Extension key
2128 * @param array Extension information array
2129 * @return string HTML table.
2130 */
2131 function getFileListOfExtension($extKey, $conf) {
2132 $content = '';
2133 $extPath = tx_em_Tools::getExtPath($extKey, $conf['type']);
2134
2135 if ($extPath) {
2136 // Read files:
2137 $fileArr = array();
2138 $fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr, $extPath, '', 0, 99, $this->excludeForPackaging);
2139
2140 // Start table:
2141 $lines = array();
2142 $totalSize = 0;
2143
2144 // Header:
2145 $lines[] = '
2146 <tr class="t3-row-header">
2147 <td>' . $GLOBALS['LANG']->getLL('extFileList_file') . '</td>
2148 <td>' . $GLOBALS['LANG']->getLL('extFileList_size') . '</td>
2149 <td>' . $GLOBALS['LANG']->getLL('extFileList_edit') . '</td>
2150 </tr>';
2151
2152 foreach ($fileArr as $file) {
2153 $fI = t3lib_div::split_fileref($file);
2154 $lines[] = '
2155 <tr class="bgColor4">
2156 <td><a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
2157 'CMD[showExt]' => $extKey,
2158 'CMD[downloadFile]' => rawurlencode($file)
2159 ))) . '" title="' . $GLOBALS['LANG']->getLL('extFileList_download') . '">' .
2160 substr($file, strlen($extPath)) . '</a></td>
2161 <td>' . t3lib_div::formatSize(filesize($file)) . '</td>
2162 <td>' . (!in_array($extKey, $this->requiredExt) &&
2163 t3lib_div::inList($this->editTextExtensions,
2164 ($fI['fileext'] ? $fI['fileext'] : $fI['filebody'])) ?
2165 '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
2166 'CMD[showExt]' => $extKey,
2167 'CMD[editFile]' => rawurlencode($file)
2168 ))) . '">' .
2169 $GLOBALS['LANG']->getLL('extFileList_edit_file') . '</a>' : ''
2170 ) . '</td>
2171 </tr>';
2172 $totalSize += filesize($file);
2173 }
2174
2175 $lines[] = '
2176 <tr class="bgColor6">
2177 <td><strong>' . $GLOBALS['LANG']->getLL('extFileList_total') . '</strong></td>
2178 <td><strong>' . t3lib_div::formatSize($totalSize) . '</strong></td>
2179 <td>&nbsp;</td>
2180 </tr>';
2181
2182 $content = '
2183 Path: ' . $extPath . '<br /><br />
2184 <table border="0" cellpadding="1" cellspacing="2">' . implode('', $lines) . '</table>';
2185 }
2186
2187 return $content;
2188 }
2189
2190
2191 /**
2192 * Update extension EM_CONF...
2193 *
2194 * @param string Extension key
2195 * @param array Extension information array
2196 * @return string HTML content.
2197 */
2198 function extUpdateEMCONF($extKey, $extInfo) {
2199 $absPath = tx_em_Tools::getExtPath($extKey, $extInfo['type']);
2200 $content = '';
2201
2202 if ($this->CMD['doUpdateEMCONF']) {
2203 return $this->extensionDetails->updateLocalEM_CONF($extKey, $extInfo);
2204 } else {
2205 $sure = $GLOBALS['LANG']->getLL('extUpdateEMCONF_sure');
2206 $updateEMConf = $GLOBALS['LANG']->getLL('extUpdateEMCONF_file');
2207 $onClick = "if (confirm('$sure')) {window.location.href='" . t3lib_div::linkThisScript(array(
2208 'CMD[showExt]' => $extKey,
2209 'CMD[doUpdateEMCONF]' => 1
2210 )) . "';}";
2211 $content .= $GLOBALS['LANG']->getLL('extUpdateEMCONF_info_changes') . '<br />'
2212 . $GLOBALS['LANG']->getLL('extUpdateEMCONF_info_reset') . '<br /><br />';
2213 $content .= '<a class="t3-link" href="#" onclick="' . htmlspecialchars($onClick) .
2214 ' return false;"><strong>' . $updateEMConf . '</strong> ' .
2215 sprintf($GLOBALS['LANG']->getLL('extDelete_from_location'),
2216 $this->typeLabels[$extInfo['type']],
2217 substr($absPath, strlen(PATH_site))
2218 ) . '</a>';
2219 return $content;
2220 }
2221 }
2222
2223 /**
2224 * Download extension as file / make backup
2225 *
2226 * @param string Extension key
2227 * @param array Extension information array
2228 * @return string HTML content
2229 */
2230 function extBackup($extKey, $extInfo) {
2231 $uArr = $this->extensionDetails->makeUploadarray($extKey, $extInfo);
2232 if (is_array($uArr)) {
2233 $backUpData = $this->terConnection->makeUploadDataFromarray($uArr);
2234 $filename = 'T3X_' . $extKey . '-' . str_replace('.', '_', $extInfo['EM_CONF']['version']) . '-z-' . date('YmdHi') . '.t3x';
2235 if (intval($this->CMD['doBackup']) == 1) {
2236 t3lib_div::cleanOutputBuffers();
2237 header('Content-Type: application/octet-stream');
2238 header('Content-Disposition: attachment; filename=' . $filename);
2239 echo $backUpData;
2240 exit;
2241 } elseif ($this->CMD['dumpTables']) {
2242 $filename = 'T3X_' . $extKey;
2243 $cTables = count(explode(',', $this->CMD['dumpTables']));
2244 if ($cTables > 1) {
2245 $filename .= '-' . $cTables . 'tables';
2246 } else {
2247 $filename .= '-' . $this->CMD['dumpTables'];
2248 }
2249 $filename .= '+adt.sql';
2250
2251 header('Content-Type: application/octet-stream');
2252 header('Content-Disposition: attachment; filename=' . $filename);
2253 echo tx_em_Database::dumpStaticTables($this->CMD['dumpTables']);
2254 exit;
2255 } else {
2256 $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $extInfo);
2257 $lines = array();
2258 $lines[] = '<tr class="t3-row-header"><td colspan="2">' .
2259 $GLOBALS['LANG']->getLL('extBackup_select') . '</td></tr>';
2260 $lines[] = '<tr class="bgColor4"><td><strong>' .
2261 $GLOBALS['LANG']->getLL('extBackup_files') . '</strong></td><td>' .
2262 '<a class="t3-link" href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
2263 'CMD[doBackup]' => 1,
2264 'CMD[showExt]' => $extKey
2265 ))) .
2266 '">' . sprintf($GLOBALS['LANG']->getLL('extBackup_download'),
2267 $extKey
2268 ) . '</a><br />
2269 (' . $filename . ', <br />' .
2270 t3lib_div::formatSize(strlen($backUpData)) . ', <br />' .
2271 $GLOBALS['LANG']->getLL('extBackup_md5') . ' ' . md5($backUpData) . ')
2272 <br /></td></tr>';
2273
2274 if (is_array($techInfo['tables'])) {
2275 $lines[] = '<tr class="bgColor4"><td><strong>' . $GLOBALS['LANG']->getLL('extBackup_data_tables') .
2276 '</strong></td><td>' . tx_em_Database::dumpDataTablesLine($techInfo['tables'], $extKey) . '</td></tr>';
2277 }
2278 if (is_array($techInfo['static'])) {
2279 $lines[] = '<tr class="bgColor4"><td><strong>' . $GLOBALS['LANG']->getLL('extBackup_static_tables') .
2280 '</strong></td><td>' . tx_em_Database::dumpDataTablesLine($techInfo['static'], $extKey) . '</td></tr>';
2281 }
2282
2283 $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>';
2284 return $content;
2285 }
2286 } else {
2287 throw new RuntimeException(
2288 'TYPO3 Fatal Error: ' . $GLOBALS['LANG']->getLL('extBackup_unexpected_error'),
2289 1270853981
2290 );
2291 }
2292 }
2293
2294
2295
2296 /**
2297 * Prints the upload form for extensions
2298 *
2299 * @param string Extension key
2300 * @param array Extension information array
2301 * @return string HTML content.
2302 */
2303 function getRepositoryUploadForm($extKey, $extInfo) {
2304 $content = '<form action="' . $this->script . '" method="post" name="repuploadform">
2305 <input type="hidden" name="CMD[showExt]" value="' . $extKey . '" />
2306 <input type="hidden" name="em[action]" value="doUpload" />
2307 <table border="0" cellpadding="2" cellspacing="1">
2308 <tr class="bgColor4">
2309 <td>' . $GLOBALS['LANG']->getLL('repositoryUploadForm_username') . '</td>
2310 <td><input' . $this->doc->formWidth(20) . ' type="text" name="em[user][fe_u]" value="' . $this->fe_user['username'] . '" /></td>
2311 </tr>
2312 <tr class="bgColor4">
2313 <td>' . $GLOBALS['LANG']->getLL('repositoryUploadForm_password') . '</td>
2314 <td><input' . $this->doc->formWidth(20) . ' type="password" name="em[user][fe_p]" value="' . $this->fe_user['password'] . '" /></td>
2315 </tr>
2316 <tr class="bgColor4">
2317 <td>' . $GLOBALS['LANG']->getLL('repositoryUploadForm_changelog') . '</td>
2318 <td><textarea' . $this->doc->formWidth(30, 1) . ' rows="5" name="em[upload][comment]"></textarea></td>
2319 </tr>
2320 <tr class="bgColor4">
2321 <td>' . $GLOBALS['LANG']->getLL('repositoryUploadForm_command') . '</td>
2322 <td nowrap="nowrap">
2323 <input type="radio" name="em[upload][mode]" id="new_dev" value="new_dev" checked="checked" />
2324 <label for="new_dev">' . sprintf($GLOBALS['LANG']->getLL('repositoryUploadForm_new_bugfix'),
2325 'x.x.<strong>' . tx_em_Tools::rfw('x+1') . '</strong>'
2326 ) . '</label><br />
2327 <input type="radio" name="em[upload][mode]" id="new_sub" value="new_sub" />
2328 <label for="new_sub">' . sprintf($GLOBALS['LANG']->getLL('repositoryUploadForm_new_sub_version'),
2329 'x.<strong>' . tx_em_Tools::rfw('x+1') . '</strong>.0'
2330 ) . '</label><br />
2331 <input type="radio" name="em[upload][mode]" id="new_main" value="new_main" />
2332 <label for="new_main">' . sprintf($GLOBALS['LANG']->getLL('repositoryUploadForm_new_main_version'),
2333 '<strong>' . tx_em_Tools::rfw('x+1') . '</strong>.0.0'
2334 ) . '</label><br />
2335 </td>
2336 </tr>
2337 <tr class="bgColor4">
2338 <td>&nbsp;</td>
2339 <td><input type="submit" name="submit" value="' . $GLOBALS['LANG']->getLL('repositoryUploadForm_upload') . '" />
2340 </td>
2341 </tr>
2342 </table>
2343 </form>';
2344
2345 return $content;
2346 }
2347
2348
2349 /************************************
2350 *
2351 * Output helper functions
2352 *
2353 ************************************/
2354
2355
2356 /**
2357 * Returns a header for an extensions including icon if any
2358 *
2359 * @param string Extension key
2360 * @param array Extension information array
2361 * @param string align-attribute value (for <img> tag)
2362 * @return string HTML; Extension title and image.
2363 */
2364 function extensionTitleIconHeader($extKey, $extInfo, $align = 'top') {
2365 $imgInfo = @getImageSize(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . '/ext_icon.gif');
2366 $out = '';
2367 if (is_array($imgInfo)) {
2368 $out .= '<img src="' . $GLOBALS['BACK_PATH'] . tx_em_Tools::typeRelPath($extInfo['type']) . $extKey . '/ext_icon.gif" ' . $imgInfo[3] . ' align="' . $align . '" alt="" />';
2369 }
2370 $out .= $extInfo['EM_CONF']['title'] ? htmlspecialchars(t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['title'], 40)) : '<em>' . htmlspecialchars($extKey) . '</em>';
2371 return $out;
2372 }
2373
2374
2375
2376
2377
2378
2379
2380
2381 /************************************
2382 *
2383 * Various helper functions
2384 *
2385 ************************************/
2386
2387 /**
2388 * Returns subtitles for the extension listings
2389 *
2390 * @param string List order type
2391 * @param string Key value
2392 * @return string output.
2393 */
2394 function listOrderTitle($listOrder, $key) {
2395 switch ($listOrder) {
2396 case 'cat':
2397 return isset($this->categories[$key]) ? $this->categories[$key] : '[' . $key . ']';
2398 break;
2399 case 'author_company':
2400 return $key;
2401 break;
2402 case 'state':
2403 return $this->states[$key];
2404 break;
2405 case 'type':
2406 return $this->typeDescr[$key];
2407 break;
2408 }
2409 }
2410
2411
2412 /**
2413 * Returns TRUE if global OR local installation of extensions is allowed/possible.
2414 *
2415 * @return boolean Returns TRUE if global OR local installation of extensions is allowed/possible.
2416 */
2417 function importAtAll() {
2418 return ($GLOBALS['TYPO3_CONF_VARS']['EXT']['allowGlobalInstall'] || $GLOBALS['TYPO3_CONF_VARS']['EXT']['allowLocalInstall']);
2419 }
2420
2421
2422 /**
2423 * Searches for ->lookUpStr in extension and returns TRUE if found (or if no search string is set)
2424 *
2425 * @param string Extension key
2426 * @param array Extension content
2427 * @return boolean If TRUE, display extension in list
2428 */
2429 function searchExtension($extKey, $row) {
2430 if ($this->lookUpStr) {
2431 return (
2432 stristr($extKey, $this->lookUpStr) ||
2433 stristr($row['EM_CONF']['title'], $this->lookUpStr) ||
2434 stristr($row['EM_CONF']['description'], $this->lookUpStr) ||
2435 stristr($row['EM_CONF']['author'], $this->lookUpStr) ||
2436 stristr($row['EM_CONF']['author_company'], $this->lookUpStr)
2437 );
2438 } else {
2439 return TRUE;
2440 }
2441 }
2442
2443
2444 /**
2445 * Checks if there are newer versions of installed extensions in the TER
2446 * integrated from the extension "ter_update_check" for TYPO3 4.2 by Christian Welzel
2447 *
2448 * @return nothing
2449 */
2450 function checkForUpdates() {
2451 $content = '';
2452
2453 $count = intval(tx_em_Database::getExtensionCountFromRepository());
2454 if ($count > 0) {
2455 $content = $this->extensionList->showExtensionsToUpdate()
2456 . t3lib_BEfunc::getFuncCheck(0, 'SET[display_installed]', $this->MOD_SETTINGS['display_installed'], '', '', 'id="checkDisplayInstalled"')
2457 . '&nbsp;<label for="checkDisplayInstalled">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:display_nle') . '</label><br />'
2458 . t3lib_BEfunc::getFuncCheck(0, 'SET[display_files]', $this->MOD_SETTINGS['display_files'], '', '', 'id="checkDisplayFiles"')
2459 . '&nbsp;<label for="checkDisplayFiles">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:display_files') . '</label>';
2460 $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:header_upd_ext'), $content, 0, 1);
2461
2462 $content = sprintf($GLOBALS['LANG']->getLL('note_last_update_new'),
2463 t3lib_BEfunc::datetime(filemtime(PATH_site . 'typo3temp/extensions.xml.gz'))
2464 ) . '<br />';
2465 }
2466
2467 $content .= sprintf($GLOBALS['LANG']->getLL('note_last_update2_new'),
2468 '<a href="' . t3lib_div::linkThisScript(array(
2469 'SET[function]' => 2
2470 )) . '">', '</a>');
2471 $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:header_vers_ret'), $content, 0, 1);
2472 }
2473
2474
2475 function showRepositoryUpdateForm() {
2476 $content = '<div class="em-repupdate"><strong>Repository:</strong>';
2477
2478 // print registered repositories
2479 /** @var $settings tx_em_Settings */
2480 $settings = t3lib_div::makeInstance('tx_em_Settings');
2481 $registeredRepos = $settings->getRegisteredRepositories();
2482 $content .= '<select>';
2483 foreach ($registeredRepos as $repository) {
2484 $content .= '<option>' . $repository->getTitle() . '</option>';
2485 }
2486 $content .= '</select>';
2487
2488 $selectedRepo = $settings->getSelectedRepository();
2489 /** @var $repoUtility tx_em_Repository_Utility */
2490 $repoUtility = t3lib_div::makeInstance('tx_em_Repository_Utility');
2491 $repoUtility->setRepository($selectedRepo);
2492
2493 $onCLick = 'window.location.href="' . t3lib_div::linkThisScript(array(
2494 'CMD[fetchMetaData]' => 'extensions'
2495 )) . '";return false;';
2496 $content .= '
2497 <input type="button" value="' . $GLOBALS['LANG']->getLL('retrieve_update') .
2498 '" onclick="' . htmlspecialchars($onCLick) . '" />';
2499 if (is_file($repoUtility->getLocalExtListFile())) {
2500 $count = tx_em_Database::getExtensionCountFromRepository($repoUtility->getRepositoryUID());
2501 $content .= '<span style="margin-left:10px;padding-right: 50px;" class="typo3-message message-notice">' .
2502 sprintf($GLOBALS['LANG']->getLL('ext_list_last_updated'),
2503 t3lib_BEfunc::datetime(filemtime($repoUtility->getLocalExtListFile())), $count) . '</span>';
2504 } else {
2505 $content .= '<span style="margin-left:10px;padding-right: 50px;" class="typo3-message message-error">There are no extensions available, please update!</span>';
2506 }
2507 $content .= '<br>&nbsp;<br>';
2508
2509 if ($this->CMD['fetchMetaData'] && $this->CMD['fetchMetaData'] == 'extensions') { // fetches mirror/extension data from online rep.
2510 $content .= $repoUtility->updateExtList(TRUE)->render();
2511 }
2512
2513 $content .= '</div>';
2514 return $content;
2515 }
2516
2517
2518 // Function wrappers for compatibility
2519
2520 /**
2521 * Reports back if installation in a certain scope is possible.
2522 *
2523 * @param string Scope: G, L, S
2524 * @param string Extension lock-type (eg. "L" or "G")
2525 * @return boolean TRUE if installation is allowed.
2526 */
2527 public static function importAsType($type, $lockType = '') {
2528 return tx_em_Tools::importAsType($type, $lockType);
2529 }
2530
2531 /**
2532 * Returns the list of available (installed) extensions
2533 *
2534 * @return array Array with two arrays, list array (all extensions with info) and category index
2535 * @wrapper for compatibility
2536 */
2537 public function getInstalledExtensions() {
2538 return $this->extensionList->getInstalledExtensions();
2539 }
2540
2541
2542 /**
2543 * @return string
2544 */
2545 protected function getSubmitAndOpenerCloseLink() {
2546 if (!$this->CMD['standAlone'] && !$this->noDocHeader && ($this->CMD['standAlone'] || t3lib_div::_GP('standAlone'))) {
2547 $link = '<a href="javascript:opener.top.list.iframe.document.forms[0].submit();window.close();">' .
2548 $GLOBALS['LANG']->getLL('ext_import_close_check') . '</a>';
2549 return $link;
2550 } else {
2551 return '<a id="closewindow" href="javascript:if (parent.TYPO3.EM && top.frames.length) {parent.TYPO3.EM.Tools.closeImportWindow();} else {window.close();}">' . $GLOBALS['LANG']->getLL('ext_import_close') . '</a>';
2552 }
2553 }
2554
2555
2556 /* Compatibility wrappers */
2557
2558
2559 /**
2560 * Returns the absolute path where the extension $extKey is installed (based on 'type' (SGL))
2561 *
2562 * @param string Extension key
2563 * @param string Install scope type: L, G, S
2564 * @return string Returns the absolute path to the install scope given by input $type variable. It is checked if the path is a directory. Slash is appended.
2565 */
2566 public function getExtPath($extKey, $type, $returnWithoutExtKey = FALSE) {
2567 return tx_em_Tools::getExtPath($extKey, $type, $returnWithoutExtKey);
2568 }
2569 }
2570
2571
2572 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['em/index.php']) {
2573 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['em/index.php']);
2574 }
2575
2576 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/em/classes/index.php'])) {
2577 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/em/classes/index.php']);
2578 }
2579
2580
2581 // Make instance:
2582 /** @var $SOBE SC_mod_tools_em_index */
2583 $SOBE = t3lib_div::makeInstance('SC_mod_tools_em_index');
2584 $SOBE->init();
2585 foreach ($SOBE->include_once as $INC_FILE) {
2586 include_once($INC_FILE);
2587 }
2588 $SOBE->checkExtObj();
2589
2590 $SOBE->main();
2591 $SOBE->printContent();
2592
2593 ?>