diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-01-05 14:10:37 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-01-05 14:10:37 +0000 |
| commit | bc8ad245212b3693d8a5ccf6bc6becc5024a9fd4 (patch) | |
| tree | ca03fc7c170ddacf25b2852a646966a2fd3dd476 /roundcubemail/program | |
| parent | 14d3c5e624132338f8193cb453842bc254e39873 (diff) | |
- Support show_bytes() output in parse_bytes() (#1486405)
git-svn-id: https://svn.roundcube.net/trunk@3193 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/include/rcube_shared.inc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/roundcubemail/program/include/rcube_shared.inc b/roundcubemail/program/include/rcube_shared.inc index fbab455c6..278f5a106 100644 --- a/roundcubemail/program/include/rcube_shared.inc +++ b/roundcubemail/program/include/rcube_shared.inc @@ -152,19 +152,22 @@ function parse_bytes($str) { if (is_numeric($str)) return floatval($str); - - if (preg_match('/([0-9]+)([a-z])/i', $str, $regs)) + + if (preg_match('/([0-9\.]+)\s*([a-z]*)/i', $str, $regs)) { $bytes = floatval($regs[1]); switch (strtolower($regs[2])) { case 'g': + case 'gb': $bytes *= 1073741824; break; case 'm': + case 'mb': $bytes *= 1048576; break; case 'k': + case 'kb': $bytes *= 1024; break; } |
