Changeset 4640 in subversion


Ignore:
Timestamp:
Apr 11, 2011 7:00:30 AM (2 years ago)
Author:
alec
Message:
  • Fix so 1024 bytes is displayed as 1KB, the same for MB and GB
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_shared.inc

    r4639 r4640  
    181181  return floatval($bytes); 
    182182} 
    183      
     183 
    184184/** 
    185185 * Create a human readable string for a number of bytes 
     
    190190function show_bytes($bytes) 
    191191{ 
    192   if ($bytes > 1073741824) 
     192  if ($bytes >= 1073741824) 
    193193  { 
    194194    $gb = $bytes/1073741824; 
    195195    $str = sprintf($gb>=10 ? "%d " : "%.1f ", $gb) . rcube_label('GB'); 
    196196  } 
    197   else if ($bytes > 1048576) 
     197  else if ($bytes >= 1048576) 
    198198  { 
    199199    $mb = $bytes/1048576; 
    200200    $str = sprintf($mb>=10 ? "%d " : "%.1f ", $mb) . rcube_label('MB'); 
    201201  } 
    202   else if ($bytes > 1024) 
     202  else if ($bytes >= 1024) 
    203203    $str = sprintf("%d ",  round($bytes/1024)) . rcube_label('KB'); 
    204204  else 
     
    207207  return $str; 
    208208} 
    209  
    210209 
    211210/** 
Note: See TracChangeset for help on using the changeset viewer.