patch #1749705, Allow multibyte characters in number formatting, thanks to garas
This commit is contained in:
@@ -75,6 +75,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
|
||||
$cfg['MaxCharactersInDisplayedSQL']
|
||||
- bug #1746186 LeftLogoLink fails if set to some external site
|
||||
. [transformations]: remove "auto-detect" MIME-type that was never implemented
|
||||
+ [display] patch #1749705, Allow multibyte characters in number formatting,
|
||||
thanks to garas
|
||||
|
||||
2.10.3.0 (not yet released)
|
||||
|
||||
|
@@ -135,9 +135,9 @@ else {
|
||||
<td align="right">
|
||||
<?php
|
||||
if ($merged_size) {
|
||||
echo '<i>' . number_format($sts_data['TABLE_ROWS'], 0, $number_decimal_separator, $number_thousands_separator) . '</i>' . "\n";
|
||||
echo '<i>' . PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . '</i>' . "\n";
|
||||
} else {
|
||||
echo number_format($sts_data['TABLE_ROWS'], 0, $number_decimal_separator, $number_thousands_separator) . "\n";
|
||||
echo PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . "\n";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
@@ -218,10 +218,10 @@ else {
|
||||
?>
|
||||
<tr>
|
||||
<th align="center">
|
||||
<?php echo sprintf($strTables, number_format($num_tables, 0, $number_decimal_separator, $number_thousands_separator)); ?>
|
||||
<?php echo sprintf($strTables, PMA_formatNumber($num_tables, 0)); ?>
|
||||
</th>
|
||||
<th align="right" nowrap="nowrap">
|
||||
<?php echo number_format($sum_entries, 0, $number_decimal_separator, $number_thousands_separator); ?>
|
||||
<?php echo PMA_formatNumber($sum_entries, 0); ?>
|
||||
</th>
|
||||
<th align="center">
|
||||
--
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
$charset = 'iso-8859-2';
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = '.';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB');
|
||||
|
@@ -9,7 +9,7 @@
|
||||
$charset = 'utf-8';
|
||||
$allow_recoding = TRUE;
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_decimal_separator = '.';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB');
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
$charset = 'windows-1250';
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = '.';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB');
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
$charset = 'iso-8859-1';
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('tavua', 'kt', 'Mt', 'Gt', 'Tt', 'Pt', 'Et');
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
$charset = 'iso-8859-15';
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('tavua', 'kt', 'Mt', 'Gt', 'Tt', 'Pt', 'Et');
|
||||
|
@@ -9,7 +9,7 @@
|
||||
$charset = 'utf-8';
|
||||
$allow_recoding = TRUE;
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('tavua', 'kt', 'Mt', 'Gt', 'Tt', 'Pt', 'Et');
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
$charset = 'iso-8859-1';
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('o', 'Kio', 'Mio', 'Gio', 'Tio', 'Pio', 'Eio');
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
$charset = 'iso-8859-15';
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('o', 'Kio', 'Mio', 'Gio', 'Tio', 'Pio', 'Eio');
|
||||
|
@@ -4,7 +4,7 @@
|
||||
$charset = 'utf-8';
|
||||
$allow_recoding = TRUE;
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('o', 'Kio', 'Mio', 'Gio', 'Tio', 'Pio', 'Eio');
|
||||
|
@@ -12,7 +12,7 @@
|
||||
$charset = 'utf-8';
|
||||
$allow_recoding = TRUE;
|
||||
$text_dir = 'ltr'; // ('ltr' for left to right, 'rtl' for right to left)
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('ბაიტი', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
$charset = 'iso-8859-2';
|
||||
$text_dir = 'ltr'; // ('ltr': balr<6C>l jobbra, 'rtl': jobbr<62>l balra)
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = '.';
|
||||
// Byte, Kilo, Mega, Giga, Tera, Peta, Exa r<>vid<69>t<EFBFBD>sei
|
||||
$byteUnits = array('B<>jt', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
@@ -6,7 +6,7 @@
|
||||
$charset = 'utf-8';
|
||||
$allow_recoding = TRUE;
|
||||
$text_dir = 'ltr'; // ('ltr': balról jobbra, 'rtl': jobbról balra)
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_decimal_separator = '.';
|
||||
// Byte, Kilo, Mega, Giga, Tera, Peta, Exa rövidítései
|
||||
$byteUnits = array('Bájt', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
@@ -8,7 +8,7 @@
|
||||
$charset = 'utf-8';
|
||||
$allow_recoding = TRUE;
|
||||
$text_dir = 'ltr'; // ('ltr' for left to right, 'rtl' for right to left)
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_decimal_separator = '.';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('baiti', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
$charset = 'windows-1257';
|
||||
$text_dir = 'ltr'; // ('ltr' for left to right, 'rtl' for right to left)
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = '.';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('baiti', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
@@ -4,8 +4,8 @@
|
||||
$charset = 'utf-8';
|
||||
$allow_recoding = TRUE;
|
||||
$text_dir = 'ltr'; // ('ltr' for left to right, 'rtl' for right to left)
|
||||
$number_thousands_separator = ',';
|
||||
$number_decimal_separator = '.';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
|
||||
$charset = 'windows-1257';
|
||||
$text_dir = 'ltr'; // ('ltr' for left to right, 'rtl' for right to left)
|
||||
$number_thousands_separator = ',';
|
||||
$number_decimal_separator = '.';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
$charset = 'iso-8859-2';
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('bajt<6A>w', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
@@ -4,7 +4,7 @@
|
||||
$charset = 'utf-8';
|
||||
$allow_recoding = TRUE;
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('bajtów', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
$charset = 'windows-1250';
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('bajt<6A>w', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
$charset = 'iso-8859-2';
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('Bajtov', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
@@ -8,7 +8,7 @@
|
||||
$charset = 'utf-8';
|
||||
$allow_recoding = TRUE;
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('Bajtov', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
$charset = 'windows-1250';
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('Bajtov', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
|
@@ -8,7 +8,7 @@
|
||||
$charset = 'iso-8859-1';
|
||||
$allow_recoding = TRUE;
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = '<EFBFBD>';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB');
|
||||
|
@@ -9,7 +9,7 @@ $charset = 'utf-8';
|
||||
$allow_recoding = TRUE;
|
||||
$allow_recoding = TRUE;
|
||||
$text_dir = 'ltr';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_thousands_separator = ' ';
|
||||
$number_decimal_separator = ',';
|
||||
// shortcuts for Byte, Kilo, Mega, Giga, Tera, Peta, Exa
|
||||
$byteUnits = array('bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB');
|
||||
|
@@ -1340,9 +1340,9 @@ function PMA_formatByteDown($value, $limes = 6, $comma = 0)
|
||||
} // end for
|
||||
|
||||
if ($unit != $GLOBALS['byteUnits'][0]) {
|
||||
$return_value = number_format($value, $comma, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator']);
|
||||
$return_value = PMA_formatNumber($value, 5, $comma);
|
||||
} else {
|
||||
$return_value = number_format($value, 0, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator']);
|
||||
$return_value = PMA_formatNumber($value, 0);
|
||||
}
|
||||
|
||||
return array($return_value, $unit);
|
||||
@@ -1378,11 +1378,11 @@ function PMA_formatByteDown($value, $limes = 6, $comma = 0)
|
||||
*/
|
||||
function PMA_formatNumber($value, $length = 3, $comma = 0, $only_down = false)
|
||||
{
|
||||
//number_format is not multibyte safe, str_replace is safe
|
||||
if ($length === 0) {
|
||||
return number_format($value,
|
||||
$comma,
|
||||
$GLOBALS['number_decimal_separator'],
|
||||
$GLOBALS['number_thousands_separator']);
|
||||
return str_replace(array(',', '.'),
|
||||
array($GLOBALS['number_thousands_separator'], $GLOBALS['number_decimal_separator']),
|
||||
number_format($value, $comma));
|
||||
}
|
||||
|
||||
// this units needs no translation, ISO
|
||||
@@ -1441,10 +1441,10 @@ function PMA_formatNumber($value, $length = 3, $comma = 0, $only_down = false)
|
||||
} // end for
|
||||
} // end if ($value >= 1) elseif (!$only_down && (float) $value !== 0.0)
|
||||
|
||||
$value = number_format($value,
|
||||
$comma,
|
||||
$GLOBALS['number_decimal_separator'],
|
||||
$GLOBALS['number_thousands_separator']);
|
||||
//number_format is not multibyte safe, str_replace is safe
|
||||
$value = str_replace(array(',', '.'),
|
||||
array($GLOBALS['number_thousands_separator'], $GLOBALS['number_decimal_separator']),
|
||||
number_format($value, $comma));
|
||||
|
||||
return $sign . $value . ' ' . $unit;
|
||||
} // end of the 'PMA_formatNumber' function
|
||||
|
@@ -154,8 +154,6 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine
|
||||
* @uses PMA_DBI_fetch_result()
|
||||
* @uses PMA_formatNumber()
|
||||
* @uses PMA_formatByteDown()
|
||||
* @uses $GLOBALS['number_decimal_separator']
|
||||
* @uses $GLOBALS['number_thousands_separator']
|
||||
* @uses $GLOBALS['strBufferPoolUsage']
|
||||
* @uses $GLOBALS['strTotalUC']
|
||||
* @uses $GLOBALS['strInnoDBPages']
|
||||
@@ -174,7 +172,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine
|
||||
* @uses $GLOBALS['strBufferWriteWaitsInPercent']
|
||||
* @uses join()
|
||||
* @uses htmlspecialchars()
|
||||
* @uses number_format()
|
||||
* @uses PMA_formatNumber()
|
||||
* @return string html table with stats
|
||||
*/
|
||||
function getPageBufferpool()
|
||||
@@ -281,7 +279,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine
|
||||
. ' <td class="value">'
|
||||
. ($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"
|
||||
: 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"
|
||||
@@ -289,7 +287,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine
|
||||
. ' <td class="value">'
|
||||
. ($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"
|
||||
: 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"
|
||||
|
@@ -450,7 +450,7 @@ foreach ($the_tables as $key => $table) {
|
||||
<tr>
|
||||
<td><?php echo ucfirst($strRows); ?></td>
|
||||
<td align="right">
|
||||
<?php echo number_format($showtable['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
|
||||
<?php echo PMA_formatNumber($showtable['Rows'], 0) . "\n"; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
@@ -460,7 +460,7 @@ foreach ($the_tables as $key => $table) {
|
||||
<tr>
|
||||
<td><?php echo ucfirst($strRowLength); ?> ø</td>
|
||||
<td>
|
||||
<?php echo number_format($showtable['Avg_row_length'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
|
||||
<?php echo PMA_formatNumber($showtable['Avg_row_length'], 0) . "\n"; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
@@ -480,7 +480,7 @@ foreach ($the_tables as $key => $table) {
|
||||
<tr>
|
||||
<td><?php echo ucfirst($strNext); ?> Autoindex</td>
|
||||
<td align="right">
|
||||
<?php echo number_format($showtable['Auto_increment'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
|
||||
<?php echo PMA_formatNumber($showtable['Auto_increment'], 0) . "\n"; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
Reference in New Issue
Block a user