/** * 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 />'; }
/** * Produces the config form for an extension (if any template file, ext_conf_template.txt is found) * * @param string Extension key * @param array Extension information array * @param boolean If true, the form HTML content is returned, otherwise the content is set in $this->content. * @param string Submit-to URL (supposedly) * @param string Additional form fields to include. * @return string Depending on $output. Can return the whole form. */ function tsStyleConfigForm($extKey, $extInfo, $output = 0, $script = '', $addFields = '') { global $TYPO3_CONF_VARS; // Initialize: $absPath = tx_em_Tools::getExtPath($extKey, $extInfo['type']); $relPath = tx_em_Tools::typeRelPath($extInfo['type']) . $extKey . '/'; $form = ''; // Look for template file for form: if (t3lib_extMgm::isLoaded($extKey) && @is_file($absPath . 'ext_conf_template.txt')) { // Load tsStyleConfig class and parse configuration template: $tsStyleConfig = t3lib_div::makeInstance('t3lib_tsStyleConfig'); $tsStyleConfig->doNotSortCategoriesBeforeMakingForm = TRUE; $theConstants = $tsStyleConfig->ext_initTSstyleConfig(t3lib_div::getUrl($absPath . 'ext_conf_template.txt'), $relPath, $absPath, $GLOBALS['BACK_PATH']); // Load the list of resources. $tsStyleConfig->ext_loadResources($absPath . 'res/'); // Load current value: $arr = unserialize($TYPO3_CONF_VARS['EXT']['extConf'][$extKey]); $arr = is_array($arr) ? $arr : array(); // Call processing function for constants config and data before write and form rendering: if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/mod/tools/em/index.php']['tsStyleConfigForm'])) { $_params = array('fields' => &$theConstants, 'data' => &$arr, 'extKey' => $extKey); foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/mod/tools/em/index.php']['tsStyleConfigForm'] as $_funcRef) { t3lib_div::callUserFunction($_funcRef, $_params, $this); } unset($_params); } // If saving operation is done: if (t3lib_div::_POST('submit')) { $tsStyleConfig->ext_procesInput(t3lib_div::_POST(), array(), $theConstants, array()); $arr = $tsStyleConfig->ext_mergeIncomingWithExisting($arr); $this->writeTsStyleConfig($extKey, $arr); } // Setting value array $tsStyleConfig->ext_setValuearray($theConstants, $arr); // Getting session data: $MOD_MENU = array(); $MOD_MENU['constant_editor_cat'] = $tsStyleConfig->ext_getCategoriesForModMenu(); $MOD_SETTINGS = t3lib_BEfunc::getModuleData($MOD_MENU, t3lib_div::_GP('SET'), 'xMod_test'); // Resetting the menu (stop) if (count($MOD_MENU['constant_editor_cat']) > 1) { $menu = $GLOBALS['LANG']->getLL('extInfoArray_category') . ' ' . t3lib_BEfunc::getFuncMenu(0, 'SET[constant_editor_cat]', $MOD_SETTINGS['constant_editor_cat'], $MOD_MENU['constant_editor_cat'], '', '&CMD[showExt]=' . $extKey); // add class to select $menu = str_replace('<select', '<select class="mod-menu-template-select"', $menu); if ($this->silentMode) { $menu = str_replace('jumpToUrl', 'abc', $menu); } if ($this->parentObject instanceof SC_mod_tools_em_index) { $this->parentObject->content .= $this->parentObject->doc->section('', '<span class="nobr">' . $menu . '</span>'); $this->parentObject->content .= $this->parentObject->doc->spacer(10); } else { $form .= '<h3>' . '<span class="nobr">' . $menu . '</span></h3>'; } } // Category and constant editor config: $form .= ' <table border="0" cellpadding="0" cellspacing="0" width="600"> <tr> <td>' . $tsStyleConfig->ext_getForm($MOD_SETTINGS['constant_editor_cat'], $theConstants, $script, $addFields, $extKey, !$this->silentMode) . ($this->silentMode ? '' : '</form>') . '</td> </tr> </table>'; } else { if (!$this->silentMode) { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('tsStyleConfigForm_additional_config'), '', t3lib_FlashMessage::INFO); } $form = ' <table border="0" cellpadding="0" cellspacing="0" width="600"> <tr> <td> <form action="' . htmlspecialchars($script) . '" method="post">' . $addFields . ($this->silentMode ? '' : $flashMessage->render()) . (t3lib_div::_GP('nodoc') ? '<input type="hidden" name="nodoc" value="1" />' : '') . '<br /><input type="submit" id="configuration-submit-' . $extKey . '" name="write" value="' . $GLOBALS['LANG']->getLL('updatesForm_make_updates') . '" /> </form> </td> </tr> </table>'; } return $form; }
/** * Returns a header for an extensions including icon if any * * @param string Extension key * @param array Extension information array * @param string align-attribute value (for <img> tag) * @return string HTML; Extension title and image. */ function extensionTitleIconHeader($extKey, $extInfo, $align = 'top') { $imgInfo = @getImageSize(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . '/ext_icon.gif'); $out = ''; if (is_array($imgInfo)) { $out .= '<img src="' . $GLOBALS['BACK_PATH'] . tx_em_Tools::typeRelPath($extInfo['type']) . $extKey . '/ext_icon.gif" ' . $imgInfo[3] . ' align="' . $align . '" alt="" />'; } $out .= $extInfo['EM_CONF']['title'] ? htmlspecialchars(t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['title'], 40)) : '<em>' . htmlspecialchars($extKey) . '</em>'; return $out; }
/** * Save extension configuration * * @formHandler * @param array $parameter * @return array */ public function saveExtensionConfiguration($parameter) { $extKey = $parameter['extkey']; $extType = $parameter['exttype']; $noSave = $parameter['noSave']; $absPath = tx_em_Tools::getExtPath($extKey, $extType); $relPath = tx_em_Tools::typeRelPath($extType) . $extKey . '/'; /** @var $extensionList tx_em_Extensions_List */ $extensionList = t3lib_div::makeInstance('tx_em_Extensions_List', $this); list($list, ) = $extensionList->getInstalledExtensions(); $arr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extKey]); $arr = is_array($arr) ? $arr : array(); /** @var $tsStyleConfig t3lib_tsStyleConfig */ $tsStyleConfig = t3lib_div::makeInstance('t3lib_tsStyleConfig'); $tsStyleConfig->doNotSortCategoriesBeforeMakingForm = TRUE; $theConstants = $tsStyleConfig->ext_initTSstyleConfig(t3lib_div::getUrl($absPath . 'ext_conf_template.txt'), $relPath, $absPath, $GLOBALS['BACK_PATH']); $tsStyleConfig->ext_procesInput($parameter, array(), $theConstants, array()); $arr = $tsStyleConfig->ext_mergeIncomingWithExisting($arr); /** @var $install tx_em_Install */ $install = t3lib_div::makeInstance('tx_em_Install'); $install->setSilentMode(TRUE); $install->install->INSTALL = $parameter['TYPO3_INSTALL']; $install->checkDBupdates($extKey, $list[$extKey]); $html = ''; if ($noSave) { $html = $install->updatesForm($extKey, $list[$extKey], 1); } else { $install->writeTsStyleConfig($extKey, $arr); } return array('success' => true, 'data' => $parameter['data'], 'html' => $html); }