summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-01-05 14:10:37 +0000
committeralecpl <alec@alec.pl>2010-01-05 14:10:37 +0000
commit892af478694f19d292769a02fe2820736bd29508 (patch)
treefd0c48857918b3eaedf0f0d3c04cb465aa2d77da
parentc3b676381bfca2a7909562c628eb06a9fbf3814d (diff)
- Support show_bytes() output in parse_bytes() (#1486405)
-rw-r--r--program/include/rcube_shared.inc7
1 files changed, 5 insertions, 2 deletions
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index fbab455c6..278f5a106 100644
--- a/program/include/rcube_shared.inc
+++ b/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;
}