diff --git a/chk_rel.php b/chk_rel.php
index ccf62af5f7..15824cc4df 100644
--- a/chk_rel.php
+++ b/chk_rel.php
@@ -6,21 +6,11 @@
* @package PhpMyAdmin
*/
-/**
- * Gets some core libraries
- */
require_once 'libraries/common.inc.php';
-PMA_Header::getInstance()->display();
+$response = PMA_Response::getInstance();
+$response->addHTML(
+ PMA_getRelationsParamDiagnostic(PMA_getRelationsParam())
+);
+$response->response();
-
-/**
- * Gets the relation settings
- */
-$cfgRelation = PMA_getRelationsParam(true);
-
-
-/**
- * Displays the footer
- */
-require 'libraries/footer.inc.php';
?>
diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php
index 3b3fad99c3..a5da95ae76 100644
--- a/libraries/relation.lib.php
+++ b/libraries/relation.lib.php
@@ -55,26 +55,18 @@ function PMA_query_as_controluser($sql, $show_error = true, $options = 0)
/**
* Returns current relation parameters
*
- * @param bool $verbose whether to print diagnostic info
- *
* @return array $cfgRelation
*/
-function PMA_getRelationsParam($verbose = false)
+function PMA_getRelationsParam()
{
if (empty($_SESSION['relation'][$GLOBALS['server']])) {
$_SESSION['relation'][$GLOBALS['server']] = PMA__getRelationsParam();
}
- // just for BC but needs to be before PMA_printRelationsParamDiagnostic()
+ // just for BC but needs to be before PMA_getRelationsParamDiagnostic()
// which uses it
$GLOBALS['cfgRelation'] = $_SESSION['relation'][$GLOBALS['server']];
- if ($verbose) {
- PMA_printRelationsParamDiagnostic(
- $_SESSION['relation'][$GLOBALS['server']]
- );
- }
-
return $_SESSION['relation'][$GLOBALS['server']];
}
@@ -83,10 +75,12 @@ function PMA_getRelationsParam($verbose = false)
*
* @param array $cfgRelation Relation configuration
*
- * @return void
+ * @return string
*/
-function PMA_printRelationsParamDiagnostic($cfgRelation)
+function PMA_getRelationsParamDiagnostic($cfgRelation)
{
+ $retval = '';
+
$messages['error'] = ''
. __('not OK')
. ''
@@ -97,211 +91,195 @@ function PMA_printRelationsParamDiagnostic($cfgRelation)
$messages['ok'] = ''
. _pgettext('Correctly working', 'OK')
. '';
+
$messages['enabled'] = '' . __('Enabled') . '';
$messages['disabled'] = '' . __('Disabled') . '';
if (false === $GLOBALS['cfg']['Server']['pmadb']) {
- echo 'PMA Database ... '
+ $retval .= 'PMA Database ... '
. sprintf($messages['error'], 'pmadb')
. '
' . "\n"
. __('General relation features')
. ' ' . __('Disabled')
. '' . "\n";
- return;
+ } else {
+ $retval .= '
' . "\n";
+ $retval .= PMA_getDiagMessageForParameter(
+ 'pmadb',
+ $GLOBALS['cfg']['Server']['pmadb'],
+ $messages,
+ 'pmadb'
+ );
+ $retval .= PMA_getDiagMessageForParameter(
+ 'relation',
+ isset($cfgRelation['relation']),
+ $messages,
+ 'relation'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('General relation features'),
+ 'relwork',
+ $messages
+ );
+ $retval .= PMA_getDiagMessageForParameter(
+ 'table_info',
+ isset($cfgRelation['table_info']),
+ $messages,
+ 'table_info'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('Display Features'),
+ 'displaywork',
+ $messages
+ );
+ $retval .= PMA_getDiagMessageForParameter(
+ 'table_coords',
+ isset($cfgRelation['table_coords']),
+ $messages,
+ 'table_coords'
+ );
+ $retval .= PMA_getDiagMessageForParameter(
+ 'pdf_pages',
+ isset($cfgRelation['pdf_pages']),
+ $messages,
+ 'table_coords'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('Creation of PDFs'),
+ 'pdfwork',
+ $messages
+ );
+ $retval .= PMA_getDiagMessageForParameter(
+ 'column_info',
+ isset($cfgRelation['column_info']),
+ $messages,
+ 'col_com'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('Displaying Column Comments'),
+ 'commwork',
+ $messages,
+ false
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('Browser transformation'),
+ 'mimework',
+ $messages
+ );
+ if ($cfgRelation['commwork'] && ! $cfgRelation['mimework']) {
+ $retval .= '| ';
+ $retval .= __('Please see the documentation on how to update your column_comments table');
+ $retval .= ' |
';
+ }
+ $retval .= PMA_getDiagMessageForParameter(
+ 'bookmarktable',
+ isset($cfgRelation['bookmark']),
+ $messages,
+ 'bookmark'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('Bookmarked SQL query'),
+ 'bookmarkwork',
+ $messages
+ );
+ $retval .= PMA_getDiagMessageForParameter(
+ 'history',
+ isset($cfgRelation['history']),
+ $messages,
+ 'history'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('SQL history'),
+ 'historywork',
+ $messages
+ );
+ $retval .= PMA_getDiagMessageForParameter(
+ 'designer_coords',
+ isset($cfgRelation['designer_coords']),
+ $messages,
+ 'designer_coords'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('Designer'),
+ 'designerwork',
+ $messages
+ );
+ $retval .= PMA_getDiagMessageForParameter(
+ 'recent',
+ isset($cfgRelation['recent']),
+ $messages,
+ 'recent'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('Persistent recently used tables'),
+ 'recentwork',
+ $messages
+ );
+ $retval .= PMA_getDiagMessageForParameter(
+ 'table_uiprefs',
+ isset($cfgRelation['table_uiprefs']),
+ $messages,
+ 'table_uiprefs'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('Persistent tables\' UI preferences'),
+ 'uiprefswork',
+ $messages
+ );
+ $retval .= PMA_getDiagMessageForParameter(
+ 'tracking',
+ isset($cfgRelation['tracking']),
+ $messages,
+ 'tracking'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('Tracking'),
+ 'trackingwork',
+ $messages
+ );
+ $retval .= PMA_getDiagMessageForParameter(
+ 'userconfig',
+ isset($cfgRelation['userconfig']),
+ $messages,
+ 'userconfig'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('User preferences'),
+ 'userconfigwork',
+ $messages
+ );
+ $retval .= '
' . "\n";
+
+ $retval .= '' . __('Quick steps to setup advanced features:') . '
';
+ $retval .= '';
+ $retval .= '- ';
+ $retval .= __(
+ 'Create the needed tables with the '
+ . '
examples/create_tables.sql.'
+ );
+ $retval .= ' ' . PMA_showDocu('linked-tables');
+ $retval .= ' ';
+ $retval .= '- ';
+ $retval .= __('Create a pma user and give access to these tables.');
+ $retval .= ' ' . PMA_showDocu('pmausr');
+ $retval .= '
';
+ $retval .= '- ';
+ $retval .= __(
+ 'Enable advanced features in configuration file '
+ . '(
config.inc.php), for example by '
+ . 'starting from config.sample.inc.php.'
+ );
+ $retval .= ' ' . PMA_showDocu('quick_install');
+ $retval .= ' ';
+ $retval .= '- ';
+ $retval .= __(
+ 'Re-login to phpMyAdmin to load the updated configuration file.'
+ );
+ $retval .= '
';
+ $retval .= '
';
}
- echo '' . "\n";
-
- PMA_printDiagMessageForParameter(
- 'pmadb',
- $GLOBALS['cfg']['Server']['pmadb'],
- $messages,
- 'pmadb'
- );
-
- PMA_printDiagMessageForParameter(
- 'relation',
- isset($cfgRelation['relation']),
- $messages,
- 'relation'
- );
-
- PMA_printDiagMessageForFeature(
- __('General relation features'),
- 'relwork',
- $messages
- );
-
- PMA_printDiagMessageForParameter(
- 'table_info',
- isset($cfgRelation['table_info']),
- $messages,
- 'table_info'
- );
-
- PMA_printDiagMessageForFeature(
- __('Display Features'),
- '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(
- __('Creation of PDFs'),
- 'pdfwork',
- $messages
- );
-
- PMA_printDiagMessageForParameter(
- 'column_info',
- isset($cfgRelation['column_info']),
- $messages,
- 'col_com'
- );
-
- PMA_printDiagMessageForFeature(
- __('Displaying Column Comments'),
- 'commwork',
- $messages,
- false
- );
-
- PMA_printDiagMessageForFeature(
- __('Browser transformation'),
- 'mimework',
- $messages
- );
-
- if ($cfgRelation['commwork'] && ! $cfgRelation['mimework']) {
- echo '| '
- . __('Please see the documentation on how to update your column_comments table')
- . ' |
' . "\n";
- }
-
- PMA_printDiagMessageForParameter(
- 'bookmarktable',
- isset($cfgRelation['bookmark']),
- $messages,
- 'bookmark'
- );
-
- PMA_printDiagMessageForFeature(
- __('Bookmarked SQL query'),
- 'bookmarkwork',
- $messages
- );
-
- PMA_printDiagMessageForParameter(
- 'history',
- isset($cfgRelation['history']),
- $messages,
- 'history'
- );
-
- PMA_printDiagMessageForFeature(
- __('SQL history'),
- 'historywork',
- $messages
- );
-
- PMA_printDiagMessageForParameter(
- 'designer_coords',
- isset($cfgRelation['designer_coords']),
- $messages,
- 'designer_coords'
- );
-
- PMA_printDiagMessageForFeature(
- __('Designer'),
- 'designerwork',
- $messages
- );
-
- PMA_printDiagMessageForParameter(
- 'recent',
- isset($cfgRelation['recent']),
- $messages,
- 'recent'
- );
-
- PMA_printDiagMessageForFeature(
- __('Persistent recently used tables'),
- 'recentwork',
- $messages
- );
-
- PMA_printDiagMessageForParameter(
- 'table_uiprefs',
- isset($cfgRelation['table_uiprefs']),
- $messages,
- 'table_uiprefs'
- );
-
- PMA_printDiagMessageForFeature(
- __('Persistent tables\' UI preferences'),
- 'uiprefswork',
- $messages
- );
-
- PMA_printDiagMessageForParameter(
- 'tracking',
- isset($cfgRelation['tracking']),
- $messages,
- 'tracking'
- );
-
- PMA_printDiagMessageForFeature(
- __('Tracking'),
- 'trackingwork',
- $messages
- );
-
- PMA_printDiagMessageForParameter(
- 'userconfig',
- isset($cfgRelation['userconfig']),
- $messages,
- 'userconfig'
- );
-
- PMA_printDiagMessageForFeature(
- __('User preferences'),
- 'userconfigwork',
- $messages
- );
-
- echo '
' . "\n";
-
- echo '' . __('Quick steps to setup advanced features:') . '
';
- echo '';
- echo '- '
- . __('Create the needed tables with the
examples/create_tables.sql.')
- . ' ' . PMA_showDocu('linked-tables')
- . ' ';
- echo '- '
- . __('Create a pma user and give access to these tables.')
- . ' ' . PMA_showDocu('pmausr')
- . '
';
- echo '- '
- . __('Enable advanced features in configuration file (
config.inc.php), for example by starting from config.sample.inc.php.')
- . ' ' . PMA_showDocu('quick_install')
- . ' ';
- echo '- '
- . __('Re-login to phpMyAdmin to load the updated configuration file.')
- . '
';
- echo '
';
+ return $retval;
}
/**
@@ -312,21 +290,22 @@ function PMA_printRelationsParamDiagnostic($cfgRelation)
* @param array $messages utility messages
* @param boolean $skip_line whether to skip a line after the message
*
- * @return void
+ * @return string
*/
-function PMA_printDiagMessageForFeature($feature_name,
+function PMA_getDiagMessageForFeature($feature_name,
$relation_parameter, $messages, $skip_line = true
) {
- echo ' | ' . $feature_name . ': ';
+ $retval = ' |
| ' . $feature_name . ': ';
if ($GLOBALS['cfgRelation'][$relation_parameter]) {
- echo $messages['enabled'];
+ $retval .= $messages['enabled'];
} else {
- echo $messages['disabled'];
+ $retval .= $messages['disabled'];
}
- echo ' |
' . "\n";
+ $retval .= '';
if ($skip_line) {
- echo ' | |
' . "\n";
+ $retval .= '| |
';
}
+ return $retval;
}
/**
@@ -339,18 +318,19 @@ function PMA_printDiagMessageForFeature($feature_name,
*
* @return void
*/
-function PMA_printDiagMessageForParameter($parameter,
+function PMA_getDiagMessageForParameter($parameter,
$relation_parameter_set, $messages, $doc_anchor
) {
- echo '| ';
- echo '$cfg[\'Servers\'][$i][\'' . $parameter . '\'] ... ';
- echo ' | ';
+ $retval = ' |
|---|
| ';
+ $retval .= '$cfg[\'Servers\'][$i][\'' . $parameter . '\'] ... ';
+ $retval .= ' | ';
if ($relation_parameter_set) {
- echo $messages['ok'];
+ $retval .= $messages['ok'];
} else {
- printf($messages['error'], $doc_anchor);
+ $retval .= sprintf($messages['error'], $doc_anchor);
}
- echo ' |
' . "\n";
+ $retval .= '' . "\n";
+ return $retval;
}