コード例 #1
0
 /**
  *  Displays a list of extensions where a newer version is available
  *  in the TER than the one that is installed right now
  *  integrated from the extension "ter_update_check" for TYPO3 4.2 by Christian Welzel
  *
  * @return string
  */
 function showExtensionsToUpdate()
 {
     global $LANG;
     $extList = $this->getInstalledExtensions();
     $content = '<table cellspacing="1" class="t3-em-extension-list t3-em-extension-list-to-update">' . '<tr class="t3-row-header">' . '<td></td>' . '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_name') . '</td>' . '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_key') . '</td>' . '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_loc_ver') . '</td>' . '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_rem_ver') . '</td>' . '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_location') . '</td>' . '<td>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:tab_mod_comment') . '</td>' . '</tr>';
     foreach ($extList[0] as $name => $data) {
         $this->xmlHandler->searchExtensionsXMLExact($name, '', '', TRUE, TRUE);
         if (!is_array($this->xmlHandler->extensionsXML[$name])) {
             continue;
         }
         $v = $this->xmlHandler->extensionsXML[$name]['versions'];
         $versions = array_keys($v);
         natsort($versions);
         $lastversion = end($versions);
         if ((t3lib_extMgm::isLoaded($name) || $this->parentObject->MOD_SETTINGS['display_installed']) && ($data['EM_CONF']['shy'] == 0 || $this->parentObject->MOD_SETTINGS['display_shy']) && tx_em_Tools::versionDifference($lastversion, $data['EM_CONF']['version'], 1)) {
             $imgInfo = @getImageSize(tx_em_Tools::getExtPath($name, $data['type']) . '/ext_icon.gif');
             if (is_array($imgInfo)) {
                 $icon = '<img src="' . $GLOBALS['BACK_PATH'] . tx_em_Tools::typeRelPath($data['type']) . $name . '/ext_icon.gif' . '" ' . $imgInfo[3] . ' alt="" />';
             } elseif ($data['_ICON']) {
                 //TODO: see if this can be removed, seems to be wrong in this context
                 $icon = $data['_ICON'];
             } else {
                 $icon = '<img src="clear.gif" width="1" height="1" alt="" />';
             }
             $comment = '<table cellpadding="0" cellspacing="0" width="100%">';
             foreach ($versions as $vk) {
                 $va =& $v[$vk];
                 if (t3lib_div::int_from_ver($vk) <= t3lib_div::int_from_ver($data['EM_CONF']['version'])) {
                     continue;
                 }
                 $comment .= '<tr><td valign="top" style="padding-right:2px;border-bottom:1px dotted gray">' . $vk . '</td>' . '<td valign="top" style="border-bottom:1px dotted gray">' . nl2br($va[uploadcomment]) . '</td></tr>';
             }
             $comment .= '</table>';
             $serverMD5Array = $this->parentObject->extensionDetails->serverExtensionMD5array($name, $data);
             if (is_array($serverMD5Array)) {
                 ksort($serverMD5Array);
             }
             $currentMD5Array = unserialize($data['EM_CONF']['_md5_values_when_last_written']);
             if (is_array($currentMD5Array)) {
                 @ksort($currentMD5Array);
             }
             $warn = '';
             if (strcmp(serialize($currentMD5Array), serialize($serverMD5Array))) {
                 $warn = '<tr class="bgColor4" style="color:red"><td colspan="7">' . tx_em_Tools::rfw('<br /><strong>' . $name . ': ' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:msg_warn_diff') . '</strong>') . '</td></tr>' . LF;
                 if ($this->parentObject->MOD_SETTINGS['display_files'] == 1) {
                     $affectedFiles = tx_em_Tools::findMD5ArrayDiff($serverMD5Array, $currentMD5Array);
                     if (count($affectedFiles)) {
                         $warn .= '<tr class="bgColor4"><td colspan="7"><strong>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:msg_modified') . '</strong><br />' . tx_em_Tools::rfw(implode('<br />', $affectedFiles)) . '</td></tr>' . LF;
                     }
                 }
             }
             $content .= '<tr class="bgColor4"><td valign="top">' . $icon . '</td>' . '<td valign="top">' . ($data['EM_CONF']['state'] == 'excludeFromUpdates' ? '<span style="color:#cf7307">' . $data['EM_CONF']['title'] . ' ' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:write_protected') . '</span>' : '<a href="' . t3lib_div::linkThisScript(array('CMD[importExtInfo]' => $name)) . '">' . $data[EM_CONF][title] . '</a>') . '</td>' . '<td valign="top">' . $name . '</td>' . '<td valign="top" align="right">' . $data[EM_CONF][version] . '</td>' . '<td valign="top" align="right">' . $lastversion . '</td>' . '<td valign="top" nowrap="nowrap">' . $this->api->typeLabels[$data['type']] . (strlen($data['doubleInstall']) > 1 ? '<strong> ' . tx_em_Tools::rfw($data['doubleInstall']) . '</strong>' : '') . '</td>' . '<td valign="top">' . $comment . '</td></tr>' . LF . $warn . '<tr class="bgColor4"><td colspan="7"><hr style="margin:0px" /></td></tr>' . LF;
         }
     }
     return $content . '</table><br />';
 }
コード例 #2
0
ファイル: index.php プロジェクト: NaveedWebdeveloper/Test
    /**
     * 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->extensionList->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->extensionList->prepareImportExtList(TRUE);
                // Available extensions
                if (is_array($cat[$this->MOD_SETTINGS['listOrder']])) {
                    $lines = array();
                    $lines[] = $this->extensionList->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]) || tx_em_Tools::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 = t3lib_div::linkThisScript(array('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 = t3lib_div::linkThisScript(array('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->extensionList->extensionListRow($extKey, $ext, array('<td class="bgColor">' . $loadUnloadLink . '</td>'), $theRowClass, $inst_list, 1, t3lib_div::linkThisScript(array('CMD[importExtInfo]' => rawurlencode($extKey))));
                                unset($list[$extKey]);
                            }
                        }
                    }
                    unset($list);
                    // headline and CSH
                    $headline = $GLOBALS['LANG']->getLL('extensions_repository_group_by') . ' ' . $this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']];
                    $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'import_ter', $headline);
                    $onsubmit = "window.location.href='" . $this->script . "&ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
                    $content .= '<form action="' . $this->script . '" 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($headline, $content, FALSE, TRUE, FALSE, TRUE);
                    // 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, 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(t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'CMD[remove]' => 1, 'CMD[clrCmd]' => 1, 'SET[singleDetails]' => 'info'))) . '">' . tx_em_Tools::removeButton() . '</a>' : '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'CMD[load]' => 1, 'CMD[clrCmd]' => 1, 'SET[singleDetails]' => 'info'))) . '">' . tx_em_Tools::installButton() . '</a>';
                            if (in_array($extKey, $this->requiredExt)) {
                                $loadUnloadLink = '<strong>' . tx_em_Tools::rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
                            }
                            $lines[] = $this->extensionList->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->extensionList->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 {
                // headline and CSH
                $headline = $GLOBALS['LANG']->getLL('extensions_repository_group_by') . ' ' . $this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']];
                $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'import_ter', $headline);
                $onsubmit = "window.location.href='" . $this->script . "&ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
                $content .= '<form action="' . $this->script . '" 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($headline, $content, FALSE, TRUE, 0, TRUE);
            }
        } else {
            // section headline and CSH
            $headline = $GLOBALS['LANG']->getLL('in_repository');
            $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'import', $headline);
            $onsubmit = "window.location.href='" . $this->script . "&ter_connect=1&ter_search='+escape(this.elements['lookUp'].value);return false;";
            $content .= '<form action="' . $this->script . '" 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="' . t3lib_div::linkThisScript(array('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')), tx_em_Database::getExtensionCountFromRepository());
                }
            }
            $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($headline, $content, FALSE, TRUE, FALSE, TRUE);
        }
        // Upload:
        if ($this->importAtAll()) {
            $content = '<form action="' . $this->script . '" 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 (tx_em_Tools::importAsType('L')) {
                $content .= '<option value="L">' . $GLOBALS['LANG']->getLL('local_folder') . '</option>';
            }
            if (tx_em_Tools::importAsType('G')) {
                $content .= '<option value="G">' . $GLOBALS['LANG']->getLL('global_folder') . '</option>';
            }
            if (tx_em_Tools::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 = tx_em_Tools::noImportMsg();
        }
        $this->content .= $this->doc->spacer(20);
        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('upload_ext_directly'), $content, 0, 1);
    }