本文整理汇总了PHP中PMA_formatNumber函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_formatNumber函数的具体用法?PHP PMA_formatNumber怎么用?PHP PMA_formatNumber使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_formatNumber函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_buildHtmlForDb
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);
}
示例2: PMA_generateEngineDetails
/**
* 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;
}
示例3: getPageBufferpool
/**
* 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;
}
示例4: countRecords
/**
* Counts and returns (or displays) the number of records in a table
*
* Revision 13 July 2001: Patch for limiting dump size from
* vinay@sanisoft.com & girish@sanisoft.com
*
* @param string the current database name
* @param string the current table name
* @param boolean whether to retain or to displays the result
* @param boolean whether to force an exact count
*
* @return mixed the number of records if retain is required, true else
*
* @access public
*/
function countRecords($db, $table, $ret = false, $force_exact = false)
{
$row_count = false;
if (!$force_exact) {
$row_count = PMA_DBI_fetch_value('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddslashes($table, true) . '\';', 0, 'Rows');
}
$tbl_is_view = PMA_Table::isView($db, $table);
if (false === $row_count || $row_count < $GLOBALS['cfg']['MaxExactCount']) {
if (!$tbl_is_view) {
$row_count = PMA_DBI_fetch_value('SELECT COUNT(*) FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table));
// since counting all rows of a view could be too long
} else {
// try_query because it can fail ( a VIEW was based on
// a table that no longer exists)
$result = PMA_DBI_try_query('SELECT 1 FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' LIMIT ' . $GLOBALS['cfg']['MaxExactCount'], null, PMA_DBI_QUERY_STORE);
if (!PMA_DBI_getError()) {
$row_count = PMA_DBI_num_rows($result);
PMA_DBI_free_result($result);
}
}
}
if ($ret) {
return $row_count;
}
/**
* @deprecated at the moment nowhere is $return = false used
*/
// Note: as of PMA 2.8.0, we no longer seem to be using
// PMA_Table::countRecords() in display mode.
echo PMA_formatNumber($row_count, 0);
if ($tbl_is_view) {
echo ' ' . sprintf($GLOBALS['strViewMaxExactCount'], $GLOBALS['cfg']['MaxExactCount'], '[a@./Documentation.html#cfg_MaxExactCount@_blank]', '[/a]');
}
}
示例5: getPageBufferpool
/**
* returns html tables with stats over inno db buffer pool
*
* @uses PMA_MYSQL_INT_VERSION
* @uses PMA_DBI_fetch_result()
* @uses PMA_formatNumber()
* @uses PMA_formatByteDown()
* @uses $GLOBALS['strBufferPoolUsage']
* @uses $GLOBALS['strTotalUC']
* @uses $GLOBALS['strInnoDBPages']
* @uses $GLOBALS['strFreePages']
* @uses $GLOBALS['strDirtyPages']
* @uses $GLOBALS['strDataPages']
* @uses $GLOBALS['strPagesToBeFlushed']
* @uses $GLOBALS['strBusyPages']
* @uses $GLOBALS['strLatchedPages']
* @uses $GLOBALS['strBufferPoolActivity']
* @uses $GLOBALS['strReadRequests']
* @uses $GLOBALS['strWriteRequests']
* @uses $GLOBALS['strBufferReadMisses']
* @uses $GLOBALS['strBufferWriteWaits']
* @uses $GLOBALS['strBufferReadMissesInPercent']
* @uses $GLOBALS['strBufferWriteWaitsInPercent']
* @uses join()
* @uses htmlspecialchars()
* @uses PMA_formatNumber()
* @return string html table with stats
*/
function getPageBufferpool()
{
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. :-)
$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" . ' ' . $GLOBALS['strBufferPoolUsage'] . "\n" . ' </caption>' . "\n" . ' <tfoot>' . "\n" . ' <tr>' . "\n" . ' <th colspan="2">' . "\n" . ' ' . $GLOBALS['strTotalUC'] . "\n" . ' : ' . PMA_formatNumber($status['Innodb_buffer_pool_pages_total'], 0) . ' ' . $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 class="odd">' . "\n" . ' <th>' . $GLOBALS['strFreePages'] . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_free'], 0) . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . $GLOBALS['strDirtyPages'] . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_dirty'], 0) . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . $GLOBALS['strDataPages'] . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_data'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . $GLOBALS['strPagesToBeFlushed'] . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_flushed'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . $GLOBALS['strBusyPages'] . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_misc'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . $GLOBALS['strLatchedPages'] . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_latched'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' </tbody>' . "\n" . '</table>' . "\n\n" . '<table class="data" id="table_innodb_bufferpool_activity">' . "\n" . ' <caption class="tblHeaders">' . "\n" . ' ' . $GLOBALS['strBufferPoolActivity'] . "\n" . ' </caption>' . "\n" . ' <tbody>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . $GLOBALS['strReadRequests'] . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_read_requests'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . $GLOBALS['strWriteRequests'] . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_write_requests'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . $GLOBALS['strBufferReadMisses'] . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_reads'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . $GLOBALS['strBufferWriteWaits'] . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_wait_free'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . $GLOBALS['strBufferReadMissesInPercent'] . '</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>' . $GLOBALS['strBufferWriteWaitsInPercent'] . '</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;
}
示例6: ucfirst
if (isset($showtable['Data_length']) && $showtable['Rows'] > 0 && $mergetable == false) {
?>
<tr>
<td><?php echo ucfirst($strRowSize); ?> ø</td>
<td align="right">
<?php echo $avg_size . ' ' . $avg_unit . "\n"; ?>
</td>
</tr>
<?php
}
if (isset($showtable['Auto_increment'])) {
?>
<tr>
<td><?php echo ucfirst($strNext); ?> Autoindex</td>
<td align="right">
<?php echo PMA_formatNumber($showtable['Auto_increment'], 0) . "\n"; ?>
</td>
</tr>
<?php
}
if (isset($showtable['Create_time'])) {
?>
<tr>
<td><?php echo $strStatCreateTime; ?></td>
<td align="right">
<?php echo PMA_localisedDate(strtotime($showtable['Create_time'])) . "\n"; ?>
</td>
</tr>
<?php
}
if (isset($showtable['Update_time'])) {
示例7: sprintf
</tbody>
<tbody>
<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) - rajk
if ($num_tables == 0)
$tableReductionCount = 0;
echo sprintf($strTables, PMA_formatNumber($num_tables - $tableReductionCount, 0));
?>
</th>
<th colspan="<?php echo ($db_is_information_schema ? 3 : 6) ?>" align="center">
<?php echo $strSum; ?></th>
<th class="value"><?php echo $sum_row_count_pre . PMA_formatNumber($sum_entries, 0); ?></th>
<?php
if (!($cfg['PropertiesNumColumns'] > 1)) {
$default_engine = PMA_DBI_get_default_engine();
echo ' <th align="center">' . "\n"
. ' <dfn title="'
. sprintf($strDefaultEngine, $default_engine) . '">' .$default_engine . '</dfn></th>' . "\n";
// we got a case where $db_collation was empty
echo ' <th align="center">' . "\n";
if (! empty($db_collation)) {
echo ' <dfn title="'
. PMA_getCollationDescr($db_collation) . ' (' . $strDefault . ')">' . $db_collation
. '</dfn>';
}
echo '</th>';
}
示例8: echo
</td>
</tr>
<?php
}
if (isset($showtable['Auto_increment'])) {
?>
<tr class="<?php
echo ($odd_row = !$odd_row) ? 'odd' : 'even';
?>
">
<th class="name"><?php
echo $strNext;
?>
Autoindex</th>
<td class="value"><?php
echo PMA_formatNumber($showtable['Auto_increment'], 0);
?>
</td>
</tr>
<?php
}
if (isset($showtable['Create_time'])) {
?>
<tr class="<?php
echo ($odd_row = !$odd_row) ? 'odd' : 'even';
?>
">
<th class="name"><?php
echo $strStatCreateTime;
?>
</th>
示例9: __
</th>
<?php
if ($server_slave_status) {
echo ' <th>' . __('Replication') . '</th>' . "\n";
}
?>
<th colspan="<?php
echo $db_is_information_schema ? 3 : 6;
?>
" align="center">
<?php
echo __('Sum');
?>
</th>
<th class="value tbl_rows"><?php
echo $sum_row_count_pre . PMA_formatNumber($sum_entries, 0);
?>
</th>
<?php
if (!($cfg['PropertiesNumColumns'] > 1)) {
$default_engine = PMA_DBI_get_default_engine();
echo ' <th align="center">' . "\n" . ' <dfn title="' . sprintf(__('%s is the default storage engine on this MySQL server.'), $default_engine) . '">' . $default_engine . '</dfn></th>' . "\n";
// we got a case where $db_collation was empty
echo ' <th align="center">' . "\n";
if (!empty($db_collation)) {
echo ' <dfn title="' . PMA_getCollationDescr($db_collation) . ' (' . __('Default') . ')">' . $db_collation . '</dfn>';
}
echo '</th>';
}
if ($is_show_stats) {
?>
示例10: PMA_displayTableList
//.........这里部分代码省略.........
* @global string html code for self link
* @param array $tables array of tables/tablegroups
* @param boolean $visible whether the list is visible or not
* @param string $tab_group_full full tab group name
* @param string $table_db db of this table
*/
function PMA_displayTableList($tables, $visible = false, $tab_group_full = '', $table_db = '')
{
if (!is_array($tables) || count($tables) === 0) {
return;
}
global $element_counter, $img_minus, $img_plus, $href_left;
$sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
if ($visible) {
echo '<ul id="subel' . $element_counter . '">';
} else {
echo '<ul id="subel' . $element_counter . '" style="display: none">';
}
foreach ($tables as $group => $table) {
// only allow grouping if the group has more than 1 table
if (isset($table['is' . $sep . 'group']) && $table['tab' . $sep . 'count'] > 1) {
$common_url_query = $GLOBALS['common_url_query'] . '&tbl_group=' . urlencode($tab_group_full . $group);
$element_counter++;
echo '<li>' . "\n";
if ($visible && (isset($_REQUEST['tbl_group']) && (strpos($_REQUEST['tbl_group'], $group) === 0 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false) || strpos($GLOBALS['table'], $group) === 0)) {
printf($href_left, $element_counter, $GLOBALS['common_url_query'] . '&tbl_group=' . $tab_group_full);
printf($img_minus, $element_counter);
} else {
printf($href_left, $element_counter, $common_url_query);
printf($img_plus, $element_counter);
}
echo '</a>';
?>
<a href="index.php?<?php
echo $common_url_query;
?>
"
target="_parent"
onclick="
if (! toggle('<?php
echo $element_counter;
?>
', true))
window.parent.goTo('./navigation.php?<?php
echo $common_url_query;
?>
');
window.parent.goTo('./<?php
echo $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $common_url_query;
?>
', 'main');
return false;">
<?php
if ($GLOBALS['text_dir'] === 'rtl') {
echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
}
echo htmlspecialchars(substr($group, 0, strlen($group) - strlen($sep)));
if ($GLOBALS['text_dir'] === 'ltr') {
echo ' <bdo dir="ltr">(' . $table['tab' . $sep . 'count'] . ')</bdo> ';
}
?>
</a>
<?php
unset($table['is' . $sep . 'group']);
unset($table['tab' . $sep . 'group']);
unset($table['tab' . $sep . 'count']);
if ($visible && (isset($_REQUEST['tbl_group']) && (strpos($_REQUEST['tbl_group'], $group) === 0 || strpos($_REQUEST['tbl_group'], $sep . $group) !== false) || strpos($GLOBALS['table'], $group) === 0)) {
PMA_displayTableList($table, true, $tab_group_full . $group, $table_db);
} else {
PMA_displayTableList($table, false, '', $table_db);
}
echo '</li>' . "\n";
} elseif (is_array($table)) {
// the table was not grouped because it is the only one with its prefix
if (isset($table['is' . $sep . 'group'])) {
// get the array with the actual table information
foreach ($table as $value) {
if (is_array($value)) {
$table = $value;
}
}
}
$link_title = PMA_getTitleForTarget($GLOBALS['cfg']['LeftDefaultTabTable']);
// quick access icon next to each table name
echo '<li>' . "\n";
echo '<a title="' . htmlspecialchars($link_title) . ': ' . htmlspecialchars($table['Comment']) . ' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows'] . ')"' . ' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"' . ' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?' . $GLOBALS['common_url_query'] . '&table=' . urlencode($table['Name']) . '&goto=' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '" >' . '<img class="icon"';
if ('VIEW' === strtoupper($table['Comment'])) {
echo ' src="' . $GLOBALS['pmaThemeImage'] . 's_views.png"';
} else {
echo ' src="' . $GLOBALS['pmaThemeImage'] . 'b_sbrowse.png"';
}
echo ' id="icon_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"' . ' width="10" height="10" alt="' . htmlspecialchars($link_title) . '" /></a>' . "\n";
// link for the table name itself
$href = $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['common_url_query'] . '&table=' . urlencode($table['Name']) . '&pos=0';
echo '<a href="' . $href . '" title="' . htmlspecialchars(PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment'] . ' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . $GLOBALS['strRows']) . ')"' . ' id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">' . str_replace(' ', ' ', htmlspecialchars($table['disp_name'])) . '</a>';
echo '</li>' . "\n";
}
}
echo '</ul>';
}
示例11: PMA_showMessage
/**
* Displays a message at the top of the "main" (right) frame
*
* @param string the message to display
*
* @global array the configuration array
*
* @access public
*/
function PMA_showMessage($message)
{
global $cfg;
// Sanitizes $message
$message = PMA_sanitize($message);
// Corrects the tooltip text via JS if required
if (isset($GLOBALS['table']) && strlen($GLOBALS['table']) && $cfg['ShowTooltip']) {
$result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], true) . '\'');
if ($result) {
$tbl_status = PMA_DBI_fetch_assoc($result);
$tooltip = empty($tbl_status['Comment']) ? '' : $tbl_status['Comment'] . ' ';
$tooltip .= '(' . PMA_formatNumber($tbl_status['Rows'], 0) . ' ' . $GLOBALS['strRows'] . ')';
PMA_DBI_free_result($result);
$uni_tbl = PMA_jsFormat($GLOBALS['db'] . '.' . $GLOBALS['table'], false);
echo "\n";
?>
<script type="text/javascript" language="javascript">
//<![CDATA[
window.parent.updateTableTitle('<?php
echo $uni_tbl;
?>
', '<?php
echo PMA_jsFormat($tooltip, false);
?>
');
//]]>
</script>
<?php
}
// end if
}
// end if ... elseif
// Checks if the table needs to be repaired after a TRUNCATE query.
if (isset($GLOBALS['table']) && isset($GLOBALS['sql_query']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
if (!isset($tbl_status)) {
$result = @PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], true) . '\'');
if ($result) {
$tbl_status = PMA_DBI_fetch_assoc($result);
PMA_DBI_free_result($result);
}
}
if (isset($tbl_status) && (int) $tbl_status['Index_length'] > 1024) {
PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
}
}
unset($tbl_status);
?>
<br />
<div align="<?php
echo $GLOBALS['cell_align_left'];
?>
">
<?php
if (!empty($GLOBALS['show_error_header'])) {
?>
<div class="error">
<h1><?php
echo $GLOBALS['strError'];
?>
</h1>
<?php
}
echo $message;
if (isset($GLOBALS['special_message'])) {
echo PMA_sanitize($GLOBALS['special_message']);
unset($GLOBALS['special_message']);
}
if (!empty($GLOBALS['show_error_header'])) {
echo '</div>';
}
if ($cfg['ShowSQL'] == true && (!empty($GLOBALS['sql_query']) || !empty($GLOBALS['display_query']))) {
$local_query = !empty($GLOBALS['display_query']) ? $GLOBALS['display_query'] : ($cfg['SQP']['fmtType'] == 'none' && isset($GLOBALS['unparsed_sql']) && $GLOBALS['unparsed_sql'] != '' ? $GLOBALS['unparsed_sql'] : $GLOBALS['sql_query']);
// Basic url query part
$url_qpart = '?' . PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', isset($GLOBALS['table']) ? $GLOBALS['table'] : '');
// Html format the query to be displayed
// The nl2br function isn't used because its result isn't a valid
// xhtml1.0 statement before php4.0.5 ("<br>" and not "<br />")
// If we want to show some sql code it is easiest to create it here
/* SQL-Parser-Analyzer */
if (!empty($GLOBALS['show_as_php'])) {
$new_line = '\'<br />' . "\n" . ' . \' ';
}
if (isset($new_line)) {
/* SQL-Parser-Analyzer */
$query_base = PMA_sqlAddslashes(htmlspecialchars($local_query), false, false, true);
/* SQL-Parser-Analyzer */
$query_base = preg_replace("@((\r\n)|(\r)|(\n))+@", $new_line, $query_base);
} else {
$query_base = $local_query;
}
// Parse SQL if needed
//.........这里部分代码省略.........
示例12: implode
<noscript>
<input type="submit" value="<?php
echo $strGo;
?>
" />
</noscript>
<?php
echo implode("\n", $hidden_fields) . "\n";
?>
</div>
</form>
<?php
// Notice about row count for views
if ($at_least_one_view_exceeds_max_count && !$db_is_information_schema) {
echo '<div class="notice">' . "\n";
echo '<sup>1</sup>' . PMA_sanitize(sprintf($strViewMaxExactCount, PMA_formatNumber($cfg['MaxExactCountViews'], 0), '[a@./Documentation.html#cfg_MaxExactCountViews@_blank]', '[/a]')) . "\n";
echo '</div>' . "\n";
}
// display again the table list navigator
PMA_listNavigator($total_num_tables, $pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList']);
?>
<hr />
<?php
// Routines
require './libraries/db_routines.inc.php';
/**
* Work on the database
* redesigned 2004-05-08 by mkkeck
*/
/* DATABASE WORK */
示例13: PMA_showMessage
/**
* displays the message and the query
* usually the message is the result of the query executed
*
* @param string $message the message to display
* @param string $sql_query the query to display
* @global array the configuration array
* @uses $GLOBALS['cfg']
* @access public
*/
function PMA_showMessage($message, $sql_query = null)
{
global $cfg;
if (null === $sql_query) {
if (!empty($GLOBALS['display_query'])) {
$sql_query = $GLOBALS['display_query'];
} elseif ($cfg['SQP']['fmtType'] == 'none' && !empty($GLOBALS['unparsed_sql'])) {
$sql_query = $GLOBALS['unparsed_sql'];
// could be empty, for example export + save on server
} elseif (!empty($GLOBALS['sql_query'])) {
$sql_query = $GLOBALS['sql_query'];
} else {
$sql_query = '';
}
}
// Corrects the tooltip text via JS if required
// @todo this is REALLY the wrong place to do this - very unexpected here
if (isset($GLOBALS['table']) && strlen($GLOBALS['table']) && $cfg['ShowTooltip']) {
$result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], true) . '\'');
if ($result) {
$tbl_status = PMA_DBI_fetch_assoc($result);
$tooltip = empty($tbl_status['Comment']) ? '' : $tbl_status['Comment'] . ' ';
$tooltip .= '(' . PMA_formatNumber($tbl_status['Rows'], 0) . ' ' . $GLOBALS['strRows'] . ')';
PMA_DBI_free_result($result);
$uni_tbl = PMA_jsFormat($GLOBALS['db'] . '.' . $GLOBALS['table'], false);
echo "\n";
echo '<script type="text/javascript" language="javascript">' . "\n";
echo '//<![CDATA[' . "\n";
echo "window.parent.updateTableTitle('" . $uni_tbl . "', '" . PMA_jsFormat($tooltip, false) . "');" . "\n";
echo '//]]>' . "\n";
echo '</script>' . "\n";
}
// end if
}
// end if ... elseif
// Checks if the table needs to be repaired after a TRUNCATE query.
// @todo this should only be done if isset($GLOBALS['sql_query']), what about $GLOBALS['display_query']???
// @todo this is REALLY the wrong place to do this - very unexpected here
if (isset($GLOBALS['table']) && isset($GLOBALS['sql_query']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
if (!isset($tbl_status)) {
$result = @PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], true) . '\'');
if ($result) {
$tbl_status = PMA_DBI_fetch_assoc($result);
PMA_DBI_free_result($result);
}
}
if (isset($tbl_status) && (int) $tbl_status['Index_length'] > 1024) {
PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
}
}
unset($tbl_status);
echo '<br />' . "\n";
echo '<div align="' . $GLOBALS['cell_align_left'] . '">' . "\n";
if (!empty($GLOBALS['show_error_header'])) {
echo '<div class="error">' . "\n";
echo '<h1>' . $GLOBALS['strError'] . '</h1>' . "\n";
}
echo '<div class="notice">';
echo PMA_sanitize($message);
if (isset($GLOBALS['special_message'])) {
echo PMA_sanitize($GLOBALS['special_message']);
unset($GLOBALS['special_message']);
}
echo '</div>';
if (!empty($GLOBALS['show_error_header'])) {
echo '</div>';
}
if ($cfg['ShowSQL'] == true && !empty($sql_query)) {
// Basic url query part
$url_qpart = '?' . PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', isset($GLOBALS['table']) ? $GLOBALS['table'] : '');
// Html format the query to be displayed
// The nl2br function isn't used because its result isn't a valid
// xhtml1.0 statement before php4.0.5 ("<br>" and not "<br />")
// If we want to show some sql code it is easiest to create it here
/* SQL-Parser-Analyzer */
if (!empty($GLOBALS['show_as_php'])) {
$new_line = '\'<br />' . "\n" . ' . \' ';
}
if (isset($new_line)) {
/* SQL-Parser-Analyzer */
$query_base = PMA_sqlAddslashes(htmlspecialchars($sql_query), false, false, true);
/* SQL-Parser-Analyzer */
$query_base = preg_replace("@((\r\n)|(\r)|(\n))+@", $new_line, $query_base);
} else {
$query_base = $sql_query;
}
$max_characters = 1000;
if (!defined('PMA_QUERY_TOO_BIG') && strlen($query_base) > $max_characters) {
define('PMA_QUERY_TOO_BIG', 1);
$query_base = nl2br(htmlspecialchars($sql_query));
//.........这里部分代码省略.........
示例14: getHtmlVariables
/**
* returns as HTML table of the engine's server variables
*
* @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 = $this->resolveTypeSize($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" . ' ' . __('There is no detailed status information available for this storage engine.') . "\n" . '</p>' . "\n";
} else {
$ret = '<table class="data">' . "\n" . $ret . '</table>' . "\n";
}
return $ret;
}
示例15: sprintf
}
?>
</td>
</tr>
<?php
}
?>
<tr>
<th align="center">
<?php
echo sprintf(_ngettext('%s table', '%s tables', $num_tables), PMA_formatNumber($num_tables, 0));
?>
</th>
<th align="right" nowrap="nowrap">
<?php
echo PMA_formatNumber($sum_entries, 0);
?>
</th>
<th align="center">
--
</th>
<?php
if ($cfg['ShowStats']) {
list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
?>
<th align="right" nowrap="nowrap">
<?php
echo $sum_formated . ' ' . $unit;
?>
</th>
<?php