示例#1
0
 * 
 * settings that are useful to know about at upload time
 */
/**
 * quota setup
 */
require_once QUOTA_PKG_PATH . 'LibertyQuota.php';
global $gBitSmarty, $assignUser, $gBitUser;
if (empty($pQuotaUserId)) {
    if (!empty($assignUser->mUserId)) {
        $pQuotaUserId = $assignUser->mUserId;
    } else {
        $pQuotaUserId = $gBitUser->mUserId;
    }
}
$quota = new LibertyQuota();
$diskUsage = $quota->getUserUsage($pQuotaUserId);
$diskQuota = $quota->getUserQuota($pQuotaUserId);
if ($diskQuota != 0) {
    $quotaPercent = round($diskUsage / $diskQuota * 100, 0);
} else {
    $quotaPercent = 0;
}
if ($quotaPercent > 100) {
    $errors['disk_quota'] = "You are over your disk quota.";
    $gBitSmarty->assignByRef('errors', $errors);
    $quotaPercent = 100;
}
$gBitSmarty->assign('usage', round($diskUsage / 1000000, 2));
$gBitSmarty->assign('quota', round($diskQuota / 1000000, 2));
$gBitSmarty->assignByRef('quotaPercent', $quotaPercent);
示例#2
0
<?php

/**
 * @version  $Revision$
 * @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;
    }
}
示例#3
0
<?php

// $Header$
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See below for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
// is this used?
//if( isset( $_REQUEST["quotaset"] ) && isset( $_REQUEST["homeSample"] ) ) {
//	$gBitSystem->storeConfig( "home_quota", $_REQUEST["homeSample"], QUOTA_PKG_NAME );
//	$gBitSmarty->assign( 'home_quota', $_REQUEST["homeSample"] );
//}
require_once QUOTA_PKG_PATH . 'LibertyQuota.php';
if (!empty($_REQUEST['cancelquota'])) {
    unset($_REQUEST['quota_id']);
}
$gQuota = new LibertyQuota(!empty($_REQUEST['quota_id']) ? $_REQUEST['quota_id'] : NULL);
if (!empty($_REQUEST['savequota'])) {
    if ($gQuota->store($_REQUEST)) {
        header('Location: ' . KERNEL_PKG_URL . 'admin/index.php?page=quota');
        die;
    } else {
        $saveError = TRUE;
        $gBitSmarty->assignByRef('errors', $gQuota->mErrors);
    }
} elseif (!empty($_REQUEST['assignquota'])) {
    foreach (array_keys($_REQUEST) as $key) {
        if (preg_match('/^quota_group_([-0-9]*)/', $key, $match)) {
            $groupId = $match[1];
            $gQuota->assignQuotaToGroup($_REQUEST[$key], $groupId);
            //vd( $match );
        }