server/settings/ajax/setquota.php

25 lines
536 B
PHP
Raw Normal View History

2011-08-15 19:06:29 +00:00
<?php
// Init owncloud
require_once('../../lib/base.php');
OC_JSON::checkAdminUser();
2011-08-15 19:06:29 +00:00
$username = $_POST["username"];
//make sure the quota is in the expected format
2012-02-24 13:10:19 +00:00
$quota=$_POST["quota"];
if($quota!='none' and $quota!='default'){
$quota= OC_Helper::computerFileSize($quota);
$quota=OC_Helper::humanFileSize($quota);
}
if($quota==0){
$quota='default';
}
2011-08-15 19:06:29 +00:00
// Return Success story
OC_Preferences::setValue($username,'files','quota',$quota);
OC_JSON::success(array("data" => array( "username" => $username ,'quota'=>$quota)));
2011-08-15 19:06:29 +00:00
?>