00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00166 unset($MCONF);
00167 require ('conf.php');
00168 require ($BACK_PATH.'init.php');
00169 require ($BACK_PATH.'template.php');
00170 $BE_USER->modAccess($MCONF,1);
00171
00172
00173 require_once(PATH_t3lib.'class.t3lib_tcemain.php');
00174 require_once(PATH_t3lib.'class.t3lib_install.php');
00175 require_once(PATH_t3lib.'class.t3lib_tsstyleconfig.php');
00176 require_once(PATH_t3lib.'class.t3lib_scbase.php');
00177
00178
00179
00180
00181
00182
00183
00191 class SC_mod_tools_em_index extends t3lib_SCbase {
00192
00193
00194 var $versionDiffFactor = 1000;
00195 var $systemInstall = 0;
00196 var $repositoryUrl = '';
00197 var $requiredExt = '';
00198 var $maxUploadSize = 6024000;
00199 var $kbMax = 100;
00200
00205 var $defaultCategories = Array(
00206 'cat' => Array (
00207 'be' => array(),
00208 'module' => array(),
00209 'fe' => array(),
00210 'plugin' => array(),
00211 'misc' => array(),
00212 'services' => array(),
00213 'templates' => array(),
00214 'example' => array(),
00215 'doc' => array()
00216 )
00217 );
00218
00223 var $categories = Array(
00224 'be' => 'Backend',
00225 'module' => 'Backend Modules',
00226 'fe' => 'Frontend',
00227 'plugin' => 'Frontend Plugins',
00228 'misc' => 'Miscellaneous',
00229 'services' => 'Services',
00230 'templates' => 'Templates',
00231 'example' => 'Examples',
00232 'doc' => 'Documentation'
00233 );
00234
00239 var $states = Array (
00240 'alpha' => 'Alpha',
00241 'beta' => 'Beta',
00242 'stable' => 'Stable',
00243 'experimental' => 'Experimental',
00244 'test' => 'Test',
00245 'obsolete' => 'Obsolete',
00246 );
00247
00251 var $typeLabels = Array (
00252 'S' => 'System',
00253 'G' => 'Global',
00254 'L' => 'Local',
00255 );
00256 var $typeDescr = Array (
00257 'S' => 'System extension (typo3/sysext/) - Always distributed with source code (Static).',
00258 'G' => 'Global extensions (typo3/ext/) - Available for shared source on server (Dynamic).',
00259 'L' => 'Local extensions (typo3conf/ext/) - Local for this TYPO3 installation only (Dynamic).',
00260 );
00261 var $typePaths = Array();
00262 var $typeBackPaths = Array();
00263
00264 var $typeRelPaths = Array (
00265 'S' => 'sysext/',
00266 'G' => 'ext/',
00267 'L' => '../typo3conf/ext/',
00268 );
00269
00273 var $remoteAccess = Array (
00274 'all' => '',
00275 'owner' => 'Owner',
00276 'selected' => 'Selected',
00277 'member' => 'Member',
00278 );
00279
00280 var $detailCols = Array (
00281 0 => 2,
00282 1 => 5,
00283 2 => 6,
00284 3 => 6,
00285 4 => 4,
00286 5 => 1
00287 );
00288
00289 var $fe_user = array(
00290 'username' => '',
00291 'password' => '',
00292 'uploadPass' => '',
00293 );
00294
00295 var $privacyNotice = 'When ever you interact with the online repository, server information is sent and stored in the repository for statistics. No personal information is sent, only identification of this TYPO3 install. If you want know exactly what is sent, look in typo3/mod/tools/em/index.php, function repTransferParams()';
00296 var $editTextExtensions = 'html,htm,txt,css,tmpl,inc,php,sql,conf,cnf,pl,pm,sh,ChangeLog';
00297 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';
00298
00299
00300
00301
00302
00303
00304 var $MCONF = array();
00305 var $MOD_MENU = array();
00306 var $MOD_SETTINGS = array();
00307 var $doc;
00308 var $content;
00309
00310 var $inst_keys = array();
00311 var $gzcompress = 0;
00312
00313
00314 var $CMD = array();
00315 var $listRemote;
00316 var $lookUpStr;
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00341 function init() {
00342 global $BE_USER,$LANG,$BACK_PATH,$TYPO3_CONF_VARS;
00343
00344
00345 $this->typePaths = Array (
00346 'S' => TYPO3_mainDir.'sysext/',
00347 'G' => TYPO3_mainDir.'ext/',
00348 'L' => 'typo3conf/ext/'
00349 );
00350 $this->typeBackPaths = Array (
00351 'S' => '../../../',
00352 'G' => '../../../',
00353 'L' => '../../../../'.TYPO3_mainDir
00354 );
00355
00356
00357 $this->MCONF = $GLOBALS['MCONF'];
00358
00359
00360 $this->CMD = t3lib_div::_GP('CMD');
00361 $this->lookUpStr = t3lib_div::_GP('_lookUp');
00362 $this->listRemote = t3lib_div::_GP('ter_connect');
00363 $this->listRemote_search = t3lib_div::_GP('ter_search');
00364
00365
00366
00367 $this->menuConfig();
00368
00369
00370 $this->gzcompress = function_exists('gzcompress');
00371 if ($TYPO3_CONF_VARS['EXT']['em_devVerUpdate']) $this->versionDiffFactor = 1;
00372 if ($TYPO3_CONF_VARS['EXT']['em_systemInstall']) $this->systemInstall = 1;
00373 $this->repositoryUrl = $TYPO3_CONF_VARS['EXT']['em_TERurls'][0];
00374 $this->requiredExt = t3lib_div::trimExplode(',',$TYPO3_CONF_VARS['EXT']['requiredExt'],1);
00375
00376
00377 $this->doc = t3lib_div::makeInstance('noDoc');
00378 $this->doc->backPath = $BACK_PATH;
00379 $this->doc->docType = 'xhtml_trans';
00380
00381
00382 $this->doc->JScode = $this->doc->wrapScriptTags('
00383 script_ended = 0;
00384 function jumpToUrl(URL) {
00385 document.location = URL;
00386 }
00387 ');
00388 $this->doc->form = '<form action="index.php" method="post" name="pageform">';
00389
00390
00391 $this->descrTable = '_MOD_'.$this->MCONF['name'];
00392 if ($BE_USER->uc['edit_showFieldHelp']) {
00393 $LANG->loadSingleTableDescription($this->descrTable);
00394 }
00395
00396
00397 $this->fe_user['username'] = $this->MOD_SETTINGS['fe_u'];
00398 $this->fe_user['password'] = $this->MOD_SETTINGS['fe_p'];
00399 $this->fe_user['uploadPass'] = $this->MOD_SETTINGS['fe_up'];
00400 parent::init();
00401 $this->handleExternalFunctionValue('singleDetails');
00402 }
00403
00415 function handleExternalFunctionValue($MM_key='function', $MS_value=NULL) {
00416 $MS_value = is_null($MS_value) ? $this->MOD_SETTINGS[$MM_key] : $MS_value;
00417 $externalItems = $this->getExternalItemConfig($this->MCONF['name'],$MM_key,$MS_value);
00418 if (is_array($externalItems)) $this->extClassConf = array_merge($externalItems,is_array($this->extClassConf)?$this->extClassConf:array());
00419 if (is_array($this->extClassConf) && $this->extClassConf['path']) {
00420 $this->include_once[]=$this->extClassConf['path'];
00421 }
00422 }
00423
00429 function menuConfig() {
00430 global $BE_USER;
00431
00432
00433 $this->MOD_MENU = array(
00434 'function' => array(
00435 0 => 'Loaded extensions',
00436 1 => 'Available extensions to install',
00437 2 => 'Import extensions from online repository',
00438 3 => 'Settings',
00439 ),
00440 'listOrder' => array(
00441 'cat' => 'Category',
00442 'author_company' => 'Author',
00443 'state' => 'State',
00444 'private' => 'Private',
00445 'type' => 'Type',
00446 'dep' => 'Dependencies',
00447 ),
00448 'display_details' => array(
00449 1 => 'Details',
00450 0 => 'Description',
00451 2 => 'More details',
00452
00453 3 => 'Technical (takes time!)',
00454 4 => 'Validating (takes time!)',
00455 5 => 'Changed? (takes time!)',
00456 ),
00457 'display_shy' => '',
00458 'own_member_only' => '',
00459 'singleDetails' => array(
00460 'info' => 'Information',
00461 'edit' => 'Edit files',
00462 'backup' => 'Backup/Delete',
00463 'dump' => 'Dump DB',
00464 'upload' => 'Upload',
00465 'updateModule' => 'UPDATE!',
00466 ),
00467 'fe_u' => '',
00468 'fe_p' => '',
00469 'fe_up' => '',
00470 );
00471
00472 $this->MOD_MENU['singleDetails'] = $this->mergeExternalItems($this->MCONF['name'],'singleDetails',$this->MOD_MENU['singleDetails']);
00473
00474
00475 if (!$BE_USER->getTSConfigVal('mod.'.$this->MCONF['name'].'.allowTVlisting')) {
00476 unset($this->MOD_MENU['display_details'][3]);
00477 unset($this->MOD_MENU['display_details'][4]);
00478 unset($this->MOD_MENU['display_details'][5]);
00479 }
00480
00481
00482 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00483
00484 if ($this->MOD_SETTINGS['function']==2) {
00485
00486 unset($this->MOD_MENU['listOrder']['type']);
00487 unset($this->MOD_MENU['listOrder']['private']);
00488 unset($this->MOD_MENU['display_details'][3]);
00489 unset($this->MOD_MENU['display_details'][4]);
00490 unset($this->MOD_MENU['display_details'][5]);
00491 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00492 }
00493 parent::menuConfig();
00494 }
00495
00501 function main() {
00502 global $BE_USER,$LANG;
00503
00504
00505 $this->content.=$this->doc->startPage('Extension Manager');
00506 $this->content.=$this->doc->header('Extension Manager');
00507 $this->content.=$this->doc->spacer(5);
00508
00509
00510
00511 if ($this->CMD['showExt']) {
00512 $this->showExtDetails($this->CMD['showExt']);
00513 } elseif ($this->CMD['importExt'] || $this->CMD['uploadExt']) {
00514 $err = $this->importExtFromRep($this->CMD['importExt'],$this->CMD['loc'],$this->CMD['uploadExt'],'',$this->CMD['transl'],$this->CMD['inc_manual']);
00515 if ($err) {
00516 $this->content.=$this->doc->section('',$GLOBALS['TBE_TEMPLATE']->rfw($err));
00517 }
00518 } elseif ($this->CMD['importExtInfo']) {
00519 $this->importExtInfo($this->CMD['importExtInfo']);
00520 } else {
00521
00522 $menu = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.menu').' '.
00523 t3lib_BEfunc::getFuncMenu(0,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function']);
00524
00525 if (t3lib_div::inList('0,1,2',$this->MOD_SETTINGS['function'])) {
00526 $menu.=' Order by: '.t3lib_BEfunc::getFuncMenu(0,'SET[listOrder]',$this->MOD_SETTINGS['listOrder'],$this->MOD_MENU['listOrder']).
00527 ' Show: '.t3lib_BEfunc::getFuncMenu(0,'SET[display_details]',$this->MOD_SETTINGS['display_details'],$this->MOD_MENU['display_details']).
00528 '<br />Display shy extensions: '.t3lib_BEfunc::getFuncCheck(0,'SET[display_shy]',$this->MOD_SETTINGS['display_shy']);
00529 }
00530
00531 if ($this->MOD_SETTINGS['function']==2) {
00532 $menu.=' Get own/member/selected extensions only: '.
00533 t3lib_BEfunc::getFuncCheck(0,'SET[own_member_only]',$this->MOD_SETTINGS['own_member_only']);
00534 }
00535
00536 $this->content.=$this->doc->section('','<span class="nobr">'.$menu.'</span>');
00537 $this->content.=$this->doc->spacer(10);
00538
00539 switch((string)$this->MOD_SETTINGS['function']) {
00540 case '0':
00541
00542 $this->extensionList_loaded();
00543 break;
00544 case '1':
00545
00546 $this->extensionList_installed();
00547 break;
00548 case '2':
00549
00550 $this->extensionList_import();
00551 break;
00552 case '3':
00553
00554 $this->alterSettings();
00555 break;
00556 default:
00557 $this->extObjContent();
00558 break;
00559 }
00560 }
00561
00562
00563 if ($BE_USER->mayMakeShortcut()) {
00564 $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('CMD','function',$this->MCONF['name']));
00565 }
00566 }
00567
00573 function printContent() {
00574 global $SOBE;
00575
00576 $this->content.= $this->doc->endPage();
00577 echo $this->content;
00578 }
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00600 function extensionList_loaded() {
00601 global $TYPO3_LOADED_EXT;
00602
00603 list($list) = $this->getInstalledExtensions();
00604
00605
00606 $content = '';
00607 $lines = array();
00608 $lines[] = $this->extensionListRowHeader(' class="bgColor5"',array('<td><img src="clear.gif" width="1" height="1" alt="" /></td>'));
00609
00610 foreach($TYPO3_LOADED_EXT as $extKey => $eConf) {
00611 if (strcmp($extKey, '_CACHEFILE')) {
00612 if (($this->MOD_SETTINGS['display_shy'] || !$list[$extKey]['EM_CONF']['shy']) && $this->searchExtension($extKey,$list[$extKey])) {
00613 if (in_array($extKey, $this->requiredExt)) {
00614 $loadUnloadLink = '<strong>'.$GLOBALS['TBE_TEMPLATE']->rfw('Rq').'</strong>';
00615 } else {
00616 $loadUnloadLink = '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1').'">'.$this->removeButton().'</a>';
00617 }
00618
00619 $lines[] = $this->extensionListRow($extKey,$list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'));
00620 }
00621 }
00622 }
00623
00624 $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'loaded', $GLOBALS['BACK_PATH'],'');
00625
00626
00627 $content.= 'Look up: <input type="text" name="_lookUp" value="'.htmlspecialchars($this->lookUpStr).'" /><input type="submit" value="Search"/><br/><br/>';
00628
00629 $content.= '
00630
00631 <!-- Loaded Extensions List -->
00632 <table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
00633
00634 $this->content.=$this->doc->section('Loaded Extensions',$content,0,1);
00635 }
00636
00642 function extensionList_installed() {
00643 global $TYPO3_LOADED_EXT;
00644
00645 list($list,$cat)=$this->getInstalledExtensions();
00646
00647
00648 if (is_array($cat[$this->MOD_SETTINGS['listOrder']])) {
00649 $content='';
00650 $lines=array();
00651 $lines[]=$this->extensionListRowHeader(' class="bgColor5"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>'));
00652
00653 $allKeys=array();
00654 foreach($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys) {
00655 $allKeys[]='';
00656 $allKeys[]='TYPE: '.$catName;
00657
00658 $lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><br /></td></tr>';
00659 $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>';
00660
00661 asort($extEkeys);
00662 reset($extEkeys);
00663 while(list($extKey)=each($extEkeys)) {
00664 $allKeys[]=$extKey;
00665 if (($this->MOD_SETTINGS['display_shy'] || !$list[$extKey]['EM_CONF']['shy']) && $this->searchExtension($extKey,$list[$extKey])) {
00666 $loadUnloadLink = t3lib_extMgm::isLoaded($extKey)?
00667 '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->removeButton().'</a>':
00668 '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[load]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->installButton().'</a>';
00669 if (in_array($extKey,$this->requiredExt)) $loadUnloadLink='<strong>'.$GLOBALS['TBE_TEMPLATE']->rfw('Rq').'</strong>';
00670
00671 if ($list[$extKey]['EM_CONF']['private']) {
00672 $theRowClass = 'em-private';
00673 } else {
00674 $theRowClass = t3lib_extMgm::isLoaded($extKey)? 'em-listbg1' : 'em-listbg2';
00675 }
00676 $lines[]=$this->extensionListRow($extKey,$list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'),$theRowClass);
00677 }
00678 }
00679 }
00680
00681 $content.='
00682
00683
00684 <!--
00685 EXTENSION KEYS:
00686
00687
00688 '.trim(implode(chr(10),$allKeys)).'
00689
00690 -->
00691
00692
00693
00694
00695 ';
00696
00697 #debug($this->MOD_SETTINGS['listOrder']);
00698 $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'avail', $GLOBALS['BACK_PATH'],'|<br/>');
00699 $content.= 'If you want to use an extension in TYPO3, you should simply click the "plus" button '.$this->installButton().' . <br />
00700 Installed extensions can also be removed again - just click the remove button '.$this->removeButton().' .<br /><br />';
00701
00702 $content.= 'Look up: <input type="text" name="_lookUp" value="'.htmlspecialchars($this->lookUpStr).'" /><input type="submit" value="Search"/><br/><br/>';
00703
00704 $content.= '<table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
00705
00706 $this->content.=$this->doc->section('Available Extensions - Order by: '.$this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']],$content,0,1);
00707 }
00708 }
00709
00715 function extensionList_import() {
00716 global $TYPO3_LOADED_EXT;
00717
00718
00719 if ($this->listRemote) {
00720 list($inst_list,$inst_cat) = $this->getInstalledExtensions();
00721 $this->inst_keys = array_flip(array_keys($inst_list));
00722
00723 $this->detailCols[1]+=6;
00724
00725
00726 $repositoryUrl=$this->repositoryUrl.
00727 $this->repTransferParams().
00728 '&tx_extrep[cmd]=currentListing'.
00729 ($this->MOD_SETTINGS['own_member_only']?'&tx_extrep[listmode]=1':'').
00730 ($this->listRemote_search ? '&tx_extrep[search]='.rawurlencode($this->listRemote_search) : '');
00731
00732 $fetchData = $this->fetchServerData($repositoryUrl);
00733
00734 if (is_array($fetchData)) {
00735 $listArr = $fetchData[0];
00736 list($list,$cat) = $this->getImportExtList($listArr);
00737
00738
00739 if (is_array($cat[$this->MOD_SETTINGS['listOrder']])) {
00740 $content='';
00741 $lines=array();
00742 $lines[]=$this->extensionListRowHeader(' class="bgColor5"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>'),1);
00743
00744 foreach($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys) {
00745 if (count($extEkeys)) {
00746 $lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><br /></td></tr>';
00747 $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>';
00748
00749 asort($extEkeys);
00750 reset($extEkeys);
00751 while(list($extKey)=each($extEkeys)) {
00752 if ($this->MOD_SETTINGS['display_shy'] || !$list[$extKey]['EM_CONF']['shy']) {
00753 $loadUnloadLink='';
00754 if ($inst_list[$extKey]['type']!='S' && (!isset($inst_list[$extKey]) || $this->versionDifference($list[$extKey]['EM_CONF']['version'],$inst_list[$extKey]['EM_CONF']['version'],$this->versionDiffFactor))) {
00755 if (isset($inst_list[$extKey])) {
00756
00757 $loc= ($inst_list[$extKey]['type']=='G'?'G':'L');
00758 $aUrl = 'index.php?CMD[importExt]='.$list[$extKey]['extRepUid'].'&CMD[loc]='.$loc.($this->getDocManual($extKey,$loc)?'&CMD[inc_manual]=1':'');
00759 $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>';
00760 } else {
00761
00762 $aUrl = 'index.php?CMD[importExt]='.$list[$extKey]['extRepUid'].'&CMD[loc]=L'.($this->getDocManual($extKey)?'&CMD[inc_manual]=1':'');
00763 $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>';
00764 }
00765 } else {
00766 $loadUnloadLink = ' ';
00767 }
00768
00769 if ($list[$extKey]['_MEMBERS_ONLY']) {
00770 $theRowClass = 'em-private';
00771 } elseif (isset($inst_list[$extKey])) {
00772 $theRowClass = t3lib_extMgm::isLoaded($extKey) ? 'em-listbg1' : 'em-listbg2';
00773 } else {
00774 $theRowClass = 'em-listbg3';
00775 }
00776 $lines[]=$this->extensionListRow($extKey,$list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'),$theRowClass,$inst_list,1,'index.php?CMD[importExtInfo]='.$list[$extKey]['extRepUid']);
00777 }
00778 }
00779 }
00780 }
00781
00782
00783 $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'import_ter', $GLOBALS['BACK_PATH'],'|<br/>');
00784
00785 $content.= '
00786
00787 <!-- TER Extensions list -->
00788 <table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
00789
00790 $content.= '<br />Data fetched: ['.implode('][',$fetchData[1]).']';
00791 $content.= '<br /><br /><strong>PRIVACY NOTICE:</strong><br /> '.$this->privacyNotice;
00792
00793 $this->content.=$this->doc->section('Extensions in TYPO3 Extension Repository (online) - Order by: '.$this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']],$content,0,1);
00794
00795 if (!$this->MOD_SETTINGS['own_member_only'] && !$this->listRemote_search) {
00796
00797 $content='';
00798 $lines=array();
00799 if (count($this->inst_keys)) {
00800 $lines[]=$this->extensionListRowHeader(' class="bgColor5"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>'));
00801
00802 reset($this->inst_keys);
00803 while(list($extKey)=each($this->inst_keys)) {
00804 if ($this->MOD_SETTINGS['display_shy'] || !$inst_list[$extKey]['EM_CONF']['shy']) {
00805 $loadUnloadLink = t3lib_extMgm::isLoaded($extKey)?
00806 '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->removeButton().'</a>':
00807 '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[load]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->installButton().'</a>';
00808 if (in_array($extKey,$this->requiredExt)) $loadUnloadLink='<strong>'.$GLOBALS['TBE_TEMPLATE']->rfw('Rq').'</strong>';
00809 $lines[]=$this->extensionListRow($extKey,$inst_list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'),t3lib_extMgm::isLoaded($extKey)?'em-listbg1':'em-listbg2');
00810 }
00811 }
00812 }
00813
00814 $content.= 'This is the list of extensions which are either user-defined (should be prepended user_ then) or which are private (and does not show up in the public list above).<br /><br />';
00815 $content.= '<table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
00816 $this->content.=$this->doc->spacer(20);
00817 $this->content.=$this->doc->section('Extensions found only on this server',$content,0,1);
00818 }
00819 }
00820 }
00821 } else {
00822
00823 $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'import', $GLOBALS['BACK_PATH'],'|<br/>');
00824 $content.= 'Click here to connect to "'.$this->repositoryUrl.'" and retrieve the list of publicly available plugins from the TYPO3 Extension Repository.<br />';
00825
00826 if ($this->fe_user['username']) {
00827 $content.= '<br /><img src="'.$GLOBALS['BACK_PATH'].'gfx/icon_note.gif" width="18" height="16" align="top" alt="" />Repository username "'.$this->fe_user['username'].'" will be sent as authentication.<br />';
00828 } else {
00829 $content.= '<br /><img src="'.$GLOBALS['BACK_PATH'].'gfx/icon_warning2.gif" width="18" height="16" align="top" alt="" />You have not configured a repository username/password yet. Please <a href="index.php?SET[function]=3">go to "Settings"</a> and do that.<br />';
00830 }
00831
00832 $onCLick = "document.location='index.php?ter_connect=1&ter_search='+escape(this.form['_lookUp'].value);return false;";
00833 $content.= '<br />
00834 Look up: <input type="text" name="_lookUp" value="" />
00835 <input type="submit" value="Connect to online repository" onclick="'.htmlspecialchars($onCLick).'" />
00836 <br /><br /><strong>PRIVACY NOTICE:</strong><br /> '.$this->privacyNotice;
00837
00838 $this->content.=$this->doc->section('Extensions in TYPO3 Extension Repository',$content,0,1);
00839 }
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850 if ($this->importAtAll()) {
00851 $content= '</form><form action="index.php" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" method="post">
00852 Upload extension file (.t3x):<br />
00853 <input type="file" size="60" name="upload_ext_file" /><br />
00854 ... in location:<br />
00855 <select name="CMD[loc]">';
00856 if ($this->importAsType('L')) $content.='<option value="L">Local (../typo3conf/ext/)</option>';
00857 if ($this->importAsType('G')) $content.='<option value="G">Global (typo3/ext/)</option>';
00858 if ($this->importAsType('S')) $content.='<option value="S">System (typo3/sysext/)</option>';
00859 $content.='</select><br />
00860 <input type="checkbox" value="1" name="CMD[uploadOverwrite]" /> Overwrite any existing extension!<br />
00861 <input type="submit" name="CMD[uploadExt]" value="Upload extension file" /><br />
00862 ';
00863 if (!$this->gzcompress) {
00864 $content.='<br />'.$GLOBALS['TBE_TEMPLATE']->rfw("NOTE: No decompression available! Don't upload a compressed extension - it will not succeed.");
00865 }
00866 } else $content=$this->noImportMsg();
00867
00868 $this->content.=$this->doc->spacer(20);
00869 $this->content.=$this->doc->section('Upload extension file directly (.t3x):',$content,0,1);
00870 }
00871
00877 function alterSettings() {
00878 $content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'settings', $GLOBALS['BACK_PATH'],'|<br/>');
00879 $content.= '
00880 <table border="0" cellpadding="2" cellspacing="2">
00881 <tr class="bgColor4">
00882 <td>Enter repository username:</td>
00883 <td><input type="text" name="SET[fe_u]" value="'.htmlspecialchars($this->MOD_SETTINGS['fe_u']).'" /></td>
00884 </tr>
00885 <tr class="bgColor4">
00886 <td>Enter repository password:</td>
00887 <td><input type="password" name="SET[fe_p]" value="'.htmlspecialchars($this->MOD_SETTINGS['fe_p']).'" /></td>
00888 </tr>
00889 <tr class="bgColor4">
00890 <td>Enter default upload password:</td>
00891 <td><input type="password" name="SET[fe_up]" value="'.htmlspecialchars($this->MOD_SETTINGS['fe_up']).'" /></td>
00892 </tr>
00893 </table>
00894
00895 <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!<br />
00896 <br />
00897 <input type="submit" value="Update" />
00898 ';
00899
00900 $this->content.=$this->doc->section('Repository settings',$content,0,1);
00901 }
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00924 function importExtInfo($extRepUid) {
00925
00926
00927 $content = '<a href="index.php" class="typo3-goBack"><img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/goback.gif','width="14" height="14"').' alt="" /> Go back</a>';
00928 $this->content.= $this->doc->section('',$content);
00929 $content = '';
00930
00931
00932 $uidParts = t3lib_div::trimExplode('-',$extRepUid);
00933 if (count($uidParts)==2) {
00934 $extRepUid = $uidParts[0];
00935 $addParams = '&tx_extrep[pKey]='.rawurlencode(trim($uidParts[1]))
00936 .'&tx_extrep[pPass]='.rawurlencode(trim($this->CMD['download_password']));
00937 $addImportParams = '&CMD[download_password]='.rawurlencode(trim($this->CMD['download_password']));
00938 } else $addParams = '';
00939
00940 $repositoryUrl = $this->repositoryUrl.
00941 $this->repTransferParams().
00942 $addParams.
00943 '&tx_extrep[cmd]=extensionInfo'.
00944 '&tx_extrep[uid]='.$extRepUid;
00945
00946
00947 list($fetchData) = $this->fetchServerData($repositoryUrl);
00948 if (is_array($fetchData['_other_versions'])) {
00949 $opt = array();
00950 $opt[] = '<option value=""></option>';
00951 $selectWasSet=0;
00952
00953 foreach($fetchData['_other_versions'] as $dat) {
00954 $setSel = ($dat['uid']==$extRepUid?' selected="selected"':'');
00955 if ($setSel) $selectWasSet=1;
00956 $opt[]='<option value="'.$dat['uid'].'"'.$setSel.'>'.$dat['version'].'</option>';
00957 }
00958 if (!$selectWasSet && $fetchData['emconf_private']) {
00959 $opt[]='<option value="'.$fetchData['uid'].'-'.$fetchData['private_key'].'" selected="selected">'.$fetchData['version'].' (Private)</option>';
00960 }
00961
00962
00963 $onClick = 'document.location=\'index.php?CMD[importExtInfo]=\'+document.pageform.repUid.options[document.pageform.repUid.selectedIndex].value; return false;';
00964 $select='<select name="repUid">'.implode('',$opt).'</select> <input type="submit" value="Load details" onclick="'.htmlspecialchars($onClick).'" /> or<br /><br />';
00965 if ($this->importAtAll()) {
00966 $onClick = '
00967 document.location=\'index.php?CMD[importExt]=\'
00968 +document.pageform.repUid.options[document.pageform.repUid.selectedIndex].value
00969 +\'&CMD[loc]=\'+document.pageform.loc.options[document.pageform.loc.selectedIndex].value
00970 +\'&CMD[transl]=\'+(document.pageform.transl.checked?1:0)
00971 +\'&CMD[inc_manual]=\'+(document.pageform.inc_manual.checked?1:0)
00972 +\''.$addImportParams.'\'; return false;';
00973 $select.='
00974 <input type="submit" value="Import/Update" onclick="'.htmlspecialchars($onClick).'"> to:
00975 <select name="loc">'.
00976 ($this->importAsType('G',$fetchData['emconf_lockType'])?'<option value="G">Global: '.$this->typePaths['G'].$fetchData['extension_key'].'/'.(@is_dir(PATH_site.$this->typePaths['G'].$fetchData['extension_key'])?' (OVERWRITE)':' (empty)').'</option>':'').
00977 ($this->importAsType('L',$fetchData['emconf_lockType'])?'<option value="L">Local: '.$this->typePaths['L'].$fetchData['extension_key'].'/'.(@is_dir(PATH_site.$this->typePaths['L'].$fetchData['extension_key'])?' (OVERWRITE)':' (empty)').'</option>':'').
00978 ($this->importAsType('S',$fetchData['emconf_lockType'])?'<option value="S">System: '.$this->typePaths['S'].$fetchData['extension_key'].'/'.(@is_dir(PATH_site.$this->typePaths['S'].$fetchData['extension_key'])?' (OVERWRITE)':' (empty)').'</option>':'').
00979 #'<option value="fileadmin">'.htmlspecialchars('TEST: fileadmin/_temp_/[extension key name + date]').'</option>'.
00980 '</select>
00981 <br /><input type="checkbox" name="transl" value="1" />Include most recent translations
00982 <br /><input type="checkbox" name="inc_manual" value="1"'.($this->getDocManual($fetchData['extension_key'],@is_dir(PATH_site.$this->typePaths['G'].$fetchData['extension_key'])?'G':'L')?' checked="checked"':'').' />Include "doc/manual.sxw", if any
00983 ';
00984 } else $select.= $this->noImportMsg();
00985 $content.= $select;
00986 $this->content.= $this->doc->section('Select command',$content,0,1);
00987 }
00988
00989
00990 $extKey = $fetchData['extension_key'];
00991 list($xList) = $this->getImportExtList(array($fetchData));
00992 $eInfo = $xList[$extKey];
00993 $eInfo['_TECH_INFO'] = unserialize($fetchData['techinfo']);
00994 $tempFiles = unserialize($fetchData['files']);
00995
00996 if (is_array($tempFiles)) {
00997 reset($tempFiles);
00998 while(list($fk)=each($tempFiles)) {
00999 if (!strstr($fk,'/')) $eInfo['files'][]=$fk;
01000 }
01001 }
01002
01003 $content='<strong>'.$fetchData['_ICON'].' '.$eInfo['EM_CONF']['title'].'</strong><br /><br />';
01004 $content.=$this->extInformationArray($extKey,$eInfo,1);
01005 $this->content.=$this->doc->spacer(10);
01006 $this->content.=$this->doc->section('Remote Extension Details:',$content,0,1);
01007
01008 if (is_array($fetchData['_MESSAGES'])) {
01009 $content = implode('<hr />',$fetchData['_MESSAGES']);
01010 $this->content.=$this->doc->section('Messages from repository server:',$content,0,1,1);
01011 }
01012 }
01013
01026 function importExtFromRep($extRepUid,$loc,$uploadFlag=0,$directInput='',$recentTranslations=0,$incManual=0,$dontDelete=0) {
01027
01028 if (is_array($directInput)) {
01029 $fetchData = array($directInput,'');
01030 $loc = !strcmp($loc,'G')?'G':'L';
01031 } elseif ($uploadFlag) {
01032 if ($_FILES['upload_ext_file']['tmp_name']) {
01033
01034
01035 $uploadedTempFile = t3lib_div::upload_to_tempfile($_FILES['upload_ext_file']['tmp_name']);
01036 $fileContent = t3lib_div::getUrl($uploadedTempFile);
01037 t3lib_div::unlink_tempfile($uploadedTempFile);
01038
01039
01040 $fetchData = array($this->decodeExchangeData($fileContent),'');
01041
01042 if (is_array($fetchData)) {
01043 $extKey = $fetchData[0]['extKey'];
01044 if ($extKey) {
01045 if (!$this->CMD['uploadOverwrite']) {
01046 $loc = !strcmp($loc,'G')?'G':'L';
01047 $comingExtPath = PATH_site.$this->typePaths[$loc].$extKey.'/';
01048 if (@is_dir($comingExtPath)) {
01049 # debug('!');
01050 return 'Extension was already present in "'.$comingExtPath.'" - and the overwrite flag was not set! So nothing done...';
01051 }
01052 }
01053 } else return 'No extension key in file. Strange...';
01054 } else return 'Wrong file format. No data recognized.';
01055 } else return 'No file uploaded! Probably the file was too large for PHPs internal limit for uploadable files.';
01056 } else {
01057
01058
01059 $content = '<a href="index.php" class="typo3-goBack"><img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/goback.gif','width="14" height="14"').' alt="" /> Go back</a>';
01060 $this->content.= $this->doc->section('',$content);
01061 $content = '';
01062
01063
01064 $uidParts = t3lib_div::trimExplode('-',$extRepUid);
01065 if (count($uidParts)==2) {
01066 $extRepUid=$uidParts[0];
01067 $addParams='&tx_extrep[pKey]='.rawurlencode(trim($uidParts[1]))
01068 .'&tx_extrep[pPass]='.rawurlencode(trim($this->CMD['download_password']));
01069 } else $addParams='';
01070
01071
01072 if ($recentTranslations) {
01073 $addParams.='&tx_extrep[transl]=1';
01074 }
01075
01076
01077 if ($incManual) {
01078 $addParams.='&tx_extrep[inc_manual]=1';
01079 }
01080
01081 $repositoryUrl=$this->repositoryUrl.
01082 $this->repTransferParams().
01083 $addParams.
01084 '&tx_extrep[cmd]=importExtension'.
01085 '&tx_extrep[uid]='.$extRepUid;
01086
01087
01088 $fetchData = $this->fetchServerData($repositoryUrl);
01089 }
01090
01091
01092 if ($this->importAsType($loc)) {
01093 if (is_array($fetchData)) {
01094 if ($fetchData[0]['extKey'] && is_array($fetchData[0]['FILES'])) {
01095 $extKey = $fetchData[0]['extKey'];
01096 $EM_CONF = $fetchData[0]['EM_CONF'];
01097 if (!$EM_CONF['lockType'] || !strcmp($EM_CONF['lockType'],$loc)) {
01098 $res = $this->clearAndMakeExtensionDir($fetchData[0],$loc,$dontDelete);
01099 if (is_array($res)) {
01100 $extDirPath = trim($res[0]);
01101 if ($extDirPath && @is_dir($extDirPath) && substr($extDirPath,-1)=='/') {
01102
01103 $emConfFile = $this->construct_ext_emconf_file($extKey,$EM_CONF);
01104 $dirs = $this->extractDirsFromFileList(array_keys($fetchData[0]['FILES']));
01105
01106 $res = $this->createDirsInPath($dirs,$extDirPath);
01107 if (!$res) {
01108 $writeFiles = $fetchData[0]['FILES'];
01109 $writeFiles['ext_emconf.php']['content'] = $emConfFile;
01110 $writeFiles['ext_emconf.php']['content_md5'] = md5($emConfFile);
01111
01112
01113 foreach($writeFiles as $theFile => $fileData) {
01114 t3lib_div::writeFile($extDirPath.$theFile,$fileData['content']);
01115 if (!@is_file($extDirPath.$theFile)) {
01116 $content.='Error: File "'.$extDirPath.$theFile.'" could not be created!!!<br />';
01117 } elseif (md5(t3lib_div::getUrl($extDirPath.$theFile)) != $fileData['content_md5']) {
01118 $content.='Error: File "'.$extDirPath.$theFile.'" MD5 was different from the original files MD5 - so the file is corrupted!<br />';
01119 } elseif (TYPO3_OS!='WIN') {
01120 #chmod ($extDirPath.$theFile, 0755); # SHOULD NOT do that here since writing the file should already have set adequate permissions!
01121 }
01122 }
01123
01124
01125 if (!$content) {
01126 $content='SUCCESS: '.$extDirPath.'<br />';
01127
01128
01129 $modules = t3lib_div::trimExplode(',',$EM_CONF['module'],1);
01130 if (count($modules)) {
01131 foreach($modules as $mD) {
01132 $confFileName = $extDirPath.$mD.'/conf.php';
01133 if (@is_file($confFileName)) {
01134 $content.= $this->writeTYPO3_MOD_PATH($confFileName,$loc,$extKey.'/'.$mD.'/').'<br />';
01135 } else $content.='Error: Couldn\'t find "'.$confFileName.'"<br />';
01136 }
01137 }
01138