diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2011-12-13 10:35:10 +0100 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2011-12-13 10:35:10 +0100 |
commit | ec12dec10688490b7ecdce3d305f1436cdf59675 (patch) | |
tree | 6bbc3be6230a0f685cc28dd47942e54fdcfc587f | |
parent | d55e689261314b3eae88f1477a3887adec361df1 (diff) | |
parent | 5e711f37ca3f009317a3c8cd0e47ed4f15922142 (diff) | |
download | nextcloud-server-ec12dec10688490b7ecdce3d305f1436cdf59675.tar.gz nextcloud-server-ec12dec10688490b7ecdce3d305f1436cdf59675.zip |
Merge git://gitorious.org/owncloud/owncloud into tanghus_remote_backup
-rw-r--r-- | lib/helper.php | 25 | ||||
-rw-r--r-- | settings/ajax/setquota.php | 2 | ||||
-rw-r--r-- | settings/js/users.js | 7 |
3 files changed, 19 insertions, 15 deletions
diff --git a/lib/helper.php b/lib/helper.php index 5b3e394cafd..24d436225b7 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -160,24 +160,25 @@ class OC_Helper { */ public static function computerFileSize( $str ){ $bytes = 0; + $str=strtolower($str); $bytes_array = array( - 'B' => 1, - 'K' => 1024, - 'KB' => 1024, - 'MB' => 1024 * 1024, - 'M' => 1024 * 1024, - 'GB' => 1024 * 1024 * 1024, - 'G' => 1024 * 1024 * 1024, - 'TB' => 1024 * 1024 * 1024 * 1024, - 'T' => 1024 * 1024 * 1024 * 1024, - 'PB' => 1024 * 1024 * 1024 * 1024 * 1024, - 'P' => 1024 * 1024 * 1024 * 1024 * 1024, + 'b' => 1, + 'k' => 1024, + 'kb' => 1024, + 'mb' => 1024 * 1024, + 'm' => 1024 * 1024, + 'gb' => 1024 * 1024 * 1024, + 'g' => 1024 * 1024 * 1024, + 'tb' => 1024 * 1024 * 1024 * 1024, + 't' => 1024 * 1024 * 1024 * 1024, + 'pb' => 1024 * 1024 * 1024 * 1024 * 1024, + 'p' => 1024 * 1024 * 1024 * 1024 * 1024, ); $bytes = floatval($str); - if (preg_match('#([KMGTP]?B?)$#si', $str, $matches) && !empty($bytes_array[$matches[1]])) { + if (preg_match('#([kmgtp]?b?)$#si', $str, $matches) && !empty($bytes_array[$matches[1]])) { $bytes *= $bytes_array[$matches[1]]; } diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php index edbf5b74516..5c07285cfca 100644 --- a/settings/ajax/setquota.php +++ b/settings/ajax/setquota.php @@ -10,6 +10,6 @@ $quota= OC_Helper::computerFileSize($_POST["quota"]); // Return Success story OC_Preferences::setValue($username,'files','quota',$quota); -OC_JSON::success(array("data" => array( "username" => $username ,'quota'=>$quota))); +OC_JSON::success(array("data" => array( "username" => $username ,'quota'=>OC_Helper::humanFileSize($quota)))); ?> diff --git a/settings/js/users.js b/settings/js/users.js index 684fee21c64..4fea52e4a1f 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -101,8 +101,11 @@ $(document).ready(function(){ if($(this).val().length>0){ $.post( OC.filePath('settings','ajax','setquota.php'), - {username:uid,quota:$(this).val()}, - function(result){} + {username:uid,quota:$(this).val()}, + function(result){ + img.parent().children('span').text(result.data.quota) + $(this).parent().attr('data-quota',result.data.quota); + } ); input.blur(); }else{ |