- added function checkQuota()

This commit is contained in:
steinm 2012-12-19 10:08:06 +00:00
parent a0cc8fb01f
commit 14334d55ae

View File

@ -47,6 +47,7 @@ function getLongReadableDate($timestamp) {
// return $string;
//}
/* Deprecated, do not use anymore */
function sanitizeString($string) { /* {{{ */
$string = (string) $string;
@ -79,6 +80,7 @@ function sanitizeString($string) { /* {{{ */
return trim($string);
} /* }}} */
/* Deprecated, do not use anymore */
function mydmsDecodeString($string) { /* {{{ */
$string = (string)$string;
@ -361,4 +363,26 @@ function checkFormKey($formid='', $method='POST') { /* {{{ */
return false;
} /* }}} */
/**
* Check disk usage of currently logged in user
*
* @return boolean/integer true if no quota is set, number of bytes until
* quota is reached. Negative values indicate a disk usage above quota.
*/
function checkQuota() { /* {{{ */
global $settings, $dms, $user;
$quota = 0;
$uquota = $user->getQuota();
if($uquota > 0)
$quota = $uquota;
elseif($settings->_quota > 0)
$quota = $settings->_quota;
if($quota == 0)
return true;
return ($quota - $user->getUsedDiskSpace());
} /* }}} */
?>