summaryrefslogtreecommitdiff
path: root/includes/calculate_quota_inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/calculate_quota_inc.php')
-rw-r--r--includes/calculate_quota_inc.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/includes/calculate_quota_inc.php b/includes/calculate_quota_inc.php
new file mode 100644
index 0000000..de4940e
--- /dev/null
+++ b/includes/calculate_quota_inc.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * @version $Revision$
+ * @package quota
+ *
+ * settings that are useful to know about at upload time
+ */
+
+/**
+ * quota setup
+ */
+
+use Bitweaver\KernelTools;
+use Bitweaver\Quota\LibertyQuota;
+
+$quota = new LibertyQuota();
+if( !$gBitUser->isAdmin() && !$quota->isUserUnderQuota( $gBitUser->mUserId ) ) {
+ $gBitSystem->display( 'bitpackage:quota/over_quota.tpl', KernelTools::tra( 'You are over your quota.' ) , [ 'display_mode' => 'display' ]);
+ 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', KernelTools::tra( 'Your remaining disk quota is' ).' '.round( ( $q - $u ) / 1000000, 2 ).' '.KernelTools::tra( 'Megabytes' ) );
+ $qMegs = round( $q / 1000000 );
+ if( $qMegs < $uploadMax ) {
+ $uploadMax = $qMegs;
+ }
+}