diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php index 943d6636c..04a70c72c 100644 --- a/libraries/relation.lib.php +++ b/libraries/relation.lib.php @@ -93,96 +93,104 @@ function PMA_getRelationsParam($verbose = false) * @uses $GLOBALS['strQuerySQLHistory'] * @uses $GLOBALS['strDesigner'] * @uses $cfg['Server']['pmadb'] - * quses sprintf() + * @uses sprintf() + * @uses PMA_printDiagMessageForFeature() + * @uses PMA_printDiagMessageForParameter() * @param array $cfgRelation */ function PMA_printRelationsParamDiagnostic($cfgRelation) { + $messages['error'] = '' . $GLOBALS['strNotOK'] + . ' [ ' + . $GLOBALS['strDocu'] . ' ]'; + + $messages['ok'] = '' . $GLOBALS['strOK'] . ''; + $messages['enabled'] = '' . $GLOBALS['strEnabled'] . ''; + $messages['disabled'] = '' . $GLOBALS['strDisabled'] . ''; + if (false === $GLOBALS['cfg']['Server']['pmadb']) { echo 'PMA Database ... ' - . '' . $GLOBALS['strNotOK'] . '' - . '[ ' . $GLOBALS['strDocu'] - . ' ]
' . "\n" + . sprintf($messages['error'], 'pmadb') + . '
' . "\n" . $GLOBALS['strGeneralRelationFeat'] . ' ' . $GLOBALS['strDisabled'] . '' . "\n"; return; } - $shit = '' . $GLOBALS['strNotOK'] - . ' [ ' - . $GLOBALS['strDocu'] . ' ]'; - $hit = '' . $GLOBALS['strOK'] . ''; - $enabled = '' . $GLOBALS['strEnabled'] . ''; - $disabled = '' . $GLOBALS['strDisabled'] . ''; - echo '' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; + + PMA_printDiagMessageForParameter('pmadb', $GLOBALS['cfg']['Server']['pmadb'], $messages, 'pmadb'); - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; + PMA_printDiagMessageForParameter('relation', isset($cfgRelation['relation']), $messages, 'relation'); - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; + PMA_printDiagMessageForFeature('strGeneralRelationFeat', 'relwork', $messages); - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; + PMA_printDiagMessageForParameter('table_info', isset($cfgRelation['displaywork']), $messages, 'table_info'); - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; + PMA_printDiagMessageForFeature('strDisplayFeat', 'displaywork', $messages); + + PMA_printDiagMessageForParameter('table_coords', isset($cfgRelation['table_coords']), $messages, 'table_coords'); + + PMA_printDiagMessageForParameter('pdf_pages', isset($cfgRelation['pdf_pages']), $messages, 'table_coords'); + + PMA_printDiagMessageForFeature('strCreatePdfFeat', 'pdfwork', $messages); + + PMA_printDiagMessageForParameter('column_info', isset($cfgRelation['column_info']), $messages, 'col_com'); + + PMA_printDiagMessageForFeature('strColComFeat', 'commwork', $messages, false); + + PMA_printDiagMessageForFeature('strBookmarkQuery', 'bookmarkwork', $messages, false); + + PMA_printDiagMessageForFeature('strMIME_transformation', 'mimework', $messages); if ($cfgRelation['commwork'] && ! $cfgRelation['mimework']) { echo '' . "\n"; } - echo ' ' . "\n"; - echo ' ' . "\n"; + PMA_printDiagMessageForParameter('history', isset($cfgRelation['history']), $messages, 'history'); - echo ' ' . "\n"; - echo ' ' . "\n"; + PMA_printDiagMessageForFeature('strQuerySQLHistory', 'historywork', $messages); + + PMA_printDiagMessageForParameter('designer_coords', isset($cfgRelation['designer_coords']), $messages, 'designer_coords'); + + PMA_printDiagMessageForFeature('strDesigner', 'designerwork', $messages); echo '
$cfg[\'Servers\'][$i][\'pmadb\'] ... ' - . (($GLOBALS['cfg']['Server']['pmadb'] == false) ? sprintf($shit, 'pmadb') : $hit) - . '
 
$cfg[\'Servers\'][$i][\'relation\'] ... ' - . ((isset($cfgRelation['relation'])) ? $hit : sprintf($shit, 'relation')) - . '
'. $GLOBALS['strGeneralRelationFeat'] . ': ' - . ($cfgRelation['relwork'] ? $enabled : $disabled) - . '
 
$cfg[\'Servers\'][$i][\'table_info\'] ... ' - . (($cfgRelation['displaywork'] == false) ? sprintf($shit, 'table_info') : $hit) - . '
' . $GLOBALS['strDisplayFeat'] . ': ' - . ($cfgRelation['displaywork'] ? $enabled : $disabled) - . '
 
$cfg[\'Servers\'][$i][\'table_coords\'] ... ' - . ((isset($cfgRelation['table_coords'])) ? $hit : sprintf($shit, 'table_coords')) - . '
$cfg[\'Servers\'][$i][\'pdf_pages\'] ... ' - . ((isset($cfgRelation['pdf_pages'])) ? $hit : sprintf($shit, 'table_coords')) - . '
' . $GLOBALS['strCreatePdfFeat'] . ': ' - . ($cfgRelation['pdfwork'] ? $enabled : $disabled) - . '
 
$cfg[\'Servers\'][$i][\'column_info\'] ... ' - . ((isset($cfgRelation['column_info'])) ? $hit : sprintf($shit, 'col_com')) - . '
' . $GLOBALS['strColComFeat'] . ': ' - . ($cfgRelation['commwork'] ? $enabled : $disabled) - . '
' . $GLOBALS['strBookmarkQuery'] . ': ' - . ($cfgRelation['bookmarkwork'] ? $enabled : $disabled) - . '
MIME ...' - . ($cfgRelation['mimework'] ? $hit : sprintf($shit, 'col_com')) - . '
' . $GLOBALS['strUpdComTab'] . '
$cfg[\'Servers\'][$i][\'history\'] ... ' - . ((isset($cfgRelation['history'])) ? $hit : sprintf($shit, 'history')) - . '
' . $GLOBALS['strQuerySQLHistory'] . ': ' - . ($cfgRelation['historywork'] ? $enabled : $disabled) - . '
$cfg[\'Servers\'][$i][\'designer_coords\'] ... ' - . ((isset($cfgRelation['designer_coords'])) ? $hit : sprintf($shit, 'designer_coords')) - . '
' . $GLOBALS['strDesigner'] . ': ' - . ($cfgRelation['designerwork'] ? $enabled : $disabled) - . '
' . "\n"; } +/** + * prints out one diagnostic message for a feature + * + * @param string feature name in a message string + * @param string the $GLOBALS['cfgRelation'] parameter to check + * @param array utility messages + * @param boolean whether to skip a line after the message + */ +function PMA_printDiagMessageForFeature($feature_name, $relation_parameter, $messages, $skip_line=true) { + echo ' ' . $GLOBALS[$feature_name] . ': ' + . ($GLOBALS['cfgRelation'][$relation_parameter] ? $messages['enabled'] : $messages['disabled']) + . '' . "\n"; + if ($skip_line) { + echo '  ' . "\n"; + } +} + +/** + * prints out one diagnostic message for a configuration parameter + * + * @param string config parameter name to display + * @param boolean whether this parameter is set + * @param array utility messages + * @param string anchor in Documentation.html + */ +function PMA_printDiagMessageForParameter($parameter, $relation_parameter_set, $messages, $doc_anchor) { + echo ' '; + echo '$cfg[\'Servers\'][$i][\'' . $parameter . '\'] ... '; + echo ($relation_parameter_set ? $messages['ok'] : sprintf($messages['error'], $doc_anchor)) . '' . "\n"; +} + + /** * Defines the relation parameters for the current user * just a copy of the functions used for relations ;-)