Пример #1
0
    /**
     * Returns detailed info about an extension in the online repository
     *
     * @param	string		Extension repository uid + optional "private key": [uid]-[key].
     * @param	[type]		$version: ...
     * @return	void
     */
    function importExtInfo($extKey, $version = '')
    {
        $content = '<form action="' . $this->script . '" method="post" name="pageform">';
        $addUrl = '';
        if ($this->noDocHeader) {
            $content .= '<input type="hidden" name="nodoc" value="1" />';
            $addUrl = '&nodoc=1';
        }
        // Fetch remote data:
        $this->xmlHandler->searchExtensionsXMLExact($extKey, '', '', true, true);
        list($fetchData, ) = $this->extensionList->prepareImportExtList(true);
        $versions = array_keys($fetchData[$extKey]['versions']);
        natsort($versions);
        $version = $version == '' ? end($versions) : $version;
        $opt = array();
        foreach ($versions as $ver) {
            $opt[] = '<option value="' . $ver . '"' . ($version == $ver ? ' selected="selected"' : '') . '>' . $ver . '</option>';
        }
        // "Select version" box:
        $onClick = 'window.location.href="' . $this->script . $addUrl . '&CMD[importExtInfo]=' . $extKey . '&CMD[extVersion]="+document.pageform.extVersion.options[document.pageform.extVersion.selectedIndex].value; return false;';
        $select = '<select name="extVersion">' . implode('', $opt) . '</select> <input type="submit" value="' . $GLOBALS['LANG']->getLL('ext_load_details_button') . '" onclick="' . htmlspecialchars($onClick) . '" />';
        if ($this->importAtAll()) {
            // Check for write-protected extension
            list($inst_list, ) = $this->extensionList->getInstalledExtensions();
            if ($inst_list[$extKey]['EM_CONF']['state'] != 'excludeFromUpdates') {
                $onClick = '
						window.location.href="' . $this->script . $addUrl . '&CMD[importExt]=' . $extKey . '"
							+"&CMD[extVersion]="+document.pageform.extVersion.options[document.pageform.extVersion.selectedIndex].value
							+"&CMD[loc]="+document.pageform.loc.options[document.pageform.loc.selectedIndex].value;
							return false;';
                $select .= ' ' . $GLOBALS['LANG']->getLL('ext_or') . '<br /><br />
					<input type="submit" value="' . $GLOBALS['LANG']->getLL('ext_import_update_button') . '" onclick="' . htmlspecialchars($onClick) . '" /> ' . $GLOBALS['LANG']->getLL('ext_import_update_to') . '
					<select name="loc">' . (tx_em_Tools::importAsType('G', $fetchData['emconf_lockType']) ? '<option value="G">' . $GLOBALS['LANG']->getLL('ext_import_global') . ' ' . tx_em_Tools::typePath('G') . $extKey . '/' . (@is_dir(tx_em_Tools::typePath('G') . $extKey) ? ' ' . $GLOBALS['LANG']->getLL('ext_import_overwrite') : ' ' . $GLOBALS['LANG']->getLL('ext_import_folder_empty')) . '</option>' : '') . (tx_em_Tools::importAsType('L', $fetchData['emconf_lockType']) ? '<option value="L">' . $GLOBALS['LANG']->getLL('ext_import_local') . ' ' . tx_em_Tools::typePath('L') . $extKey . '/' . (@is_dir(tx_em_Tools::typePath('L') . $extKey) ? ' ' . $GLOBALS['LANG']->getLL('ext_import_overwrite') : ' ' . $GLOBALS['LANG']->getLL('ext_import_folder_empty')) . '</option>' : '') . (tx_em_Tools::importAsType('S', $fetchData['emconf_lockType']) ? '<option value="S">' . $GLOBALS['LANG']->getLL('ext_import_system') . ' ' . tx_em_Tools::typePath('S') . $extKey . '/' . (@is_dir(tx_em_Tools::typePath('S') . $extKey) ? ' ' . $GLOBALS['LANG']->getLL('ext_import_overwrite') : ' ' . $GLOBALS['LANG']->getLL('ext_import_folder_empty')) . '</option>' : '') . '</select>
					</form>';
            } else {
                $select .= '<br /><br />' . $GLOBALS['LANG']->getLL('ext_import_excluded_from_updates');
            }
        } else {
            $select .= '<br /><br />' . tx_em_Tools::noImportMsg();
        }
        $content .= $select;
        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_import_select_command'), $content, 0, 1);
        // Details:
        $eInfo = $fetchData[$extKey]['versions'][$version];
        $content = '<strong>' . $fetchData[$extKey]['_ICON'] . ' &nbsp;' . $eInfo['EM_CONF']['title'] . ' (' . $extKey . ', ' . $version . ')</strong><br /><br />';
        $content .= $this->extensionDetails->extInformationarray($extKey, $eInfo, 1);
        $this->content .= $this->doc->spacer(10);
        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_import_remote_ext_details'), $content, 0, 1);
    }