summaryrefslogtreecommitdiff
path: root/calculate_quota_inc.php
blob: bb5638950eabe859fca65b9d5af48d42877bed48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
 * @version  $Revision: 1.3 $
 * @package  quota
 * 
 * settings that are useful to know about at upload time
 */

/**
 * quota setup
 */
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.' ) , array( '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', tra( 'Your remaining disk quota is' ).' '.round( ( $q - $u ) / 1000000, 2 ).' '.tra( 'Megabytes' ) );
	$qMegs = round( $q / 1000000 );
	if( $qMegs < $uploadMax ) {
		$uploadMax = $qMegs;
	}
}
?>