Project

General

Profile

Bug #23212 » 15154.diff

Administrator Admin, 2010-07-16 17:38

View differences:

typo3/sysext/em/ext_emconf.php (revision 0)
<?php
########################################################################
# Extension Manager/Repository config file for ext "func".
#
# Auto generated 16-07-2010 13:33
#
# Manual updates:
# Only the data in the array - everything else is removed by next
# writing. "version" and "dependencies" must not be touched!
########################################################################
$EM_CONF[$_EXTKEY] = array(
'title' => 'Ext Manager',
'description' => 'TYPO3 Extension Manager',
'category' => 'module',
'shy' => 1,
'dependencies' => 'cms',
'conflicts' => '',
'priority' => '',
'loadOrder' => '',
'module' => 'view',
'doNotLoadInFE' => 1,
'state' => 'stable',
'internal' => 0,
'uploadfolder' => 0,
'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'lockType' => '',
'author' => 'Kasper Skaarhoj',
'author_email' => 'kasperYYYY@typo3.com',
'author_company' => '',
'CGLcompliance' => '',
'CGLcompliance_note' => '',
'version' => '1.0.0',
'_md5_values_when_last_written' => 'a:6:{s:12:"ext_icon.gif";s:4:"2d41";s:14:"ext_tables.php";s:4:"6f55";s:14:"mod1/clear.gif";s:4:"cc11";s:13:"mod1/conf.php";s:4:"ff90";s:13:"mod1/func.gif";s:4:"2d41";s:14:"mod1/index.php";s:4:"69d7";}',
'constraints' => array(
'depends' => array(
'cms' => '',
'php' => '5.1.0-0.0.0',
'typo3' => '4.5.0-0.0.0',
),
'conflicts' => array(
),
'suggests' => array(
),
),
'suggests' => array(
),
);
?>
typo3/sysext/em/ext_tables.php (revision 0)
<?php
if (!defined ('TYPO3_MODE')) {
die ('Access denied.');
}
if (TYPO3_MODE === 'BE') {
t3lib_extMgm::addModule('tools', 'em', 'after:layout', t3lib_extMgm::extPath($_EXTKEY) . 'mod1/');
}
?>
typo3/sysext/em/mod1/class.em_index.php (revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2010 Kasper Skaarhoj (kasperYYYY@typo3.com)
* (c) 2005-2010 Karsten Dambekalns <karsten@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Module: Extension manager
*
* $Id: class.em_index.php 8173 2010-07-13 17:35:35Z jsegars $
*
* @author Kasper Skaarhoj <kasperYYYY@typo3.com>
* @author Karsten Dambekalns <karsten@typo3.org>
*/
/**
* [CLASS/FUNCTION INDEX of SCRIPT]
*
*
*
* 194: class SC_mod_tools_em_index extends t3lib_SCbase
*
* SECTION: Standard module initialization
* 337: function init()
* 417: function handleExternalFunctionValue($MM_key='function', $MS_value=NULL)
* 431: function menuConfig()
* 508: function main()
* 584: function printContent()
*
* SECTION: Function Menu Applications
* 609: function extensionList_loaded()
* 664: function extensionList_installed()
* 736: function extensionList_import()
* 903: function alterSettings()
*
* SECTION: Command Applications (triggered by GET var)
* 1005: function importExtInfo($extKey, $version='')
* 1062: function fetchMetaData($metaType)
* 1125: function getMirrorURL()
* 1158: function installExtension($extKey, $version=null, $mode=EM_INSTALL_VERSION_MIN)
* 1279: function importExtFromRep($extKey,$version,$loc,$uploadFlag=0,$dontDelete=0,$directInput='')
* 1425: function showExtDetails($extKey)
*
* SECTION: Application Sub-functions (HTML parts)
* 1737: function updatesForm($extKey,$extInfo,$notSilent=0,$script='',$addFields='')
* 1768: function extDumpTables($extKey,$extInfo)
* 1835: function getFileListOfExtension($extKey,$conf)
* 1889: function extDelete($extKey,$extInfo)
* 1920: function extUpdateEMCONF($extKey,$extInfo)
* 1940: function extBackup($extKey,$extInfo)
* 1987: function extBackup_dumpDataTablesLine($tablesArray,$extKey)
* 2015: function extInformationArray($extKey,$extInfo,$remote=0)
* 2097: function extInformationArray_dbReq($techInfo,$tableHeader=0)
* 2110: function extInformationArray_dbInst($dbInst,$current)
* 2129: function getRepositoryUploadForm($extKey,$extInfo)
*
* SECTION: Extension list rendering
* 2190: function extensionListRowHeader($trAttrib,$cells,$import=0)
* 2251: function extensionListRow($extKey,$extInfo,$cells,$bgColorClass='',$inst_list=array(),$import=0,$altLinkUrl='')
*
* SECTION: Output helper functions
* 2367: function wrapEmail($str,$email)
* 2380: function helpCol($key)
* 2396: function labelInfo($str)
* 2408: function extensionTitleIconHeader($extKey,$extInfo,$align='top')
* 2423: function removeButton()
* 2432: function installButton()
* 2441: function noImportMsg()
* 2454: function depToString($dep,$type='depends')
* 2473: function stringToDep($dep)
*
* SECTION: Read information about all available extensions
* 2503: function getInstalledExtensions()
* 2530: function getInstExtList($path,&$list,&$cat,$type)
* 2561: function fixEMCONF($emConf)
* 2600: function splitVersionRange($ver)
* 2616: function prepareImportExtList()
* 2660: function setCat(&$cat,$listArrayPart,$extKey)
*
* SECTION: Extension analyzing (detailed information)
* 2710: function makeDetailedExtensionAnalysis($extKey,$extInfo,$validity=0)
* 2892: function getClassIndexLocallangFiles($absPath,$table_class_prefix,$extKey)
* 2962: function modConfFileAnalysis($confFilePath)
* 2990: function serverExtensionMD5Array($extKey,$conf)
* 3015: function findMD5ArrayDiff($current,$past)
*
* SECTION: File system operations
* 3047: function createDirsInPath($dirs,$extDirPath)
* 3065: function removeExtDirectory($removePath,$removeContentOnly=0)
* 3128: function clearAndMakeExtensionDir($importedData,$type,$dontDelete=0)
* 3182: function removeCacheFiles()
* 3192: function extractDirsFromFileList($files)
* 3218: function getExtPath($extKey,$type)
*
* SECTION: Writing to "conf.php" and "localconf.php" files
* 3252: function writeTYPO3_MOD_PATH($confFilePath,$type,$mP)
* 3289: function writeNewExtensionList($newExtList)
* 3312: function writeTsStyleConfig($extKey,$arr)
* 3334: function updateLocalEM_CONF($extKey,$extInfo)
*
* SECTION: Compiling upload information, emconf-file etc.
* 3376: function construct_ext_emconf_file($extKey,$EM_CONF)
* 3407: function arrayToCode($array, $level=0)
* 3433: function makeUploadArray($extKey,$conf)
* 3502: function getSerializedLocalLang($file,$content)
*
* SECTION: Managing dependencies, conflicts, priorities, load order of extension keys
* 3538: function addExtToList($extKey,$instExtInfo)
* 3569: function checkDependencies($extKey, $conf, $instExtInfo)
* 3709: function removeExtFromList($extKey,$instExtInfo)
* 3746: function removeRequiredExtFromListArr($listArr)
* 3761: function managesPriorities($listArr,$instExtInfo)
*
* SECTION: System Update functions (based on extension requirements)
* 3813: function checkClearCache($extInfo)
* 3840: function checkUploadFolder($extKey,$extInfo)
* 3925: function checkDBupdates($extKey,$extInfo,$infoOnly=0)
* 4022: function forceDBupdates($extKey, $extInfo)
* 4080: function tsStyleConfigForm($extKey,$extInfo,$output=0,$script='',$addFields='')
*
* SECTION: Dumping database (MySQL compliant)
* 4175: function dumpTableAndFieldStructure($arr)
* 4200: function dumpStaticTables($tableList)
* 4229: function dumpHeader()
* 4246: function dumpTableHeader($table,$fieldKeyInfo,$dropTableIfExists=0)
* 4288: function dumpTableContent($table,$fieldStructure)
* 4323: function getTableAndFieldStructure($parts)
*
* SECTION: TER Communication functions
* 4373: function uploadExtensionToTER($em)
*
* SECTION: Various helper functions
* 4411: function listOrderTitle($listOrder,$key)
* 4436: function makeVersion($v,$mode)
* 4448: function renderVersion($v,$raise='')
* 4485: function ulFolder($extKey)
* 4494: function importAtAll()
* 4505: function importAsType($type,$lockType='')
* 4527: function deleteAsType($type)
* 4548: function versionDifference($v1,$v2,$div=1)
* 4560: function first_in_array($str,$array,$caseInsensitive=FALSE)
* 4578: function includeEMCONF($path,$_EXTKEY)
* 4593: function searchExtension($extKey,$row)
*
* TOTAL FUNCTIONS: 90
* (This index is automatically created/updated by the extension "extdeveval")
*
*/
// Include classes needed:
require_once('class.em_xmlhandler.php');
require_once('class.em_terconnection.php');
require_once('class.em_unzip.php');
$GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_mod_tools_em.xml');
// from tx_ter by Robert Lemke
define('TX_TER_RESULT_EXTENSIONSUCCESSFULLYUPLOADED', '10504');
define('EM_INSTALL_VERSION_MIN', 1);
define('EM_INSTALL_VERSION_MAX', 2);
define('EM_INSTALL_VERSION_STRICT', 3);
/**
* Module: Extension manager
*
* @author Kasper Skaarhoj <kasperYYYY@typo3.com>
* @author Karsten Dambekalns <karsten@typo3.org>
* @package TYPO3
* @subpackage core
*/
class SC_mod_tools_em_index extends t3lib_SCbase {
// Internal, static:
var $versionDiffFactor = 1; // This means that version difference testing for import is detected for sub-versions only, not dev-versions. Default: 1000
var $systemInstall = 0; // If "1" then installs in the sysext directory is allowed. Default: 0
var $requiredExt = ''; // List of required extension (from TYPO3_CONF_VARS)
var $maxUploadSize = 31457280; // Max size in bytes of extension upload to repository
var $kbMax = 500; // Max size in kilobytes for files to be edited.
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
var $listingLimit = 500; // List that many extension maximally at one time (fixing memory problems)
var $listingLimitAuthor = 250; // List that many extension maximally at one time (fixing memory problems)
/**
* Internal variable loaded with extension categories (for display/listing). Should reflect $categories above
* Dynamic var.
*/
var $defaultCategories = Array(
'cat' => Array (
'be' => array(),
'module' => array(),
'fe' => array(),
'plugin' => array(),
'misc' => array(),
'services' => array(),
'templates' => array(),
'example' => array(),
'doc' => array()
)
);
var $categories = array(); // Extension Categories (static var); see init()
var $states = array(); // Extension States; see init()
/**
* Colors for extension states
*/
var $stateColors = Array (
'alpha' => '#d12438',
'beta' => '#97b17e',
'stable' => '#3bb65c',
'experimental' => '#007eba',
'test' => '#979797',
'obsolete' => '#000000',
'excludeFromUpdates' => '#cf7307'
);
/**
* "TYPE" information; labels, paths, description etc. See init()
*/
var $typeLabels = array();
var $typeDescr = array();
var $typePaths = Array(); // Also static, set in init()
var $typeBackPaths = Array(); // Also static, set in init()
var $typeRelPaths = Array (
'S' => 'sysext/',
'G' => 'ext/',
'L' => '../typo3conf/ext/',
);
var $detailCols = Array (
0 => 2,
1 => 5,
2 => 6,
3 => 6,
4 => 4,
5 => 1
);
var $fe_user = array(
'username' => '',
'password' => '',
);
var $privacyNotice; // Set in init()
var $securityHint; // Set in init()
var $editTextExtensions = 'html,htm,txt,css,tmpl,inc,php,sql,conf,cnf,pl,pm,sh,xml,ChangeLog';
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';
// Default variables for backend modules
var $MCONF = array(); // Module configuration
var $MOD_MENU = array(); // Module menu items
var $MOD_SETTINGS = array(); // Module session settings
/**
* Document Template Object
*
* @var noDoc
*/
var $doc;
var $content; // Accumulated content
var $inst_keys = array(); // Storage of installed extensions
var $gzcompress = 0; // Is set true, if system support compression.
/**
* instance of TER connection handler
*
* @var SC_mod_tools_em_terconnection
*/
var $terConnection;
/**
* XML handling class for the TYPO3 Extension Manager
*
* @var SC_mod_tools_em_xmlhandler
*/
var $xmlhandler;
var $JScode; // JavaScript code to be forwared to $this->doc->JScode
// GPvars:
var $CMD = array(); // CMD array
var $listRemote; // If set, connects to remote repository
var $lookUpStr; // Search string when listing local extensions
/*********************************
*
* Standard module initialization
*
*********************************/
/**
* Standard init function of a module.
*
* @return void
*/
function init() {
global $BE_USER,$LANG,$BACK_PATH,$TYPO3_CONF_VARS;
/**
* Extension Categories (static var)
* Content must be redundant with the same internal variable as in class.tx_extrep.php!
*/
$this->categories = array(
'be' => $GLOBALS['LANG']->getLL('category_BE'),
'module' => $GLOBALS['LANG']->getLL('category_BE_modules'),
'fe' => $GLOBALS['LANG']->getLL('category_FE'),
'plugin' => $GLOBALS['LANG']->getLL('category_FE_plugins'),
'misc' => $GLOBALS['LANG']->getLL('category_miscellanous'),
'services' => $GLOBALS['LANG']->getLL('category_services'),
'templates' => $GLOBALS['LANG']->getLL('category_templates'),
'example' => $GLOBALS['LANG']->getLL('category_examples'),
'doc' => $GLOBALS['LANG']->getLL('category_documentation')
);
/**
* Extension States
* Content must be redundant with the same internal variable as in class.tx_extrep.php!
*/
$this->states = array(
'alpha' => $GLOBALS['LANG']->getLL('state_alpha'),
'beta' => $GLOBALS['LANG']->getLL('state_beta'),
'stable' => $GLOBALS['LANG']->getLL('state_stable'),
'experimental' => $GLOBALS['LANG']->getLL('state_experimental'),
'test' => $GLOBALS['LANG']->getLL('state_test'),
'obsolete' => $GLOBALS['LANG']->getLL('state_obsolete'),
'excludeFromUpdates' => $GLOBALS['LANG']->getLL('state_exclude_from_updates')
);
/**
* "TYPE" information; labels, paths, description etc.
*/
$this->typeLabels = array(
'S' => $GLOBALS['LANG']->getLL('type_system'),
'G' => $GLOBALS['LANG']->getLL('type_global'),
'L' => $GLOBALS['LANG']->getLL('type_local'),
);
$this->typeDescr = array(
'S' => $GLOBALS['LANG']->getLL('descr_system'),
'G' => $GLOBALS['LANG']->getLL('descr_global'),
'L' => $GLOBALS['LANG']->getLL('descr_local'),
);
// Setting paths of install scopes:
$this->typePaths = Array (
'S' => TYPO3_mainDir.'sysext/',
'G' => TYPO3_mainDir.'ext/',
'L' => 'typo3conf/ext/'
);
$this->typeBackPaths = Array (
'S' => '../../../',
'G' => '../../../',
'L' => '../../../../'.TYPO3_mainDir
);
$this->privacyNotice = $GLOBALS['LANG']->getLL('privacy_notice');
$securityMessage = $GLOBALS['LANG']->getLL('security_warning_extensions') .
'<br /><br />' . sprintf($GLOBALS['LANG']->getLL('security_descr'),
'<a href="http://typo3.org/teams/security/" target="_blank">', '</a>'
);
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$securityMessage,
$GLOBALS['LANG']->getLL('security_header'),
t3lib_FlashMessage::INFO
);
$this->securityHint = $flashMessage->render();
$this->excludeForPackaging = $GLOBALS['TYPO3_CONF_VARS']['EXT']['excludeForPackaging'];
// Setting module configuration:
$this->MCONF = $GLOBALS['MCONF'];
// Setting GPvars:
$this->CMD = is_array(t3lib_div::_GP('CMD')) ? t3lib_div::_GP('CMD') : array();
$this->lookUpStr = trim(t3lib_div::_GP('lookUp'));
$this->listRemote = t3lib_div::_GP('ter_connect');
$this->listRemote_search = trim(t3lib_div::_GP('ter_search'));
// Configure menu
$this->menuConfig();
// Setting internal static:
if ($TYPO3_CONF_VARS['EXT']['allowSystemInstall']) $this->systemInstall = 1;
$this->requiredExt = t3lib_div::trimExplode(',',$TYPO3_CONF_VARS['EXT']['requiredExt'],1);
// Initialize helper object
$this->terConnection = t3lib_div::makeInstance('SC_mod_tools_em_terconnection');
$this->terConnection->emObj = $this;
$this->terConnection->wsdlURL = $TYPO3_CONF_VARS['EXT']['em_wsdlURL'];
$this->xmlhandler = t3lib_div::makeInstance('SC_mod_tools_em_xmlhandler');
$this->xmlhandler->emObj = $this;
$this->xmlhandler->useObsolete = $this->MOD_SETTINGS['display_obsolete'];
// Initialize Document Template object:
$this->doc = t3lib_div::makeInstance('template');
$this->doc->backPath = $BACK_PATH;
$this->doc->setModuleTemplate('templates/em_index.html');
// the id is needed for getting same styles TODO: general table styles
$this->doc->bodyTagId = 'typo3-mod-tools-em-index-php';
// JavaScript
$this->doc->JScode = $this->doc->wrapScriptTags('
script_ended = 0;
function jumpToUrl(URL) { //
window.location.href = URL;
}
');
// Reload left frame menu
if ($this->CMD['refreshMenu']) {
$this->doc->JScode .= $this->doc->wrapScriptTags('
if(top.refreshMenu) {
top.refreshMenu();
} else {
top.TYPO3ModuleMenu.refreshMenu();
}
');
}
// Descriptions:
$this->descrTable = '_MOD_'.$this->MCONF['name'];
if ($BE_USER->uc['edit_showFieldHelp']) {
$LANG->loadSingleTableDescription($this->descrTable);
}
// Setting username/password etc. for upload-user:
$this->fe_user['username'] = $this->MOD_SETTINGS['fe_u'];
$this->fe_user['password'] = $this->MOD_SETTINGS['fe_p'];
parent::init();
$this->handleExternalFunctionValue('singleDetails');
}
/**
* This function is a copy of the same function in t3lib_SCbase with one modification:
* In contrast to t3lib_SCbase::handleExternalFunctionValue() this function merges the $this->extClassConf array
* instead of overwriting it. That was necessary for including the Kickstarter as a submodule into the 'singleDetails'
* selectorbox as well as in the main 'function' selectorbox.
*
* @param string Mod-setting array key
* @param string Mod setting value, overriding the one in the key
* @return void
* @see t3lib_SCbase::handleExternalFunctionValue()
*/
function handleExternalFunctionValue($MM_key='function', $MS_value=NULL) {
$MS_value = is_null($MS_value) ? $this->MOD_SETTINGS[$MM_key] : $MS_value;
$externalItems = $this->getExternalItemConfig($this->MCONF['name'],$MM_key,$MS_value);
if (is_array($externalItems)) $this->extClassConf = array_merge($externalItems,is_array($this->extClassConf)?$this->extClassConf:array());
if (is_array($this->extClassConf) && $this->extClassConf['path']) {
$this->include_once[]=$this->extClassConf['path'];
}
}
/**
* Configuration of which mod-menu items can be used
*
* @return void
*/
function menuConfig() {
global $BE_USER, $TYPO3_CONF_VARS;
// MENU-ITEMS:
$this->MOD_MENU = array(
'function' => array(
0 => $GLOBALS['LANG']->getLL('menu_loaded_extensions'),
1 => $GLOBALS['LANG']->getLL('menu_install_extensions'),
2 => $GLOBALS['LANG']->getLL('menu_import_extensions'),
4 => $GLOBALS['LANG']->getLL('menu_translation_handling'),
3 => $GLOBALS['LANG']->getLL('menu_settings'),
5 => $GLOBALS['LANG']->getLL('menu_extension_updates'),
),
'listOrder' => array(
'cat' => $GLOBALS['LANG']->getLL('list_order_category'),
'author_company' => $GLOBALS['LANG']->getLL('list_order_author'),
'state' => $GLOBALS['LANG']->getLL('list_order_state'),
'type' => $GLOBALS['LANG']->getLL('list_order_type'),
),
'display_details' => array(
1 => $GLOBALS['LANG']->getLL('show_details'),
0 => $GLOBALS['LANG']->getLL('show_description'),
2 => $GLOBALS['LANG']->getLL('show_more_details'),
3 => $GLOBALS['LANG']->getLL('show_technical'),
4 => $GLOBALS['LANG']->getLL('show_validating'),
5 => $GLOBALS['LANG']->getLL('show_changed'),
),
'display_shy' => '',
'display_own' => '',
'display_obsolete' => '',
'display_installed' => '',
'display_files' => '',
'singleDetails' => array(
'info' => $GLOBALS['LANG']->getLL('details_info'),
'edit' => $GLOBALS['LANG']->getLL('details_edit'),
'backup' => $GLOBALS['LANG']->getLL('details_backup_delete'),
'dump' => $GLOBALS['LANG']->getLL('details_dump_db'),
'upload' => $GLOBALS['LANG']->getLL('details_upload'),
'updateModule' => $GLOBALS['LANG']->getLL('details_update'),
),
'fe_u' => '',
'fe_p' => '',
'mirrorListURL' => '',
'rep_url' => '',
'extMirrors' => '',
'selectedMirror' => '',
'selectedLanguages' => ''
);
$this->MOD_MENU['singleDetails'] = $this->mergeExternalItems($this->MCONF['name'],'singleDetails',$this->MOD_MENU['singleDetails']);
// page/be_user TSconfig settings and blinding of menu-items
if (!$BE_USER->getTSConfigVal('mod.'.$this->MCONF['name'].'.allowTVlisting')) {
unset($this->MOD_MENU['display_details'][3]);
unset($this->MOD_MENU['display_details'][4]);
unset($this->MOD_MENU['display_details'][5]);
}
// CLEANSE SETTINGS
$this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
if ($this->MOD_SETTINGS['function']==2) {
// If listing from online repository, certain items are removed though:
unset($this->MOD_MENU['listOrder']['type']);
unset($this->MOD_MENU['display_details'][2]);
unset($this->MOD_MENU['display_details'][3]);
unset($this->MOD_MENU['display_details'][4]);
unset($this->MOD_MENU['display_details'][5]);
$this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
}
parent::menuConfig();
}
/**
* Main function for Extension Manager module.
*
* @return void
*/
function main() {
global $BE_USER,$LANG,$TYPO3_CONF_VARS;
if (empty($this->MOD_SETTINGS['mirrorListURL'])) $this->MOD_SETTINGS['mirrorListURL'] = $TYPO3_CONF_VARS['EXT']['em_mirrorListURL'];
// Starting page:
$this->content.=$this->doc->header($GLOBALS['LANG']->getLL('header'));
$this->content.=$this->doc->spacer(5);
// Command given which is executed regardless of main menu setting:
if ($this->CMD['showExt']) { // Show details for a single extension
$this->showExtDetails($this->CMD['showExt']);
} elseif ($this->CMD['requestInstallExtensions']) { // Show details for a single extension
$this->requestInstallExtensions($this->CMD['requestInstallExtensions']);
} elseif ($this->CMD['importExt'] || $this->CMD['uploadExt']) { // Imports an extension from online rep.
$err = $this->importExtFromRep($this->CMD['importExt'],$this->CMD['extVersion'],$this->CMD['loc'],$this->CMD['uploadExt']);
if ($err) {
$this->content.=$this->doc->section('',$GLOBALS['TBE_TEMPLATE']->rfw($err));
}
if(!$err && $this->CMD['importExt']) {
$this->installTranslationsForExtension($this->CMD['importExt'], $this->getMirrorURL());
}
} elseif ($this->CMD['importExtInfo']) { // Gets detailed information of an extension from online rep.
$this->importExtInfo($this->CMD['importExtInfo'],$this->CMD['extVersion']);
} else { // No command - we show what the menu setting tells us:
if (t3lib_div::inList('0,1,2',$this->MOD_SETTINGS['function'])) {
$menu .= '&nbsp;' . $GLOBALS['LANG']->getLL('group_by') . '&nbsp;' . t3lib_BEfunc::getFuncMenu(0, 'SET[listOrder]', $this->MOD_SETTINGS['listOrder'], $this->MOD_MENU['listOrder']) .
'&nbsp;&nbsp;' . $GLOBALS['LANG']->getLL('show') . '&nbsp;' . t3lib_BEfunc::getFuncMenu(0, 'SET[display_details]', $this->MOD_SETTINGS['display_details'], $this->MOD_MENU['display_details']) . '<br />';
}
if (t3lib_div::inList('0,1,5',$this->MOD_SETTINGS['function'])) {
$menu.='<label for="checkDisplayShy">' . $GLOBALS['LANG']->getLL('display_shy') . '</label>&nbsp;&nbsp;' . t3lib_BEfunc::getFuncCheck(0, 'SET[display_shy]', $this->MOD_SETTINGS['display_shy'], '', '', 'id="checkDisplayShy"');
}
if (t3lib_div::inList('2',$this->MOD_SETTINGS['function']) && strlen($this->fe_user['username'])) {
$menu.='<label for="checkDisplayOwn">' . $GLOBALS['LANG']->getLL('only_my_ext') . '</label>&nbsp;&nbsp;' . t3lib_BEfunc::getFuncCheck(0, 'SET[display_own]', $this->MOD_SETTINGS['display_own'], '', '', 'id="checkDisplayOwn"');
}
if (t3lib_div::inList('0,1,2',$this->MOD_SETTINGS['function'])) {
$menu.='&nbsp;&nbsp;<label for="checkDisplayObsolete">' . $GLOBALS['LANG']->getLL('show_obsolete') . '</label>&nbsp;&nbsp;' . t3lib_BEfunc::getFuncCheck(0, 'SET[display_obsolete]', $this->MOD_SETTINGS['display_obsolete'], '', '', 'id="checkDisplayObsolete"');
}
$this->content.=$this->doc->section('','<form action="index.php" method="post" name="pageform"><span class="nobr">' . ($menu ? $menu : '&nbsp;') . '</span></form>');
$this->content.=$this->doc->spacer(10);
switch((string)$this->MOD_SETTINGS['function']) {
case '0':
// Lists loaded (installed) extensions
$this->extensionList_loaded();
break;
case '1':
// Lists the installed (available) extensions
$this->extensionList_installed();
break;
case '2':
// Lists the extensions available from online rep.
$this->extensionList_import();
break;
case '3':
// Shows the settings screen
$this->alterSettings();
break;
case '4':
// Allows to set the translation preferences and check the status
$this->translationHandling();
break;
case '5':
// Shows a list of extensions with updates in TER
$this->checkForUpdates();
break;
default:
$this->extObjContent();
break;
}
}
// closing any form?
$formTags = substr_count($this->content, '<form') + substr_count($this->content, '</form');
if ($formTags % 2 > 0) {
$this->content .= '</form>';
}
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
$markers = array(
'CSH' => $docHeaderButtons['csh'],
'FUNC_MENU' => $this->getFuncMenu(),
'CONTENT' => $this->content
);
// Build the <body> for the module
$this->content = $this->doc->startPage('Extension Manager');
$this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
}
/**
* Print module content. Called as last thing in the global scope.
*
* @return void
*/
function printContent() {
if ($this->doPrintContent) {
echo $this->content;
}
}
/**
* Create the function menu
*
* @return string HTML of the function menu
*/
protected function getFuncMenu() {
$funcMenu = '';
if(!$this->CMD['showExt'] && !$this->CMD['requestInstallExtensions'] && !$this->CMD['importExt'] && !$this->CMD['uploadExt'] && !$this->CMD['importExtInfo']) {
$funcMenu = t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
} elseif($this->CMD['showExt'] && (!$this->CMD['standAlone'] && !t3lib_div::_GP('standAlone'))) {
$funcMenu = t3lib_BEfunc::getFuncMenu(0, 'SET[singleDetails]', $this->MOD_SETTINGS['singleDetails'], $this->MOD_MENU['singleDetails'], '', '&CMD[showExt]=' . $this->CMD['showExt']);
}
return $funcMenu;
}
/**
* Create the panel of buttons for submitting the form or otherwise perform operations.
*
* @return array all available buttons as an assoc. array
*/
protected function getButtons() {
$buttons = array(
'csh' => '',
'back' => '',
'shortcut' => ''
);
// CSH
//$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']);
// Shortcut
if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
$buttons['shortcut'] = $this->doc->makeShortcutIcon('CMD','function',$this->MCONF['name']);
}
// Back
if(($this->CMD['showExt'] && (!$this->CMD['standAlone'] && !t3lib_div::_GP('standAlone'))) || ($this->CMD['importExt'] || $this->CMD['uploadExt'] && (!$this->CMD['standAlone'])) || $this->CMD['importExtInfo']) {
$buttons['back'] = '<a href="index.php" class="typo3-goBack" title="' . $GLOBALS['LANG']->getLL('go_back') . '">' .
t3lib_iconWorks::getSpriteIcon('actions-view-go-back') .
'</a>';
}
return $buttons;
}
/*********************************
*
* Function Menu Applications
*
*********************************/
/**
* Listing of loaded (installed) extensions
*
* @return void
*/
function extensionList_loaded() {
global $TYPO3_LOADED_EXT;
list($list,$cat) = $this->getInstalledExtensions();
// Loaded extensions
$content = '';
$lines = array();
// Available extensions
if (is_array($cat[$this->MOD_SETTINGS['listOrder']])) {
$content='';
$lines=array();
$lines[] = $this->extensionListRowHeader(' class="t3-row-header"',array('<td><img src="clear.gif" width="1" height="1" alt="" /></td>'));
foreach($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys) {
natcasesort($extEkeys);
$extensions = array();
foreach ($extEkeys as $extKey => $value) {
if (array_key_exists($extKey,$TYPO3_LOADED_EXT) && ($this->MOD_SETTINGS['display_shy'] || !$list[$extKey]['EM_CONF']['shy']) && $this->searchExtension($extKey,$list[$extKey])) {
if (in_array($extKey, $this->requiredExt)) {
$loadUnloadLink = '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
} else {
$loadUnloadLink = '<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1').'">'.$this->removeButton().'</a>';
}
$extensions[] = $this->extensionListRow($extKey,$list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'));
}
}
if(count($extensions)) {
$lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><br /></td></tr>';
$lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'">' . t3lib_iconWorks::getSpriteIcon('apps-filetree-folder-default') . '<strong>'.htmlspecialchars($this->listOrderTitle($this->MOD_SETTINGS['listOrder'],$catName)).'</strong></td></tr>';
$lines[] = implode(LF,$extensions);
}
}
}
$content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'loaded', $GLOBALS['BACK_PATH'],'');
$content.= '<form action="index.php" method="post" name="lookupform">';
$content.= '<label for="lookUp">' . $GLOBALS['LANG']->getLL('look_up') . '</label> <input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->lookUpStr) . '" /><input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" /><br /><br />';
$content.= '</form>
<!-- Loaded Extensions List -->
<table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
$this->content.=$this->doc->section($GLOBALS['LANG']->getLL('loaded_exts'),$content,0,1);
}
/**
* Listing of available (installed) extensions
*
* @return void
*/
function extensionList_installed() {
global $TYPO3_LOADED_EXT;
list($list,$cat)=$this->getInstalledExtensions();
// Available extensions
if (is_array($cat[$this->MOD_SETTINGS['listOrder']])) {
$content='';
$lines=array();
$lines[]=$this->extensionListRowHeader(' class="t3-row-header"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>'));
$allKeys=array();
foreach($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys) {
if(!$this->MOD_SETTINGS['display_obsolete'] && $catName=='obsolete') continue;
$allKeys[]='';
$allKeys[]='TYPE: '.$catName;
natcasesort($extEkeys);
$extensions = array();
foreach ($extEkeys as $extKey => $value) {
$allKeys[]=$extKey;
if ((!$list[$extKey]['EM_CONF']['shy'] || $this->MOD_SETTINGS['display_shy']) &&
($list[$extKey]['EM_CONF']['state']!='obsolete' || $this->MOD_SETTINGS['display_obsolete'])
&& $this->searchExtension($extKey,$list[$extKey])) {
$loadUnloadLink = t3lib_extMgm::isLoaded($extKey)?
'<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->removeButton().'</a>':
'<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[load]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->installButton().'</a>';
if (in_array($extKey,$this->requiredExt)) {
$loadUnloadLink = '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
}
$theRowClass = t3lib_extMgm::isLoaded($extKey)? 'em-listbg1' : 'em-listbg2';
$extensions[]=$this->extensionListRow($extKey,$list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'),$theRowClass);
}
}
if(count($extensions)) {
$lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><br /></td></tr>';
$lines[]='<tr><td colspan="' . (3+$this->detailCols[$this->MOD_SETTINGS['display_details']]) . '">' . t3lib_iconWorks::getSpriteIcon('apps-filetree-folder-default') . '<strong>'. htmlspecialchars($this->listOrderTitle($this->MOD_SETTINGS['listOrder'],$catName)).'</strong></td></tr>';
$lines[] = implode(LF,$extensions);
}
}
$content.='
<!--
EXTENSION KEYS:
'.trim(implode(LF,$allKeys)).'
-->
';
$content.= t3lib_BEfunc::cshItem('_MOD_tools_em', 'avail', $GLOBALS['BACK_PATH'], '|<br />');
$content.= sprintf($GLOBALS['LANG']->getLL('how_to_install'), $this->installButton()) . ' <br />' .
sprintf($GLOBALS['LANG']->getLL('how_to_uninstall'), $this->removeButton()). ' <br /><br />';
$content .= '<form action="index.php" method="post" name="lookupform">';
$content .= '<label for="lookUp">' . $GLOBALS['LANG']->getLL('look_up') . '</label> <input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->lookUpStr) . '" /><input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" /></form><br /><br />';
$content.= $this->securityHint.'<br /><br />';
$content.= '<table border="0" cellpadding="2" cellspacing="1">'.implode('',$lines).'</table>';
$this->content.=$this->doc->section(sprintf($GLOBALS['LANG']->getLL('available_extensions'), $this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']]),$content,0,1);
}
}
/**
* Listing remote extensions from online repository
*
* @return void
*/
function extensionList_import() {
global $TYPO3_LOADED_EXT;
$content='';
// Listing from online repository:
if ($this->listRemote) {
list($inst_list,) = $this->getInstalledExtensions();
$this->inst_keys = array_flip(array_keys($inst_list));
$this->detailCols[1]+=6;
// see if we have an extensionlist at all
$this->extensionCount = $this->xmlhandler->countExtensions();
if (!$this->extensionCount) {
$content .= $this->fetchMetaData('extensions');
}
if($this->MOD_SETTINGS['listOrder']=='author_company') {
$this->listingLimit = $this->listingLimitAuthor;
}
$this->pointer = intval(t3lib_div::_GP('pointer'));
$offset = $this->listingLimit*$this->pointer;
if($this->MOD_SETTINGS['display_own'] && strlen($this->fe_user['username'])) {
$this->xmlhandler->searchExtensionsXML($this->listRemote_search, $this->fe_user['username'], $this->MOD_SETTINGS['listOrder'], TRUE);
} else {
$this->xmlhandler->searchExtensionsXML($this->listRemote_search, '', $this->MOD_SETTINGS['listOrder'], TRUE, FALSE, $offset, $this->listingLimit);
}
if (count($this->xmlhandler->extensionsXML)) {
list($list,$cat) = $this->prepareImportExtList(true);
// Available extensions
if (is_array($cat[$this->MOD_SETTINGS['listOrder']])) {
$lines=array();
$lines[]=$this->extensionListRowHeader(' class="t3-row-header"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>'),1);
foreach($cat[$this->MOD_SETTINGS['listOrder']] as $catName => $extEkeys) {
if (count($extEkeys)) {
$lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'"><br /></td></tr>';
$lines[]='<tr><td colspan="'.(3+$this->detailCols[$this->MOD_SETTINGS['display_details']]).'">' . t3lib_iconWorks::getSpriteIcon('apps-filetree-folder-default') . '<strong>'.htmlspecialchars($this->listOrderTitle($this->MOD_SETTINGS['listOrder'],$catName)).'</strong></td></tr>';
natcasesort($extEkeys);
foreach ($extEkeys as $extKey => $value) {
$version = array_keys($list[$extKey]['versions']);
$version = end($version);
$ext = $list[$extKey]['versions'][$version];
$ext['downloadcounter_all'] = $list[$extKey]['downloadcounter'];
$ext['_ICON'] = $list[$extKey]['_ICON'];
$loadUnloadLink='';
if ($inst_list[$extKey]['type']!='S' && (!isset($inst_list[$extKey]) || $this->versionDifference($version,$inst_list[$extKey]['EM_CONF']['version'],$this->versionDiffFactor))) {
if (isset($inst_list[$extKey])) {
// update
if ($inst_list[$extKey]['EM_CONF']['state'] != 'excludeFromUpdates') {
$loc= ($inst_list[$extKey]['type']=='G'?'G':'L');
$aUrl = 'index.php?CMD[importExt]='.$extKey.'&CMD[extVersion]='.$version.'&CMD[loc]='.$loc;
$loadUnloadLink .= '<a href="' . htmlspecialchars($aUrl) . '" title="' . sprintf($GLOBALS['LANG']->getLL('do_update'), ($loc == 'G' ? $GLOBALS['LANG']->getLL('global') : $GLOBALS['LANG']->getLL('local'))) . '">' .
t3lib_iconWorks::getSpriteIcon('actions-system-extension-update') .
'</a>';
} else {
// extension is marked as "excludeFromUpdates"
$loadUnloadLink .= t3lib_iconWorks::getSpriteIcon('status-dialog-warning', $GLOBALS['LANG']->getLL('excluded_from_updates') );
}
} else {
// import
$aUrl = 'index.php?CMD[importExt]='.$extKey.'&CMD[extVersion]='.$version.'&CMD[loc]=L';
$loadUnloadLink .= '<a href="' . htmlspecialchars($aUrl) . '" title="' . $GLOBALS['LANG']->getLL('import_to_local_dir') . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-extension-import') . '</a>';
}
} else {
$loadUnloadLink = '&nbsp;';
}
if (isset($inst_list[$extKey])) {
$theRowClass = t3lib_extMgm::isLoaded($extKey) ? 'em-listbg1' : 'em-listbg2';
} else {
$theRowClass = 'em-listbg3';
}
$lines[]=$this->extensionListRow($extKey,$ext,array('<td class="bgColor">'.$loadUnloadLink.'</td>'),$theRowClass,$inst_list,1,'index.php?CMD[importExtInfo]='.rawurlencode($extKey));
unset($list[$extKey]);
}
}
}
unset($list);
// CSH:
$content .= t3lib_BEfunc::cshItem('_MOD_tools_em', 'import_ter', $GLOBALS['BACK_PATH'], '|<br />');
$onsubmit = "window.location.href='index.php?ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
$content .= '<form action="index.php" method="post" onsubmit="' . htmlspecialchars($onsubmit) .
'"><label for="lookUp">' . $GLOBALS['LANG']->getLL('list_or_look_up_extensions') . '</label><br />
<input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->listRemote_search) .
'" /> <input type="submit" value="' . $GLOBALS['LANG']->getLL('look_up_button') . '" /></form><br /><br />';
$content .= $this->browseLinks();
$content.= '
<!-- TER Extensions list -->
<table border="0" cellpadding="2" cellspacing="1">'.implode(LF,$lines).'</table>';
$content .= '<br />'.$this->browseLinks();
$content.= '<br /><br />'.$this->securityHint;
$content .= '<br /><br /><strong>' . $GLOBALS['LANG']->getLL('privacy_notice_header') .
'</strong><br /> ' . $this->privacyNotice;
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('extensions_repository_group_by') . ' ' .
$this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']], $content, 0, 1);
// Plugins which are NOT uploaded to repository but present on this server.
$content='';
$lines=array();
if (count($this->inst_keys)) {
foreach ($this->inst_keys as $extKey => $value) {
$this->xmlhandler->searchExtensionsXMLExact($extKey, '', '', true);
if((strlen($this->listRemote_search) && !stristr($extKey,$this->listRemote_search)) || isset($this->xmlhandler->extensionsXML[$extKey])) continue;
$loadUnloadLink = t3lib_extMgm::isLoaded($extKey)?
'<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[remove]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->removeButton().'</a>':
'<a href="'.htmlspecialchars('index.php?CMD[showExt]='.$extKey.'&CMD[load]=1&CMD[clrCmd]=1&SET[singleDetails]=info').'">'.$this->installButton().'</a>';
if (in_array($extKey,$this->requiredExt)) {
$loadUnloadLink = '<strong>' .$GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
}
$lines[]=$this->extensionListRow($extKey,$inst_list[$extKey],array('<td class="bgColor">'.$loadUnloadLink.'</td>'),t3lib_extMgm::isLoaded($extKey)?'em-listbg1':'em-listbg2');
}
}
if(count($lines)) {
$content .= $GLOBALS['LANG']->getLL('list_of_local_extensions') .
'<br />' . $GLOBALS['LANG']->getLL('might_be_user_defined') . '<br /><br />';
$content.= '<table border="0" cellpadding="2" cellspacing="1">'.
$this->extensionListRowHeader(' class="t3-row-header"',array('<td><img src="clear.gif" width="18" height="1" alt="" /></td>')).
implode('',$lines).'</table>';
$this->content.=$this->doc->spacer(20);
$this->content.=$this->doc->section($GLOBALS['LANG']->getLL('only_on_this_server'), $content, 0, 1);
}
}
} else {
$content .= t3lib_BEfunc::cshItem('_MOD_tools_em', 'import_ter', $GLOBALS['BACK_PATH'], '|<br />');
$onsubmit = "window.location.href='index.php?ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
$content .= '<form action="index.php" method="post" onsubmit="' . htmlspecialchars($onsubmit) .
'"><label for="lookUp">' .
$GLOBALS['LANG']->getLL('list_or_look_up_extensions') . '</label><br />
<input type="text" id="lookUp" name="lookUp" value="' . htmlspecialchars($this->listRemote_search) .
'" /> <input type="submit" value="' . $GLOBALS['LANG']->getLL('look_up_button') . '" /></form><br /><br />';
$content .= '<p><strong>' . $GLOBALS['LANG']->getLL('no_matching_extensions') . '</strong></p>';
$content .= '<br /><br /><strong>' . $GLOBALS['LANG']->getLL('privacy_notice_header') .
'</strong><br /> ' . $this->privacyNotice;
$this->content.=$this->doc->section($GLOBALS['LANG']->getLL('extensions_repository_group_by') . ' ' .
$this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']], $content, 0, 1);
}
} else {
// CSH
$content .= t3lib_BEfunc::cshItem('_MOD_tools_em', 'import', $GLOBALS['BACK_PATH'], '|<br />');
$onsubmit = "window.location.href='index.php?ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
$content .= '<form action="index.php" method="post" onsubmit="' . htmlspecialchars($onsubmit) .
'"><label for="lookUp">' .
$GLOBALS['LANG']->getLL('list_or_look_up_extensions') . '</label><br />
<input type="text" id="lookUp" name="lookUp" value="" /> <input type="submit" value="' .
$GLOBALS['LANG']->getLL('look_up_button') . '" /><br /><br />';
if ($this->CMD['fetchMetaData']) { // fetches mirror/extension data from online rep.
$content .= $this->fetchMetaData($this->CMD['fetchMetaData']);
} else {
$onCLick = "window.location.href='index.php?CMD[fetchMetaData]=extensions';return false;";
$content .= $GLOBALS['LANG']->getLL('connect_to_ter') . '<br />
<input type="submit" value="' . $GLOBALS['LANG']->getLL('retrieve_update') .
'" onclick="' . htmlspecialchars($onCLick) . '" />';
if (is_file(PATH_site.'typo3temp/extensions.xml.gz')) {
$dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
$timeFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
$content .= ' ' . sprintf($GLOBALS['LANG']->getLL('ext_list_last_updated') . ' ',
date(
$dateFormat . ', ' . $timeFormat,
filemtime(PATH_site . 'typo3temp/extensions.xml.gz')
)
);
}
}
$content.= '</form><br /><br />'.$this->securityHint;
$content .= '<br /><br /><strong>' . $GLOBALS['LANG']->getLL('privacy_notice_header') .
'</strong><br />' . $this->privacyNotice;
$this->content.=$this->doc->section($GLOBALS['LANG']->getLL('in_repository'), $content, 0, 1);
}
// Upload:
if ($this->importAtAll()) {
$content= '<form action="index.php" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" method="post">
<label for="upload_ext_file">' . $GLOBALS['LANG']->getLL('upload_t3x') . '</label><br />
<input type="file" size="60" id="upload_ext_file" name="upload_ext_file" /><br />' .
$GLOBALS['LANG']->getLL('upload_to_location') . '<br />
<select name="CMD[loc]">';
if ($this->importAsType('L')) $content .= '<option value="L">' . $GLOBALS['LANG']->getLL('local_folder') . '</option>';
if ($this->importAsType('G')) $content .= '<option value="G">' . $GLOBALS['LANG']->getLL('global_folder') . '</option>';
if ($this->importAsType('S')) $content .= '<option value="S">' . $GLOBALS['LANG']->getLL('system_folder') . '</option>';
$content.='</select><br />
<input type="checkbox" value="1" name="CMD[uploadOverwrite]" id="checkUploadOverwrite" /> <label for="checkUploadOverwrite">' .
$GLOBALS['LANG']->getLL('overwrite_ext') . '</label><br />
<input type="submit" name="CMD[uploadExt]" value="' . $GLOBALS['LANG']->getLL('upload_ext_file') . '" /></form><br />
';
} else $content=$this->noImportMsg();
$this->content.=$this->doc->spacer(20);
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('upload_ext_directly'), $content, 0, 1);
}
/**
* Generates a link to the next page of extensions
*
* @return void
*/
function browseLinks() {
$content = '';
if ($this->pointer) {
$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="' . $GLOBALS['LANG']->getLL('previous_page') . '" /> ' .
$GLOBALS['LANG']->getLL('previous_page') . '</a>';
}
if ($content) $content .= '&nbsp;&nbsp;&nbsp;';
if (intval($this->xmlhandler->matchingCount/$this->listingLimit)>$this->pointer) {
$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="' . $GLOBALS['LANG']->getLL('next_page') . '" /> ' .
$GLOBALS['LANG']->getLL('next_page') . '</a>';
}
$upper = (($this->pointer+1)*$this->listingLimit);
if ($upper>$this->xmlhandler->matchingCount) {
$upper = $this->xmlhandler->matchingCount;
}
if ($content) $content .= '<br /><br />' .
sprintf($GLOBALS['LANG']->getLL('showing_extensions_from_to'),
'<strong>' . ($this->pointer*$this->listingLimit+1) . '</strong>',
'<strong>' . $upper . '</strong>'
);
if ($content) $content .= '<br /><br />';
return $content;
}
/**
* Allows changing of settings
*
* @return void
*/
function alterSettings() {
// Prepare the HTML output:
$content.= '
' . t3lib_BEfunc::cshItem('_MOD_tools_em', 'settings', $GLOBALS['BACK_PATH'], '|<br />') . '
<form action="index.php" method="post" name="altersettings">
<fieldset><legend>' . $GLOBALS['LANG']->getLL('user_settings') . '</legend>
<table border="0" cellpadding="2" cellspacing="2">
<tr class="bgColor4">
<td><label for="set_fe_u">' . $GLOBALS['LANG']->getLL('enter_repository_username') . '</label></td>
<td><input type="text" id="set_fe_u" name="SET[fe_u]" value="'.htmlspecialchars($this->MOD_SETTINGS['fe_u']).'" /></td>
</tr>
<tr class="bgColor4">
<td><label for="set_fe_p">' . $GLOBALS['LANG']->getLL('enter_repository_password') . '</label></td>
<td><input type="password" id="set_fe_p" name="SET[fe_p]" value="'.htmlspecialchars($this->MOD_SETTINGS['fe_p']).'" /></td>
</tr>
</table>
<strong>' . $GLOBALS['LANG']->getLL('notice') . '</strong> ' .
$GLOBALS['LANG']->getLL('repository_password_info') . '
</fieldset>
<br />
<br />
<fieldset><legend>' . $GLOBALS['LANG']->getLL('mirror_selection') . '</legend>
<table border="0" cellpadding="2" cellspacing="2">
<tr class="bgColor4">
<td><label for="set_mirror_list_url">' . $GLOBALS['LANG']->getLL('mirror_list_url') . '</label></td>
<td><input type="text" size="50" id="set_mirror_list_url" name="SET[mirrorListURL]" value="'.htmlspecialchars($this->MOD_SETTINGS['mirrorListURL']).'" /></td>
</tr>
</table>
</fieldset>
<br />
<p>' . $GLOBALS['LANG']->getLL('mirror_select') . '<br /><br /></p>
<fieldset><legend>' . $GLOBALS['LANG']->getLL('mirror_list') . '</legend>';
if(!empty($this->MOD_SETTINGS['mirrorListURL'])) {
if ($this->CMD['fetchMetaData']) { // fetches mirror/extension data from online rep.
$content .= $this->fetchMetaData($this->CMD['fetchMetaData']);
} else {
$content .= '<a href="index.php?CMD[fetchMetaData]=mirrors">' . $GLOBALS['LANG']->getLL('mirror_list_reload') . '</a>';
}
}
$content .= '<br />
<table cellspacing="4" style="text-align:left; vertical-alignment:top;">
<tr>
<td>' . $GLOBALS['LANG']->getLL('mirror_use') . '</td>
<td>' . $GLOBALS['LANG']->getLL('mirror_name') . '</td>
<td>' . $GLOBALS['LANG']->getLL('mirror_url') . '</td>
<td>' . $GLOBALS['LANG']->getLL('mirror_country') . '</td>
<td>' . $GLOBALS['LANG']->getLL('mirror_sponsored_by') . '</td>
</tr>
';
if (!strlen($this->MOD_SETTINGS['extMirrors'])) $this->fetchMetaData('mirrors');
$extMirrors = unserialize($this->MOD_SETTINGS['extMirrors']);
$extMirrors[''] = array('title'=>$GLOBALS['LANG']->getLL('mirror_use_random'));
ksort($extMirrors);
if(is_array($extMirrors)) {
foreach($extMirrors as $k => $v) {
if(isset($v['sponsor'])) {
$sponsor = '<a href="'.htmlspecialchars($v['sponsor']['link']).'" target="_blank"><img src="'.$v['sponsor']['logo'].'" title="'.htmlspecialchars($v['sponsor']['name']).'" alt="'.htmlspecialchars($v['sponsor']['name']).'" /></a>';
}
$selected = ($this->MOD_SETTINGS['selectedMirror']==$k) ? 'checked="checked"' : '';
$content.='<tr class="bgColor4">
<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>';
}
}
$content.= '
</table>
</fieldset>
<fieldset>
<br />
<table border="0" cellpadding="2" cellspacing="2">
<tr class="bgColor4">
<td><label for="set_rep_url">' . $GLOBALS['LANG']->getLL('enter_repository_url') . '</label></td>
<td><input type="text" size="50" id="set_rep_url" name="SET[rep_url]" value="'.htmlspecialchars($this->MOD_SETTINGS['rep_url']).'" /></td>
</tr>
</table>
' . $GLOBALS['LANG']->getLL('repository_url_hint') . '<br />
</fieldset>
<br />
<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tsfe.xml:update') . '" />
</form>
';
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('repository_settings'), $content, 0, 1);
}
/**
* Allows to set the translation preferences and check the status
*
* @return void
*/
function translationHandling() {
global $LANG, $TYPO3_LOADED_EXT;
$LANG->includeLLFile('EXT:setup/mod/locallang.xml');
//prepare docheader
$docHeaderButtons = $this->getButtons();
$markers = array(
'CSH' => $docHeaderButtons['csh'],
'FUNC_MENU' => $this->getFuncMenu(),
);
$incoming = t3lib_div::_POST('SET');
if(isset($incoming['selectedLanguages']) && is_array($incoming['selectedLanguages'])) {
t3lib_BEfunc::getModuleData($this->MOD_MENU, array('selectedLanguages' => serialize($incoming['selectedLanguages'])), $this->MCONF['name'], '', 'selectedLanguages');
$this->MOD_SETTINGS['selectedLanguages'] = serialize($incoming['selectedLanguages']);
}
$selectedLanguages = unserialize($this->MOD_SETTINGS['selectedLanguages']);
if(count($selectedLanguages)==1 && empty($selectedLanguages[0])) $selectedLanguages = array();
$theLanguages = t3lib_div::trimExplode('|',TYPO3_languages);
foreach($theLanguages as $val) {
if ($val!='default') {
$localLabel = ' - ['.htmlspecialchars($GLOBALS['LOCAL_LANG']['default']['lang_'.$val]).']';
$selected = (is_array($selectedLanguages) && in_array($val, $selectedLanguages)) ? ' selected="selected"' : '';
$opt[$GLOBALS['LANG']->getLL('lang_' . $val, 1) . '--' . $val] = '
<option value="'.$val.'"'.$selected.'>'.$LANG->getLL('lang_'.$val,1).$localLabel.'</option>';
}
}
ksort($opt);
// Prepare the HTML output:
$content.= '
' . t3lib_BEfunc::cshItem('_MOD_tools_em', 'translation', $GLOBALS['BACK_PATH'], '|<br />') . '
<form action="index.php" method="post" name="translationform">
<fieldset><legend>' . $GLOBALS['LANG']->getLL('translation_settings') . '</legend>
<table border="0" cellpadding="2" cellspacing="2">
<tr class="bgColor4">
<td>' . $GLOBALS['LANG']->getLL('languages_to_fetch') . '</td>
<td>
<select name="SET[selectedLanguages][]" multiple="multiple" size="10">
<option>&nbsp;</option>'.
implode('',$opt).'
</select>
</td>
</tr>
</table>
<br />
<p>' . $GLOBALS['LANG']->getLL('translation_info') . '<br />
<br />' . $GLOBALS['LANG']->getLL('translation_loaded_exts') . '</p>
</fieldset>
<br />
<input type="submit" value="' . $GLOBALS['LANG']->getLL('translation_save_selection') . '" />
<br />
</form>';
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('translation_settings'), $content, 0, 1);
if(count($selectedLanguages)>0) {
$mirrorURL = $this->getMirrorURL();
$content = '<input type="button" value="' . $GLOBALS['LANG']->getLL('translation_check_status_button') .
'" onclick="document.location.href=\'' . htmlspecialchars(t3lib_div::linkThisScript(array('l10n'=>'check'))) .
'\'" />&nbsp;<input type="button" value="' . $GLOBALS['LANG']->getLL('translation_update_button') .
'" onclick="document.location.href=\'' . htmlspecialchars(t3lib_div::linkThisScript(array('l10n'=>'update'))) .
'\'" />';
// as this page loads dynamically, quit output buffering caused by ob_gzhandler
t3lib_div::cleanOutputBuffers();
if(t3lib_div::_GET('l10n') == 'check') {
$loadedExtensions = array_keys($TYPO3_LOADED_EXT);
$loadedExtensions = array_diff($loadedExtensions,array('_CACHEFILE'));
// Override content output - we now do that ourselves:
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('translation_status'), $content, 0, 1);
// Setting up the buttons and markers for docheader
$content = $this->doc->startPage('Extension Manager');
$content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
$contentParts=explode('###CONTENT###',$content);
echo $contentParts[0].$this->content;
$this->doPrintContent = FALSE;
flush();
echo '
<br />
<br />
<p id="progress-message">
' . $GLOBALS['LANG']->getLL('translation_check_status') . '
</p>
<br />
<div style="width:100%; height:20px; border: 1px solid black;">
<div id="progress-bar" style="float: left; width: 0%; height: 20px; background-color:green;">&nbsp;</div>
<div id="transparent-bar" style="float: left; width: 100%; height: 20px; background-color:'.$this->doc->bgColor2.';">&nbsp;</div>
</div>
<br />
<br /><p>' . $GLOBALS['LANG']->getLL('translation_table_check') . '</p><br />
<table border="0" cellpadding="2" cellspacing="2">
<tr class="t3-row-header"><td>' . $GLOBALS['LANG']->getLL('translation_extension_key') . '</td>
';
foreach($selectedLanguages as $lang) {
echo ('<td>'.$LANG->getLL('lang_'.$lang,1).'</td>');
}
echo ('</tr>');
$counter = 1;
foreach($loadedExtensions as $extKey) {
$percentDone = intval (($counter / count($loadedExtensions)) * 100);
echo ('
<script type="text/javascript">
document.getElementById("progress-bar").style.width = "'.$percentDone.'%";
document.getElementById("transparent-bar").style.width = "'.(100-$percentDone).'%";
document.getElementById("progress-message").firstChild.data="' .
sprintf($GLOBALS['LANG']->getLL('translation_checking_extension'), $extKey) . '";
</script>
');
flush();
$translationStatusArr = $this->terConnection->fetchTranslationStatus($extKey,$mirrorURL);
echo ('<tr class="bgColor4"><td>'.$extKey.'</td>');
foreach($selectedLanguages as $lang) {
// remote unknown -> no l10n available
if(!isset($translationStatusArr[$lang])) {
echo ('<td title="' . $GLOBALS['LANG']->getLL('translation_no_translation') . '">' .
$GLOBALS['LANG']->getLL('translation_n_a') . '</td>');
continue;
}
// determine local md5 from zip
if(is_file(PATH_site.'typo3temp/'.$extKey.'-l10n-'.$lang.'.zip')) {
$localmd5 = md5_file(PATH_site.'typo3temp/'.$extKey.'-l10n-'.$lang.'.zip');
} else {
echo ('<td title="' . $GLOBALS['LANG']->getLL('translation_not_installed') .
'" style="background-color:#ff0">' . $GLOBALS['LANG']->getLL('translation_status_unknown') .
'</td>');
continue;
}
// local!=remote -> needs update
if($localmd5 != $translationStatusArr[$lang]['md5']) {
echo ('<td title="' . $GLOBALS['LANG']->getLL('translation_needs_update') .
'" style="background-color:#ff0">' . $GLOBALS['LANG']->getLL('translation_status_update') .
'</td>');
continue;
}
echo ('<td title="' . $GLOBALS['LANG']->getLL('translation_is_ok') .
'" style="background-color:#69a550">' . $GLOBALS['LANG']->getLL('translation_status_ok') .
'</td>');
}
echo ('</tr>');
$counter ++;
}
echo '</table>
<script type="text/javascript">
document.getElementById("progress-message").firstChild.data="' .
$GLOBALS['LANG']->getLL('translation_check_done') . '";
</script>
';
echo $contentParts[1] . $this->doc->endPage();
exit;
} elseif(t3lib_div::_GET('l10n') == 'update') {
$loadedExtensions = array_keys($TYPO3_LOADED_EXT);
$loadedExtensions = array_diff($loadedExtensions,array('_CACHEFILE'));
// Override content output - we now do that ourselves:
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('translation_status'), $content, 0, 1);
// Setting up the buttons and markers for docheader
$content = $this->doc->startPage('Extension Manager');
$content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
$contentParts=explode('###CONTENT###',$content);
echo $contentParts[0].$this->content;
$this->doPrintContent = FALSE;
flush();
echo ('
<br />
<br />
<p id="progress-message">
' . $GLOBALS['LANG']->getLL('translation_update_status') . '
</p>
<br />
<div style="width:100%; height:20px; border: 1px solid black;">
<div id="progress-bar" style="float: left; width: 0%; height: 20px; background-color:green;">&nbsp;</div>
<div id="transparent-bar" style="float: left; width: 100%; height: 20px; background-color:'.$this->doc->bgColor2.';">&nbsp;</div>
</div>
<br />
<br /><p>' . $GLOBALS['LANG']->getLL('translation_table_update') . '<br />
<em>' . $GLOBALS['LANG']->getLL('translation_full_check_update') . '</em></p><br />
<table border="0" cellpadding="2" cellspacing="2">
<tr class="t3-row-header"><td>' . $GLOBALS['LANG']->getLL('translation_extension_key') . '</td>
');
foreach($selectedLanguages as $lang) {
echo '<td>'.$LANG->getLL('lang_'.$lang,1).'</td>';
}
echo '</tr>';
$counter = 1;
foreach($loadedExtensions as $extKey) {
$percentDone = intval (($counter / count($loadedExtensions)) * 100);
echo ('
<script type="text/javascript">
document.getElementById("progress-bar").style.width = "'.$percentDone.'%";
... This diff was truncated because it exceeds the maximum size that can be displayed.
(1-1/2)