Index: typo3/sysext/em/classes/tools/class.tx_em_tools.php
===================================================================
--- typo3/sysext/em/classes/tools/class.tx_em_tools.php	(revision 9361)
+++ typo3/sysext/em/classes/tools/class.tx_em_tools.php	(revision )
@@ -93,6 +93,34 @@
 
 
 	/**
+	 * Refreshes the global extension list
+	 *
+	 * @return void
+	 */
+	function refreshGlobalExtList() {
+		global $TYPO3_LOADED_EXT;
+
+		$TYPO3_LOADED_EXT = t3lib_extMgm::typo3_loadExtensions();
+		if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
+			require(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_localconf.php');
+		}
+		return;
+
+		$GLOBALS['TYPO3_LOADED_EXT'] = t3lib_extMgm::typo3_loadExtensions();
+		if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
+			require(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_localconf.php');
+		} else {
+			$temp_TYPO3_LOADED_EXT = $TYPO3_LOADED_EXT;
+			foreach ($temp_TYPO3_LOADED_EXT as $_EXTKEY => $temp_lEDat) {
+				if (is_array($temp_lEDat) && $temp_lEDat['ext_localconf.php']) {
+					$_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
+					require($temp_lEDat['ext_localconf.php']);
+				}
+			}
+		}
+	}
+
+	/**
 	 * Set category array entries for extension
 	 *
 	 * @param	array		Category index array
Index: typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php
===================================================================
--- typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php	(revision 9414)
+++ typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php	(revision )
@@ -544,10 +544,11 @@
 						'</a></td>';
 
 				// Manual download
-				$fileP = PATH_site . $this->parentObject->typePaths[$extInfo['type']] . $extKey . '/doc/manual.sxw';
+				$fileP = PATH_site . tx_em_Tools::typePath($extInfo['type']) . $extKey . '/doc/manual.sxw';
 				$cells[] = '<td nowrap="nowrap">' .
-						($this->parentObject->typePaths[$extInfo['type']] && @is_file($fileP) ?
-								'<a href="' . htmlspecialchars(t3lib_div::resolveBackPath($this->parentObject->doc->backPath . '../' . $this->parentObject->typePaths[$extInfo['type']] . $extKey . '/doc/manual.sxw')) . '" target="_blank" title="' . $GLOBALS['LANG']->getLL('listRow_local_manual') . '">' .
+						(tx_em_Tools::typePath($extInfo['type']) && @is_file($fileP) ?
+								'<a href="' . htmlspecialchars(t3lib_div::resolveBackPath($this->parentObject->doc->backPath . '../' .
+									tx_em_Tools::typePath($extInfo['type']) . $extKey . '/doc/manual.sxw')) . '" target="_blank" title="' . $GLOBALS['LANG']->getLL('listRow_local_manual') . '">' .
 										t3lib_iconWorks::getSpriteIcon('actions-system-extension-documentation') . '</a>' : '') .
 						'</td>';
 
@@ -781,6 +782,7 @@
 
 		// Implode unique list of extensions to load and return:
 		$list = implode(',', array_unique($listArr));
+
 		return $list;
 	}
 
@@ -835,8 +837,9 @@
 	 * @see removeExtFromList(), addExtToList()
 	 */
 	function removeRequiredExtFromListArr($listArr) {
+		$requiredExtensions = t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXT']['requiredExt'], 1);
 		foreach ($listArr as $k => $ext) {
-			if (in_array($ext, $this->parentObject->requiredExt) || !strcmp($ext, '_CACHEFILE')) {
+			if (in_array($ext, $requiredExtensions) || !strcmp($ext, '_CACHEFILE')) {
 				unset($listArr[$k]);
 			}
 		}
Index: typo3/sysext/em/classes/install/class.tx_em_install.php
===================================================================
--- typo3/sysext/em/classes/install/class.tx_em_install.php	(revision 9449)
+++ typo3/sysext/em/classes/install/class.tx_em_install.php	(revision )
@@ -1304,6 +1304,107 @@
 		return $content;
 	}
 
+	/**
+	 * Writes the extension list to "localconf.php" file
+	 * Removes the temp_CACHED* files before return.
+	 *
+	 * @param	string		List of extensions
+	 * @return	void
+	 */
+	function writeNewExtensionList($newExtList) {
+		$strippedExtensionList = $this->stripNonFrontendExtensions($newExtList);
+
+		// Instance of install tool
+		$instObj = new t3lib_install;
+		$instObj->allowUpdateLocalConf = 1;
+		$instObj->updateIdentity = 'TYPO3 Extension Manager';
+
+		// Get lines from localconf file
+		$lines = $instObj->writeToLocalconf_control();
+		$instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList);
+		$instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList_FE\']', $strippedExtensionList);
+		$instObj->writeToLocalconf_control($lines);
+
+		$GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList;
+		$GLOBALS['TYPO3_CONF_VARS']['EXT']['extList_FE'] = $strippedExtensionList;
+		t3lib_extMgm::removeCacheFiles();
-}
+	}
 
+	/**
+	 * Removes unneeded extensions from the frontend based on
+	 * EMCONF doNotLoadInFE = 1
+	 *
+	 * @param string $extList
+	 * @return string
+	 */
+	function stripNonFrontendExtensions($extList) {
+		$fullExtList = $this->parentObject->extensionList->getInstalledExtensions();
+		$extListArray = t3lib_div::trimExplode(',', $extList);
+		foreach ($extListArray as $arrayKey => $extKey) {
+			if ($fullExtList[0][$extKey]['EM_CONF']['doNotLoadInFE'] == 1) {
+				unset($extListArray[$arrayKey]);
+			}
+		}
+		$nonFEList = implode(',', $extListArray);
+		return $nonFEList;
+	}
+
+	/**
+	 * Updates the database according to extension requirements
+	 * DBAL compliant (based on Install Tool code)
+	 *
+	 * @param	string		Extension key
+	 * @param	array		Extension information array
+	 * @return	void
+	 */
+	function forceDBupdates($extKey, $extInfo) {
+		$instObj = new t3lib_install;
+
+		// Updating tables and fields?
+		if (is_array($extInfo['files']) && in_array('ext_tables.sql', $extInfo['files'])) {
+			$fileContent = t3lib_div::getUrl(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . 'ext_tables.sql');
+
+			$FDfile = $instObj->getFieldDefinitions_fileContent($fileContent);
+			if (count($FDfile)) {
+				$FDdb = $instObj->getFieldDefinitions_database(TYPO3_db);
+				$diff = $instObj->getDatabaseExtra($FDfile, $FDdb);
+				$update_statements = $instObj->getUpdateSuggestions($diff);
+
+				foreach ((array) $update_statements['add'] as $string) {
+					$GLOBALS['TYPO3_DB']->admin_query($string);
+				}
+				foreach ((array) $update_statements['change'] as $string) {
+					$GLOBALS['TYPO3_DB']->admin_query($string);
+				}
+				foreach ((array) $update_statements['create_table'] as $string) {
+					$GLOBALS['TYPO3_DB']->admin_query($string);
+				}
+			}
+		}
+
+		// Importing static tables?
+		if (is_array($extInfo['files']) && in_array('ext_tables_static+adt.sql', $extInfo['files'])) {
+			$fileContent = t3lib_div::getUrl(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . 'ext_tables_static+adt.sql');
+
+			$statements = $instObj->getStatementarray($fileContent, 1);
+			list($statements_table, $insertCount) = $instObj->getCreateTables($statements, 1);
+
+			// Traverse the tables
+			foreach ($statements_table as $table => $query) {
+				$GLOBALS['TYPO3_DB']->admin_query('DROP TABLE IF EXISTS ' . $table);
+				$GLOBALS['TYPO3_DB']->admin_query($query);
+
+				if ($insertCount[$table]) {
+					$statements_insert = $instObj->getTableInsertStatements($statements, $table);
+
+					foreach ($statements_insert as $v) {
+						$GLOBALS['TYPO3_DB']->admin_query($v);
+					}
+				}
+			}
+		}
+	}
+
+}
+
 ?>
\ No newline at end of file
Index: typo3/sysext/em/classes/index.php
===================================================================
--- typo3/sysext/em/classes/index.php	(revision 9440)
+++ typo3/sysext/em/classes/index.php	(revision )
@@ -428,8 +428,12 @@
 
 			// temporary unset new modules
 		unset ($this->MOD_MENU['function']['extensionmanager'], $this->MOD_MENU['function']['develop']);
+		/*
+		if (!intval($GLOBALS['TYPO3_CONF_VARS']['BE']['debug'])) {
+			unset ($this->MOD_MENU['function']['develop']);
+		}
+        */
 
-
 		$this->MOD_MENU['singleDetails'] = $this->mergeExternalItems($this->MCONF['name'], 'singleDetails', $this->MOD_MENU['singleDetails']);
 
 
@@ -466,10 +470,9 @@
 	 * @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'];
+			$this->MOD_SETTINGS['mirrorListURL'] = $GLOBALS['TYPO3_CONF_VARS']['EXT']['em_mirrorListURL'];
 		}
 
 		// Starting page:
@@ -1312,9 +1315,9 @@
 						break;
 				}
 				if ($newExtList != -1) {
-					$this->writeNewExtensionList($newExtList);
-					$this->refreshGlobalExtList();
-					$this->forceDBupdates($extKey, $inst_list[$extKey]);
+					$this->install->writeNewExtensionList($newExtList);
+					tx_em_Tools::refreshGlobalExtList();
+					$this->install->forceDBupdates($extKey, $inst_list[$extKey]);
 					return array(true, $GLOBALS['LANG']->getLL('ext_import_ext_loaded'));
 				}
 			}
@@ -1360,9 +1363,9 @@
 			$this->importExtFromRep($extKey, $version, 'L');
 			$newExtList = $this->extensionList->addExtToList($extKey, $inst_list);
 			if ($newExtList != -1) {
-				$this->writeNewExtensionList($newExtList);
-				$this->refreshGlobalExtList();
-				$this->forceDBupdates($extKey, $inst_list[$extKey]);
+				$this->install->writeNewExtensionList($newExtList);
+				tx_em_Tools::refreshGlobalExtList();
+				$this->install->forceDBupdates($extKey, $inst_list[$extKey]);
 				$this->translations->installTranslationsForExtension($extKey, $this->getMirrorURL());
 				return array(true, $GLOBALS['LANG']->getLL('ext_import_ext_imported'));
 			} else {
@@ -1373,30 +1376,7 @@
 		}
 	}
 
-	function refreshGlobalExtList() {
-		global $TYPO3_LOADED_EXT;
 
-		$TYPO3_LOADED_EXT = t3lib_extMgm::typo3_loadExtensions();
-		if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
-			require(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_localconf.php');
-		}
-		return;
-
-		$GLOBALS['TYPO3_LOADED_EXT'] = t3lib_extMgm::typo3_loadExtensions();
-		if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
-			require(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_localconf.php');
-		} else {
-			$temp_TYPO3_LOADED_EXT = $TYPO3_LOADED_EXT;
-			foreach ($temp_TYPO3_LOADED_EXT as $_EXTKEY => $temp_lEDat) {
-				if (is_array($temp_lEDat) && $temp_lEDat['ext_localconf.php']) {
-					$_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
-					require($temp_lEDat['ext_localconf.php']);
-				}
-			}
-		}
-	}
-
-
 	/**
 	 * Imports an extensions from the online repository
 	 * NOTICE: in version 4.0 this changed from "importExtFromRep_old($extRepUid,$loc,$uploadFlag=0,$directInput='',$recentTranslations=0,$incManual=0,$dontDelete=0)"
@@ -1613,7 +1593,7 @@
 							}
 						}
 						if (!$updates || t3lib_div::_GP('_do_install')) {
-							$this->writeNewExtensionList($newExtList);
+							$this->install->writeNewExtensionList($newExtList);
 							$action = $this->CMD['load'] ? 'installed' : 'removed';
 							$GLOBALS['BE_USER']->writelog(5, 1, 0, 0, 'Extension list has been changed, extension %s has been %s', array($extKey, $action));
 
@@ -2418,111 +2398,12 @@
 	}
 
 
-	/**
-	 * Writes the extension list to "localconf.php" file
-	 * Removes the temp_CACHED* files before return.
-	 *
-	 * @param	string		List of extensions
-	 * @return	void
-	 */
-	function writeNewExtensionList($newExtList) {
-		global $TYPO3_CONF_VARS;
 
-		$strippedExtensionList = $this->stripNonFrontendExtensions($newExtList);
 
-		// Instance of install tool
-		$instObj = new t3lib_install;
-		$instObj->allowUpdateLocalConf = 1;
-		$instObj->updateIdentity = 'TYPO3 Extension Manager';
 
-		// Get lines from localconf file
-		$lines = $instObj->writeToLocalconf_control();
-		$instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList);
-		$instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList_FE\']', $strippedExtensionList);
-		$instObj->writeToLocalconf_control($lines);
 
-		$TYPO3_CONF_VARS['EXT']['extList'] = $newExtList;
-		$TYPO3_CONF_VARS['EXT']['extList_FE'] = $strippedExtensionList;
-		t3lib_extMgm::removeCacheFiles();
-	}
 
-	/**
-	 * Removes unneeded extensions from the frontend based on
-	 * EMCONF doNotLoadInFE = 1
-	 *
-	 * @param string $extList
-	 * @return string
-	 */
-	function stripNonFrontendExtensions($extList) {
-		$fullExtList = $this->extensionList->getInstalledExtensions();
-		$extListArray = t3lib_div::trimExplode(',', $extList);
-		foreach ($extListArray as $arrayKey => $extKey) {
-			if ($fullExtList[0][$extKey]['EM_CONF']['doNotLoadInFE'] == 1) {
-				unset($extListArray[$arrayKey]);
-			}
-		}
-		$nonFEList = implode(',', $extListArray);
-		return $nonFEList;
-	}
 
-
-	/**
-	 * Updates the database according to extension requirements
-	 * DBAL compliant (based on Install Tool code)
-	 *
-	 * @param	string		Extension key
-	 * @param	array		Extension information array
-	 * @return	void
-	 */
-	function forceDBupdates($extKey, $extInfo) {
-		$instObj = new t3lib_install;
-
-		// Updating tables and fields?
-		if (is_array($extInfo['files']) && in_array('ext_tables.sql', $extInfo['files'])) {
-			$fileContent = t3lib_div::getUrl(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . 'ext_tables.sql');
-
-			$FDfile = $instObj->getFieldDefinitions_fileContent($fileContent);
-			if (count($FDfile)) {
-				$FDdb = $instObj->getFieldDefinitions_database(TYPO3_db);
-				$diff = $instObj->getDatabaseExtra($FDfile, $FDdb);
-				$update_statements = $instObj->getUpdateSuggestions($diff);
-
-				foreach ((array) $update_statements['add'] as $string) {
-					$GLOBALS['TYPO3_DB']->admin_query($string);
-				}
-				foreach ((array) $update_statements['change'] as $string) {
-					$GLOBALS['TYPO3_DB']->admin_query($string);
-				}
-				foreach ((array) $update_statements['create_table'] as $string) {
-					$GLOBALS['TYPO3_DB']->admin_query($string);
-				}
-			}
-		}
-
-		// Importing static tables?
-		if (is_array($extInfo['files']) && in_array('ext_tables_static+adt.sql', $extInfo['files'])) {
-			$fileContent = t3lib_div::getUrl(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . 'ext_tables_static+adt.sql');
-
-			$statements = $instObj->getStatementarray($fileContent, 1);
-			list($statements_table, $insertCount) = $instObj->getCreateTables($statements, 1);
-
-			// Traverse the tables
-			foreach ($statements_table as $table => $query) {
-				$GLOBALS['TYPO3_DB']->admin_query('DROP TABLE IF EXISTS ' . $table);
-				$GLOBALS['TYPO3_DB']->admin_query($query);
-
-				if ($insertCount[$table]) {
-					$statements_insert = $instObj->getTableInsertStatements($statements, $table);
-
-					foreach ($statements_insert as $v) {
-						$GLOBALS['TYPO3_DB']->admin_query($v);
-					}
-				}
-			}
-		}
-	}
-
-
 	/************************************
 	 *
 	 * Various helper functions
Index: typo3/sysext/em/classes/connection/class.tx_em_connection_extdirectserver.php
===================================================================
--- typo3/sysext/em/classes/connection/class.tx_em_connection_extdirectserver.php	(revision 9402)
+++ typo3/sysext/em/classes/connection/class.tx_em_connection_extdirectserver.php	(revision )
@@ -42,6 +42,20 @@
 	var $xmlhandler;
 
 	/**
+	 * Class for printing extension lists
+	 *
+	 * @var tx_em_Extensions_List
+	 */
+	public $extensionList;
+
+	/**
+	 * Class for extension details
+	 *
+	 * @var tx_em_Extensions_Details
+	 */
+	public $extensionDetails;
+
+	/**
 	 * Keeps instance of settings class.
 	 *
 	 * @var tx_em_Settings
@@ -654,11 +668,14 @@
 	 * @return  array status
 	 */
 	public function uploadExtension($parameter) {
-		$uploadedTempFile = t3lib_div::upload_to_tempfile($parameter['extupload-path']['tmp_name']);
+		$uploadedTempFile = isset($parameter['extfile']) ? $parameter['extfile'] : t3lib_div::upload_to_tempfile($parameter['extupload-path']['tmp_name']);
 		$location = ($parameter['loc'] === 'G' || $parameter['loc'] === 'S') ? $parameter['loc'] : 'L';
 		$uploadOverwrite = $parameter['uploadOverwrite'] ? TRUE : FALSE;
 
 		$install = t3lib_div::makeInstance('tx_em_Install', $this);
+		$this->extensionList = t3lib_div::makeInstance('tx_em_Extensions_List', $this);
+		$this->extensionDetails = t3lib_div::makeInstance('tx_em_Extensions_Details', $this);
+
 		$upload = $install->uploadExtensionFile($uploadedTempFile, $location, $uploadOverwrite);
 
 		if ($upload[0] === FALSE) {
@@ -667,8 +684,11 @@
 				'error' => $upload[1]
 			);
 		}
+
 		$extKey = $upload[1][0]['extKey'];
-		$result = $install->installExtension($upload[1], $location);
+		$version = '';
+		$dontDelete = TRUE;
+		$result = $install->installExtension($upload[1], $location, $version, $uploadedTempFile, $dontDelete);
 		return array(
 			'success' => TRUE,
 			'data' => $result,
@@ -676,6 +696,24 @@
 		);
 
 	}
+
+	/**
+	 * Enables an extension
+	 *
+	 * @param  $extensionKey
+	 * @return void
+	 */
+	public function enableExtension($extensionKey) {
+		$this->extensionList = t3lib_div::makeInstance('tx_em_Extensions_List', $this);
+		$install = t3lib_div::makeInstance('tx_em_Install', $this);
+
+		list($installedList,) = $this->extensionList->getInstalledExtensions();
+		$newExtensionList = $this->extensionList->addExtToList($extensionKey, $installedList);
+
+		$install->writeNewExtensionList($newExtensionList);
+		tx_em_Tools::refreshGlobalExtList();
+		$install->forceDBupdates($extensionKey, $newExtensionList[$extensionKey]);
-}
+	}
+}
 
 ?>
\ No newline at end of file
