- use style classes

- format numbers
- display only global variables that differs from local/session
- use PMA_DBI_fetch_result()
- PMA_NO_VARIABLES_IMPORT
This commit is contained in:
Sebastian Mendel
2005-12-07 12:57:07 +00:00
parent d3a6024fd8
commit 6bf8b8330e

View File

@@ -2,6 +2,9 @@
/* $Id$ */ /* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4: // vim: expandtab sw=4 ts=4 sts=4:
if ( ! defined( 'PMA_NO_VARIABLES_IMPORT' ) ) {
define( 'PMA_NO_VARIABLES_IMPORT', true );
}
require_once('./libraries/common.lib.php'); require_once('./libraries/common.lib.php');
/** /**
@@ -29,80 +32,78 @@ echo '<h2>' . "\n"
* Sends the queries and buffers the results * Sends the queries and buffers the results
*/ */
if (PMA_MYSQL_INT_VERSION >= 40003) { if (PMA_MYSQL_INT_VERSION >= 40003) {
$res = PMA_DBI_query('SHOW SESSION VARIABLES;'); $serverVars = PMA_DBI_fetch_result('SHOW SESSION VARIABLES;', 0, 1);
while ($row = PMA_DBI_fetch_row($res)) { $serverVarsGlobal = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES;', 0, 1);
$serverVars[$row[0]] = $row[1];
}
PMA_DBI_free_result($res);
unset($res, $row);
$res = PMA_DBI_query('SHOW GLOBAL VARIABLES;');
while ($row = PMA_DBI_fetch_row($res)) {
$serverVarsGlobal[$row[0]] = $row[1];
}
PMA_DBI_free_result($res);
unset($res, $row);
} else { } else {
$res = PMA_DBI_query('SHOW VARIABLES;'); $serverVars = PMA_DBI_fetch_result('SHOW VARIABLES;', 0, 1);
while ($row = PMA_DBI_fetch_row($res)) {
$serverVars[$row[0]] = $row[1];
} }
PMA_DBI_free_result($res);
unset($res, $row);
}
unset($res);
unset($row);
/** /**
* Displays the page * Displays the page
*/ */
?> ?>
<table border="0" cellpadding="2" cellspacing="1" width="90%"> <table class="data">
<tr> <thead>
<th>&nbsp;<?php echo $strVar; ?>&nbsp;</th> <tr><th><?php echo $strVar; ?></th>
<th>
<?php <?php
echo ' <th>&nbsp;';
if (PMA_MYSQL_INT_VERSION >= 40003) { if (PMA_MYSQL_INT_VERSION >= 40003) {
echo $strSessionValue . '&nbsp;</th>' . "\n" echo $strSessionValue . ' / ' . $strGlobalValue;
. ' <th>&nbsp;' . $strGlobalValue;
} else { } else {
echo $strValue; echo $strValue;
} }
echo '&nbsp;</th>' . "\n";
?> ?>
</th>
</tr> </tr>
</thead>
<tbody>
<?php <?php
$odd_row = true;
$useBgcolorOne = TRUE; $useBgcolorOne = TRUE;
$on_mouse='';
foreach ($serverVars as $name => $value) { foreach ($serverVars as $name => $value) {
if ($GLOBALS['cfg']['BrowsePointerEnable'] == TRUE) { ?>
$on_mouse = ' onmouseover="this.style.backgroundColor=\'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\';"' <tr class="<?php
. ' onmouseout="this.style.backgroundColor=\'' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '\';"'; echo $odd_row ? 'odd' : 'even';
if (PMA_MYSQL_INT_VERSION >= 40003
&& $serverVarsGlobal[$name] !== $value ) {
echo ' marked';
}
?>">
<th nowrap="nowrap">
<?php echo htmlspecialchars(str_replace('_', ' ', $name)); ?></th>
<td class="value"><?php
if ( is_numeric($value) ) {
echo PMA_formatNumber($value, 0);
$is_numeric = true;
} else { } else {
$on_mouse = ''; echo htmlspecialchars($value);
$is_numeric = false;
} }
?> ?></td>
<tr bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>"<?php echo $on_mouse; ?>>
<td nowrap="nowrap" valign="top">
<b><?php echo htmlspecialchars(str_replace('_', ' ', $name)) . "\n"; ?></b>
</td>
<td>
<?php echo htmlspecialchars($value) . "\n"; ?>
</td>
<?php <?php
if (PMA_MYSQL_INT_VERSION >= 40003) { if (PMA_MYSQL_INT_VERSION >= 40003
?> && $serverVarsGlobal[$name] !== $value ) {
<td>
<?php echo htmlspecialchars($serverVarsGlobal[$name]) . "\n"; ?>
</td>
<?php
}
$useBgcolorOne = !$useBgcolorOne;
?> ?>
</tr>
<tr class="<?php
echo $odd_row ? 'odd' : 'even';
?> marked">
<td>(<?php echo $strGlobalValue; ?>)</td>
<td class="value"><?php
if ( $is_numeric ) {
echo PMA_formatNumber($serverVarsGlobal[$name], 0);
} else {
echo htmlspecialchars($serverVarsGlobal[$name]);
}
?></td>
<?php } ?>
</tr> </tr>
<?php <?php
$odd_row = !$odd_row;
} }
?> ?>
</tbody>
</table> </table>
<?php <?php