diff --git a/ChangeLog b/ChangeLog index 3720d3f91..e29907384 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ $Source$ thanks to Matt "Cyber Dog" LaPlante * libraries/display_import.lib.php: missing '/' for closing div tag * libraries/display_export.lib.php: no name attribute for sup tag + * server_engines.php: revised (style, code, xhtml output) 2005-12-05 Sebastian Mendel * libraries/common.lib.php: added PMA_array_merge_recursive() diff --git a/server_engines.php b/server_engines.php index fac7d17b1..1bb5882fe 100644 --- a/server_engines.php +++ b/server_engines.php @@ -1,7 +1,13 @@ array('title' => $title, 'desc' => $description); * @param string Prefix for the SHOW VARIABLES query. - * @param int The indentation level - * - * @global array The global phpMyAdmin configuration. - * * @return string The table that was generated based on the given information. */ -define('PMA_ENGINE_DETAILS_TYPE_PLAINTEXT', 0); -define('PMA_ENGINE_DETAILS_TYPE_SIZE', 1); -define('PMA_ENGINE_DETAILS_TYPE_NUMERIC', 2); //Has no effect yet... -define('PMA_ENGINE_DETAILS_TYPE_BOOLEAN', 3); // 'ON' or 'OFF' -function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0) { - global $cfg; - - $spaces = ''; - for ($i = 0; $i < $indent; $i++) { - $spaces .= ' '; - } +function PMA_generateEngineDetails($variables, $like = null) { /** * Get the variables! @@ -54,39 +53,44 @@ function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0) { $res = PMA_DBI_query($sql_query); $mysql_vars = array(); while ($row = PMA_DBI_fetch_row($res)) { - if (isset($variables[$row[0]])) $mysql_vars[$row[0]] = $row[1]; + if (isset($variables[$row[0]])) { + $mysql_vars[$row[0]] = $row[1]; + } } PMA_DBI_free_result($res); unset($res, $row, $sql_query); } - if (empty($mysql_vars)) return $spaces . '

' . "\n" - . $spaces . ' ' . $GLOBALS['strNoDetailsForEngine'] . "\n" - . $spaces . '

' . "\n"; + if (empty($mysql_vars)) { + return '

' . "\n" + . ' ' . $GLOBALS['strNoDetailsForEngine'] . "\n" + . '

' . "\n"; + } - $dt_table = $spaces . '' . "\n"; - $useBgcolorOne = TRUE; - $has_content = FALSE; + $dt_table = '
' . "\n"; + $odd_row = false; + $has_content = false; foreach ($variables as $var => $details) { - if (!isset($mysql_vars[$var])) continue; - - if (!isset($details['type'])) $details['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT; - $is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC; - - $bgcolor = $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; - - $dt_table .= $spaces . ' ' . "\n" - . $spaces . ' ' . "\n" - . $spaces . ' ' . "\n" - . $spaces . ' ' . "\n" + . ' ' . "\n" + . ' ' . "\n" + . ' ' . "\n" - . $spaces . ' ' . "\n"; - $useBgcolorOne = !$useBgcolorOne; - $has_content = TRUE; + $dt_table .= '' . "\n" + . '' . "\n"; + $odd_row = !$odd_row; + $has_content = true; } - if (!$has_content) return ''; + if (!$has_content) { + return ''; + } + + $dt_table .= '
' . "\n"; - if (!empty($variables[$var]['desc'])) { - $dt_table .= $spaces . ' ' . PMA_showHint($details['desc']) . "\n"; + if (!isset($mysql_vars[$var])) { + continue; } - $dt_table .= $spaces . ' ' . "\n" - . $spaces . '  ' . $details['title'] . ' ' . "\n" - . $spaces . ' ' . "\n" - . $spaces . '  '; + + if (!isset($details['type'])) { + $details['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT; + } + $is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE + || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC; + + $dt_table .= '
' . "\n"; + if (!empty($variables[$var]['desc'])) { + $dt_table .= ' ' . PMA_showHint($details['desc']) . "\n"; + } + $dt_table .= ' ' . htmlspecialchars($details['title']) . "\n" + . ' '; switch ($details['type']) { case PMA_ENGINE_DETAILS_TYPE_SIZE: $parsed_size = PMA_formatByteDown($mysql_vars[$var]); @@ -96,14 +100,17 @@ function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0) { default: $dt_table .= htmlspecialchars($mysql_vars[$var]); } - $dt_table .= ' ' . "\n" - . $spaces . '
' . "\n"; return $dt_table; } @@ -112,14 +119,17 @@ function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0) { /** * Did the user request information about a certain storage engine? */ -if (empty($engine) || empty($mysql_storage_engines[$engine])) { +if ( empty($_REQUEST['engine']) + || empty($mysql_storage_engines[$_REQUEST['engine']]) ) { /** * Displays the sub-page heading */ echo '

' . "\n" - . ($cfg['MainPageIconic'] ? '' : '' ) - . ' ' . $strStorageEngines . "\n" + . ($GLOBALS['cfg']['MainPageIconic'] + ? '' : '' ) + . "\n" . $strStorageEngines . "\n" . '

' . "\n"; @@ -127,43 +137,41 @@ if (empty($engine) || empty($mysql_storage_engines[$engine])) { * Displays the table header */ echo '' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n"; + . '' . "\n" + . '' . "\n"; if (PMA_MYSQL_INT_VERSION >= 40102) { - echo ' ' . "\n"; + echo ' ' . "\n"; } - echo ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n"; + echo '' . "\n" + . '' . "\n" + . '' . "\n"; /** * Listing the storage engines */ - $useBgcolorOne = TRUE; - $common_url = './server_engines.php?' . PMA_generate_common_url() . '&engine='; + $odd_row = true; foreach ($mysql_storage_engines as $engine => $details) { - echo ' ' . "\n" - . ' ' . "\n"; + echo '' . "\n" + . ' ' . "\n"; if (PMA_MYSQL_INT_VERSION >= 40102) { - echo ' ' . "\n"; + echo ' ' . "\n"; } - echo ' ' . "\n"; - $useBgcolorOne = !$useBgcolorOne; + echo '' . "\n"; + $odd_row = !$odd_row; } - unset($useBgcolorOne, $common_url, $engine, $details); - echo ' ' . "\n" + unset($odd_row, $engine, $details); + echo '' . "\n" . '
' . "\n" - . ' ' . $strStorageEngine . "\n" - . '
' . $strStorageEngine . '' . "\n" - . ' ' . $strDescription . "\n" - . ' ' . $strDescription . '
' . "\n" - . ' ' . "\n" - . ' ' . htmlspecialchars($details['Engine']) . "\n" - . ' ' . "\n" - . '
' . "\n" + . ' ' . htmlspecialchars($details['Engine']) . "\n" + . ' ' . "\n" + . ' ' . "\n" - . ' ' . htmlspecialchars($details['Comment']) . "\n" - . ' ' . htmlspecialchars($details['Comment']) . "\n" + . '
' . "\n"; } else { @@ -172,51 +180,57 @@ if (empty($engine) || empty($mysql_storage_engines[$engine])) { * Displays details about a given Storage Engine */ - $engine_plugin = PMA_StorageEngine::getEngine($engine); + $engine_plugin = PMA_StorageEngine::getEngine($_REQUEST['engine']); echo '

' . "\n" - . ($cfg['MainPageIconic'] ? '' : '' ) + . ($GLOBALS['cfg']['MainPageIconic'] + ? '' : '' ) . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n" . '

' . "\n\n"; if (PMA_MYSQL_INT_VERSION >= 40102) { echo '

' . "\n" - . ' ' . "\n" + . ' ' . "\n" . ' ' . htmlspecialchars($engine_plugin->getComment()) . "\n" - . ' ' . "\n" + . ' ' . "\n" . '

' . "\n\n"; } $infoPages = $engine_plugin->getInfoPages(); if (!empty($infoPages) && is_array($infoPages)) { - $common_url = './server_engines.php?' . PMA_generate_common_url() . '&engine=' . urlencode($engine); echo '

' . "\n" - . ' [' . "\n"; - if (empty($page)) { - echo ' ' . $strServerTabVariables . '' . "\n"; + . ' [' . "\n"; + if (empty($_REQUEST['page'])) { + echo ' ' . $strServerTabVariables . '' . "\n"; } else { - echo ' ' . $strServerTabVariables . '' . "\n"; + echo ' ' + . $strServerTabVariables . '' . "\n"; } foreach ($infoPages as $current => $label) { - echo ' |' . "\n"; - if (isset($page) && $page == $current) { - echo ' ' . $label . '' . "\n"; + echo ' |' . "\n"; + if (isset($_REQUEST['page']) && $_REQUEST['page'] == $current) { + echo ' ' . $label . '' . "\n"; } else { - echo ' ' . $label . '' . "\n"; + echo ' ' . htmlspecialchars($label) . '' . "\n"; } } unset($current, $label); - echo ' ]' . "\n" + echo ' ]' . "\n" . '

' . "\n\n"; } unset($infoPages, $page_output); - if (!empty($page)) { - $page_output = $engine_plugin->getPage($page); + if (!empty($_REQUEST['page'])) { + $page_output = $engine_plugin->getPage($_REQUEST['page']); } if (!empty($page_output)) { echo $page_output; } else { - echo '

' . "\n" - . ' ' . $engine_plugin->getSupportInformationMessage() . "\n" + echo '

' . $engine_plugin->getSupportInformationMessage() . "\n" . '

' . "\n" - . PMA_generateEngineDetails($engine_plugin->getVariables(), $engine_plugin->getVariablesLikePattern()); + . PMA_generateEngineDetails($engine_plugin->getVariables(), + $engine_plugin->getVariablesLikePattern()); } }