Documentation TYPO3 par Ameos

class.em_index.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  (c) 2005-2006 Karsten Dambekalns <karsten@typo3.org>
00007 *  All rights reserved
00008 *
00009 *  This script is part of the TYPO3 project. The TYPO3 project is
00010 *  free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  The GNU General Public License can be found at
00016 *  http://www.gnu.org/copyleft/gpl.html.
00017 *  A copy is found in the textfile GPL.txt and important notices to the license
00018 *  from the author is found in LICENSE.txt distributed with these scripts.
00019 *
00020 *
00021 *  This script is distributed in the hope that it will be useful,
00022 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024 *  GNU General Public License for more details.
00025 *
00026 *  This copyright notice MUST APPEAR in all copies of the script!
00027 ***************************************************************/
00170         // Include classes needed:
00171 require_once(PATH_t3lib.'class.t3lib_tcemain.php');
00172 require_once(PATH_t3lib.'class.t3lib_install.php');
00173 require_once(PATH_t3lib.'class.t3lib_tsstyleconfig.php');
00174 require_once(PATH_t3lib.'class.t3lib_scbase.php');
00175 
00176 require_once('class.em_xmlhandler.php');
00177 require_once('class.em_terconnection.php');
00178 require_once('class.em_unzip.php');
00179 
00180         // from tx_ter by Robert Lemke
00181 define('TX_TER_RESULT_EXTENSIONSUCCESSFULLYUPLOADED', '10504');
00182 
00183 define('EM_INSTALL_VERSION_MIN', 1);
00184 define('EM_INSTALL_VERSION_MAX', 2);
00185 define('EM_INSTALL_VERSION_STRICT', 3);
00186 
00195 class SC_mod_tools_em_index extends t3lib_SCbase {
00196 
00197                 // Internal, static:
00198         var $versionDiffFactor = 1;             // This means that version difference testing for import is detected for sub-versions only, not dev-versions. Default: 1000
00199         var $systemInstall = 0;                         // If "1" then installs in the sysext directory is allowed. Default: 0
00200         var $requiredExt = '';                          // List of required extension (from TYPO3_CONF_VARS)
00201         var $maxUploadSize = 31457280;          // Max size in bytes of extension upload to repository
00202         var $kbMax = 500;                                       // Max size in kilobytes for files to be edited.
00203         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
00204         var $listingLimit = 500;                // List that many extension maximally at one time (fixing memory problems)
00205         var $listingLimitAuthor = 250;          // List that many extension maximally at one time (fixing memory problems)
00206 
00211         var $defaultCategories = Array(
00212                 'cat' => Array (
00213                         'be' => array(),
00214                         'module' => array(),
00215                         'fe' => array(),
00216                         'plugin' => array(),
00217                         'misc' => array(),
00218                         'services' => array(),
00219                         'templates' => array(),
00220                         'example' => array(),
00221                         'doc' => array()
00222                 )
00223         );
00224 
00229         var $categories = Array(
00230                 'be' => 'Backend',
00231                 'module' => 'Backend Modules',
00232                 'fe' => 'Frontend',
00233                 'plugin' => 'Frontend Plugins',
00234                 'misc' => 'Miscellaneous',
00235                 'services' => 'Services',
00236                 'templates' => 'Templates',
00237                 'example' => 'Examples',
00238                 'doc' => 'Documentation'
00239         );
00240 
00245         var $states = Array (
00246                 'alpha' => 'Alpha',
00247                 'beta' => 'Beta',
00248                 'stable' => 'Stable',
00249                 'experimental' => 'Experimental',
00250                 'test' => 'Test',
00251                 'obsolete' => 'Obsolete',
00252         );
00253 
00257         var $stateColors = Array (
00258                 'alpha' => '#d12438',
00259                 'beta' => '#97b17e',
00260                 'stable' => '#3bb65c',
00261                 'experimental' => '#007eba',
00262                 'test' => '#979797',
00263                 'obsolete' => '#000000',
00264         );
00265 
00269         var $typeLabels = Array (
00270                 'S' => 'System',
00271                 'G' => 'Global',
00272                 'L' => 'Local',
00273         );
00274         var $typeDescr = Array (
00275                 'S' => 'System extension (typo3/sysext/) - Always distributed with source code (Static).',
00276                 'G' => 'Global extensions (typo3/ext/) - Available for shared source on server (Dynamic).',
00277                 'L' => 'Local extensions (typo3conf/ext/) - Local for this TYPO3 installation only (Dynamic).',
00278         );
00279         var $typePaths = Array();                       // Also static, set in init()
00280         var $typeBackPaths = Array();           // Also static, set in init()
00281 
00282         var $typeRelPaths = Array (
00283                 'S' => 'sysext/',
00284                 'G' => 'ext/',
00285                 'L' => '../typo3conf/ext/',
00286         );
00287 
00288         var $detailCols = Array (
00289                 0 => 2,
00290                 1 => 5,
00291                 2 => 6,
00292                 3 => 6,
00293                 4 => 4,
00294                 5 => 1
00295         );
00296 
00297         var $fe_user = array(
00298                 'username' => '',
00299                 'password' => '',
00300         );
00301 
00302         var $privacyNotice = 'When you interact with the online repository, server information may be sent and stored in the repository for statistics.';
00303         var $securityHint = '<strong>Found a security problem? Please get in touch with us!</strong><br />If you think you have found a security issue in TYPO3 or an extension, please contact the <a href="http://typo3.org/teams/security/" target="_blank">TYPO3 security team</a>! Thank you!';
00304         var $editTextExtensions = 'html,htm,txt,css,tmpl,inc,php,sql,conf,cnf,pl,pm,sh,xml,ChangeLog';
00305         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';
00306 
00307 
00308 
00309 
00310 
00311                 // Default variables for backend modules
00312         var $MCONF = array();                           // Module configuration
00313         var $MOD_MENU = array();                        // Module menu items
00314         var $MOD_SETTINGS = array();            // Module session settings
00315         var $doc;                                                       // Document Template Object
00316         var $content;                                           // Accumulated content
00317 
00318         var $inst_keys = array();                       // Storage of installed extensions
00319         var $gzcompress = 0;                            // Is set true, if system support compression.
00320 
00321         var $terConnection;                     // instance of TER connection handler
00322 
00323                 // GPvars:
00324         var $CMD = array();                                     // CMD array
00325         var $listRemote;                                        // If set, connects to remote repository
00326         var $lookUpStr;                                         // Search string when listing local extensions
00327 
00328 
00329 
00330 
00331         /*********************************
00332         *
00333         * Standard module initialization
00334         *
00335         *********************************/
00336 
00342         function init() {
00343                 global $BE_USER,$LANG,$BACK_PATH,$TYPO3_CONF_VARS;
00344 
00345                         // Setting paths of install scopes:
00346                 $this->typePaths = Array (
00347                         'S' => TYPO3_mainDir.'sysext/',
00348                         'G' => TYPO3_mainDir.'ext/',
00349                         'L' => 'typo3conf/ext/'
00350                 );
00351                 $this->typeBackPaths = Array (
00352                         'S' => '../../../',
00353                         'G' => '../../../',
00354                         'L' => '../../../../'.TYPO3_mainDir
00355                 );
00356 
00357                 $this->excludeForPackaging = $GLOBALS['TYPO3_CONF_VARS']['EXT']['excludeForPackaging'];
00358 
00359                         // Setting module configuration:
00360                 $this->MCONF = $GLOBALS['MCONF'];
00361 
00362                         // Setting GPvars:
00363                 $this->CMD = t3lib_div::_GP('CMD');
00364                 $this->lookUpStr = trim(t3lib_div::_GP('_lookUp'));
00365                 $this->listRemote = t3lib_div::_GP('ter_connect');
00366                 $this->listRemote_search = trim(t3lib_div::_GP('ter_search'));
00367 
00368 
00369                         // Configure menu
00370                 $this->menuConfig();
00371 
00372                         // Setting internal static:
00373                 if ($TYPO3_CONF_VARS['EXT']['allowSystemInstall'])      $this->systemInstall = 1;
00374                 $this->requiredExt = t3lib_div::trimExplode(',',$TYPO3_CONF_VARS['EXT']['requiredExt'],1);
00375 
00376 
00377                         // Initialize helper object
00378                 $this->terConnection = t3lib_div::makeInstance('SC_mod_tools_em_terconnection');
00379                 $this->terConnection->emObj =& $this;
00380                 $this->terConnection->wsdlURL = $TYPO3_CONF_VARS['EXT']['em_wsdlURL'];
00381                 $this->xmlhandler = t3lib_div::makeInstance('SC_mod_tools_em_xmlhandler');
00382                 $this->xmlhandler->emObj =& $this;
00383                 $this->xmlhandler->useUnchecked = $this->MOD_SETTINGS['display_unchecked'];
00384                 $this->xmlhandler->useObsolete = $this->MOD_SETTINGS['display_obsolete'];
00385 
00386                         // Initialize Document Template object:
00387                 $this->doc = t3lib_div::makeInstance('noDoc');
00388                 $this->doc->backPath = $BACK_PATH;
00389                 $this->doc->docType = 'xhtml_trans';
00390 
00391                         // JavaScript
00392                 $this->doc->JScode = $this->doc->wrapScriptTags('
00393                         script_ended = 0;
00394                         function jumpToUrl(URL) {       //
00395                                 window.location.href = URL;
00396                         }
00397                 ');
00398                 $this->doc->form = '<form action="index.php" method="post" name="pageform">';
00399 
00400                 // Descriptions:
00401                 $this->descrTable = '_MOD_'.$this->MCONF['name'];
00402                 if ($BE_USER->uc['edit_showFieldHelp']) {
00403                         $LANG->loadSingleTableDescription($this->descrTable);
00404                 }
00405 
00406                 // Setting username/password etc. for upload-user:
00407                 $this->fe_user['username'] = $this->MOD_SETTINGS['fe_u'];
00408                 $this->fe_user['password'] = $this->MOD_SETTINGS['fe_p'];
00409                 parent::init();
00410                 $this->handleExternalFunctionValue('singleDetails');
00411         }
00412 
00424         function handleExternalFunctionValue($MM_key='function', $MS_value=NULL)        {
00425                 $MS_value = is_null($MS_value) ? $this->MOD_SETTINGS[$MM_key] : $MS_value;
00426                 $externalItems = $this->getExternalItemConfig($this->MCONF['name'],$MM_key,$MS_value);
00427                 if (is_array($externalItems))   $this->extClassConf = array_merge($externalItems,is_array($this->extClassConf)?$this->extClassConf:array());
00428                 if (is_array($this->extClassConf) && $this->extClassConf['path'])       {
00429                         $this->include_once[]=$this->extClassConf['path'];
00430                 }
00431         }
00432 
00438         function menuConfig()   {
00439                 global $BE_USER, $TYPO3_CONF_VARS;
00440 
00441                 // MENU-ITEMS:
00442                 $this->MOD_MENU = array(
00443                         'function' => array(
00444                                 0 => 'Loaded extensions',
00445                                 1 => 'Install extensions',
00446                                 2 => 'Import extensions',
00447                                 4 => 'Translation handling',
00448                                 3 => 'Settings',
00449                         ),
00450                         'listOrder' => array(
00451                                 'cat' => 'Category',
00452                                 'author_company' => 'Author',
00453                                 'state' => 'State',
00454                                 'type' => 'Type'
00455                         ),
00456                         'display_details' => array(
00457                                 1 => 'Details',
00458                                 0 => 'Description',
00459                                 2 => 'More details',
00460 
00461                                 3 => 'Technical (takes time!)',
00462                                 4 => 'Validating (takes time!)',
00463                                 5 => 'Changed? (takes time!)',
00464                         ),
00465                         'display_shy' => '',
00466                         'display_own' => '',
00467                         'display_unchecked' => '',
00468                         'display_obsolete' => '',
00469 
00470                         'singleDetails' => array(
00471                                 'info' => 'Information',
00472                                 'edit' => 'Edit files',
00473                                 'backup' => 'Backup/Delete',
00474                                 'dump' => 'Dump DB',
00475                                 'upload' => 'Upload to TER',
00476                                 'updateModule' => 'UPDATE!',
00477                         ),
00478                         'fe_u' => '',
00479                         'fe_p' => '',
00480 
00481                         'mirrorListURL' => '',
00482                         'rep_url' => '',
00483                         'extMirrors' => '',
00484                         'selectedMirror' => '',
00485 
00486                         'selectedLanguages' => ''
00487                 );
00488 
00489                 $this->MOD_MENU['singleDetails'] = $this->mergeExternalItems($this->MCONF['name'],'singleDetails',$this->MOD_MENU['singleDetails']);
00490 
00491                 // page/be_user TSconfig settings and blinding of menu-items
00492                 if (!$BE_USER->getTSConfigVal('mod.'.$this->MCONF['name'].'.allowTVlisting'))   {
00493                         unset($this->MOD_MENU['display_details'][3]);
00494                         unset($this->MOD_MENU['display_details'][4]);
00495                         unset($this->MOD_MENU['display_details'][5]);
00496                 }
00497 
00498                 // CLEANSE SETTINGS
00499                 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00500 
00501                 if ($this->MOD_SETTINGS['function']==2) {
00502                         // If listing from online repository, certain items are removed though:
00503                         unset($this->MOD_MENU['listOrder']['type']);
00504                         unset($this->MOD_MENU['display_details'][2]);
00505                         unset($this->MOD_MENU['display_details'][3]);
00506                         unset($this->MOD_MENU['display_details'][4]);
00507                         unset($this->MOD_MENU['display_details'][5]);
00508                         $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00509                 }
00510                 parent::menuConfig();
00511         }
00512 
00518         function main() {
00519                 global $BE_USER,$LANG,$TYPO3_CONF_VARS;
00520 
00521                 if (empty($this->MOD_SETTINGS['mirrorListURL'])) $this->MOD_SETTINGS['mirrorListURL'] = $TYPO3_CONF_VARS['EXT']['em_mirrorListURL'];
00522 
00523                 // Starting page:
00524                 $this->content.=$this->doc->startPage('Extension Manager');
00525                 $this->content.=$this->doc->header('Extension Manager');
00526                 $this->content.=$this->doc->spacer(5);
00527 
00528                 // Commands given which is executed regardless of main menu setting:
00529                 if ($this->CMD['showExt'])      {       // Show details for a single extension
00530                         $this->showExtDetails($this->CMD['showExt']);
00531                 } elseif ($this->CMD['requestInstallExtensions'])       {       // Show details for a single extension
00532                                 $this->requestInstallExtensions($this->CMD['requestInstallExtensions']);
00533                 } elseif ($this->CMD['importExt'] || $this->CMD['uploadExt'])   {       // Imports an extension from online rep.
00534                         $err = $this->importExtFromRep($this->CMD['importExt'],$this->CMD['extVersion'],$this->CMD['loc'],$this->CMD['uploadExt']);
00535                         if ($err)       {
00536                                 $this->content.=$this->doc->section('',$GLOBALS['TBE_TEMPLATE']->rfw($err));
00537                         }
00538                         if(!$err && $this->CMD['importExt']) {
00539                                 $this->installTranslationsForExtension($this->CMD['importExt'], $this->getMirrorURL());
00540                         }
00541                 } elseif ($this->CMD['importExtInfo'])  {       // Gets detailed information of an extension from online rep.
00542                         $this->importExtInfo($this->CMD['importExtInfo'],$this->CMD['extVersion']);
00543                 } else {        // No command - we show what the menu setting tells us:
00544 
00545                         $menu = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.menu').' '.
00546                         t3lib_BEfunc::getFuncMenu(0,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function']);
00547 
00548                         if (t3lib_div::inList('0,1,2',$this->MOD_SETTINGS['function'])) {
00549                                 $menu.='&nbsp;Group by:&nbsp;'.t3lib_BEfunc::getFuncMenu(0,'SET[listOrder]',$this->MOD_SETTINGS['listOrder'],$this->MOD_MENU['listOrder']).
00550                                 '&nbsp;&nbsp;Show:&nbsp;'.t3lib_BEfunc::getFuncMenu(0,'SET[display_details]',$this->MOD_SETTINGS['display_details'],$this->MOD_MENU['display_details']).'<br />';
00551                         }
00552                         if (t3lib_div::inList('0,1',$this->MOD_SETTINGS['function']))   {
00553                                 $menu.='<label for="checkDisplayShy">Display shy extensions:</label>&nbsp;&nbsp;'.t3lib_BEfunc::getFuncCheck(0,'SET[display_shy]',$this->MOD_SETTINGS['display_shy'],'','','id="checkDisplayShy"');
00554                         }
00555                         if (t3lib_div::inList('2',$this->MOD_SETTINGS['function']) && strlen($this->fe_user['username']))       {
00556                                 $menu.='<label for="checkDisplayOwn">Only my extensions:</label>&nbsp;&nbsp;'.t3lib_BEfunc::getFuncCheck(0,'SET[display_own]',$this->MOD_SETTINGS['display_own'],'','','id="checkDisplayOwn"');
00557                         }
00558                         if (t3lib_div::inList('0,1,2',$this->MOD_SETTINGS['function'])) {
00559                                 $menu.='&nbsp;&nbsp;<label for="checkDisplayObsolete">Show obsolete:</label>&nbsp;&nbsp;'.t3lib_BEfunc::getFuncCheck(0,'SET[display_obsolete]',$this->MOD_SETTINGS['display_obsolete'],'','','id="checkDisplayObsolete"');
00560                         }
00561 
00562                         $this->content.=$this->doc->section('','<span class="nobr">'.$menu.'</span>');
00563                         $this->content.=$this->doc->spacer(10);
00564 
00565                         switch((string)$this->MOD_SETTINGS['function']) {
00566                                 case '0':
00567                                         // Lists loaded (installed) extensions
00568                                         $this->extensionList_loaded();
00569                                         break;
00570                                 case '1':
00571                                         // Lists the installed (available) extensions
00572                                         $this->extensionList_installed();
00573                                         break;
00574                                 case '2':
00575                                         // Lists the extensions available from online rep.
00576                                         $this->extensionList_import();
00577                                         break;
00578                                 case '3':
00579                                         // Shows the settings screen
00580                                         $this->alterSettings();
00581                                         break;
00582                                 case '4':
00583                                         // Allows to set the translation preferences and check the status
00584                                         $this->translationHandling();
00585                                         break;
00586                                 default:
00587                                         $this->extObjContent();
00588                                         break;
00589                         }
00590                 }
00591 
00592                 // Shortcuts:
00593                 if ($BE_USER->mayMakeShortcut())        {
00594                         $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('CMD','function',$this->MCONF['name']));
00595                 }
00596         }
00597 
00603         function printContent() {
00604                 if ($this->doPrintContent) {
00605                         $this->content.= $this->doc->endPage();
00606                         echo $this->content;
00607                 }
00608         }
00609 
00610 
00611 
00612 
00613 
00614 
00615 
00616 
00617 
00618 
00619         /*********************************
00620         *
00621         * Function Menu Applications
00622         *
00623         *********************************/
00624 
00630         function extensionList_loaded() {
00631                 global $TYPO3_LOADED_EXT;
00632 
00633                 list($list,$cat) = $this->getInstalledExtensions();
00634 
00635                 // Loaded extensions
00636                 $content = '';
00637                 $lines = array();
00638 
00639                 // Available extensions
00640                 if (is_array($cat[$this->MOD_SETTINGS['listOrder']]))   {
00641                         $content='';
00642                         $lines=array();
00643                         $lines[] = $this->extensionListRowHeader(' class="bgColor5"',array('<td><img src="clear.gif" width="1" height="1" alt="" /></td>'));
00644 
00645                         foreach($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys)        {
00646                                 natcasesort($extEkeys);
00647                                 reset($extEkeys);
00648                                 $extensions = array();
00649                                 while(list($extKey)=each($extEkeys))    {
00650                                         if (array_key_exists($extKey,$TYPO3_LOADED_EXT) && ($this->MOD_SETTINGS['display_shy'] || !$list[$extKey]['EM_CONF']['shy']) && $this->searchExtension($extKey,$list[$extKey])) {
00651                                                 if (in_array($extKey, $this->requiredExt))      {
00652                                                         $loadUnloadLink = '<strong>'.$GLOBALS['TBE_TEMPLATE']->rfw('Rq').'</strong>';
00653                                                 } else {
00654                                                         $loadUnloadLink = '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1').'">'.$this->removeButton().'</a>';
00655                                                 }
00656 
00657                                                 $extensions[] = $this->extensionListRow($extKey,$list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'));
00658                                         }
00659                                 }
00660                                 if(count($extensions)) {
00661                                         $lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><br /></td></tr>';
00662                                         $lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><img src="'.$GLOBALS['BACK_PATH'].'gfx/i/sysf.gif" width="18" height="16" align="top" alt="" /><strong>'.$this->listOrderTitle($this->MOD_SETTINGS['listOrder'],$catName).'</strong></td></tr>';
00663                                         $lines[] = implode(chr(10),$extensions);
00664                                 }
00665                         }
00666                 }
00667 
00668                 $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'loaded', $GLOBALS['BACK_PATH'],'');
00669 
00670                 $content.= 'Look up: <input type="text" name="_lookUp" value="'.htmlspecialchars($this->lookUpStr).'" /><input type="submit" value="Search"/><br/><br/>';
00671 
00672                 $content.= '
00673 
00674                         <!-- Loaded Extensions List -->
00675                         <table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
00676 
00677                 $this->content.=$this->doc->section('Loaded Extensions',$content,0,1);
00678         }
00679 
00685         function extensionList_installed()      {
00686                 global $TYPO3_LOADED_EXT;
00687 
00688                 list($list,$cat)=$this->getInstalledExtensions();
00689 
00690                 // Available extensions
00691                 if (is_array($cat[$this->MOD_SETTINGS['listOrder']]))   {
00692                         $content='';
00693                         $lines=array();
00694                         $lines[]=$this->extensionListRowHeader(' class="bgColor5"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>'));
00695 
00696                         $allKeys=array();
00697                         foreach($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys)        {
00698                                 if(!$this->MOD_SETTINGS['display_obsolete'] && $catName=='obsolete') continue;
00699 
00700                                 $allKeys[]='';
00701                                 $allKeys[]='TYPE: '.$catName;
00702 
00703                                 natcasesort($extEkeys);
00704                                 reset($extEkeys);
00705                                 $extensions = array();
00706                                 while(list($extKey)=each($extEkeys))    {
00707                                         $allKeys[]=$extKey;
00708                                         if ((!$list[$extKey]['EM_CONF']['shy'] || $this->MOD_SETTINGS['display_shy']) &&
00709                                                         ($list[$extKey]['EM_CONF']['state']!='obsolete' || $this->MOD_SETTINGS['display_obsolete'])
00710                                          && $this->searchExtension($extKey,$list[$extKey]))     {
00711                                                 $loadUnloadLink = t3lib_extMgm::isLoaded($extKey)?
00712                                                 '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->removeButton().'</a>':
00713                                                 '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[load]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->installButton().'</a>';
00714                                                 if (in_array($extKey,$this->requiredExt))       {
00715                                                         $loadUnloadLink='<strong>'.$GLOBALS['TBE_TEMPLATE']->rfw('Rq').'</strong>';
00716                                                 }
00717                                                 $theRowClass = t3lib_extMgm::isLoaded($extKey)? 'em-listbg1' : 'em-listbg2';
00718                                                 $extensions[]=$this->extensionListRow($extKey,$list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'),$theRowClass);
00719                                         }
00720                                 }
00721                                 if(count($extensions)) {
00722                                         $lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><br /></td></tr>';
00723                                         $lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><img src="'.$GLOBALS['BACK_PATH'].'gfx/i/sysf.gif" width="18" height="16" align="top" alt="" /><strong>'.$this->listOrderTitle($this->MOD_SETTINGS['listOrder'],$catName).'</strong></td></tr>';
00724                                         $lines[] = implode(chr(10),$extensions);
00725                                 }
00726                         }
00727 
00728                         $content.='
00729 
00730 
00731 <!--
00732 EXTENSION KEYS:
00733 
00734 '.trim(implode(chr(10),$allKeys)).'
00735 
00736 -->
00737 
00738 ';
00739 
00740                         $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'avail', $GLOBALS['BACK_PATH'],'|<br/>');
00741                         $content.= 'If you want to use an extension in TYPO3, you should simply click the "plus" button '.$this->installButton().' . <br />
00742                                                 Installed extensions can also be removed again - just click the remove button '.$this->removeButton().' .<br /><br />';
00743 
00744                         $content.= 'Look up: <input type="text" name="_lookUp" value="'.htmlspecialchars($this->lookUpStr).'" /><input type="submit" value="Search"/><br/><br/>';
00745                         $content.= $this->securityHint.'<br /><br />';
00746 
00747                         $content.= '<table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
00748 
00749                         $this->content.=$this->doc->section('Available Extensions - Grouped by: '.$this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']],$content,0,1);
00750                 }
00751         }
00752 
00758         function extensionList_import() {
00759                 global $TYPO3_LOADED_EXT;
00760                 $content='';
00761 
00762                         // Listing from online repository:
00763                 if ($this->listRemote)  {
00764                         list($inst_list,) = $this->getInstalledExtensions();
00765                         $this->inst_keys = array_flip(array_keys($inst_list));
00766 
00767                         $this->detailCols[1]+=6;
00768 
00769                                 // see if we have an extensionlist at all
00770                         $this->extensionCount = $this->xmlhandler->countExtensions();
00771                         if (!$this->extensionCount)     {
00772                                 $content .= $this->fetchMetaData('extensions');
00773                         }
00774 
00775                         if($this->MOD_SETTINGS['listOrder']=='author_company') {
00776                                 $this->listingLimit = $this->listingLimitAuthor;
00777                         }
00778 
00779                         $this->pointer = intval(t3lib_div::_GP('pointer'));
00780                         $offset = $this->listingLimit*$this->pointer;
00781 
00782                         if($this->MOD_SETTINGS['display_own'] && strlen($this->fe_user['username'])) {
00783                                 $this->xmlhandler->searchExtensionsXML($this->listRemote_search, $this->fe_user['username'], $this->MOD_SETTINGS['listOrder']);
00784                         } else {
00785                                 $this->xmlhandler->searchExtensionsXML($this->listRemote_search, '', $this->MOD_SETTINGS['listOrder'], false, false, $offset, $this->listingLimit);
00786                         }
00787                         if (count($this->xmlhandler->extensionsXML))    {
00788                                 list($list,$cat) = $this->prepareImportExtList(true);
00789 
00790                                         // Available extensions
00791                                 if (is_array($cat[$this->MOD_SETTINGS['listOrder']]))   {
00792                                         $lines=array();
00793                                         $lines[]=$this->extensionListRowHeader(' class="bgColor5"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>'),1);
00794 
00795                                         foreach($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys)        {
00796                                                 if (count($extEkeys))   {
00797                                                         $lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><br /></td></tr>';
00798                                                         $lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><img src="'.$GLOBALS['BACK_PATH'].'gfx/i/sysf.gif" width="18" height="16" align="top" alt="" /><strong>'.$this->listOrderTitle($this->MOD_SETTINGS['listOrder'],$catName).'</strong></td></tr>';
00799 
00800                                                         natcasesort($extEkeys);
00801                                                         reset($extEkeys);
00802                                                         while(list($extKey)=each($extEkeys))    {
00803                                                                 $version = array_keys($list[$extKey]['versions']);
00804                                                                 $version = end($version);
00805                                                                 $ext = $list[$extKey]['versions'][$version];
00806                                                                 $ext['downloadcounter_all'] = $list[$extKey]['downloadcounter'];
00807                                                                 $ext['_ICON'] = $list[$extKey]['_ICON'];
00808                                                                 $loadUnloadLink='';
00809                                                                 if ($inst_list[$extKey]['type']!='S' && (!isset($inst_list[$extKey]) || $this->versionDifference($version,$inst_list[$extKey]['EM_CONF']['version'],$this->versionDiffFactor))) {
00810                                                                         if (isset($inst_list[$extKey])) {
00811                                                                                         // update
00812                                                                                 $loc= ($inst_list[$extKey]['type']=='G'?'G':'L');
00813                                                                                 $aUrl = 'index.php?CMD[importExt]='.$extKey.'&CMD[extVersion]='.$version.'&CMD[loc]='.$loc;
00814                                                                                 $loadUnloadLink.= '<a href="'.htmlspecialchars($aUrl).'"><img src="'.$GLOBALS['BACK_PATH'].'gfx/import_update.gif" width="12" height="12" title="Update the extension in \''.($loc=='G'?'global':'local').'\' from online repository to server" alt="" /></a>';
00815                                                                         } else {
00816                                                                                         // import
00817                                                                                 $aUrl = 'index.php?CMD[importExt]='.$extKey.'&CMD[extVersion]='.$version.'&CMD[loc]=L';
00818                                                                                 $loadUnloadLink.= '<a href="'.htmlspecialchars($aUrl).'"><img src="'.$GLOBALS['BACK_PATH'].'gfx/import.gif" width="12" height="12" title="Import this extension to \'local\' dir typo3conf/ext/ from online repository." alt="" /></a>';
00819                                                                         }
00820                                                                 } else {
00821                                                                         $loadUnloadLink = '&nbsp;';
00822                                                                 }
00823 
00824                                                                 if (isset($inst_list[$extKey])) {
00825                                                                         $theRowClass = t3lib_extMgm::isLoaded($extKey) ? 'em-listbg1' : 'em-listbg2';
00826                                                                 } else {
00827                                                                         $theRowClass = 'em-listbg3';
00828                                                                 }
00829 
00830                                                                 $lines[]=$this->extensionListRow($extKey,$ext,array('<td class="bgColor">'.$loadUnloadLink.'</td>'),$theRowClass,$inst_list,1,'index.php?CMD[importExtInfo]='.rawurlencode($extKey));
00831                                                                 unset($list[$extKey]);
00832                                                         }
00833                                                 }
00834                                         }
00835                                         unset($list);
00836 
00837                                                 // CSH:
00838                                         $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'import_ter', $GLOBALS['BACK_PATH'],'|<br/>');
00839                                         $onsubmit = "window.location.href='index.php?ter_connect=1&ter_search='+escape(this.elements['_lookUp'].value);return false;";
00840                                         $content.= '</form><form action="index.php" method="post" onsubmit="'.htmlspecialchars($onsubmit).'">List or look up <strong'.($this->MOD_SETTINGS['display_unchecked']?' style="color:#900;">all':' style="color:#090;">reviewed').'</strong> extensions<br />
00841                                                         <input type="text" name="_lookUp" value="'.htmlspecialchars($this->listRemote_search).'" /> <input type="submit" value="Look up" /><br /><br />';
00842 
00843                                         $content .= $this->browseLinks();
00844 
00845                                         $content.= '
00846 
00847                                         <!-- TER Extensions list -->
00848                                         <table border="0" cellpadding="2" cellspacing="1">'.implode(chr(10),$lines).'</table>';
00849                                         $content .= '<br />'.$this->browseLinks();
00850                                         $content.= '<br /><br />'.$this->securityHint;
00851                                         $content.= '<br /><br /><strong>PRIVACY NOTICE:</strong><br /> '.$this->privacyNotice;
00852 
00853                                         $this->content.=$this->doc->section('Extensions in TYPO3 Extension Repository (online) - Grouped by: '.$this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']],$content,0,1);
00854 
00855                                                 // Plugins which are NOT uploaded to repository but present on this server.
00856                                         $content='';
00857                                         $lines=array();
00858                                         if (count($this->inst_keys))    {
00859                                                 reset($this->inst_keys);
00860                                                 while(list($extKey)=each($this->inst_keys))     {
00861                                                         $this->xmlhandler->searchExtensionsXML($extKey, '', '', true);
00862                                                         if((strlen($this->listRemote_search) && !stristr($extKey,$this->listRemote_search)) || isset($this->xmlhandler->extensionsXML[$extKey])) continue;
00863 
00864                                                         $loadUnloadLink = t3lib_extMgm::isLoaded($extKey)?
00865                                                         '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->removeButton().'</a>':
00866                                                         '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[load]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->installButton().'</a>';
00867                                                         if (in_array($extKey,$this->requiredExt))       $loadUnloadLink='<strong>'.$GLOBALS['TBE_TEMPLATE']->rfw('Rq').'</strong>';
00868                                                         $lines[]=$this->extensionListRow($extKey,$inst_list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'),t3lib_extMgm::isLoaded($extKey)?'em-listbg1':'em-listbg2');
00869                                                 }
00870                                         }
00871                                         if(count($lines)) {
00872                                                 $content.= 'This is the list of extensions which are available locally, but not in the repository.<br />They might be user-defined and should be prepended user_ then.<br /><br />';
00873                                                 $content.= '<table border="0" cellpadding="2" cellspacing="1">'.
00874                                                         $this->extensionListRowHeader(' class="bgColor5"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>')).
00875                                                         implode('',$lines).'</table>';
00876                                                 $this->content.=$this->doc->spacer(20);
00877                                                 $this->content.=$this->doc->section('Extensions found only on this server',$content,0,1);
00878                                         }
00879                                 }
00880                         } else {
00881                                 $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'import_ter', $GLOBALS['BACK_PATH'],'|<br/>');
00882                                 $onsubmit = "window.location.href='index.php?ter_connect=1&ter_search='+escape(this.elements['_lookUp'].value);return false;";
00883                                 $content.= '</form><form action="index.php" method="post" onsubmit="'.htmlspecialchars($onsubmit).'">List or look up <strong'.($this->MOD_SETTINGS['display_unchecked']?' style="color:#900;">all':' style="color:#090;">reviewed').'</strong> extensions<br />
00884                                         <input type="text" name="_lookUp" value="'.htmlspecialchars($this->listRemote_search).'" /> <input type="submit" value="Look up" /><br /><br />';
00885 
00886                                 $content.= '<p><strong>No matching extensions found.</strong></p>';
00887 
00888                                 $content.= '<br /><br /><strong>PRIVACY NOTICE:</strong><br /> '.$this->privacyNotice;
00889                                 $this->content.=$this->doc->section('Extensions in TYPO3 Extension Repository (online) - Grouped by: '.$this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']],$content,0,1);
00890                         }
00891                 } else {
00892                                 // CSH
00893                         $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'import', $GLOBALS['BACK_PATH'],'|<br/>');
00894 
00895                         $onsubmit = "window.location.href='index.php?ter_connect=1&ter_search='+escape(this.elements['_lookUp'].value);return false;";
00896                         $content.= '</form><form action="index.php" method="post" onsubmit="'.htmlspecialchars($onsubmit).'">List or look up <strong'.($this->MOD_SETTINGS['display_unchecked']?' style="color:#900;">all':' style="color:#090;">reviewed').'</strong> extensions<br />
00897                         <input type="text" name="_lookUp" value="" /> <input type="submit" value="Look up" /><br /><br />';
00898 
00899                         if ($this->CMD['fetchMetaData'])        {       // fetches mirror/extension data from online rep.
00900                                 $content .= $this->fetchMetaData($this->CMD['fetchMetaData']);
00901                         } else {
00902                                 $onCLick = "window.location.href='index.php?CMD[fetchMetaData]=extensions';return false;";
00903                                 $content.= 'Connect to the current mirror and retrieve the current list of available plugins from the TYPO3 Extension Repository.<br />
00904                                 <input type="submit" value="Retrieve/Update" onclick="'.htmlspecialchars($onCLick).'" />';
00905                                 if (is_file(PATH_site.'typo3temp/extensions.xml.gz'))   {
00906                                         $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
00907                                         $timeFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
00908                                         $content.= ' (last update: '.date($dateFormat.' '.$timeFormat,filemtime(PATH_site.'typo3temp/extensions.xml.gz')).')';
00909                                 }
00910                         }
00911                         $content.= '<br /><br />'.$this->securityHint;
00912                         $content.= '<br /><br /><strong>PRIVACY NOTICE:</strong><br />'.$this->privacyNotice;
00913 
00914                         $this->content.=$this->doc->section('Extensions in TYPO3 Extension Repository',$content,0,1);
00915                 }
00916 
00917                         // Upload:
00918                 if ($this->importAtAll())       {
00919                         $content= '</form><form action="index.php" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" method="post">
00920                         Upload extension file (.t3x):<br />
00921                                 <input type="file" size="60" name="upload_ext_file" /><br />
00922                                 ... to location:<br />
00923                                 <select name="CMD[loc]">';
00924                         if ($this->importAsType('L'))   $content.='<option value="L">Local (../typo3conf/ext/)</option>';
00925                         if ($this->importAsType('G'))   $content.='<option value="G">Global (typo3/ext/)</option>';
00926                         if ($this->importAsType('S'))   $content.='<option value="S">System (typo3/sysext/)</option>';
00927                         $content.='</select><br />
00928         <input type="checkbox" value="1" name="CMD[uploadOverwrite]" id="checkUploadOverwrite" /> <label for="checkUploadOverwrite">Overwrite any existing extension!</label><br />
00929         <input type="submit" name="CMD[uploadExt]" value="Upload extension file" /><br />
00930                         ';
00931                 } else $content=$this->noImportMsg();
00932 
00933                 $this->content.=$this->doc->spacer(20);
00934                 $this->content.=$this->doc->section('Upload extension file directly (.t3x):',$content,0,1);
00935         }
00936 
00942         function browseLinks()  {
00943                 $content = '';
00944                 if ($this->pointer)     {
00945                         $content .= '<a href="'.t3lib_div::linkThisScript(array('pointer' => $this->pointer-1)).'" class="typo3-prevPage"><img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/pilleft_n.gif','width="14" height="14"').' alt="Prev page" /> Prev page</a>';
00946                 }
00947                 if ($content) $content .= '&nbsp;&nbsp;&nbsp;';
00948                 if (intval($this->xmlhandler->matchingCount/$this->listingLimit)>$this->pointer)        {
00949                         $content .= '<a href="'.t3lib_div::linkThisScript(array('pointer' => $this->pointer+1)).'" class="typo3-nextPage"><img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/pilright_n.gif','width="14" height="14"').' alt="Next page" /> Next page</a>';
00950                 }
00951                 $upper = (($this->pointer+1)*$this->listingLimit);
00952                 if ($upper>$this->xmlhandler->matchingCount)    {
00953                         $upper = $this->xmlhandler->matchingCount;
00954                 }
00955                 if ($content) $content .= '<br /><br />Showing extensions <strong>'.($this->pointer*$this->listingLimit+1).'</strong> to <strong>'.$upper.'</strong>';
00956                 if ($content) $content .= '<br /><br />';
00957                 return $content;
00958         }
00959 
00965         function alterSettings()        {
00966 
00967                         // Prepare the HTML output:
00968                 $content.= '
00969                         '.t3lib_BEfunc::cshItem('_MOD_tools_em', 'settings', $GLOBALS['BACK_PATH'],'|<br/>').'
00970                         <fieldset><legend>Security Settings</legend>
00971                         <table border="0" cellpadding="2" cellspacing="2">
00972                                 <tr class="bgColor4">
00973                                         <td><label for="display_unchecked">Enable extensions without review (basic security check):</label></td>
00974                                         <td>'.t3lib_BEfunc::getFuncCheck(0,'SET[display_unchecked]',$this->MOD_SETTINGS['display_unchecked'],'','','id="display_unchecked"').'</td>
00975                                 </tr>
00976                         </table>
00977                         <strong>Notice:</strong> Make sure you know what consequences enabling this checkbox might have. Check the <a href="http://typo3.org/extensions/what-are-reviews/" target="_blank">information on typo3.org about security reviewing</a>!
00978                         </fieldset>
00979                         <br />
00980                         <br />
00981                         <fieldset><legend>User Settings</legend>
00982                         <table border="0" cellpadding="2" cellspacing="2">
00983                                 <tr class="bgColor4">
00984                                         <td>Enter repository username:</td>
00985                                         <td><input type="text" name="SET[fe_u]" value="'.htmlspecialchars($this->MOD_SETTINGS['fe_u']).'" /></td>
00986                                 </tr>
00987                                 <tr class="bgColor4">
00988                                         <td>Enter repository password:</td>
00989                                         <td><input type="password" name="SET[fe_p]" value="'.htmlspecialchars($this->MOD_SETTINGS['fe_p']).'" /></td>
00990                                 </tr>
00991                         </table>
00992                         <strong>Notice:</strong> This is <em>not</em> your password to the TYPO3 backend! This user information is what is needed to log in at typo3.org with your account there!
00993                         </fieldset>
00994                         <br />
00995                         <br />
00996                         <fieldset><legend>Mirror selection</legend>
00997                         <table border="0" cellpadding="2" cellspacing="2">
00998                                 <tr class="bgColor4">
00999                                         <td>Enter mirror list URL:</td>
01000                                         <td><input type="text" size="50" name="SET[mirrorListURL]" value="'.htmlspecialchars($this->MOD_SETTINGS['mirrorListURL']).'" /></td>
01001                                 </tr>
01002                         </table>
01003                         <br />
01004                         <p>Select a mirror from below. This list is built from the online mirror list retrieved from the URL above.<br /><br /></p>
01005                         <fieldset><legend>Mirror list</legend>';
01006                 if(!empty($this->MOD_SETTINGS['mirrorListURL'])) {
01007                         if ($this->CMD['fetchMetaData'])        {       // fetches mirror/extension data from online rep.
01008                                 $content .= $this->fetchMetaData($this->CMD['fetchMetaData']);
01009                         } else {
01010                                 $content.= '<a href="index.php?CMD[fetchMetaData]=mirrors">Click here to reload the list.</a>';
01011                         }
01012                 }
01013                 $content .= '<br />
01014                         <table cellspacing="4" style="text-align:left; vertical-alignment:top;">
01015                         <tr><td>Use</td><td>Name</td><td>URL</td><td>Country</td><td>Sponsored by</td></tr>
01016                 ';
01017 
01018                 if (!strlen($this->MOD_SETTINGS['extMirrors'])) $this->fetchMetaData('mirrors');
01019                 $extMirrors = unserialize($this->MOD_SETTINGS['extMirrors']);
01020                 $extMirrors[''] = array('title'=>'Random (recommended!)');
01021                 ksort($extMirrors);
01022                 if(is_array($extMirrors)) {
01023                         foreach($extMirrors as $k => $v) {
01024                                 if(isset($v['sponsor'])) {
01025                                         $sponsor = '<a href="'.htmlspecialchars($v['sponsor']['link']).'" target="_new"><img src="'.$v['sponsor']['logo'].'" title="'.htmlspecialchars($v['sponsor']['name']).'" alt="'.htmlspecialchars($v['sponsor']['name']).'" /></a>';
01026                                 }
01027                                 $selected = ($this->MOD_SETTINGS['selectedMirror']==$k) ? 'checked="checked"' : '';
01028                                 $content.='<tr class="bgColor4">
01029                         <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>';
01030                         }
01031                 }
01032                 $content.= '
01033                         </table>
01034                         </fieldset>
01035                         <br />
01036                         <table border="0" cellpadding="2" cellspacing="2">
01037                                 <tr class="bgColor4">
01038                                         <td>Enter repository URL:</td>
01039                                         <td><input type="text" size="50" name="SET[rep_url]" value="'.htmlspecialchars($this->MOD_SETTINGS['rep_url']).'" /></td>
01040                                 </tr>
01041                         </table>
01042 
01043                         If you set a repository URL, this overrides the use of a mirror. Use this to select a specific (private) repository.<br />
01044                         </fieldset>
01045                         <br />
01046                         <input type="submit" value="Update" />
01047                 ';
01048 
01049                 $this->content.=$this->doc->section('Repository settings',$content,0,1);
01050         }
01051 
01057         function translationHandling()  {
01058                 global $LANG, $TYPO3_LOADED_EXT;
01059                 $LANG->includeLLFile('EXT:setup/mod/locallang.xml');
01060 
01061                 $incoming = t3lib_div::_POST('SET');
01062                 if(isset($incoming['selectedLanguages']) && is_array($incoming['selectedLanguages'])) {
01063                         t3lib_BEfunc::getModuleData($this->MOD_MENU, array('selectedLanguages' => serialize($incoming['selectedLanguages'])), $this->MCONF['name'], '', 'selectedLanguages');
01064                         $this->MOD_SETTINGS['selectedLanguages'] = serialize($incoming['selectedLanguages']);
01065                 }
01066 
01067                 $selectedLanguages = unserialize($this->MOD_SETTINGS['selectedLanguages']);
01068                 if(count($selectedLanguages)==1 && empty($selectedLanguages[0])) $selectedLanguages = array();
01069                 $theLanguages = t3lib_div::trimExplode('|',TYPO3_languages);
01070                 foreach($theLanguages as $val)  {
01071                         if ($val!='default')    {
01072                                 $localLabel = '  -  ['.htmlspecialchars($GLOBALS['LOCAL_LANG']['default']['lang_'.$val]).']';
01073                                 $selected = (is_array($selectedLanguages) && in_array($val, $selectedLanguages)) ? ' selected="selected"' : '';
01074                                 $opt[$GLOBALS['LOCAL_LANG']['default']['lang_'.$val].'--'.$val]='
01075              <option value="'.$val.'"'.$selected.'>'.$LANG->getLL('lang_'.$val,1).$localLabel.'</option>';
01076                         }
01077                 }
01078                 ksort($opt);
01079 
01080                         // Prepare the HTML output:
01081                 $content.= '
01082                         '.t3lib_BEfunc::cshItem('_MOD_tools_em', 'translation', $GLOBALS['BACK_PATH'],'|<br/>').'
01083                         <fieldset><legend>Translation Settings</legend>
01084                         <table border="0" cellpadding="2" cellspacing="2">
01085                                 <tr class="bgColor4">
01086                                         <td>Languages to fetch:</td>
01087                                         <td>
01088                                           <select name="SET[selectedLanguages][]" multiple="multiple" size="10">
01089                                           <option></option>'.
01090             implode('',$opt).'
01091             </select>
01092           </td>
01093                                 </tr>
01094                         </table>
01095                         <br />
01096                         <p>For the selected languages the EM tries to download and install translation files if available, whenever an extension is installed. (This replaces the <code>csh_*</code> extensions that were used to install core translations before TYPO3 version 4!)<br />
01097                         <br />To request an update/install for already loaded extensions, see below.</p>
01098                         </fieldset>
01099                         <br />
01100                         <input type="submit" value="Save selection" />
01101                         <br />
01102                         </fieldset>';
01103 
01104                 $this->content.=$this->doc->section('Translation settings',$content,0,1);
01105 
01106                 if(count($selectedLanguages)>0) {
01107                         $mirrorURL = $this->getMirrorURL();
01108                         $content = '<input type="button" value="Check status against repository" onclick="document.location.href=\''.t3lib_div::linkThisScript(array('l10n'=>'check')).'\'" />&nbsp;<input type="button" value="Update from repository" onclick="document.location.href=\''.t3lib_div::linkThisScript(array('l10n'=>'update')).'\'" />';
01109 
01110                         if(t3lib_div::_GET('l10n') == 'check') {
01111                                 $loadedExtensions = array_keys($TYPO3_LOADED_EXT);
01112                                 $loadedExtensions = array_diff($loadedExtensions,array('_CACHEFILE'));
01113 
01114                                         // Override content output - we now do that ourself:
01115                                 echo ($this->content . $this->doc->section('Translation status',$content,0,1));
01116                                 $this->doPrintContent = FALSE;
01117                                 flush();
01118 
01119                                 echo '
01120                                 <br />
01121                                 <br />
01122                                 <p id="progress-message">
01123                                         Checking translation status, please wait ...
01124                                 </p>
01125                                 <br />
01126                                 <div style="width:100%; height:20px; border: 1px solid black;">
01127                                         <div id="progress-bar" style="float: left; width: 0%; height: 20px; background-color:green;">&nbsp;</div>
01128                                         <div id="transparent-bar" style="float: left; width: 100%; height: 20px; background-color:'.$this->doc->bgColor2.';">&nbsp;</div>
01129                                 </div>
01130                                 <br />
01131                                 <br /><p>This table shows the status of the loaded extension\'s translations.</p><br />
01132                                 <table border="0" cellpadding="2" cellspacing="2">
01133