diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index 3bd19bb6a..4a29a4a23 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -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; diff --git a/out/out.AddDocument.php b/out/out.AddDocument.php index 08c7c7b00..9ed9b34e4 100644 --- a/out/out.AddDocument.php +++ b/out/out.AddDocument.php @@ -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'])); diff --git a/out/out.UpdateDocument.php b/out/out.UpdateDocument.php index 1ade7df67..092ca9edc 100644 --- a/out/out.UpdateDocument.php +++ b/out/out.UpdateDocument.php @@ -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();