diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2006-06-10 16:18:42 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2006-06-10 16:18:42 +0000 |
| commit | fb78d8f796d4bb7f2127dc8da2b61d0a9f582d10 (patch) | |
| tree | d9d1e369ecc13a82185e15c482fb8aade69545d5 | |
| parent | 274db344ba6e638fdf8c488c2c3c1beb88ae437d (diff) | |
| download | quota-fb78d8f796d4bb7f2127dc8da2b61d0a9f582d10.tar.gz quota-fb78d8f796d4bb7f2127dc8da2b61d0a9f582d10.tar.bz2 quota-fb78d8f796d4bb7f2127dc8da2b61d0a9f582d10.zip | |
move uploadMax calculation to seperate file for easy inclusion
| -rw-r--r-- | calculate_quota_inc.php | 20 |
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; + } +} +?> |
