revised (style, code, xhtml output) server_engines.php
This commit is contained in:
@@ -10,6 +10,7 @@ $Source$
|
|||||||
thanks to Matt "Cyber Dog" LaPlante
|
thanks to Matt "Cyber Dog" LaPlante
|
||||||
* libraries/display_import.lib.php: missing '/' for closing div tag
|
* libraries/display_import.lib.php: missing '/' for closing div tag
|
||||||
* libraries/display_export.lib.php: no name attribute for sup 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 <cybot_tm@users.sourceforge.net>
|
2005-12-05 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||||
* libraries/common.lib.php: added PMA_array_merge_recursive()
|
* libraries/common.lib.php: added PMA_array_merge_recursive()
|
||||||
|
@@ -1,7 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
// vim: expandtab sw=4 ts=4 sts=4:
|
// vim: expandtab sw=4 ts=4 sts=4:
|
||||||
|
/**
|
||||||
|
* display list of server enignes and additonal information about them
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* requirements
|
||||||
|
*/
|
||||||
require_once('./libraries/common.lib.php');
|
require_once('./libraries/common.lib.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,6 +22,13 @@ require('./libraries/storage_engines.lib.php');
|
|||||||
*/
|
*/
|
||||||
require('./libraries/server_links.inc.php');
|
require('./libraries/server_links.inc.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* defines
|
||||||
|
*/
|
||||||
|
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 for displaying the table of an engine's parameters
|
* Function for displaying the table of an engine's parameters
|
||||||
@@ -24,23 +37,9 @@ require('./libraries/server_links.inc.php');
|
|||||||
* The array elements should have the following format:
|
* The array elements should have the following format:
|
||||||
* $variable => array('title' => $title, 'desc' => $description);
|
* $variable => array('title' => $title, 'desc' => $description);
|
||||||
* @param string Prefix for the SHOW VARIABLES query.
|
* @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.
|
* @return string The table that was generated based on the given information.
|
||||||
*/
|
*/
|
||||||
define('PMA_ENGINE_DETAILS_TYPE_PLAINTEXT', 0);
|
function PMA_generateEngineDetails($variables, $like = null) {
|
||||||
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 .= ' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the variables!
|
* Get the variables!
|
||||||
@@ -54,39 +53,44 @@ function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0) {
|
|||||||
$res = PMA_DBI_query($sql_query);
|
$res = PMA_DBI_query($sql_query);
|
||||||
$mysql_vars = array();
|
$mysql_vars = array();
|
||||||
while ($row = PMA_DBI_fetch_row($res)) {
|
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);
|
PMA_DBI_free_result($res);
|
||||||
unset($res, $row, $sql_query);
|
unset($res, $row, $sql_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($mysql_vars)) return $spaces . '<p>' . "\n"
|
if (empty($mysql_vars)) {
|
||||||
. $spaces . ' ' . $GLOBALS['strNoDetailsForEngine'] . "\n"
|
return '<p>' . "\n"
|
||||||
. $spaces . '</p>' . "\n";
|
. ' ' . $GLOBALS['strNoDetailsForEngine'] . "\n"
|
||||||
|
. '</p>' . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
$dt_table = $spaces . '<table>' . "\n";
|
$dt_table = '<table class="data">' . "\n";
|
||||||
$useBgcolorOne = TRUE;
|
$odd_row = false;
|
||||||
$has_content = FALSE;
|
$has_content = false;
|
||||||
|
|
||||||
foreach ($variables as $var => $details) {
|
foreach ($variables as $var => $details) {
|
||||||
if (!isset($mysql_vars[$var])) continue;
|
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 . ' <tr>' . "\n"
|
|
||||||
. $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n";
|
|
||||||
if (!empty($variables[$var]['desc'])) {
|
|
||||||
$dt_table .= $spaces . ' ' . PMA_showHint($details['desc']) . "\n";
|
|
||||||
}
|
}
|
||||||
$dt_table .= $spaces . ' </td>' . "\n"
|
|
||||||
. $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n"
|
if (!isset($details['type'])) {
|
||||||
. $spaces . ' ' . $details['title'] . ' ' . "\n"
|
$details['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT;
|
||||||
. $spaces . ' </td>' . "\n"
|
}
|
||||||
. $spaces . ' <td bgcolor="' . $bgcolor . '"' . ($is_num ? ' align="right"' : '') . '>' . "\n"
|
$is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE
|
||||||
. $spaces . ' ';
|
|| $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC;
|
||||||
|
|
||||||
|
$dt_table .= '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n"
|
||||||
|
. ' <td>' . "\n";
|
||||||
|
if (!empty($variables[$var]['desc'])) {
|
||||||
|
$dt_table .= ' ' . PMA_showHint($details['desc']) . "\n";
|
||||||
|
}
|
||||||
|
$dt_table .= ' </td>' . "\n"
|
||||||
|
. ' <th>' . htmlspecialchars($details['title']) . "\n"
|
||||||
|
. ' </th>' . "\n"
|
||||||
|
. ' <td class="value">';
|
||||||
switch ($details['type']) {
|
switch ($details['type']) {
|
||||||
case PMA_ENGINE_DETAILS_TYPE_SIZE:
|
case PMA_ENGINE_DETAILS_TYPE_SIZE:
|
||||||
$parsed_size = PMA_formatByteDown($mysql_vars[$var]);
|
$parsed_size = PMA_formatByteDown($mysql_vars[$var]);
|
||||||
@@ -96,14 +100,17 @@ function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0) {
|
|||||||
default:
|
default:
|
||||||
$dt_table .= htmlspecialchars($mysql_vars[$var]);
|
$dt_table .= htmlspecialchars($mysql_vars[$var]);
|
||||||
}
|
}
|
||||||
$dt_table .= ' ' . "\n"
|
$dt_table .= '</td>' . "\n"
|
||||||
. $spaces . ' </td>' . "\n"
|
. '</tr>' . "\n";
|
||||||
. $spaces . ' </tr>' . "\n";
|
$odd_row = !$odd_row;
|
||||||
$useBgcolorOne = !$useBgcolorOne;
|
$has_content = true;
|
||||||
$has_content = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$has_content) return '';
|
if (!$has_content) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$dt_table .= '</table>' . "\n";
|
||||||
|
|
||||||
return $dt_table;
|
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?
|
* 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
|
* Displays the sub-page heading
|
||||||
*/
|
*/
|
||||||
echo '<h2>' . "\n"
|
echo '<h2>' . "\n"
|
||||||
. ($cfg['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png" width="16" height="16" alt="" />' : '' )
|
. ($GLOBALS['cfg']['MainPageIconic']
|
||||||
. ' ' . $strStorageEngines . "\n"
|
? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png"'
|
||||||
|
.' width="16" height="16" alt="" />' : '' )
|
||||||
|
. "\n" . $strStorageEngines . "\n"
|
||||||
. '</h2>' . "\n";
|
. '</h2>' . "\n";
|
||||||
|
|
||||||
|
|
||||||
@@ -127,43 +137,41 @@ if (empty($engine) || empty($mysql_storage_engines[$engine])) {
|
|||||||
* Displays the table header
|
* Displays the table header
|
||||||
*/
|
*/
|
||||||
echo '<table>' . "\n"
|
echo '<table>' . "\n"
|
||||||
. ' <thead>' . "\n"
|
. '<thead>' . "\n"
|
||||||
. ' <tr>' . "\n"
|
. '<tr><th>' . $strStorageEngine . '</th>' . "\n";
|
||||||
. ' <th>' . "\n"
|
|
||||||
. ' ' . $strStorageEngine . "\n"
|
|
||||||
. ' </th>' . "\n";
|
|
||||||
if (PMA_MYSQL_INT_VERSION >= 40102) {
|
if (PMA_MYSQL_INT_VERSION >= 40102) {
|
||||||
echo ' <th>' . "\n"
|
echo ' <th>' . $strDescription . '</th>' . "\n";
|
||||||
. ' ' . $strDescription . "\n"
|
|
||||||
. ' </th>' . "\n";
|
|
||||||
}
|
}
|
||||||
echo ' </tr>' . "\n"
|
echo '</tr>' . "\n"
|
||||||
. ' </thead>' . "\n"
|
. '</thead>' . "\n"
|
||||||
. ' <tbody>' . "\n";
|
. '<tbody>' . "\n";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listing the storage engines
|
* Listing the storage engines
|
||||||
*/
|
*/
|
||||||
$useBgcolorOne = TRUE;
|
$odd_row = true;
|
||||||
$common_url = './server_engines.php?' . PMA_generate_common_url() . '&engine=';
|
|
||||||
foreach ($mysql_storage_engines as $engine => $details) {
|
foreach ($mysql_storage_engines as $engine => $details) {
|
||||||
echo ' <tr' . ($details['Support'] == 'NO' || $details['Support'] == 'DISABLED' ? ' class="disabled"' : '') . '>' . "\n"
|
echo '<tr class="'
|
||||||
. ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n"
|
. ($odd_row ? 'odd' : 'even')
|
||||||
. ' <a href="' . $common_url . $engine . '">' . "\n"
|
. ($details['Support'] == 'NO' || $details['Support'] == 'DISABLED'
|
||||||
|
? ' disabled'
|
||||||
|
: '')
|
||||||
|
. '">' . "\n"
|
||||||
|
. ' <td><a href="./server_engines.php'
|
||||||
|
. PMA_generate_common_url(array( 'engine' => $engine )) . '">' . "\n"
|
||||||
. ' ' . htmlspecialchars($details['Engine']) . "\n"
|
. ' ' . htmlspecialchars($details['Engine']) . "\n"
|
||||||
. ' </a>' . "\n"
|
. ' </a>' . "\n"
|
||||||
. ' </td>' . "\n";
|
. ' </td>' . "\n";
|
||||||
if (PMA_MYSQL_INT_VERSION >= 40102) {
|
if (PMA_MYSQL_INT_VERSION >= 40102) {
|
||||||
echo ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n"
|
echo ' <td>' . htmlspecialchars($details['Comment']) . "\n"
|
||||||
. ' ' . htmlspecialchars($details['Comment']) . "\n"
|
|
||||||
. ' </td>' . "\n";
|
. ' </td>' . "\n";
|
||||||
}
|
}
|
||||||
echo ' </tr>' . "\n";
|
echo '</tr>' . "\n";
|
||||||
$useBgcolorOne = !$useBgcolorOne;
|
$odd_row = !$odd_row;
|
||||||
}
|
}
|
||||||
unset($useBgcolorOne, $common_url, $engine, $details);
|
unset($odd_row, $engine, $details);
|
||||||
echo ' </tbody>' . "\n"
|
echo '</tbody>' . "\n"
|
||||||
. '</table>' . "\n";
|
. '</table>' . "\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -172,51 +180,57 @@ if (empty($engine) || empty($mysql_storage_engines[$engine])) {
|
|||||||
* Displays details about a given Storage Engine
|
* Displays details about a given Storage Engine
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$engine_plugin = PMA_StorageEngine::getEngine($engine);
|
$engine_plugin = PMA_StorageEngine::getEngine($_REQUEST['engine']);
|
||||||
echo '<h2>' . "\n"
|
echo '<h2>' . "\n"
|
||||||
. ($cfg['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 'b_engine.png" width="16" height="16" border="0" hspace="2" align="middle" />' : '' )
|
. ($GLOBALS['cfg']['MainPageIconic']
|
||||||
|
? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png"'
|
||||||
|
.' width="16" height="16" alt="" />' : '' )
|
||||||
. ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n"
|
. ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n"
|
||||||
. '</h2>' . "\n\n";
|
. '</h2>' . "\n\n";
|
||||||
if (PMA_MYSQL_INT_VERSION >= 40102) {
|
if (PMA_MYSQL_INT_VERSION >= 40102) {
|
||||||
echo '<p>' . "\n"
|
echo '<p>' . "\n"
|
||||||
. ' <i>' . "\n"
|
. ' <em>' . "\n"
|
||||||
. ' ' . htmlspecialchars($engine_plugin->getComment()) . "\n"
|
. ' ' . htmlspecialchars($engine_plugin->getComment()) . "\n"
|
||||||
. ' </i>' . "\n"
|
. ' </em>' . "\n"
|
||||||
. '</p>' . "\n\n";
|
. '</p>' . "\n\n";
|
||||||
}
|
}
|
||||||
$infoPages = $engine_plugin->getInfoPages();
|
$infoPages = $engine_plugin->getInfoPages();
|
||||||
if (!empty($infoPages) && is_array($infoPages)) {
|
if (!empty($infoPages) && is_array($infoPages)) {
|
||||||
$common_url = './server_engines.php?' . PMA_generate_common_url() . '&engine=' . urlencode($engine);
|
|
||||||
echo '<p>' . "\n"
|
echo '<p>' . "\n"
|
||||||
. ' <b>[</b>' . "\n";
|
. ' <strong>[</strong>' . "\n";
|
||||||
if (empty($page)) {
|
if (empty($_REQUEST['page'])) {
|
||||||
echo ' <b>' . $strServerTabVariables . '</b>' . "\n";
|
echo ' <strong>' . $strServerTabVariables . '</strong>' . "\n";
|
||||||
} else {
|
} else {
|
||||||
echo ' <a href="' . $common_url . '">' . $strServerTabVariables . '</a>' . "\n";
|
echo ' <a href="./server_engines.php'
|
||||||
|
. PMA_generate_common_url(array( 'engine' => $engine )) . '">'
|
||||||
|
. $strServerTabVariables . '</a>' . "\n";
|
||||||
}
|
}
|
||||||
foreach ($infoPages as $current => $label) {
|
foreach ($infoPages as $current => $label) {
|
||||||
echo ' <b>|</b>' . "\n";
|
echo ' <strong>|</strong>' . "\n";
|
||||||
if (isset($page) && $page == $current) {
|
if (isset($_REQUEST['page']) && $_REQUEST['page'] == $current) {
|
||||||
echo ' <b>' . $label . '</b>' . "\n";
|
echo ' <strong>' . $label . '</strong>' . "\n";
|
||||||
} else {
|
} else {
|
||||||
echo ' <a href="' . $common_url . '&page=' . urlencode($current) . '">' . $label . '</a>' . "\n";
|
echo ' <a href="./server_engines.php'
|
||||||
|
. PMA_generate_common_url(
|
||||||
|
array( 'engine' => $engine, 'page' => $current ))
|
||||||
|
. '">' . htmlspecialchars($label) . '</a>' . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($current, $label);
|
unset($current, $label);
|
||||||
echo ' <b>]</b>' . "\n"
|
echo ' <strong>]</strong>' . "\n"
|
||||||
. '</p>' . "\n\n";
|
. '</p>' . "\n\n";
|
||||||
}
|
}
|
||||||
unset($infoPages, $page_output);
|
unset($infoPages, $page_output);
|
||||||
if (!empty($page)) {
|
if (!empty($_REQUEST['page'])) {
|
||||||
$page_output = $engine_plugin->getPage($page);
|
$page_output = $engine_plugin->getPage($_REQUEST['page']);
|
||||||
}
|
}
|
||||||
if (!empty($page_output)) {
|
if (!empty($page_output)) {
|
||||||
echo $page_output;
|
echo $page_output;
|
||||||
} else {
|
} else {
|
||||||
echo '<p>' . "\n"
|
echo '<p> ' . $engine_plugin->getSupportInformationMessage() . "\n"
|
||||||
. ' ' . $engine_plugin->getSupportInformationMessage() . "\n"
|
|
||||||
. '</p>' . "\n"
|
. '</p>' . "\n"
|
||||||
. PMA_generateEngineDetails($engine_plugin->getVariables(), $engine_plugin->getVariablesLikePattern());
|
. PMA_generateEngineDetails($engine_plugin->getVariables(),
|
||||||
|
$engine_plugin->getVariablesLikePattern());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user