summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Fowler <spider@viovio.com>2006-07-06 23:58:24 +0000
committerChristian Fowler <spider@viovio.com>2006-07-06 23:58:24 +0000
commita2620d589f75fc0b563d0163da3eb431cbadcdd3 (patch)
tree588e776a3127bbf27ee4f6898ff56b5477bd45d8
parentf7afce6e79e19de135e93ff72ea56e6accfccae9 (diff)
downloadquota-a2620d589f75fc0b563d0163da3eb431cbadcdd3.tar.gz
quota-a2620d589f75fc0b563d0163da3eb431cbadcdd3.tar.bz2
quota-a2620d589f75fc0b563d0163da3eb431cbadcdd3.zip
add ability to query quota info user other than current user
-rw-r--r--LibertyQuota.php8
-rw-r--r--quota_inc.php13
2 files changed, 15 insertions, 6 deletions
diff --git a/LibertyQuota.php b/LibertyQuota.php
index 0fa4bd0..adee10e 100644
--- a/LibertyQuota.php
+++ b/LibertyQuota.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_quota/LibertyQuota.php,v 1.9 2006/02/18 21:03:46 spiderr Exp $
+ * $Header: /cvsroot/bitweaver/_bit_quota/LibertyQuota.php,v 1.10 2006/07/06 23:58:24 spiderr Exp $
*
* Copyright (c) 2004 bitweaver.org
* Copyright (c) 2003 tikwiki.org
@@ -8,7 +8,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: LibertyQuota.php,v 1.9 2006/02/18 21:03:46 spiderr Exp $
+ * $Id: LibertyQuota.php,v 1.10 2006/07/06 23:58:24 spiderr Exp $
* @package quota
*/
@@ -28,7 +28,7 @@ require_once( LIBERTY_PKG_PATH.'LibertyAttachable.php' );
*
* @author spider <spider@steelsun.com>
*
- * @version $Revision: 1.9 $ $Date: 2006/02/18 21:03:46 $ $Author: spiderr $
+ * @version $Revision: 1.10 $ $Date: 2006/07/06 23:58:24 $ $Author: spiderr $
*/
class LibertyQuota extends LibertyBase {
/**
@@ -174,7 +174,7 @@ class LibertyQuota extends LibertyBase {
**/
function isUserUnderQuota( $pUserId ) {
$ret = FALSE;
- if( is_numeric( $pUserId) ) {
+ if( is_numeric( $pUserId ) ) {
$query = 'SELECT MAX(qo.`disk_usage`) AS `disk_usage`
FROM `'.BIT_DB_PREFIX.'users_users` uu
INNER JOIN `'.BIT_DB_PREFIX.'users_groups_map` ugm ON ( ugm.`user_id`=uu.`user_id` )
diff --git a/quota_inc.php b/quota_inc.php
index d05679b..174cf4a 100644
--- a/quota_inc.php
+++ b/quota_inc.php
@@ -1,9 +1,18 @@
<?php
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( $gBitUser->mUserId );
-$diskQuota = $quota->getUserQuota( $gBitUser->mUserId );
+$diskUsage = $quota->getUserUsage( $pQuotaUserId );
+$diskQuota = $quota->getUserQuota( $pQuotaUserId );
if( $diskQuota != 0 ) {
$quotaPercent = round( (($diskUsage / $diskQuota) * 100), 0 );