Merge branch 'master' of gitorious.org:owncloud/owncloud into ace-editor
This commit is contained in:
commit
6cef214b66
|
@ -88,7 +88,7 @@ else {
|
|||
if(defined("DEBUG") && DEBUG) {
|
||||
OC_Log::write('core','Setting remember login to cookie',OC_Log::DEBUG);
|
||||
}
|
||||
$token = md5($_POST["user"].time());
|
||||
$token = md5($_POST["user"].time().$_POST['password']);
|
||||
OC_Preferences::setValue($_POST['user'], 'login', 'token', $token);
|
||||
OC_User::setMagicInCookie($_POST["user"], $token);
|
||||
}
|
||||
|
|
|
@ -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]];
|
||||
}
|
||||
|
||||
|
|
|
@ -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))));
|
||||
|
||||
?>
|
||||
|
|
|
@ -102,7 +102,10 @@ $(document).ready(function(){
|
|||
$.post(
|
||||
OC.filePath('settings','ajax','setquota.php'),
|
||||
{username:uid,quota:$(this).val()},
|
||||
function(result){}
|
||||
function(result){
|
||||
img.parent().children('span').text(result.data.quota)
|
||||
$(this).parent().attr('data-quota',result.data.quota);
|
||||
}
|
||||
);
|
||||
input.blur();
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue