aboutsummaryrefslogtreecommitdiffstats
path: root/settings/ajax/setquota.php
blob: e66513e54cc52c0fcf237424fcf7f47e5eb3f9f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

// Init owncloud
require_once('../../lib/base.php');

OC_JSON::checkAdminUser();

$username = $_POST["username"];

//make sure the quota is in the expected format
$quota=$_POST["quota"];
if($quota!='none' and $quota!='default'){
	$quota= OC_Helper::computerFileSize($quota);
	if($quota==0){
		$quota='default';
	}else{
		$quota=OC_Helper::humanFileSize($quota);
	}
}

// Return Success story
OC_Preferences::setValue($username,'files','quota',$quota);
OC_JSON::success(array("data" => array( "username" => $username ,'quota'=>$quota)));

?>