mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
checkQuota() now takes the user as an argument
This commit is contained in:
parent
1f5b44a654
commit
6e8af30e17
|
@ -404,15 +404,20 @@ function checkFormKey($formid='', $method='POST') { /* {{{ */
|
|||
* @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;
|
||||
function checkQuota($user) { /* {{{ */
|
||||
global $settings, $dms;
|
||||
|
||||
/* check if quota is turn off system wide */
|
||||
if($settings->_quota == 0)
|
||||
return true;
|
||||
|
||||
$quota = 0;
|
||||
$uquota = $user->getQuota();
|
||||
if($uquota > 0)
|
||||
$quota = $uquota;
|
||||
elseif($settings->_quota > 0)
|
||||
elseif($settings->_quota > 0) {
|
||||
$quota = $settings->_quota;
|
||||
}
|
||||
|
||||
if($quota == 0)
|
||||
return true;
|
||||
|
|
|
@ -38,9 +38,11 @@ if ($folder->getAccessMode($user) < M_READWRITE) {
|
|||
UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
$remain = checkQuota();
|
||||
if ($remain < 0) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("quota_exceeded", array('bytes'=>SeedDMS_Core_File::format_filesize(abs($remain)))));
|
||||
if($settings->_quota > 0) {
|
||||
$remain = checkQuota($user);
|
||||
if ($remain < 0) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("quota_exceeded", array('bytes'=>SeedDMS_Core_File::format_filesize(abs($remain)))));
|
||||
}
|
||||
}
|
||||
|
||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
|
|
|
@ -38,9 +38,11 @@ if ($document->getAccessMode($user) < M_READWRITE) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
$remain = checkQuota();
|
||||
if ($remain < 0) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("quota_exceeded", array('bytes'=>SeedDMS_Core_File::format_filesize(abs($remain)))));
|
||||
if($settings->_quota > 0) {
|
||||
$remain = checkQuota($user);
|
||||
if ($remain < 0) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("quota_exceeded", array('bytes'=>SeedDMS_Core_File::format_filesize(abs($remain)))));
|
||||
}
|
||||
}
|
||||
|
||||
$folder = $document->getFolder();
|
||||
|
|
Loading…
Reference in New Issue
Block a user