summaryrefslogtreecommitdiff
path: root/calculate_quota_inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'calculate_quota_inc.php')
-rw-r--r--calculate_quota_inc.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/calculate_quota_inc.php b/calculate_quota_inc.php
new file mode 100644
index 0000000..b93dba6
--- /dev/null
+++ b/calculate_quota_inc.php
@@ -0,0 +1,20 @@
+<?php
+require_once( QUOTA_PKG_PATH.'LibertyQuota.php' );
+
+$quota = new LibertyQuota();
+if( !$gBitUser->isAdmin() && !$quota->isUserUnderQuota( $gBitUser->mUserId ) ) {
+ $gBitSystem->display( 'bitpackage:quota/over_quota.tpl', tra( 'You are over your quota.' ) );
+ die;
+}
+
+if( !$gBitUser->isAdmin() ) {
+ // Prevent people from uploading more than their quota
+ $q = $quota->getUserQuota( $gBitUser->mUserId );
+ $u = $quota->getUserUsage( $gBitUser->mUserId );
+ $gBitSmarty->assign( 'quotaMessage', tra( 'Your remaining disk quota is' ).' '.round( ( $q - $u ) / 1000000, 2 ).' '.tra( 'Megabytes' ) );
+ $qMegs = round( $q / 1000000 );
+ if( $qMegs < $uploadMax ) {
+ $uploadMax = $qMegs;
+ }
+}
+?>