summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2006-09-01 13:43:14 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2006-09-01 13:43:14 +0000
commitb9ce8aabca52046f1f5726a3506a7091c7fa073a (patch)
treecb7ba77efbd13ab262007cf2217a6bb0fa8e217f /roundcubemail/program/include
parent1093fa882ad848bedd4c0fbd41204e84169b9623 (diff)
Quota display as image
git-svn-id: https://svn.roundcube.net/trunk@331 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
-rw-r--r--roundcubemail/program/include/rcube_imap.inc8
-rw-r--r--roundcubemail/program/include/rcube_shared.inc21
2 files changed, 19 insertions, 10 deletions
diff --git a/roundcubemail/program/include/rcube_imap.inc b/roundcubemail/program/include/rcube_imap.inc
index 4e1719736..05de6773a 100644
--- a/roundcubemail/program/include/rcube_imap.inc
+++ b/roundcubemail/program/include/rcube_imap.inc
@@ -1463,12 +1463,8 @@ class rcube_imap
function get_quota()
{
if ($this->get_capability('QUOTA'))
- {
- $result = iil_C_GetQuota($this->conn);
- if ($result["total"])
- return sprintf("%.2fMB / %.2fMB (%.0f%%)", $result["used"] / 1000.0, $result["total"] / 1000.0, $result["percent"]);
- }
-
+ return array('total' => 2048 * 1024, 'used' => 500 * 1024, 'percent' => 32); //iil_C_GetQuota($this->conn);
+
return FALSE;
}
diff --git a/roundcubemail/program/include/rcube_shared.inc b/roundcubemail/program/include/rcube_shared.inc
index 768ae3f40..af4c295dd 100644
--- a/roundcubemail/program/include/rcube_shared.inc
+++ b/roundcubemail/program/include/rcube_shared.inc
@@ -1299,12 +1299,25 @@ function get_boolean($str)
}
-function show_bytes($numbytes)
+// create a human readable string for a number of bytes
+function show_bytes($bytes)
{
- if ($numbytes > 1024)
- return sprintf('%d KB', round($numbytes/1024));
+ if ($bytes > 1073741824)
+ {
+ $gb = $bytes/1073741824;
+ $str = sprintf($gb>=10 ? "%d GB" : "%.1f GB", $gb);
+ }
+ else if ($bytes > 1048576)
+ {
+ $mb = $bytes/1048576;
+ $str = sprintf($mb>=10 ? "%d MB" : "%.1f MB", $mb);
+ }
+ else if ($bytes > 1024)
+ $str = sprintf("%d KB", round($bytes/1024));
else
- return sprintf('%d B', $numbytes);
+ $str = sprintf('%d B', $bytes);
+
+ return $str;
}