1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-16 13:44:12 +02:00

Merge PR #1074 branch 'bantu/ticket/11192' into develop-olympus

* bantu/ticket/11192:
  [ticket/11192] Merge dataProvider arrays because the test is the same now.
  [ticket/11192] Update $value parameter description to support other types.
  [ticket/11192] Mark negative byte numbers as unsupported.
  [ticket/11192] Test strings not converted to int/float before.
  [ticket/11192] Also test strings, e.g. sums returned by the database.
  [ticket/11192] Also test powers of 10 / 1000.
  [ticket/11192] Add tests.
  [ticket/11192] Add Tebibyte to get_formatted_filesize().
This commit is contained in:
Oleg Pudeyev
2012-11-16 10:25:06 -05:00
3 changed files with 81 additions and 1 deletions

View File

@@ -289,7 +289,8 @@ function phpbb_gmgetdate($time = false)
/**
* Return formatted string for filesizes
*
* @param int $value filesize in bytes
* @param mixed $value filesize in bytes
* (non-negative number; int, float or string)
* @param bool $string_only true if language string should be returned
* @param array $allowed_units only allow these units (data array indexes)
*
@@ -301,6 +302,12 @@ function get_formatted_filesize($value, $string_only = true, $allowed_units = fa
global $user;
$available_units = array(
'tb' => array(
'min' => 1099511627776, // pow(2, 40)
'index' => 4,
'si_unit' => 'TB',
'iec_unit' => 'TIB',
),
'gb' => array(
'min' => 1073741824, // pow(2, 30)
'index' => 3,

View File

@@ -568,9 +568,11 @@ $lang = array_merge($lang, array(
'SUBJECT' => 'Subject',
'SUBMIT' => 'Submit',
'TB' => 'TB',
'TERMS_USE' => 'Terms of use',
'TEST_CONNECTION' => 'Test connection',
'THE_TEAM' => 'The team',
'TIB' => 'TiB',
'TIME' => 'Time',
'TOO_LARGE' => 'The value you entered is too large.',