From f1c4cdd6a7c963d7357a7ea30e7413f2dbdd4ccc Mon Sep 17 00:00:00 2001
From: Dominik Mueller <info@profi-webdesign.net>
Date: Wed, 5 Mar 2014 15:14:38 +0100
Subject: [PATCH] Changed Quota-Functions from sys_group to client_id

---
 interface/lib/classes/quota_lib.inc.php        | 12 ++++++------
 interface/lib/classes/remote.d/mail.inc.php    |  6 +++---
 interface/lib/classes/remote.d/sites.inc.php   |  6 +++---
 interface/web/dashboard/dashlets/mailquota.php |  2 +-
 interface/web/dashboard/dashlets/quota.php     |  2 +-
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/interface/lib/classes/quota_lib.inc.php b/interface/lib/classes/quota_lib.inc.php
index c5a442e98a..55b2aa8571 100644
--- a/interface/lib/classes/quota_lib.inc.php
+++ b/interface/lib/classes/quota_lib.inc.php
@@ -1,7 +1,7 @@
 <?php
 
 class quota_lib {
-	public function get_quota_data($groupid = null, $readable = true) {
+	public function get_quota_data($clientid = null, $readable = true) {
 		global $app; 
 		
 		$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC");
@@ -13,8 +13,8 @@ class quota_lib {
 		}
 		//print_r($monitor_data);
 		
-		if($groupid != null){
-			$sql_where = " AND sys_groupid = ".$groupid;
+		if($clientid != null){
+			$sql_where = " AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=".$clientid.")";
 		}
 		
 		// select websites belonging to client
@@ -93,7 +93,7 @@ class quota_lib {
 		return $sites;
 	}
 
-	public function get_mailquota_data($groupid = null, $readable = true) {
+	public function get_mailquota_data($clientid = null, $readable = true) {
 		global $app;
 		
 		$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'email_quota' ORDER BY created DESC");
@@ -111,8 +111,8 @@ class quota_lib {
 		}
 		//print_r($monitor_data);
 		
-		if($groupid != null){
-			$sql_where = " AND sys_groupid = ".$groupid;
+		if($clientid != null){
+			$sql_where = " AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=".$clientid.")";
 		}
 		
 		
diff --git a/interface/lib/classes/remote.d/mail.inc.php b/interface/lib/classes/remote.d/mail.inc.php
index ef37c61f84..d97f575ab9 100644
--- a/interface/lib/classes/remote.d/mail.inc.php
+++ b/interface/lib/classes/remote.d/mail.inc.php
@@ -1025,7 +1025,7 @@ class remoting_mail extends remoting {
 	}
 
 	//** quota functions -----------------------------------------------------------------------------------
-	public function mailquota_get_by_user($session_id, $group_id)
+	public function mailquota_get_by_user($session_id, $client_id)
 	{
 		global $app;
 		$app->uses('quota_lib');
@@ -1034,9 +1034,9 @@ class remoting_mail extends remoting {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$group_id = $app->functions->intval($group_id);
+		$client_id = $app->functions->intval($client_id);
 		
-		return $app->quota_lib->get_mailquota_data($group_id, false);
+		return $app->quota_lib->get_mailquota_data($client_id, false);
 	}
 
 }
diff --git a/interface/lib/classes/remote.d/sites.inc.php b/interface/lib/classes/remote.d/sites.inc.php
index 704a87ef8a..91b4523365 100644
--- a/interface/lib/classes/remote.d/sites.inc.php
+++ b/interface/lib/classes/remote.d/sites.inc.php
@@ -873,7 +873,7 @@ class remoting_sites extends remoting {
 	}
 
 	//** quota functions -----------------------------------------------------------------------------------
-	public function quota_get_by_user($session_id, $group_id)
+	public function quota_get_by_user($session_id, $client_id)
 	{
 		global $app;
 		$app->uses('quota_lib');
@@ -882,9 +882,9 @@ class remoting_sites extends remoting {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$group_id = $app->functions->intval($group_id);
+		$client_id = $app->functions->intval($client_id);
 	
-		return $app->quota_lib->get_quota_data($group_id, false);
+		return $app->quota_lib->get_quota_data($client_id, false);
 	}
 	
 	
diff --git a/interface/web/dashboard/dashlets/mailquota.php b/interface/web/dashboard/dashlets/mailquota.php
index e0f6be29df..27b8333775 100644
--- a/interface/web/dashboard/dashlets/mailquota.php
+++ b/interface/web/dashboard/dashlets/mailquota.php
@@ -16,7 +16,7 @@ class dashlet_mailquota {
 		if(is_file($lng_file)) include $lng_file;
 		$tpl->setVar($wb);
 
-		$emails = $app->quota_lib->get_mailquota_data( ($_SESSION["s"]["user"]["typ"] != 'admin') ? $_SESSION['s']['user']['default_group'] : null);
+		$emails = $app->quota_lib->get_mailquota_data( ($_SESSION["s"]["user"]["typ"] != 'admin') ? $_SESSION['s']['user']['client_id'] : null);
 		//print_r($emails);
 
 		$has_mailquota = false;
diff --git a/interface/web/dashboard/dashlets/quota.php b/interface/web/dashboard/dashlets/quota.php
index 589de71738..a72e1fd237 100644
--- a/interface/web/dashboard/dashlets/quota.php
+++ b/interface/web/dashboard/dashlets/quota.php
@@ -16,7 +16,7 @@ class dashlet_quota {
 		if(is_file($lng_file)) include $lng_file;
 		$tpl->setVar($wb);
 
-		$sites = $app->quota_lib->get_quota_data( ($_SESSION["s"]["user"]["typ"] != 'admin') ? $_SESSION['s']['user']['default_group'] : null);
+		$sites = $app->quota_lib->get_quota_data( ($_SESSION["s"]["user"]["typ"] != 'admin') ? $_SESSION['s']['user']['client_id'] : null);
 		//print_r($sites);
 
 		$has_quota = false;
-- 
GitLab