作者:mike50
项目:phpmyadmi
function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0)
{
global $cfg;
$spaces = '';
for ($i = 0; $i < $indent; $i++) {
$spaces .= ' ';
}
/**
* Get the variables!
*/
if (!empty($variables)) {
$sql_query = 'SHOW ' . (PMA_MYSQL_INT_VERSION >= 40102 ? 'GLOBAL ' : '') . 'VARIABLES' . (empty($like) ? '' : ' LIKE \'' . $like . '\'') . ';';
$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];
}
}
PMA_DBI_free_result($res);
unset($res, $row, $sql_query);
}
if (empty($mysql_vars)) {
return $spaces . '<p>' . "\n" . $spaces . ' ' . $GLOBALS['strNoDetailsForEngine'] . "\n" . $spaces . '</p>' . "\n";
}
$dt_table = $spaces . '<table>' . "\n";
$useBgcolorOne = TRUE;
$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 . ' <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" . $spaces . ' ' . $details['title'] . ' ' . "\n" . $spaces . ' </td>' . "\n" . $spaces . ' <td bgcolor="' . $bgcolor . '"' . ($is_num ? ' align="right"' : '') . '>' . "\n" . $spaces . ' ';
switch ($details['type']) {
case PMA_ENGINE_DETAILS_TYPE_SIZE:
$parsed_size = PMA_formatByteDown($mysql_vars[$var]);
$dt_table .= $parsed_size[0] . ' ' . $parsed_size[1];
unset($parsed_size);
break;
default:
$dt_table .= htmlspecialchars($mysql_vars[$var]);
}
$dt_table .= ' ' . "\n" . $spaces . ' </td>' . "\n" . $spaces . ' </tr>' . "\n";
$useBgcolorOne = !$useBgcolorOne;
$has_content = TRUE;
}
if (!$has_content) {
return '';
}
return $dt_table;
}
作者:mike50
项目:phpmyadmi
function getPage($id)
{
global $cfg;
switch ($id) {
case 'bufferpool':
if (PMA_MYSQL_INT_VERSION < 50002) {
return FALSE;
}
// rabus: The following query is only possible because we know
// that we are on MySQL 5 here (checked above)!
// side note: I love MySQL 5 for this. :-)
$res = PMA_DBI_query('SHOW STATUS WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\' OR Variable_name = \'Innodb_page_size\';');
$status = array();
while ($row = PMA_DBI_fetch_row($res)) {
$status[$row[0]] = $row[1];
}
PMA_DBI_free_result($res);
unset($res, $row);
$output = '<table>' . "\n" . ' <thead>' . "\n" . ' <tr>' . "\n" . ' <th colspan="4">' . "\n" . ' ' . $GLOBALS['strBufferPoolUsage'] . "\n" . ' </th>' . "\n" . ' </tr>' . "\n" . ' </thead>' . "\n" . ' <tfoot>' . "\n" . ' <tr>' . "\n" . ' <th>' . "\n" . ' ' . $GLOBALS['strTotalUC'] . "\n" . ' </th>' . "\n" . ' <th colspan="3">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_total']) . ' ' . $GLOBALS['strInnoDBPages'] . ' / ' . join(' ', PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n" . ' </th>' . "\n" . ' </tr>' . "\n" . ' </tfoot>' . "\n" . ' <tbody>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . $GLOBALS['strFreePages'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_free']) . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strDirtyPages'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_dirty']) . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strDataPages'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_data']) . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strPagesToBeFlushed'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_flushed']) . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . $GLOBALS['strBusyPages'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_misc']) . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strLatchedPages'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_latched']) . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' </tbody>' . "\n" . '</table>' . "\n\n" . '<br />' . "\n\n" . '<table>' . "\n" . ' <thead>' . "\n" . ' <tr>' . "\n" . ' <th colspan="4">' . "\n" . ' ' . $GLOBALS['strBufferPoolActivity'] . "\n" . ' </th>' . "\n" . ' </tr>' . "\n" . ' </thead>' . "\n" . ' <tbody>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strReadRequests'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_read_requests']) . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strWriteRequests'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_write_requests']) . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . $GLOBALS['strBufferReadMisses'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_reads']) . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . $GLOBALS['strBufferWriteWaits'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_wait_free']) . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strBufferReadMissesInPercent'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . ($status['Innodb_buffer_pool_read_requests'] == 0 ? '---' : htmlspecialchars(number_format($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . ' %') . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strBufferWriteWaitsInPercent'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . ($status['Innodb_buffer_pool_write_requests'] == 0 ? '---' : htmlspecialchars(number_format($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . ' %') . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' </tbody>' . "\n" . '</table>' . "\n";
return $output;
case 'status':
$res = PMA_DBI_query('SHOW INNODB STATUS;');
$row = PMA_DBI_fetch_row($res);
PMA_DBI_free_result($res);
return '<pre>' . "\n" . htmlspecialchars($row[0]) . "\n" . '</pre>' . "\n";
default:
return FALSE;
}
}
作者:BGCX26
项目:zuozhenshi-prego-svn-to-gi
function PMA_buildHtmlForDb($current, $is_superuser, $checkall, $url_query, $column_order, $replication_types, $replication_info)
{
$out = '';
if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
$out .= '<td class="tool">';
$out .= '<input type="checkbox" name="selected_dbs[]" title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" value="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ';
if ($current['SCHEMA_NAME'] != 'mysql' && $current['SCHEMA_NAME'] != 'information_schema') {
$out .= (empty($checkall) ? '' : 'checked="checked" ') . '/>';
} else {
$out .= ' disabled="disabled" />';
}
$out .= '</td>';
}
$out .= '<td class="name">' . ' <a onclick="' . 'if (window.parent.openDb && window.parent.openDb(\'' . PMA_jsFormat($current['SCHEMA_NAME'], false) . '\')) return false;' . '" href="index.php?' . $url_query . '&db=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Jump to database'), htmlspecialchars($current['SCHEMA_NAME'])) . '" target="_parent">' . ' ' . htmlspecialchars($current['SCHEMA_NAME']) . '</a>' . '</td>';
foreach ($column_order as $stat_name => $stat) {
if (array_key_exists($stat_name, $current)) {
if (is_numeric($stat['footer'])) {
$column_order[$stat_name]['footer'] += $current[$stat_name];
}
if ($stat['format'] === 'byte') {
list($value, $unit) = PMA_formatByteDown($current[$stat_name], 3, 1);
} elseif ($stat['format'] === 'number') {
$value = PMA_formatNumber($current[$stat_name], 0);
} else {
$value = htmlentities($current[$stat_name], 0);
}
$out .= '<td class="value">';
if (isset($stat['description_function'])) {
$out .= '<dfn title="' . $stat['description_function']($current[$stat_name]) . '">';
}
$out .= $value;
if (isset($stat['description_function'])) {
$out .= '</dfn>';
}
$out .= '</td>';
if ($stat['format'] === 'byte') {
$out .= '<td class="unit">' . $unit . '</td>';
}
}
}
foreach ($replication_types as $type) {
if ($replication_info[$type]['status']) {
$out .= '<td class="tool" style="text-align: center;">';
if (strlen(array_search($current["SCHEMA_NAME"], $replication_info[$type]['Ignore_DB'])) > 0) {
$out .= PMA_getIcon('s_cancel.png', __('Not replicated'));
} else {
$key = array_search($current["SCHEMA_NAME"], $replication_info[$type]['Do_DB']);
if (strlen($key) > 0 || $replication_info[$type]['Do_DB'][0] == "" && count($replication_info[$type]['Do_DB']) == 1) {
// if ($key != null) did not work for index "0"
$out .= PMA_getIcon('s_success.png', __('Replicated'));
}
}
$out .= '</td>';
}
}
if ($is_superuser) {
$out .= '<td class="tool">' . '<a onclick="' . 'if (window.parent.setDb) window.parent.setDb(\'' . PMA_jsFormat($current['SCHEMA_NAME']) . '\');' . '" href="./server_privileges.php?' . $url_query . '&checkprivs=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Check privileges for database "%s".'), htmlspecialchars($current['SCHEMA_NAME'])) . '">' . ' ' . PMA_getIcon('s_rights.png', __('Check Privileges')) . '</a></td>';
}
return array($column_order, $out);
}
作者:JakubMarde
项目:esho
/**
* Function for displaying the table of an engine's parameters
*
* @param array List of MySQL variables and corresponding localized descriptions.
* The array elements should have the following format:
* $variable => array('title' => $title, 'desc' => $description);
* @param string Prefix for the SHOW VARIABLES query.
* @return string The table that was generated based on the given information.
*/
function PMA_generateEngineDetails($variables, $like = null)
{
/**
* Get the variables!
*/
if (!empty($variables)) {
$sql_query = 'SHOW ' . (PMA_MYSQL_INT_VERSION >= 40102 ? 'GLOBAL ' : '') . 'VARIABLES' . (empty($like) ? '' : ' LIKE \'' . $like . '\'') . ';';
$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];
}
}
PMA_DBI_free_result($res);
unset($res, $row, $sql_query);
}
if (empty($mysql_vars)) {
return '<p>' . "\n" . ' ' . $GLOBALS['strNoDetailsForEngine'] . "\n" . '</p>' . "\n";
}
$dt_table = '<table class="data" cellspacing="1">' . "\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;
$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(empty($details['title']) ? $var : $details['title']) . "\n" . ' </th>' . "\n" . ' <td class="value">';
switch ($details['type']) {
case PMA_ENGINE_DETAILS_TYPE_SIZE:
$parsed_size = PMA_formatByteDown($mysql_vars[$var]);
$dt_table .= $parsed_size[0] . ' ' . $parsed_size[1];
unset($parsed_size);
break;
case PMA_ENGINE_DETAILS_TYPE_NUMERIC:
$dt_table .= PMA_formatNumber($mysql_vars[$var]) . ' ';
break;
default:
$dt_table .= htmlspecialchars($mysql_vars[$var]) . ' ';
}
$dt_table .= '</td>' . "\n" . '</tr>' . "\n";
$odd_row = !$odd_row;
$has_content = true;
}
if (!$has_content) {
return '';
}
$dt_table .= '</table>' . "\n";
return $dt_table;
}
作者:AmberWis
项目:laba_we
/**
* returns the pbxt engine specific handling for
* PMA_ENGINE_DETAILS_TYPE_SIZE variables.
*
* @param string $formatted_size the size expression (for example 8MB)
*
* @return string the formatted value and its unit
*/
function resolveTypeSize($formatted_size)
{
if (preg_match('/^[0-9]+[a-zA-Z]+$/', $formatted_size)) {
$value = PMA_extractValueFromFormattedSize($formatted_size);
} else {
$value = $formatted_size;
}
return PMA_formatByteDown($value);
}
作者:dingdong231
项目:g5_them
/**
* returns html tables with stats over inno db buffer pool
*
* @uses PMA_DBI_fetch_result()
* @uses PMA_formatNumber()
* @uses PMA_formatByteDown()
* @uses join()
* @uses htmlspecialchars()
* @uses PMA_formatNumber()
* @return string html table with stats
*/
function getPageBufferpool()
{
// The following query is only possible because we know
// that we are on MySQL 5 here (checked above)!
// side note: I love MySQL 5 for this. :-)
$sql = '
SHOW STATUS
WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\'
OR Variable_name = \'Innodb_page_size\';';
$status = PMA_DBI_fetch_result($sql, 0, 1);
$output = '<table class="data" id="table_innodb_bufferpool_usage">' . "\n" . ' <caption class="tblHeaders">' . "\n" . ' ' . __('Buffer Pool Usage') . "\n" . ' </caption>' . "\n" . ' <tfoot>' . "\n" . ' <tr>' . "\n" . ' <th colspan="2">' . "\n" . ' ' . __('Total') . "\n" . ' : ' . PMA_formatNumber($status['Innodb_buffer_pool_pages_total'], 0) . ' ' . __('pages') . ' / ' . join(' ', PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n" . ' </th>' . "\n" . ' </tr>' . "\n" . ' </tfoot>' . "\n" . ' <tbody>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Free pages') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_free'], 0) . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Dirty pages') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_dirty'], 0) . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Pages containing data') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_data'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Pages to be flushed') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_flushed'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Busy pages') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_misc'], 0) . "\n" . '</td>' . "\n" . ' </tr>';
// not present at least since MySQL 5.1.40
if (isset($status['Innodb_buffer_pool_pages_latched'])) {
$output .= ' <tr class="even">' . ' <th>' . __('Latched pages') . '</th>' . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_latched'], 0) . '</td>' . ' </tr>';
}
$output .= ' </tbody>' . "\n" . '</table>' . "\n\n" . '<table class="data" id="table_innodb_bufferpool_activity">' . "\n" . ' <caption class="tblHeaders">' . "\n" . ' ' . __('Buffer Pool Activity') . "\n" . ' </caption>' . "\n" . ' <tbody>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Read requests') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_read_requests'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Write requests') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_write_requests'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Read misses') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_reads'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Write waits') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_wait_free'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Read misses in %') . '</th>' . "\n" . ' <td class="value">' . ($status['Innodb_buffer_pool_read_requests'] == 0 ? '---' : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 3, 2)) . ' %') . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Write waits in %') . '</th>' . "\n" . ' <td class="value">' . ($status['Innodb_buffer_pool_write_requests'] == 0 ? '---' : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 3, 2)) . ' %') . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' </tbody>' . "\n" . '</table>' . "\n";
return $output;
}
作者:zsean
项目:klox
foreach ($binary_logs as $each_log) {
echo '<option value="' . $each_log['Log_name'] . '"';
if ($each_log['Log_name'] == $_REQUEST['log']) {
echo ' selected="selected"';
}
echo '>' . $each_log['Log_name'];
if (isset($each_log['File_size'])) {
$full_size += $each_log['File_size'];
echo ' (' . implode(' ', PMA_formatByteDown($each_log['File_size'], 3, 2)) . ')';
}
echo '</option>';
}
echo '</select> ';
echo count($binary_logs) . ' ' . __('Files') . ', ';
if ($full_size > 0) {
echo implode(' ', PMA_formatByteDown($full_size));
}
echo '</fieldset>';
echo '<fieldset class="tblFooters">';
echo '<input type="submit" value="' . __('Go') . '" />';
echo '</fieldset>';
echo '</form>';
}
PMA_showMessage(PMA_Message::success());
/**
* Displays the page
*/
?>
<table border="0" cellpadding="2" cellspacing="1">
<thead>
<tr>
作者:anmolvie
项目:yiidemo
/**
* Verifies what to do with non-printable contents (binary or BLOB)
* in Browse mode.
*
* @uses is_null()
* @uses isset()
* @uses strlen()
* @uses PMA_formatByteDown()
* @uses strpos()
* @uses str_replace()
* @param string $category BLOB|BINARY|GEOMETRY
* @param string $content the binary content
* @param string $transform_function
* @param string $transform_options
* @param string $default_function
* @param object $meta the meta-information about this field
* @return mixed string or float
*/
function PMA_handle_non_printable_contents($category, $content, $transform_function, $transform_options, $default_function, $meta, $url_params = array())
{
$result = '[' . $category;
if (is_null($content)) {
$result .= ' - NULL';
$size = 0;
} elseif (isset($content)) {
$size = strlen($content);
$display_size = PMA_formatByteDown($size, 3, 1);
$result .= ' - ' . $display_size[0] . $display_size[1];
}
$result .= ']';
if (strpos($transform_function, 'octetstream')) {
$result = $content;
}
if ($size > 0) {
if ($default_function != $transform_function) {
$result = $transform_function($result, $transform_options, $meta);
} else {
$result = $default_function($result, array(), $meta);
if (stristr($meta->type, 'BLOB') && $_SESSION['tmp_user_values']['display_blob']) {
// in this case, restart from the original $content
$result = htmlspecialchars(PMA_replace_binary_contents($content));
}
/* Create link to download */
if (count($url_params) > 0) {
$result = '<a href="tbl_get_field.php' . PMA_generate_common_url($url_params) . '">' . $result . '</a>';
}
}
}
return $result;
}
作者:nesthu
项目:php_jannu
$max_digits = 5;
$decimals = 1;
list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length'], $max_digits, $decimals);
if ($mergetable == false) {
list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length'], $max_digits, $decimals);
}
// InnoDB returns a huge value in Data_free, do not use it
if (!$is_innodb && isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
list($free_size, $free_unit) = PMA_formatByteDown($showtable['Data_free'], $max_digits, $decimals);
list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free'], $max_digits, $decimals);
} else {
list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals);
}
list($tot_size, $tot_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals);
if ($table_info_num_rows > 0) {
list($avg_size, $avg_unit) = PMA_formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
}
// Displays them
$odd_row = false;
?>
<a name="showusage"></a>
<?php
if (!$tbl_is_view && !$db_is_information_schema) {
?>
<table id="tablespaceusage" class="data">
<caption class="tblHeaders"><?php
echo $strSpaceUsage;
?>
</caption>
<thead>
作者:fathitare
项目:cop5725-dbms-projec
/**
* returns as HTML table of the engine's server variables
*
* @uses PMA_ENGINE_DETAILS_TYPE_SIZE
* @uses PMA_ENGINE_DETAILS_TYPE_NUMERIC
* @uses PMA_StorageEngine::getVariablesStatus()
* @uses $GLOBALS['strNoDetailsForEngine']
* @uses PMA_showHint()
* @uses PMA_formatByteDown()
* @uses PMA_formatNumber()
* @uses htmlspecialchars()
* @return string The table that was generated based on the retrieved information
*/
function getHtmlVariables()
{
$odd_row = false;
$ret = '';
foreach ($this->getVariablesStatus() as $details) {
$ret .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n" . ' <td>' . "\n";
if (!empty($details['desc'])) {
$ret .= ' ' . PMA_showHint($details['desc']) . "\n";
}
$ret .= ' </td>' . "\n" . ' <th>' . htmlspecialchars($details['title']) . '</th>' . "\n" . ' <td class="value">';
switch ($details['type']) {
case PMA_ENGINE_DETAILS_TYPE_SIZE:
$parsed_size = PMA_formatByteDown($details['value']);
$ret .= $parsed_size[0] . ' ' . $parsed_size[1];
unset($parsed_size);
break;
case PMA_ENGINE_DETAILS_TYPE_NUMERIC:
$ret .= PMA_formatNumber($details['value']) . ' ';
break;
default:
$ret .= htmlspecialchars($details['value']) . ' ';
}
$ret .= '</td>' . "\n" . '</tr>' . "\n";
$odd_row = !$odd_row;
}
if (!$ret) {
$ret = '<p>' . "\n" . ' ' . $GLOBALS['strNoDetailsForEngine'] . "\n" . '</p>' . "\n";
} else {
$ret = '<table class="data">' . "\n" . $ret . '</table>' . "\n";
}
return $ret;
}
作者:bugya
项目:phporadmi
/**
* format byte test, globals are defined
* @dataProvider formatByteDownDataProvider
*/
public function testFormatByteDown($a, $b, $c, $e)
{
$result = PMA_formatByteDown($a, $b, $c);
$result[0] = trim($result[0]);
$this->assertEquals($e, $result);
}
作者:bugya
项目:phporadmi
<?php
echo __('in use');
?>
</td>
<?php
}
// end if (isset($each_table['TABLE_ROWS'])) else
?>
</tr>
<?php
}
// end foreach
// Show Summary
if ($is_show_stats) {
list($sum_formatted, $unit) = PMA_formatByteDown($sum_size, 3, 1);
list($overhead_formatted, $overhead_unit) = PMA_formatByteDown($overhead_size, 3, 1);
}
?>
</tbody>
<tbody id="tbl_summary_row">
<tr><th></th>
<th align="center" nowrap="nowrap">
<?php
// for blobstreaming - if the number of tables is 0, set tableReductionCount to 0
// (we don't want negative numbers here)
if ($num_tables == 0) {
$tableReductionCount = 0;
}
echo sprintf(_ngettext('%s table', '%s tables', $num_tables - $tableReductionCount), PMA_formatNumber($num_tables - $tableReductionCount, 0));
?>
</th>
作者:AmberWis
项目:laba_we
/**
* Displays the maximum size for an upload
*
* @param integer $max_upload_size the size
*
* @return string the message
*
* @access public
*/
function PMA_displayMaximumUploadSize($max_upload_size)
{
// I have to reduce the second parameter (sensitiveness) from 6 to 4
// to avoid weird results like 512 kKib
list($max_size, $max_unit) = PMA_formatByteDown($max_upload_size, 4);
return '(' . sprintf(__('Max: %s%s'), $max_size, $max_unit) . ')';
}
作者:BGCX26
项目:zhe-project-agri-hg-to-gi
<td class="value"><?php
echo implode(' ', PMA_formatByteDown($server_status['Bytes_sent'] * $hour_factor, 4));
?>
</td>
</tr>
<tr class="odd">
<th class="name"><?php
echo $strTotalUC;
?>
</th>
<td class="value"><?php
echo implode(' ', PMA_formatByteDown($server_status['Bytes_received'] + $server_status['Bytes_sent'], 4));
?>
</td>
<td class="value"><?php
echo implode(' ', PMA_formatByteDown(($server_status['Bytes_received'] + $server_status['Bytes_sent']) * $hour_factor, 4));
?>
</td>
</tr>
</tbody>
</table>
<table id="serverstatusconnections" class="data">
<thead>
<tr>
<th colspan="2"><?php
echo $strConnections;
?>
</th>
<th>ø <?php
echo $strPerHour;
作者:Apx
项目:Rubin_fina
/**
* Displays the maximum size for an upload
*
* @param integer the size
*
* @return string the message
*
* @access public
*/
function PMA_displayMaximumUploadSize($max_upload_size)
{
list($max_size, $max_unit) = PMA_formatByteDown($max_upload_size);
return '(' . sprintf($GLOBALS['strMaximumSize'], $max_size, $max_unit) . ')';
}
作者:AmberWis
项目:laba_we
function printServerTraffic()
{
global $server_status, $PMA_PHP_SELF;
global $server_master_status, $server_slave_status, $replication_types;
$hour_factor = 3600 / $server_status['Uptime'];
/**
* starttime calculation
*/
$start_time = PMA_DBI_fetch_value('SELECT UNIX_TIMESTAMP() - ' . $server_status['Uptime']);
?>
<h3><?php
echo sprintf(__('Network traffic since startup: %s'), implode(' ', PMA_formatByteDown($server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1)));
?>
</h3>
<p>
<?php
echo sprintf(__('This MySQL server has been running for %1$s. It started up on %2$s.'), PMA_timespanFormat($server_status['Uptime']), PMA_localisedDate($start_time)) . "\n";
?>
</p>
<?php
if ($server_master_status || $server_slave_status) {
echo '<p class="notice">';
if ($server_master_status && $server_slave_status) {
echo __('This MySQL server works as <b>master</b> and <b>slave</b> in <b>replication</b> process.');
} elseif ($server_master_status) {
echo __('This MySQL server works as <b>master</b> in <b>replication</b> process.');
} elseif ($server_slave_status) {
echo __('This MySQL server works as <b>slave</b> in <b>replication</b> process.');
}
echo ' ';
echo __('For further information about replication status on the server, please visit the <a href="#replication">replication section</a>.');
echo '</p>';
}
/* if the server works as master or slave in replication process, display useful information */
if ($server_master_status || $server_slave_status) {
?>
<hr class="clearfloat" />
<h3><a name="replication"></a><?php
echo __('Replication status');
?>
</h3>
<?php
foreach ($replication_types as $type) {
if (${"server_{$type}_status"}) {
PMA_replication_print_status_table($type);
}
}
unset($types);
}
?>
<table id="serverstatustraffic" class="data noclick">
<thead>
<tr>
<th colspan="2"><?php
echo __('Traffic') . ' ' . PMA_showHint(__('On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.'));
?>
</th>
<th>ø <?php
echo __('per hour');
?>
</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<th class="name"><?php
echo __('Received');
?>
</th>
<td class="value"><?php
echo implode(' ', PMA_formatByteDown($server_status['Bytes_received'], 3, 1));
?>
</td>
<td class="value"><?php
echo implode(' ', PMA_formatByteDown($server_status['Bytes_received'] * $hour_factor, 3, 1));
?>
</td>
</tr>
<tr class="even">
<th class="name"><?php
echo __('Sent');
?>
</th>
<td class="value"><?php
echo implode(' ', PMA_formatByteDown($server_status['Bytes_sent'], 3, 1));
?>
</td>
<td class="value"><?php
echo implode(' ', PMA_formatByteDown($server_status['Bytes_sent'] * $hour_factor, 3, 1));
?>
</td>
</tr>
<tr class="odd">
<th class="name"><?php
echo __('Total');
?>
//.........这里部分代码省略.........
作者:nicokaise
项目:phpmyadmi
function formatVariable($name, $value)
{
global $VARIABLE_DOC_LINKS;
if (is_numeric($value)) {
if (isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte') {
return '<abbr title="'.PMA_formatNumber($value, 0).'">'.implode(' ', PMA_formatByteDown($value, 3, 3)).'</abbr>';
} else {
return PMA_formatNumber($value, 0);
}
}
return htmlspecialchars($value);
}
作者:dapfr
项目:gladiator
$current_collation = PMA_getDbCollation($current['db_name']);
echo ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" . ' <dfn title="' . htmlspecialchars(PMA_getCollationDescr($current_collation)) . '">' . "\n" . ' ' . htmlspecialchars($current_collation) . "\n" . ' </dfn>' . "\n" . ' </td>' . "\n";
}
echo ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '" align="right">' . "\n" . ' ' . $current['tbl_cnt'] . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '" align="right">' . "\n" . ' ' . $data_size . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" . ' ' . $data_unit . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '" align="right">' . "\n" . ' ' . $idx_size . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" . ' ' . $idx_unit . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '" align="right">' . "\n" . ' <b>' . "\n" . ' ' . $tot_size . "\n" . ' </b>' . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" . ' <b>' . "\n" . ' ' . $tot_unit . "\n" . ' </b>' . "\n" . ' </td>' . "\n";
}
if ($is_superuser) {
echo ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '" align="center">' . "\n" . ' <a onclick="reload_window(\'' . urlencode($current['db_name']) . '\'); return true;" href="./server_privileges.php?' . $url_query . '&checkprivs=' . urlencode($current['db_name']) . '" title="' . sprintf($strCheckPrivsLong, htmlspecialchars($current['db_name'])) . '">' . "\n" . ' ' . ($cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 's_rights.png" width="16" height="16" hspace="2" border="0" alt=" ' . $strCheckPrivs . '" /> ' : $strCheckPrivs) . "\n" . ' </a>' . "\n" . ' </td>' . "\n";
}
echo ' </tr>' . "\n";
$useBgcolorOne = !$useBgcolorOne;
}
// end while
if (!empty($dbstats)) {
list($data_size, $data_unit) = PMA_formatByteDown($total_calc['data_sz'], 3, 1);
list($idx_size, $idx_unit) = PMA_formatByteDown($total_calc['idx_sz'], 3, 1);
list($tot_size, $tot_unit) = PMA_formatByteDown($total_calc['tot_sz'], 3, 1);
echo ' <tr>' . "\n" . ' <th> </th>' . "\n" . ' <th>' . "\n" . ' ' . $strTotalUC . ': ' . $total_calc['db_cnt'] . ' ' . "\n" . ' </th>' . "\n";
if (PMA_MYSQL_INT_VERSION >= 40101) {
echo ' <th> </th>' . "\n";
}
echo ' <th align="right">' . "\n" . ' ' . $total_calc['tbl_cnt'] . ' ' . "\n" . ' </th>' . "\n" . ' <th align="right">' . "\n" . ' ' . $data_size . "\n" . ' </th>' . "\n" . ' <th align="left">' . "\n" . ' ' . $data_unit . ' ' . "\n" . ' </th>' . "\n" . ' <th align="right">' . "\n" . ' ' . $idx_size . "\n" . ' </th>' . "\n" . ' <th align="left">' . "\n" . ' ' . $idx_unit . ' ' . "\n" . ' </th>' . "\n" . ' <th align="right">' . "\n" . ' ' . $tot_size . "\n" . ' </th>' . "\n" . ' <th align="left">' . "\n" . ' ' . $tot_unit . ' ' . "\n" . ' </th>' . "\n" . ' <th> </th>' . "\n" . ' </tr>' . "\n";
}
if ($is_superuser || $cfg['AllowUserDropDatabase']) {
$common_url_query = PMA_generate_common_url() . '&sort_by=' . $sort_by . '&sort_order=' . $sort_order . '&dbstats=' . (empty($dbstats) ? '10' : '3');
echo ' <tr>' . "\n" . ' <td colspan="' . (empty($dbstats) ? '10' : '3') . '">' . "\n" . ' <img src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" border="0" width="38" height="22" alt="' . $strWithChecked . '" />' . "\n" . ' <a href="./server_databases.php?' . $common_url_query . '&checkall=1" onclick="setCheckboxes(\'dbStatsForm\', true); return false;">' . "\n" . ' ' . $strCheckAll . ' </a>' . "\n" . ' / ' . "\n" . ' <a href="./server_databases.php?' . $common_url_query . '" onclick="setCheckboxes(\'dbStatsForm\', false); return false;">' . "\n" . ' ' . $strUncheckAll . ' </a>' . "\n" . ' </td>' . "\n" . ' </tr>' . "\n";
}
echo ' </table>' . "\n";
unset($data_size);
unset($data_unit);
unset($idx_size);
unset($idx_unit);
作者:quarteme
项目:xoopserve
"> <?php
echo $strTotalUC;
?>
</td>
<td bgcolor="<?php
echo $cfg['BgcolorOne'];
?>
" align="right"> <?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'] + $serverStatus['Bytes_sent']));
?>
</td>
<td bgcolor="<?php
echo $cfg['BgcolorOne'];
?>
" align="right"> <?php
echo join(' ', PMA_formatByteDown(($serverStatus['Bytes_received'] + $serverStatus['Bytes_sent']) * 3600 / $serverStatus['Uptime']));
?>
</td>
</tr>
</table>
</td>
<td valign="top">
<table border="0">
<tr>
<th colspan="2"> <?php
echo $strConnections;
?>
</th>
<th> ø <?php
echo $strPerHour;
?>
作者:quarteme
项目:xoopserve
//.........这里部分代码省略.........
$dispval = PMA_mysql_result($dispresult, 0);
} else {
$dispval = $GLOBALS['strLinkNotFound'];
}
} else {
$dispval = '';
}
// end if... else...
if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') {
$vertical_display['data'][$row_no][$i] .= ($transform_function != $default_function ? $transform_function($row[$pointer], $transform_options, $meta) : $transform_function($row[$pointer], array(), $meta)) . ' <code>[->' . $dispval . ']</code>';
} else {
$title = !empty($dispval) ? ' title="' . htmlspecialchars($dispval) . '"' : '';
$vertical_display['data'][$row_no][$i] .= '<a href="sql.php?' . PMA_generate_common_url($map[$meta->name][3], $map[$meta->name][0]) . '&pos=0&session_max_rows=' . $session_max_rows . '&dontlimitchars=' . $dontlimitchars . '&sql_query=' . urlencode('SELECT * FROM ' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = ' . $row[$pointer]) . '"' . $title . '>' . ($transform_function != $default_function ? $transform_function($row[$pointer], $transform_options, $meta) : $transform_function($row[$pointer], array(), $meta)) . '</a>';
}
} else {
$vertical_display['data'][$row_no][$i] .= $transform_function != $default_function ? $transform_function($row[$pointer], $transform_options, $meta) : $transform_function($row[$pointer], array(), $meta);
}
$vertical_display['data'][$row_no][$i] .= '</td>' . "\n";
} else {
$vertical_display['data'][$row_no][$i] = ' <td align="right" ' . $column_style . ' valign="top" bgcolor="' . $bgcolor . '" nowrap="nowrap"> </td>' . "\n";
}
}
// b l o b
} else {
if ($GLOBALS['cfg']['ShowBlob'] == FALSE && stristr($meta->type, 'BLOB')) {
// loic1 : PMA_mysql_fetch_fields returns BLOB in place of
// TEXT fields type, however TEXT fields must be displayed
// even if $cfg['ShowBlob'] is false -> get the true type
// of the fields.
$field_flags = PMA_mysql_field_flags($dt_result, $i);
if (stristr($field_flags, 'BINARY')) {
$blobtext = '[BLOB';
if (isset($row[$pointer])) {
$blob_size = PMA_formatByteDown(strlen($row[$pointer]), 3, 1);
$blobtext .= ' - ' . $blob_size[0] . ' ' . $blob_size[1];
unset($blob_size);
}
$blobtext .= ']';
$blobtext = $default_function != $transform_function ? $transform_function($blobtext, $transform_options, $meta) : $default_function($blobtext, array(), $meta);
$vertical_display['data'][$row_no][$i] = ' <td align="center" ' . $column_style . ' valign="top" bgcolor="' . $bgcolor . '">' . $blobtext . '</td>';
} else {
//if (!isset($row[$meta->name])
if (!isset($row[$pointer]) || function_exists('is_null') && is_null($row[$pointer])) {
$vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
} else {
if ($row[$pointer] != '') {
// garvin: if a transform function for blob is set, none of these replacements will be made
if (strlen($row[$pointer]) > $GLOBALS['cfg']['LimitChars'] && $dontlimitchars != 1) {
$row[$pointer] = substr($row[$pointer], 0, $GLOBALS['cfg']['LimitChars']) . '...';
}
// loic1: displays all space characters, 4 space
// characters for tabulations and <cr>/<lf>
$row[$pointer] = $default_function != $transform_function ? $transform_function($row[$pointer], $transform_options, $meta) : $default_function($row[$pointer], array(), $meta);
$vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '">' . $row[$pointer] . '</td>' . "\n";
} else {
$vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"> </td>' . "\n";
}
}
}
} else {
//if (!isset($row[$meta->name])
if (!isset($row[$pointer]) || function_exists('is_null') && is_null($row[$pointer])) {
$vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
} else {
if ($row[$pointer] != '') {
// loic1: support blanks in the key