From e1b074082a3edbb1aae4bc9a026f4717526ac015 Mon Sep 17 00:00:00 2001 From: Alick Zhao Date: Sat, 10 Dec 2011 18:15:04 +0900 Subject: [PATCH] index.php: simplify format_size() SEE also Issue149 --- index.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/index.php b/index.php index a26b32c..76e6366 100644 --- a/index.php +++ b/index.php @@ -145,16 +145,7 @@ function initialize_status($status_file, $ftp3_status_file) function format_size($size) { - $size = explode(' ', $size); - if ($size[0] === 'na') { - return 'na'; - } - $size = (float)$size[0]; - $size /= 1048576; - if ($size <= 1000) - return sprintf("%.2f MB", $size); - $size /= 1024; - return sprintf("%.2f GB", $size); + return str_replace(' bytes', 'B', $size); } ?>