PageRenderTime 72ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 1ms

/typo3/mod/tools/em/class.em_index.php

https://bitbucket.org/linxpinx/mercurial
PHP | 6205 lines | 4237 code | 708 blank | 1260 comment | 759 complexity | 63d5a84b510a060cee640d8810107b70 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, Unlicense, LGPL-2.1, Apache-2.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /***************************************************************
  3. * Copyright notice
  4. *
  5. * (c) 1999-2010 Kasper Skaarhoj (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. * $Id: class.em_index.php 8429 2010-07-28 09:19:00Z ohader $
  32. *
  33. * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
  34. * @author Karsten Dambekalns <karsten@typo3.org>
  35. */
  36. /**
  37. * [CLASS/FUNCTION INDEX of SCRIPT]
  38. *
  39. *
  40. *
  41. * 194: class SC_mod_tools_em_index extends t3lib_SCbase
  42. *
  43. * SECTION: Standard module initialization
  44. * 337: function init()
  45. * 417: function handleExternalFunctionValue($MM_key='function', $MS_value=NULL)
  46. * 431: function menuConfig()
  47. * 508: function main()
  48. * 584: function printContent()
  49. *
  50. * SECTION: Function Menu Applications
  51. * 609: function extensionList_loaded()
  52. * 664: function extensionList_installed()
  53. * 736: function extensionList_import()
  54. * 903: function alterSettings()
  55. *
  56. * SECTION: Command Applications (triggered by GET var)
  57. * 1005: function importExtInfo($extKey, $version='')
  58. * 1062: function fetchMetaData($metaType)
  59. * 1125: function getMirrorURL()
  60. * 1158: function installExtension($extKey, $version=null, $mode=EM_INSTALL_VERSION_MIN)
  61. * 1279: function importExtFromRep($extKey,$version,$loc,$uploadFlag=0,$dontDelete=0,$directInput='')
  62. * 1425: function showExtDetails($extKey)
  63. *
  64. * SECTION: Application Sub-functions (HTML parts)
  65. * 1737: function updatesForm($extKey,$extInfo,$notSilent=0,$script='',$addFields='')
  66. * 1768: function extDumpTables($extKey,$extInfo)
  67. * 1835: function getFileListOfExtension($extKey,$conf)
  68. * 1889: function extDelete($extKey,$extInfo)
  69. * 1920: function extUpdateEMCONF($extKey,$extInfo)
  70. * 1940: function extBackup($extKey,$extInfo)
  71. * 1987: function extBackup_dumpDataTablesLine($tablesArray,$extKey)
  72. * 2015: function extInformationArray($extKey,$extInfo,$remote=0)
  73. * 2097: function extInformationArray_dbReq($techInfo,$tableHeader=0)
  74. * 2110: function extInformationArray_dbInst($dbInst,$current)
  75. * 2129: function getRepositoryUploadForm($extKey,$extInfo)
  76. *
  77. * SECTION: Extension list rendering
  78. * 2190: function extensionListRowHeader($trAttrib,$cells,$import=0)
  79. * 2251: function extensionListRow($extKey,$extInfo,$cells,$bgColorClass='',$inst_list=array(),$import=0,$altLinkUrl='')
  80. *
  81. * SECTION: Output helper functions
  82. * 2367: function wrapEmail($str,$email)
  83. * 2380: function helpCol($key)
  84. * 2396: function labelInfo($str)
  85. * 2408: function extensionTitleIconHeader($extKey,$extInfo,$align='top')
  86. * 2423: function removeButton()
  87. * 2432: function installButton()
  88. * 2441: function noImportMsg()
  89. * 2454: function depToString($dep,$type='depends')
  90. * 2473: function stringToDep($dep)
  91. *
  92. * SECTION: Read information about all available extensions
  93. * 2503: function getInstalledExtensions()
  94. * 2530: function getInstExtList($path,&$list,&$cat,$type)
  95. * 2561: function fixEMCONF($emConf)
  96. * 2600: function splitVersionRange($ver)
  97. * 2616: function prepareImportExtList()
  98. * 2660: function setCat(&$cat,$listArrayPart,$extKey)
  99. *
  100. * SECTION: Extension analyzing (detailed information)
  101. * 2710: function makeDetailedExtensionAnalysis($extKey,$extInfo,$validity=0)
  102. * 2892: function getClassIndexLocallangFiles($absPath,$table_class_prefix,$extKey)
  103. * 2962: function modConfFileAnalysis($confFilePath)
  104. * 2990: function serverExtensionMD5Array($extKey,$conf)
  105. * 3015: function findMD5ArrayDiff($current,$past)
  106. *
  107. * SECTION: File system operations
  108. * 3047: function createDirsInPath($dirs,$extDirPath)
  109. * 3065: function removeExtDirectory($removePath,$removeContentOnly=0)
  110. * 3128: function clearAndMakeExtensionDir($importedData,$type,$dontDelete=0)
  111. * 3182: function removeCacheFiles()
  112. * 3192: function extractDirsFromFileList($files)
  113. * 3218: function getExtPath($extKey,$type)
  114. *
  115. * SECTION: Writing to "conf.php" and "localconf.php" files
  116. * 3252: function writeTYPO3_MOD_PATH($confFilePath,$type,$mP)
  117. * 3289: function writeNewExtensionList($newExtList)
  118. * 3312: function writeTsStyleConfig($extKey,$arr)
  119. * 3334: function updateLocalEM_CONF($extKey,$extInfo)
  120. *
  121. * SECTION: Compiling upload information, emconf-file etc.
  122. * 3376: function construct_ext_emconf_file($extKey,$EM_CONF)
  123. * 3407: function arrayToCode($array, $level=0)
  124. * 3433: function makeUploadArray($extKey,$conf)
  125. * 3502: function getSerializedLocalLang($file,$content)
  126. *
  127. * SECTION: Managing dependencies, conflicts, priorities, load order of extension keys
  128. * 3538: function addExtToList($extKey,$instExtInfo)
  129. * 3569: function checkDependencies($extKey, $conf, $instExtInfo)
  130. * 3709: function removeExtFromList($extKey,$instExtInfo)
  131. * 3746: function removeRequiredExtFromListArr($listArr)
  132. * 3761: function managesPriorities($listArr,$instExtInfo)
  133. *
  134. * SECTION: System Update functions (based on extension requirements)
  135. * 3813: function checkClearCache($extInfo)
  136. * 3840: function checkUploadFolder($extKey,$extInfo)
  137. * 3925: function checkDBupdates($extKey,$extInfo,$infoOnly=0)
  138. * 4022: function forceDBupdates($extKey, $extInfo)
  139. * 4080: function tsStyleConfigForm($extKey,$extInfo,$output=0,$script='',$addFields='')
  140. *
  141. * SECTION: Dumping database (MySQL compliant)
  142. * 4175: function dumpTableAndFieldStructure($arr)
  143. * 4200: function dumpStaticTables($tableList)
  144. * 4229: function dumpHeader()
  145. * 4246: function dumpTableHeader($table,$fieldKeyInfo,$dropTableIfExists=0)
  146. * 4288: function dumpTableContent($table,$fieldStructure)
  147. * 4323: function getTableAndFieldStructure($parts)
  148. *
  149. * SECTION: TER Communication functions
  150. * 4373: function uploadExtensionToTER($em)
  151. *
  152. * SECTION: Various helper functions
  153. * 4411: function listOrderTitle($listOrder,$key)
  154. * 4436: function makeVersion($v,$mode)
  155. * 4448: function renderVersion($v,$raise='')
  156. * 4485: function ulFolder($extKey)
  157. * 4494: function importAtAll()
  158. * 4505: function importAsType($type,$lockType='')
  159. * 4527: function deleteAsType($type)
  160. * 4548: function versionDifference($v1,$v2,$div=1)
  161. * 4560: function first_in_array($str,$array,$caseInsensitive=FALSE)
  162. * 4578: function includeEMCONF($path,$_EXTKEY)
  163. * 4593: function searchExtension($extKey,$row)
  164. *
  165. * TOTAL FUNCTIONS: 90
  166. * (This index is automatically created/updated by the extension "extdeveval")
  167. *
  168. */
  169. // Include classes needed:
  170. require_once('class.em_xmlhandler.php');
  171. require_once('class.em_terconnection.php');
  172. require_once('class.em_unzip.php');
  173. $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_mod_tools_em.xml');
  174. // from tx_ter by Robert Lemke
  175. define('TX_TER_RESULT_EXTENSIONSUCCESSFULLYUPLOADED', '10504');
  176. define('EM_INSTALL_VERSION_MIN', 1);
  177. define('EM_INSTALL_VERSION_MAX', 2);
  178. define('EM_INSTALL_VERSION_STRICT', 3);
  179. /**
  180. * Module: Extension manager
  181. *
  182. * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
  183. * @author Karsten Dambekalns <karsten@typo3.org>
  184. * @package TYPO3
  185. * @subpackage core
  186. */
  187. class SC_mod_tools_em_index extends t3lib_SCbase {
  188. // Internal, static:
  189. var $versionDiffFactor = 1; // This means that version difference testing for import is detected for sub-versions only, not dev-versions. Default: 1000
  190. var $systemInstall = 0; // If "1" then installs in the sysext directory is allowed. Default: 0
  191. var $requiredExt = ''; // List of required extension (from TYPO3_CONF_VARS)
  192. var $maxUploadSize = 31457280; // Max size in bytes of extension upload to repository
  193. var $kbMax = 500; // Max size in kilobytes for files to be edited.
  194. 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
  195. var $listingLimit = 500; // List that many extension maximally at one time (fixing memory problems)
  196. var $listingLimitAuthor = 250; // List that many extension maximally at one time (fixing memory problems)
  197. /**
  198. * Internal variable loaded with extension categories (for display/listing). Should reflect $categories above
  199. * Dynamic var.
  200. */
  201. var $defaultCategories = Array(
  202. 'cat' => Array (
  203. 'be' => array(),
  204. 'module' => array(),
  205. 'fe' => array(),
  206. 'plugin' => array(),
  207. 'misc' => array(),
  208. 'services' => array(),
  209. 'templates' => array(),
  210. 'example' => array(),
  211. 'doc' => array()
  212. )
  213. );
  214. var $categories = array(); // Extension Categories (static var); see init()
  215. var $states = array(); // Extension States; see init()
  216. /**
  217. * Colors for extension states
  218. */
  219. var $stateColors = Array (
  220. 'alpha' => '#d12438',
  221. 'beta' => '#97b17e',
  222. 'stable' => '#3bb65c',
  223. 'experimental' => '#007eba',
  224. 'test' => '#979797',
  225. 'obsolete' => '#000000',
  226. 'excludeFromUpdates' => '#cf7307'
  227. );
  228. /**
  229. * "TYPE" information; labels, paths, description etc. See init()
  230. */
  231. var $typeLabels = array();
  232. var $typeDescr = array();
  233. var $typePaths = Array(); // Also static, set in init()
  234. var $typeBackPaths = Array(); // Also static, set in init()
  235. var $typeRelPaths = Array (
  236. 'S' => 'sysext/',
  237. 'G' => 'ext/',
  238. 'L' => '../typo3conf/ext/',
  239. );
  240. var $detailCols = Array (
  241. 0 => 2,
  242. 1 => 5,
  243. 2 => 6,
  244. 3 => 6,
  245. 4 => 4,
  246. 5 => 1
  247. );
  248. var $fe_user = array(
  249. 'username' => '',
  250. 'password' => '',
  251. );
  252. var $privacyNotice; // Set in init()
  253. var $securityHint; // Set in init()
  254. var $editTextExtensions = 'html,htm,txt,css,tmpl,inc,php,sql,conf,cnf,pl,pm,sh,xml,ChangeLog';
  255. 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';
  256. // Default variables for backend modules
  257. var $MCONF = array(); // Module configuration
  258. var $MOD_MENU = array(); // Module menu items
  259. var $MOD_SETTINGS = array(); // Module session settings
  260. /**
  261. * Document Template Object
  262. *
  263. * @var noDoc
  264. */
  265. var $doc;
  266. var $content; // Accumulated content
  267. var $inst_keys = array(); // Storage of installed extensions
  268. var $gzcompress = 0; // Is set true, if system support compression.
  269. /**
  270. * instance of TER connection handler
  271. *
  272. * @var SC_mod_tools_em_terconnection
  273. */
  274. var $terConnection;
  275. /**
  276. * XML handling class for the TYPO3 Extension Manager
  277. *
  278. * @var SC_mod_tools_em_xmlhandler
  279. */
  280. var $xmlhandler;
  281. var $JScode; // JavaScript code to be forwared to $this->doc->JScode
  282. // GPvars:
  283. var $CMD = array(); // CMD array
  284. var $listRemote; // If set, connects to remote repository
  285. var $lookUpStr; // Search string when listing local extensions
  286. /*********************************
  287. *
  288. * Standard module initialization
  289. *
  290. *********************************/
  291. /**
  292. * Standard init function of a module.
  293. *
  294. * @return void
  295. */
  296. function init() {
  297. global $BE_USER,$LANG,$BACK_PATH,$TYPO3_CONF_VARS;
  298. /**
  299. * Extension Categories (static var)
  300. * Content must be redundant with the same internal variable as in class.tx_extrep.php!
  301. */
  302. $this->categories = array(
  303. 'be' => $GLOBALS['LANG']->getLL('category_BE'),
  304. 'module' => $GLOBALS['LANG']->getLL('category_BE_modules'),
  305. 'fe' => $GLOBALS['LANG']->getLL('category_FE'),
  306. 'plugin' => $GLOBALS['LANG']->getLL('category_FE_plugins'),
  307. 'misc' => $GLOBALS['LANG']->getLL('category_miscellanous'),
  308. 'services' => $GLOBALS['LANG']->getLL('category_services'),
  309. 'templates' => $GLOBALS['LANG']->getLL('category_templates'),
  310. 'example' => $GLOBALS['LANG']->getLL('category_examples'),
  311. 'doc' => $GLOBALS['LANG']->getLL('category_documentation')
  312. );
  313. /**
  314. * Extension States
  315. * Content must be redundant with the same internal variable as in class.tx_extrep.php!
  316. */
  317. $this->states = array(
  318. 'alpha' => $GLOBALS['LANG']->getLL('state_alpha'),
  319. 'beta' => $GLOBALS['LANG']->getLL('state_beta'),
  320. 'stable' => $GLOBALS['LANG']->getLL('state_stable'),
  321. 'experimental' => $GLOBALS['LANG']->getLL('state_experimental'),
  322. 'test' => $GLOBALS['LANG']->getLL('state_test'),
  323. 'obsolete' => $GLOBALS['LANG']->getLL('state_obsolete'),
  324. 'excludeFromUpdates' => $GLOBALS['LANG']->getLL('state_exclude_from_updates')
  325. );
  326. /**
  327. * "TYPE" information; labels, paths, description etc.
  328. */
  329. $this->typeLabels = array(
  330. 'S' => $GLOBALS['LANG']->getLL('type_system'),
  331. 'G' => $GLOBALS['LANG']->getLL('type_global'),
  332. 'L' => $GLOBALS['LANG']->getLL('type_local'),
  333. );
  334. $this->typeDescr = array(
  335. 'S' => $GLOBALS['LANG']->getLL('descr_system'),
  336. 'G' => $GLOBALS['LANG']->getLL('descr_global'),
  337. 'L' => $GLOBALS['LANG']->getLL('descr_local'),
  338. );
  339. // Setting paths of install scopes:
  340. $this->typePaths = Array (
  341. 'S' => TYPO3_mainDir.'sysext/',
  342. 'G' => TYPO3_mainDir.'ext/',
  343. 'L' => 'typo3conf/ext/'
  344. );
  345. $this->typeBackPaths = Array (
  346. 'S' => '../../../',
  347. 'G' => '../../../',
  348. 'L' => '../../../../'.TYPO3_mainDir
  349. );
  350. $this->privacyNotice = $GLOBALS['LANG']->getLL('privacy_notice');
  351. $securityMessage = $GLOBALS['LANG']->getLL('security_warning_extensions') .
  352. '<br /><br />' . sprintf($GLOBALS['LANG']->getLL('security_descr'),
  353. '<a href="http://typo3.org/teams/security/" target="_blank">', '</a>'
  354. );
  355. $flashMessage = t3lib_div::makeInstance(
  356. 't3lib_FlashMessage',
  357. $securityMessage,
  358. $GLOBALS['LANG']->getLL('security_header'),
  359. t3lib_FlashMessage::INFO
  360. );
  361. $this->securityHint = $flashMessage->render();
  362. $this->excludeForPackaging = $GLOBALS['TYPO3_CONF_VARS']['EXT']['excludeForPackaging'];
  363. // Setting module configuration:
  364. $this->MCONF = $GLOBALS['MCONF'];
  365. // Setting GPvars:
  366. $this->CMD = is_array(t3lib_div::_GP('CMD')) ? t3lib_div::_GP('CMD') : array();
  367. $this->lookUpStr = trim(t3lib_div::_GP('lookUp'));
  368. $this->listRemote = t3lib_div::_GP('ter_connect');
  369. $this->listRemote_search = trim(t3lib_div::_GP('ter_search'));
  370. // Configure menu
  371. $this->menuConfig();
  372. // Setting internal static:
  373. if ($TYPO3_CONF_VARS['EXT']['allowSystemInstall']) $this->systemInstall = 1;
  374. $this->requiredExt = t3lib_div::trimExplode(',',$TYPO3_CONF_VARS['EXT']['requiredExt'],1);
  375. // Initialize helper object
  376. $this->terConnection = t3lib_div::makeInstance('SC_mod_tools_em_terconnection');
  377. $this->terConnection->emObj = $this;
  378. $this->terConnection->wsdlURL = $TYPO3_CONF_VARS['EXT']['em_wsdlURL'];
  379. $this->xmlhandler = t3lib_div::makeInstance('SC_mod_tools_em_xmlhandler');
  380. $this->xmlhandler->emObj = $this;
  381. $this->xmlhandler->useObsolete = $this->MOD_SETTINGS['display_obsolete'];
  382. // Initialize Document Template object:
  383. $this->doc = t3lib_div::makeInstance('template');
  384. $this->doc->backPath = $BACK_PATH;
  385. $this->doc->setModuleTemplate('templates/em_index.html');
  386. // JavaScript
  387. $this->doc->JScode = $this->doc->wrapScriptTags('
  388. script_ended = 0;
  389. function jumpToUrl(URL) { //
  390. window.location.href = URL;
  391. }
  392. ');
  393. // Reload left frame menu
  394. if ($this->CMD['refreshMenu']) {
  395. $this->doc->JScode .= $this->doc->wrapScriptTags('
  396. if(top.refreshMenu) {
  397. top.refreshMenu();
  398. } else {
  399. top.TYPO3ModuleMenu.refreshMenu();
  400. }
  401. ');
  402. }
  403. // Descriptions:
  404. $this->descrTable = '_MOD_'.$this->MCONF['name'];
  405. if ($BE_USER->uc['edit_showFieldHelp']) {
  406. $LANG->loadSingleTableDescription($this->descrTable);
  407. }
  408. // Setting username/password etc. for upload-user:
  409. $this->fe_user['username'] = $this->MOD_SETTINGS['fe_u'];
  410. $this->fe_user['password'] = $this->MOD_SETTINGS['fe_p'];
  411. parent::init();
  412. $this->handleExternalFunctionValue('singleDetails');
  413. }
  414. /**
  415. * This function is a copy of the same function in t3lib_SCbase with one modification:
  416. * In contrast to t3lib_SCbase::handleExternalFunctionValue() this function merges the $this->extClassConf array
  417. * instead of overwriting it. That was necessary for including the Kickstarter as a submodule into the 'singleDetails'
  418. * selectorbox as well as in the main 'function' selectorbox.
  419. *
  420. * @param string Mod-setting array key
  421. * @param string Mod setting value, overriding the one in the key
  422. * @return void
  423. * @see t3lib_SCbase::handleExternalFunctionValue()
  424. */
  425. function handleExternalFunctionValue($MM_key='function', $MS_value=NULL) {
  426. $MS_value = is_null($MS_value) ? $this->MOD_SETTINGS[$MM_key] : $MS_value;
  427. $externalItems = $this->getExternalItemConfig($this->MCONF['name'],$MM_key,$MS_value);
  428. if (is_array($externalItems)) $this->extClassConf = array_merge($externalItems,is_array($this->extClassConf)?$this->extClassConf:array());
  429. if (is_array($this->extClassConf) && $this->extClassConf['path']) {
  430. $this->include_once[]=$this->extClassConf['path'];
  431. }
  432. }
  433. /**
  434. * Configuration of which mod-menu items can be used
  435. *
  436. * @return void
  437. */
  438. function menuConfig() {
  439. global $BE_USER, $TYPO3_CONF_VARS;
  440. // MENU-ITEMS:
  441. $this->MOD_MENU = array(
  442. 'function' => array(
  443. 0 => $GLOBALS['LANG']->getLL('menu_loaded_extensions'),
  444. 1 => $GLOBALS['LANG']->getLL('menu_install_extensions'),
  445. 2 => $GLOBALS['LANG']->getLL('menu_import_extensions'),
  446. 4 => $GLOBALS['LANG']->getLL('menu_translation_handling'),
  447. 3 => $GLOBALS['LANG']->getLL('menu_settings'),
  448. 5 => $GLOBALS['LANG']->getLL('menu_extension_updates'),
  449. ),
  450. 'listOrder' => array(
  451. 'cat' => $GLOBALS['LANG']->getLL('list_order_category'),
  452. 'author_company' => $GLOBALS['LANG']->getLL('list_order_author'),
  453. 'state' => $GLOBALS['LANG']->getLL('list_order_state'),
  454. 'type' => $GLOBALS['LANG']->getLL('list_order_type'),
  455. ),
  456. 'display_details' => array(
  457. 1 => $GLOBALS['LANG']->getLL('show_details'),
  458. 0 => $GLOBALS['LANG']->getLL('show_description'),
  459. 2 => $GLOBALS['LANG']->getLL('show_more_details'),
  460. 3 => $GLOBALS['LANG']->getLL('show_technical'),
  461. 4 => $GLOBALS['LANG']->getLL('show_validating'),
  462. 5 => $GLOBALS['LANG']->getLL('show_changed'),
  463. ),
  464. 'display_shy' => '',
  465. 'display_own' => '',
  466. 'display_obsolete' => '',
  467. 'display_installed' => '',
  468. 'display_files' => '',
  469. 'singleDetails' => array(
  470. 'info' => $GLOBALS['LANG']->getLL('details_info'),
  471. 'edit' => $GLOBALS['LANG']->getLL('details_edit'),
  472. 'backup' => $GLOBALS['LANG']->getLL('details_backup_delete'),
  473. 'dump' => $GLOBALS['LANG']->getLL('details_dump_db'),
  474. 'upload' => $GLOBALS['LANG']->getLL('details_upload'),
  475. 'updateModule' => $GLOBALS['LANG']->getLL('details_update'),
  476. ),
  477. 'fe_u' => '',
  478. 'fe_p' => '',
  479. 'mirrorListURL' => '',
  480. 'rep_url' => '',
  481. 'extMirrors' => '',
  482. 'selectedMirror' => '',
  483. 'selectedLanguages' => ''
  484. );
  485. $this->MOD_MENU['singleDetails'] = $this->mergeExternalItems($this->MCONF['name'],'singleDetails',$this->MOD_MENU['singleDetails']);
  486. // page/be_user TSconfig settings and blinding of menu-items
  487. if (!$BE_USER->getTSConfigVal('mod.'.$this->MCONF['name'].'.allowTVlisting')) {
  488. unset($this->MOD_MENU['display_details'][3]);
  489. unset($this->MOD_MENU['display_details'][4]);
  490. unset($this->MOD_MENU['display_details'][5]);
  491. }
  492. // CLEANSE SETTINGS
  493. $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
  494. if ($this->MOD_SETTINGS['function']==2) {
  495. // If listing from online repository, certain items are removed though:
  496. unset($this->MOD_MENU['listOrder']['type']);
  497. unset($this->MOD_MENU['display_details'][2]);
  498. unset($this->MOD_MENU['display_details'][3]);
  499. unset($this->MOD_MENU['display_details'][4]);
  500. unset($this->MOD_MENU['display_details'][5]);
  501. $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
  502. }
  503. parent::menuConfig();
  504. }
  505. /**
  506. * Main function for Extension Manager module.
  507. *
  508. * @return void
  509. */
  510. function main() {
  511. global $BE_USER,$LANG,$TYPO3_CONF_VARS;
  512. if (empty($this->MOD_SETTINGS['mirrorListURL'])) $this->MOD_SETTINGS['mirrorListURL'] = $TYPO3_CONF_VARS['EXT']['em_mirrorListURL'];
  513. // Starting page:
  514. $this->content.=$this->doc->header($GLOBALS['LANG']->getLL('header'));
  515. $this->content.=$this->doc->spacer(5);
  516. // Command given which is executed regardless of main menu setting:
  517. if ($this->CMD['showExt']) { // Show details for a single extension
  518. $this->showExtDetails($this->CMD['showExt']);
  519. } elseif ($this->CMD['requestInstallExtensions']) { // Show details for a single extension
  520. $this->requestInstallExtensions($this->CMD['requestInstallExtensions']);
  521. } elseif ($this->CMD['importExt'] || $this->CMD['uploadExt']) { // Imports an extension from online rep.
  522. $err = $this->importExtFromRep($this->CMD['importExt'],$this->CMD['extVersion'],$this->CMD['loc'],$this->CMD['uploadExt']);
  523. if ($err) {
  524. $this->content.=$this->doc->section('',$GLOBALS['TBE_TEMPLATE']->rfw($err));
  525. }
  526. if(!$err && $this->CMD['importExt']) {
  527. $this->installTranslationsForExtension($this->CMD['importExt'], $this->getMirrorURL());
  528. }
  529. } elseif ($this->CMD['importExtInfo']) { // Gets detailed information of an extension from online rep.
  530. $this->importExtInfo($this->CMD['importExtInfo'],$this->CMD['extVersion']);
  531. } else { // No command - we show what the menu setting tells us:
  532. if (t3lib_div::inList('0,1,2',$this->MOD_SETTINGS['function'])) {
  533. $menu .= '&nbsp;' . $GLOBALS['LANG']->getLL('group_by') . '&nbsp;' . t3lib_BEfunc::getFuncMenu(0, 'SET[listOrder]', $this->MOD_SETTINGS['listOrder'], $this->MOD_MENU['listOrder']) .
  534. '&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 />';
  535. }
  536. if (t3lib_div::inList('0,1,5',$this->MOD_SETTINGS['function'])) {
  537. $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"');
  538. }
  539. if (t3lib_div::inList('2',$this->MOD_SETTINGS['function']) && strlen($this->fe_user['username'])) {
  540. $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"');
  541. }
  542. if (t3lib_div::inList('0,1,2',$this->MOD_SETTINGS['function'])) {
  543. $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"');
  544. }
  545. $this->content.=$this->doc->section('','<form action="index.php" method="post" name="pageform"><span class="nobr">' . ($menu ? $menu : '&nbsp;') . '</span></form>');
  546. $this->content.=$this->doc->spacer(10);
  547. switch((string)$this->MOD_SETTINGS['function']) {
  548. case '0':
  549. // Lists loaded (installed) extensions
  550. $this->extensionList_loaded();
  551. break;
  552. case '1':
  553. // Lists the installed (available) extensions
  554. $this->extensionList_installed();
  555. break;
  556. case '2':
  557. // Lists the extensions available from online rep.
  558. $this->extensionList_import();
  559. break;
  560. case '3':
  561. // Shows the settings screen
  562. $this->alterSettings();
  563. break;
  564. case '4':
  565. // Allows to set the translation preferences and check the status
  566. $this->translationHandling();
  567. break;
  568. case '5':
  569. // Shows a list of extensions with updates in TER
  570. $this->checkForUpdates();
  571. break;
  572. default:
  573. $this->extObjContent();
  574. break;
  575. }
  576. }
  577. // closing any form?
  578. $formTags = substr_count($this->content, '<form') + substr_count($this->content, '</form');
  579. if ($formTags % 2 > 0) {
  580. $this->content .= '</form>';
  581. }
  582. // Setting up the buttons and markers for docheader
  583. $docHeaderButtons = $this->getButtons();
  584. $markers = array(
  585. 'CSH' => $docHeaderButtons['csh'],
  586. 'FUNC_MENU' => $this->getFuncMenu(),
  587. 'CONTENT' => $this->content
  588. );
  589. // Build the <body> for the module
  590. $this->content = $this->doc->startPage('Extension Manager');
  591. $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
  592. $this->content.= $this->doc->endPage();
  593. $this->content = $this->doc->insertStylesAndJS($this->content);
  594. }
  595. /**
  596. * Print module content. Called as last thing in the global scope.
  597. *
  598. * @return void
  599. */
  600. function printContent() {
  601. if ($this->doPrintContent) {
  602. echo $this->content;
  603. }
  604. }
  605. /**
  606. * Create the function menu
  607. *
  608. * @return string HTML of the function menu
  609. */
  610. protected function getFuncMenu() {
  611. $funcMenu = '';
  612. if(!$this->CMD['showExt'] && !$this->CMD['requestInstallExtensions'] && !$this->CMD['importExt'] && !$this->CMD['uploadExt'] && !$this->CMD['importExtInfo']) {
  613. $funcMenu = t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
  614. } elseif($this->CMD['showExt'] && (!$this->CMD['standAlone'] && !t3lib_div::_GP('standAlone'))) {
  615. $funcMenu = t3lib_BEfunc::getFuncMenu(0, 'SET[singleDetails]', $this->MOD_SETTINGS['singleDetails'], $this->MOD_MENU['singleDetails'], '', '&CMD[showExt]=' . $this->CMD['showExt']);
  616. }
  617. return $funcMenu;
  618. }
  619. /**
  620. * Create the panel of buttons for submitting the form or otherwise perform operations.
  621. *
  622. * @return array all available buttons as an assoc. array
  623. */
  624. protected function getButtons() {
  625. $buttons = array(
  626. 'csh' => '',
  627. 'back' => '',
  628. 'shortcut' => ''
  629. );
  630. // CSH
  631. //$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']);
  632. // Shortcut
  633. if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
  634. $buttons['shortcut'] = $this->doc->makeShortcutIcon('CMD','function',$this->MCONF['name']);
  635. }
  636. // Back
  637. if(($this->CMD['showExt'] && (!$this->CMD['standAlone'] && !t3lib_div::_GP('standAlone'))) || ($this->CMD['importExt'] || $this->CMD['uploadExt'] && (!$this->CMD['standAlone'])) || $this->CMD['importExtInfo']) {
  638. $buttons['back'] = '<a href="index.php" class="typo3-goBack" title="' . $GLOBALS['LANG']->getLL('go_back') . '">' .
  639. t3lib_iconWorks::getSpriteIcon('actions-view-go-back') .
  640. '</a>';
  641. }
  642. return $buttons;
  643. }
  644. /*********************************
  645. *
  646. * Function Menu Applications
  647. *
  648. *********************************/
  649. /**
  650. * Listing of loaded (installed) extensions
  651. *
  652. * @return void
  653. */
  654. function extensionList_loaded() {
  655. global $TYPO3_LOADED_EXT;
  656. list($list,$cat) = $this->getInstalledExtensions();
  657. // Loaded extensions
  658. $content = '';
  659. $lines = array();
  660. // Available extensions
  661. if (is_array($cat[$this->MOD_SETTINGS['listOrder']])) {
  662. $content='';
  663. $lines=array();
  664. $lines[] = $this->extensionListRowHeader(' class="t3-row-header"',array('<td><img src="clear.gif" width="1" height="1" alt="" /></td>'));
  665. foreach($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys) {
  666. natcasesort($extEkeys);
  667. $extensions = array();
  668. foreach ($extEkeys as $extKey => $value) {
  669. if (array_key_exists($extKey,$TYPO3_LOADED_EXT) && ($this->MOD_SETTINGS['display_shy'] || !$list[$extKey]['EM_CONF']['shy']) && $this->searchExtension($extKey,$list[$extKey])) {
  670. if (in_array($extKey, $this->requiredExt)) {
  671. $loadUnloadLink = '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
  672. } else {
  673. $loadUnloadLink = '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1').'">'.$this->removeButton().'</a>';
  674. }
  675. $extensions[] = $this->extensionListRow($extKey,$list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'));
  676. }
  677. }
  678. if(count($extensions)) {
  679. $lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><br /></td></tr>';
  680. $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>';
  681. $lines[] = implode(LF,$extensions);
  682. }
  683. }
  684. }
  685. $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'loaded', $GLOBALS['BACK_PATH'],'');
  686. $content.= '<form action="index.php" method="post" name="lookupform">';
  687. $content.= '<label for="lookUp">' . $GLOBALS['LANG']->getLL('look_up') . '</label> <input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->lookUpStr) . '" /><input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" /><br /><br />';
  688. $content.= '</form>
  689. <!-- Loaded Extensions List -->
  690. <table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
  691. $this->content.=$this->doc->section($GLOBALS['LANG']->getLL('loaded_exts'),$content,0,1);
  692. }
  693. /**
  694. * Listing of available (installed) extensions
  695. *
  696. * @return void
  697. */
  698. function extensionList_installed() {
  699. global $TYPO3_LOADED_EXT;
  700. list($list,$cat)=$this->getInstalledExtensions();
  701. // Available extensions
  702. if (is_array($cat[$this->MOD_SETTINGS['listOrder']])) {
  703. $content='';
  704. $lines=array();
  705. $lines[]=$this->extensionListRowHeader(' class="t3-row-header"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>'));
  706. $allKeys=array();
  707. foreach($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys) {
  708. if(!$this->MOD_SETTINGS['display_obsolete'] && $catName=='obsolete') continue;
  709. $allKeys[]='';
  710. $allKeys[]='TYPE: '.$catName;
  711. natcasesort($extEkeys);
  712. $extensions = array();
  713. foreach ($extEkeys as $extKey => $value) {
  714. $allKeys[]=$extKey;
  715. if ((!$list[$extKey]['EM_CONF']['shy'] || $this->MOD_SETTINGS['display_shy']) &&
  716. ($list[$extKey]['EM_CONF']['state']!='obsolete' || $this->MOD_SETTINGS['display_obsolete'])
  717. && $this->searchExtension($extKey,$list[$extKey])) {
  718. $loadUnloadLink = t3lib_extMgm::isLoaded($extKey)?
  719. '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->removeButton().'</a>':
  720. '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[load]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->installButton().'</a>';
  721. if (in_array($extKey,$this->requiredExt)) {
  722. $loadUnloadLink = '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
  723. }
  724. $theRowClass = t3lib_extMgm::isLoaded($extKey)? 'em-listbg1' : 'em-listbg2';
  725. $extensions[]=$this->extensionListRow($extKey,$list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'),$theRowClass);
  726. }
  727. }
  728. if(count($extensions)) {
  729. $lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><br /></td></tr>';
  730. $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>';
  731. $lines[] = implode(LF,$extensions);
  732. }
  733. }
  734. $content.='
  735. <!--
  736. EXTENSION KEYS:
  737. '.trim(implode(LF,$allKeys)).'
  738. -->
  739. ';
  740. $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'avail', $GLOBALS['BACK_PATH'], '|<br />');
  741. $content.= sprintf($GLOBALS['LANG']->getLL('how_to_install'), $this->installButton()) . ' <br />' .
  742. sprintf($GLOBALS['LANG']->getLL('how_to_uninstall'), $this->removeButton()). ' <br /><br />';
  743. $content .= '<form action="index.php" method="post" name="lookupform">';
  744. $content .= '<label for="lookUp">' . $GLOBALS['LANG']->getLL('look_up') . '</label> <input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->lookUpStr) . '" /><input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" /></form><br /><br />';
  745. $content.= $this->securityHint.'<br /><br />';
  746. $content.= '<table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
  747. $this->content.=$this->doc->section(sprintf($GLOBALS['LANG']->getLL('available_extensions'), $this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']]),$content,0,1);
  748. }
  749. }
  750. /**
  751. * Listing remote extensions from online repository
  752. *
  753. * @return void
  754. */
  755. function extensionList_import() {
  756. global $TYPO3_LOADED_EXT;
  757. $content='';
  758. // Listing from online repository:
  759. if ($this->listRemote) {
  760. list($inst_list,) = $this->getInstalledExtensions();
  761. $this->inst_keys = array_flip(array_keys($inst_list));
  762. $this->detailCols[1]+=6;
  763. // see if we have an extensionlist at all
  764. $this->extensionCount = $this->xmlhandler->countExtensions();
  765. if (!$this->extensionCount) {
  766. $content .= $this->fetchMetaData('extensions');
  767. }
  768. if($this->MOD_SETTINGS['listOrder']=='author_company') {
  769. $this->listingLimit = $this->listingLimitAuthor;
  770. }
  771. $this->pointer = intval(t3lib_div::_GP('pointer'));
  772. $offset = $this->listingLimit*$this->pointer;
  773. if($this->MOD_SETTINGS['display_own'] && strlen($this->fe_user['username'])) {
  774. $this->xmlhandler->searchExtensionsXML($this->listRemote_search, $this->fe_user['username'], $this->MOD_SETTINGS['listOrder'], TRUE);
  775. } else {
  776. $this->xmlhandler->searchExtensionsXML($this->listRemote_search, '', $this->MOD_SETTINGS['listOrder'], TRUE, FALSE, $offset, $this->listingLimit);
  777. }
  778. if (count($this->xmlhandler->extensionsXML)) {
  779. list($list,$cat) = $this->prepareImportExtList(true);
  780. // Available extensions
  781. if (is_array($cat[$this->MOD_SETTINGS['listOrder']])) {
  782. $lines=array();
  783. $lines[]=$this->extensionListRowHeader(' class="t3-row-header"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>'),1);
  784. foreach($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys) {
  785. if (count($extEkeys)) {
  786. $lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><br /></td></tr>';
  787. $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>';
  788. natcasesort($extEkeys);
  789. foreach ($extEkeys as $extKey => $value) {
  790. $version = array_keys($list[$extKey]['versions']);
  791. $version = end($version);
  792. $ext = $list[$extKey]['versions'][$version];
  793. $ext['downloadcounter_all'] = $list[$extKey]['downloadcounter'];
  794. $ext['_ICON'] = $list[$extKey]['_ICON'];
  795. $loadUnloadLink='';
  796. if ($inst_list[$extKey]['type']!='S' && (!isset($inst_list[$extKey]) || $this->versionDifference($version,$inst_list[$extKey]['EM_CONF']['version'],$this->versionDiffFactor))) {
  797. if (isset($inst_list[$extKey])) {
  798. // update
  799. if ($inst_list[$extKey]['EM_CONF']['state'] != 'excludeFromUpdates') {
  800. $loc= ($inst_list[$extKey]['type']=='G'?'G':'L');
  801. $aUrl = 'index.php?CMD[importExt]='.$extKey.'&CMD[extVersion]='.$version.'&CMD[loc]='.$loc;
  802. $loadUnloadLink .= '<a href="' . htmlspecialchars($aUrl) . '" title="' . sprintf($GLOBALS['LANG']->getLL('do_update'), ($loc == 'G' ? $GLOBALS['LANG']->getLL('global') : $GLOBALS['LANG']->getLL('local'))) . '">' .
  803. t3lib_iconWorks::getSpriteIcon('actions-system-extension-update') .
  804. '</a>';
  805. } else {
  806. // extension is marked as "excludeFromUpdates"
  807. $loadUnloadLink .= t3lib_iconWorks::getSpriteIcon('status-dialog-warning', $GLOBALS['LANG']->getLL('excluded_from_updates') );
  808. }
  809. } else {
  810. // import
  811. $aUrl = 'index.php?CMD[importExt]='.$extKey.'&CMD[extVersion]='.$version.'&CMD[loc]=L';
  812. $loadUnloadLink .= '<a href="' . htmlspecialchars($aUrl) . '" title="' . $GLOBALS['LANG']->getLL('import_to_local_dir') . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-extension-import') . '</a>';
  813. }
  814. } else {
  815. $loadUnloadLink = '&nbsp;';
  816. }
  817. if (isset($inst_list[$extKey])) {
  818. $theRowClass = t3lib_extMgm::isLoaded($extKey) ? 'em-listbg1' : 'em-listbg2';
  819. } else {
  820. $theRowClass = 'em-listbg3';
  821. }
  822. $lines[]=$this->extensionListRow($extKey,$ext,array('<td class="bgColor">'.$loadUnloadLink.'</td>'),$theRowClass,$inst_list,1,'index.php?CMD[importExtInfo]='.rawurlencode($extKey));
  823. unset($list[$extKey]);
  824. }
  825. }
  826. }
  827. unset($list);
  828. // CSH:
  829. $content .= t3lib_BEfunc::cshItem('_MOD_tools_em', 'import_ter', $GLOBALS['BACK_PATH'], '|<br />');
  830. $onsubmit = "window.location.href='index.php?ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
  831. $content .= '<form action="index.php" method="post" onsubmit="' . htmlspecialchars($onsubmit) .
  832. '"><label for="lookUp">' . $GLOBALS['LANG']->getLL('list_or_look_up_extensions') . '</label><br />
  833. <input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->listRemote_search) .
  834. '" /> <input type="submit" value="' . $GLOBALS['LANG']->getLL('look_up_button') . '" /></form><br /><br />';
  835. $content .= $this->browseLinks();
  836. $content.= '
  837. <!-- TER Extensions list -->
  838. <table border="0" cellpadding="2" cellspacing="1">'.implode(LF,$lines).'</table>';
  839. $content .= '<br />'.$this->browseLinks();
  840. $content.= '<br /><br />'.$this->securityHint;
  841. $content .= '<br /><br /><strong>' . $GLOBALS['LANG']->getLL('privacy_notice_header') .
  842. '</strong><br /> ' . $this->privacyNotice;
  843. $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('extensions_repository_group_by') . ' ' .
  844. $this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']], $content, 0, 1);
  845. // Plugins which are NOT uploaded to repository but present on this server.
  846. $content='';
  847. $lines=array();
  848. if (count($this->inst_keys)) {
  849. foreach ($this->inst_keys as $extKey => $value) {
  850. $this->xmlhandler->searchExtensionsXMLExact($extKey, '', '', true);
  851. if((strlen($this->listRemote_search) && !stristr($extKey,$this->listRemote_search)) || isset($this->xmlhandler->extensionsXML[$extKey])) continue;
  852. $loadUnloadLink = t3lib_extMgm::isLoaded($extKey)?
  853. '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->removeButton().'</a>':
  854. '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[load]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->installButton().'</a>';
  855. if (in_array($extKey,$this->requiredExt)) {
  856. $loadUnloadLink = '<strong>' .$GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
  857. }
  858. $lines[]=$this->extensionListRow($extKey,$inst_list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'),t3lib_extMgm::isLoaded($extKey)?'em-listbg1':'em-listbg2');
  859. }
  860. }
  861. if(count($lines)) {
  862. $content .= $GLOBALS['LANG']->getLL('list_of_local_extensions') .
  863. '<br />' . $GLOBALS['LANG']->getLL('might_be_user_defined') . '<br /><br />';
  864. $content.= '<table border="0" cellpadding="2" cellspacing="1">'.
  865. $this->extensionListRowHeader(' class="t3-row-header"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>')).
  866. implode('',$lines).'</table>';
  867. $this->content.=$this->doc->spacer(20);
  868. $this->content.=$this->doc->section($GLOBALS['LANG']->getLL('only_on_this_server'), $content, 0, 1);
  869. }
  870. }
  871. } else {
  872. $content .= t3lib_BEfunc::cshItem('_MOD_tools_em', 'import_ter', $GLOBALS['BACK_PATH'], '|<br />');
  873. $onsubmit = "window.location.href='index.php?ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
  874. $content .= '<form action="index.php" method="post" onsubmit="' . htmlspecialchars($onsubmit) .
  875. '"><label for="lookUp">' .
  876. $GLOBALS['LANG']->getLL('list_or_look_up_extensions') . '</label><br />
  877. <input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->listRemote_search) .
  878. '" /> <input type="submit" value="' . $GLOBALS['LANG']->getLL('look_up_button') . '" /></form><br /><br />';
  879. $content .= '<p><strong>' . $GLOBALS['LANG']->getLL('no_matching_extensions') . '</strong></p>';
  880. $content .= '<br /><br /><strong>' . $GLOBALS['LANG']->getLL('privacy_notice_header') .
  881. '</strong><br /> ' . $this->privacyNotice;
  882. $this->content.=$this->doc->section($GLOBALS['LANG']->getLL('extensions_repository_group_by') . ' ' .
  883. $this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']], $content, 0, 1);
  884. }
  885. } else {
  886. // CSH
  887. $content .= t3lib_BEfunc::cshItem('_MOD_tools_em', 'import', $GLOBALS['BACK_PATH'], '|<br />');
  888. $onsubmit = "window.location.href='index.php?ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
  889. $content .= '<form action="index.php" method="post" onsubmit="' . htmlspecialchars($onsubmit) .
  890. '"><label for="lookUp">' .
  891. $GLOBALS['LANG']->getLL('list_or_look_up_extensions') . '</label><br />
  892. <input type="text" id="lookUp" name="lookUp" value="" /> <input type="submit" value="' .
  893. $GLOBALS['LANG']->getLL('look_up_button') . '" /><br /><br />';
  894. if ($this->CMD['fetchMetaData']) { // fetches mirror/extension data from online rep.
  895. $content .= $this->fetchMetaData($this->CMD['fetchMetaData']);
  896. } else {
  897. $onCLick = "window.location.href='index.php?CMD[fetchMetaData]=extensions';return false;";
  898. $content .= $GLOBALS['LANG']->getLL('connect_to_ter') . '<br />
  899. <input type="submit" value="' . $GLOBALS['LANG']->getLL('retrieve_update') .
  900. '" onclick="' . htmlspecialchars($onCLick) . '" />';
  901. if (is_file(PATH_site.'typo3temp/extensions.xml.gz')) {
  902. $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
  903. $timeFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
  904. $content .= ' ' . sprintf($GLOBALS['LANG']->getLL('ext_list_last_updated') . ' ',
  905. date(
  906. $dateFormat . ', ' . $timeFormat,
  907. filemtime(PATH_site . 'typo3temp/extensions.xml.gz')
  908. )
  909. );
  910. }
  911. }
  912. $content.= '</form><br /><br />'.$this->securityHint;
  913. $content .= '<br /><br /><strong>' . $GLOBALS['LANG']->getLL('privacy_notice_header') .
  914. '</strong><br />' . $this->privacyNotice;
  915. $this->content.=$this->doc->section($GLOBALS['LANG']->getLL('in_repository'), $content, 0, 1);
  916. }
  917. // Upload:
  918. if ($this->importAtAll()) {
  919. $content= '<form action="index.php" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" method="post">
  920. <label for="upload_ext_file">' . $GLOBALS['LANG']->getLL('upload_t3x') . '</label><br />
  921. <input type="file" size="60" id="upload_ext_file" name="upload_ext_file" /><br />' .
  922. $GLOBALS['LANG']->getLL('upload_to_location') . '<br />
  923. <select name="CMD[loc]">';
  924. if ($this->importAsType('L')) $content .= '<option value="L">' . $GLOBALS['LANG']->getLL('local_folder') . '</option>';
  925. if ($this->importAsType('G')) $content .= '<option value="G">' . $GLOBALS['LANG']->getLL('global_folder') . '</option>';
  926. if ($this->importAsType('S')) $content .= '<option value="S">' . $GLOBALS['LANG']->getLL('system_folder') . '</option>';
  927. $content.='</select><br />
  928. <input type="checkbox" value="1" name="CMD[uploadOverwrite]" id="checkUploadOverwrite" /> <label for="checkUploadOverwrite">' .
  929. $GLOBALS['LANG']->getLL('overwrite_ext') . '</label><br />
  930. <input type="submit" name="CMD[uploadExt]" value="' . $GLOBALS['LANG']->getLL('upload_ext_file') . '" /></form><br />
  931. ';
  932. } else $content=$this->noImportMsg();
  933. $this->content.=$this->doc->spacer(20);
  934. $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('upload_ext_directly'), $content, 0, 1);
  935. }
  936. /**
  937. * Generates a link to the next page of extensions
  938. *
  939. * @return void
  940. */
  941. function browseLinks() {
  942. $content = '';
  943. if ($this->pointer) {
  944. $content .= '<a href="' . t3lib_div::linkThisScript(array('pointer' => $this->pointer-1)) .
  945. '" class="typo3-prevPage"><img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],
  946. 'gfx/pilleft_n.gif', 'width="14" height="14"') .
  947. ' alt="' . $GLOBALS['LANG']->getLL('previous_page') . '" /> ' .
  948. $GLOBALS['LANG']->getLL('previous_page') . '</a>';
  949. }
  950. if ($content) $content .= '&nbsp;&nbsp;&nbsp;';
  951. if (intval($this->xmlhandler->matchingCount/$this->listingLimit)>$this->pointer) {
  952. $content .= '<a href="' . t3lib_div::linkThisScript(array('pointer' => $this->pointer+1)) .
  953. '" class="typo3-nextPage"><img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],
  954. 'gfx/pilright_n.gif', 'width="14" height="14"') .
  955. ' alt="' . $GLOBALS['LANG']->getLL('next_page') . '" /> ' .
  956. $GLOBALS['LANG']->getLL('next_page') . '</a>';
  957. }
  958. $upper = (($this->pointer+1)*$this->listingLimit);
  959. if ($upper>$this->xmlhandler->matchingCount) {
  960. $upper = $this->xmlhandler->matchingCount;
  961. }
  962. if ($content) $content .= '<br /><br />' .
  963. sprintf($GLOBALS['LANG']->getLL('showing_extensions_from_to'),
  964. '<strong>' . ($this->pointer*$this->listingLimit+1) . '</strong>',
  965. '<strong>' . $upper . '</strong>'
  966. );
  967. if ($content) $content .= '<br /><br />';
  968. return $content;
  969. }
  970. /**
  971. * Allows changing of settings
  972. *
  973. * @return void
  974. */
  975. function alterSettings() {
  976. // Prepare the HTML output:
  977. $content.= '
  978. ' . t3lib_BEfunc::cshItem('_MOD_tools_em', 'settings', $GLOBALS['BACK_PATH'], '|<br />') . '
  979. <form action="index.php" method="post" name="altersettings">
  980. <fieldset><legend>' . $GLOBALS['LANG']->getLL('user_settings') . '</legend>
  981. <table border="0" cellpadding="2" cellspacing="2">
  982. <tr class="bgColor4">
  983. <td><label for="set_fe_u">' . $GLOBALS['LANG']->getLL('enter_repository_username') . '</label></td>
  984. <td><input type="text" id="set_fe_u" name="SET[fe_u]" value="'.htmlspecialchars($this->MOD_SETTINGS['fe_u']).'" /></td>
  985. </tr>
  986. <tr class="bgColor4">
  987. <td><label for="set_fe_p">' . $GLOBALS['LANG']->getLL('enter_repository_password') . '</label></td>
  988. <td><input type="password" id="set_fe_p" name="SET[fe_p]" value="'.htmlspecialchars($this->MOD_SETTINGS['fe_p']).'" /></td>
  989. </tr>
  990. </table>
  991. <strong>' . $GLOBALS['LANG']->getLL('notice') . '</strong> ' .
  992. $GLOBALS['LANG']->getLL('repository_password_info') . '
  993. </fieldset>
  994. <br />
  995. <br />
  996. <fieldset><legend>' . $GLOBALS['LANG']->getLL('mirror_selection') . '</legend>
  997. <table border="0" cellpadding="2" cellspacing="2">
  998. <tr class="bgColor4">
  999. <td><label for="set_mirror_list_url">' . $GLOBALS['LANG']->getLL('mirror_list_url') . '</label></td>
  1000. <td><input type="text" size="50" id="set_mirror_list_url" name="SET[mirrorListURL]" value="'.htmlspecialchars($this->MOD_SETTINGS['mirrorListURL']).'" /></td>
  1001. </tr>
  1002. </table>
  1003. </fieldset>
  1004. <br />
  1005. <p>' . $GLOBALS['LANG']->getLL('mirror_select') . '<br /><br /></p>
  1006. <fieldset><legend>' . $GLOBALS['LANG']->getLL('mirror_list') . '</legend>';
  1007. if(!empty($this->MOD_SETTINGS['mirrorListURL'])) {
  1008. if ($this->CMD['fetchMetaData']) { // fetches mirror/extension data from online rep.
  1009. $content .= $this->fetchMetaData($this->CMD['fetchMetaData']);
  1010. } else {
  1011. $content .= '<a href="index.php?CMD[fetchMetaData]=mirrors">' . $GLOBALS['LANG']->getLL('mirror_list_reload') . '</a>';
  1012. }
  1013. }
  1014. $content .= '<br />
  1015. <table cellspacing="4" style="text-align:left; vertical-alignment:top;">
  1016. <tr>
  1017. <td>' . $GLOBALS['LANG']->getLL('mirror_use') . '</td>
  1018. <td>' . $GLOBALS['LANG']->getLL('mirror_name') . '</td>
  1019. <td>' . $GLOBALS['LANG']->getLL('mirror_url') . '</td>
  1020. <td>' . $GLOBALS['LANG']->getLL('mirror_country') . '</td>
  1021. <td>' . $GLOBALS['LANG']->getLL('mirror_sponsored_by') . '</td>
  1022. </tr>
  1023. ';
  1024. if (!strlen($this->MOD_SETTINGS['extMirrors'])) $this->fetchMetaData('mirrors');
  1025. $extMirrors = unserialize($this->MOD_SETTINGS['extMirrors']);
  1026. $extMi

Large files files are truncated, but you can click here to view the full file