コード例 #1
0
    /**
     * Prints a table with extension information in it.
     *
     * @param	string		Extension key
     * @param	array		Extension information array
     * @param	boolean		If set, the information array shows information for a remote extension in TER, not a local one.
     * @return	string		HTML content.
     */
    function extInformationarray($extKey, $extInfo, $remote = 0)
    {
        $emConf = $extInfo['EM_CONF'];
        $lines = array();
        $lines[] = '
			<tr class="t3-row-header"><td colspan="2"><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_general_info') . '</strong></td></tr>';
        // row for the extension title
        $key = 'title';
        $dataCol = $emConf['_icon'] . $emConf[$key];
        $lines[] = array($this->headerCol($key), $dataCol);
        // row for the extension description
        $key = 'description';
        $dataCol = nl2br(htmlspecialchars($emConf[$key]));
        $lines[] = array($this->headerCol($key), $dataCol);
        // row for the extension author
        $key = 'author';
        $dataCol = tx_em_Tools::wrapEmail($emConf['author'] . ($emConf['author_email'] ? ' <' . $emConf['author_email'] . '>' : ''), $emConf['author_email']);
        if ($emConf['author_company']) {
            $dataCol .= ', ' . $emConf['author_company'];
        }
        $lines[] = array($this->headerCol($key), $dataCol);
        // row for the version
        $key = 'version';
        $dataCol = $emConf[$key];
        $lines[] = array($this->headerCol($key), $dataCol);
        // row for the category
        $key = 'category';
        $dataCol = $this->categories[$emConf[$key]];
        $lines[] = array($this->headerCol($key), $dataCol);
        // row for the state
        $key = 'state';
        $dataCol = $this->states[$emConf[$key]];
        $lines[] = array($this->headerCol($key), $dataCol);
        // row for the shy state
        $key = 'shy';
        if ($emConf[$key]) {
            $dataCol = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes');
        } else {
            $dataCol = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:no');
        }
        $lines[] = array($this->headerCol($key), $dataCol);
        // row for the internal state
        $key = 'internal';
        if ($emConf[$key]) {
            $dataCol = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes');
        } else {
            $dataCol = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:no');
        }
        $lines[] = array($this->headerCol($key), $dataCol);
        // row for the dependencies
        $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_depends_on');
        $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_dependencies', $headerCol);
        $dataCol = tx_em_Tools::depToString($emConf['constraints']);
        $lines[] = array($headerCol, $dataCol);
        // row for the conflicts
        $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_conflicts_with');
        $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_conflicts', $headerCol);
        $dataCol = tx_em_Tools::depToString($emConf['constraints'], 'conflicts');
        $lines[] = array($headerCol, $dataCol);
        // row for the suggestions
        $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_suggests');
        $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_conflicts', $headerCol);
        $dataCol = tx_em_Tools::depToString($emConf['constraints'], 'suggests');
        $lines[] = array($this->headerCol('suggests'), $dataCol);
        if (!$remote) {
            $key = 'priority';
            $lines[] = array($this->headerCol($key), $emConf[$key]);
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_clear_cache');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_clearCacheOnLoad', $headerCol);
            if ($emConf['clearCacheOnLoad']) {
                $dataCol = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes');
            } else {
                $dataCol = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:no');
            }
            $lines[] = array($headerCol, $dataCol);
            $key = 'module';
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_incl_modules');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_module', $headerCol);
            $lines[] = array($headerCol, $emConf[$key]);
            $key = 'lockType';
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_lock_type');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_lockType', $headerCol);
            $lines[] = array($headerCol, $emConf[$key] ? $emConf[$key] : '');
            $key = 'doNotLoadInFE';
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_load_in_frontend');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_doNotLoadInFE', $headerCol);
            if (!$emConf['doNotLoadInFE']) {
                $dataCol = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes');
            } else {
                $dataCol = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:no');
            }
            $lines[] = array($headerCol, $dataCol);
            $key = 'modify_tables';
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_modifies_tables');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_modify_tables', $headerCol);
            $lines[] = array($headerCol, $emConf[$key]);
            // Installation status:
            $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $extInfo, 1);
            $lines[] = array('<tr><td colspan="2">&nbsp;</td></tr>');
            $lines[] = array('<tr class="t3-row-header"><td colspan="2"><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_inst_status') . '</strong></td></tr>');
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_inst_type');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_type', $headerCol);
            $dataCol = $this->api->typeLabels[$extInfo['type']] . ' - <em>' . $this->api->typeDescr[$extInfo['type']] . '</em>';
            $lines[] = array($headerCol, $dataCol);
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_inst_twice');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_doubleInstall', $headerCol);
            $dataCol = $this->extInformationArray_dbInst($extInfo['doubleInstall'], $extInfo['type']);
            $lines[] = array($headerCol, $dataCol);
            if (is_array($extInfo['files'])) {
                sort($extInfo['files']);
                $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_root_files');
                $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_rootfiles', $headerCol);
                $dataCol = implode('<br />', $extInfo['files']);
                $lines[] = array($headerCol, $dataCol);
            }
            if ($techInfo['tables'] || $techInfo['static'] || $techInfo['fields']) {
                if (!$remote && t3lib_extMgm::isLoaded($extKey)) {
                    $tableStatus = tx_em_Tools::rfw(($techInfo['tables_error'] ? '<strong>' . $GLOBALS['LANG']->getLL('extInfoArray_table_error') . '</strong><br />' . $GLOBALS['LANG']->getLL('extInfoArray_missing_fields') : '') . ($techInfo['static_error'] ? '<strong>' . $GLOBALS['LANG']->getLL('extInfoArray_static_table_error') . '</strong><br />' . $GLOBALS['LANG']->getLL('extInfoArray_static_tables_missing_empty') : ''));
                } else {
                    $tableStatus = $techInfo['tables_error'] || $techInfo['static_error'] ? $GLOBALS['LANG']->getLL('extInfoArray_db_update_needed') : $GLOBALS['LANG']->getLL('extInfoArray_tables_ok');
                }
            }
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_db_requirements');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_dbReq', $headerCol);
            $dataCol = $this->extInformationArray_dbReq($techInfo, 1);
            $lines[] = array($headerCol, $dataCol);
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_db_status');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_dbStatus', $headerCol);
            $lines[] = array($headerCol, $tableStatus);
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_flags');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_flags', $headerCol);
            $dataCol = is_array($techInfo['flags']) ? implode('<br />', $techInfo['flags']) : '';
            $lines[] = array($headerCol, $dataCol);
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_config_template');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_conf', $headerCol);
            $dataCol = $techInfo['conf'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '';
            $lines[] = array($headerCol, $dataCol);
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_typoscript_files');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_TSfiles', $headerCol);
            $dataCol = is_array($techInfo['TSfiles']) ? implode('<br />', $techInfo['TSfiles']) : '';
            $lines[] = array($headerCol, $dataCol);
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_language_files');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_locallang', $headerCol);
            $dataCol = is_array($techInfo['locallang']) ? implode('<br />', $techInfo['locallang']) : '';
            $lines[] = array($headerCol, $dataCol);
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_upload_folder');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_uploadfolder', $headerCol);
            $dataCol = $techInfo['uploadfolder'] ? $techInfo['uploadfolder'] : '';
            $lines[] = array($headerCol, $dataCol);
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_create_directories');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_createDirs', $headerCol);
            $dataCol = is_array($techInfo['createDirs']) ? implode('<br />', $techInfo['createDirs']) : '';
            $lines[] = array($headerCol, $dataCol);
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_module_names');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_moduleNames', $headerCol);
            $dataCol = is_array($techInfo['moduleNames']) ? implode('<br />', $techInfo['moduleNames']) : '';
            $lines[] = array($headerCol, $dataCol);
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_class_names');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_classNames', $headerCol);
            $dataCol = is_array($techInfo['classes']) ? implode('<br />', $techInfo['classes']) : '';
            $lines[] = array($headerCol, $dataCol);
            $currentMd5Array = $this->serverExtensionMD5array($extKey, $extInfo);
            $msgLines = array();
            if (strcmp($extInfo['EM_CONF']['_md5_values_when_last_written'], serialize($currentMd5Array))) {
                $msgLines[] = tx_em_Tools::rfw('<br /><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_difference_detected') . '</strong>');
                $affectedFiles = tx_em_Tools::findMD5ArrayDiff($currentMd5Array, unserialize($extInfo['EM_CONF']['_md5_values_when_last_written']));
                if (count($affectedFiles)) {
                    $msgLines[] = '<br /><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_modified_files') . '</strong><br />' . tx_em_Tools::rfw(implode('<br />', $affectedFiles));
                }
            }
            $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_files_changed');
            $headerCol = t3lib_BEfunc::wrapInHelp($this->descrTable, 'emconf_filesChanged', $headerCol);
            $dataCol = implode('<br />', $msgLines);
            $lines[] = array($headerCol, $dataCol);
        }
        $output = '';
        foreach ($lines as $cols) {
            // if it's just one line, we assume it's a headline,
            // thus no need to wrap it in HTML table tags
            if (count($cols) == 1) {
                $output .= $cols[0];
            } else {
                $output .= '
					<tr class="bgColor4">
						<td>' . $cols[0] . '</td>
						<td>' . $cols[1] . '</td>
					</tr>';
            }
        }
        return '<table border="0" cellpadding="1" cellspacing="2">
					' . $output . '
				</table>';
    }