From 0e2978ef48e7877ee46aa4a9e52e86b8f76c9733 Mon Sep 17 00:00:00 2001
From: Dominik Müller <info@profi-webdesign.net>
Date: Sat, 18 Jan 2014 23:34:06 -0500
Subject: [PATCH] Mailbox quota can now be included into website quota (FS#3297) -------------------------------------------------------------- Feature can be activated over admin mailserver settings. when activated websites uid is used instead of standard vmail-uid. this only takes effect if web and mailserver are on the same server, otherwise it will be old behaviour. switching this setting when mailboxes exist doesn't matter. Mailboxfolder will be created with website uid for this. access of postfix and dovecot now works over mysql-table mail_user. virtual_uid_maps is changed from static to mysql-table. for dovecot<->postfix communication protocoll is changed vrom lda to lmtp. disablelmtp-column is added to mail_user-table. uid and gid can be overwritten by remoting. ONE OPEN ISSUE: since remoting has completly changed and mail_user_add function is missing at the moment, this function now was inclulded again. it is important to add the both new lines to the future function and then remove this new one.

---
 interface/lib/plugins/sites_web_database_user_plugin.inc.php |   59 +++++++++++++++++++++++++++++++----------------------------
 1 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/interface/lib/plugins/sites_web_database_user_plugin.inc.php b/interface/lib/plugins/sites_web_database_user_plugin.inc.php
index 4b6af43..1a880a1 100644
--- a/interface/lib/plugins/sites_web_database_user_plugin.inc.php
+++ b/interface/lib/plugins/sites_web_database_user_plugin.inc.php
@@ -1,40 +1,43 @@
 <?php
 /**
  * sites_web_database_user_plugin plugin
- * 
+ *
  * @author Marius Cramer <m.cramer@pixcept.de> pixcept KG 2012
  */
- 
+
+
 class sites_web_database_user_plugin {
 
 	var $plugin_name        = 'sites_web_database_user_plugin';
 	var $class_name         = 'sites_web_database_user_plugin';
-	
-    /*
+
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        //Register for the events        
-        $app->plugin->registerEvent('sites:web_database_user:on_after_update','sites_web_database_user_plugin','sites_web_database_user_edit');
-        $app->plugin->registerEvent('sites:web_database_user:on_after_insert','sites_web_database_user_plugin','sites_web_database_user_edit');
-    }
-
-    /*
-		Function to create the sites_web_database_user rule and insert it into the custom rules           
-    */
-    function sites_web_database_user_edit($event_name, $page_form) {
-        global $app, $conf;   
-        
-        // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
-        // also make sure that the user can not delete domain created by a admin
-        if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) {
-            $client_group_id = intval($page_form->dataRecord["client_group_id"]);
-            $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$page_form->id);
-        }
-        if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($page_form->dataRecord["client_group_id"])) {
-            $client_group_id = intval($page_form->dataRecord["client_group_id"]);
-            $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$page_form->id);
-        }
+	function onLoad() {
+		global $app;
+		//Register for the events
+		$app->plugin->registerEvent('sites:web_database_user:on_after_update', 'sites_web_database_user_plugin', 'sites_web_database_user_edit');
+		$app->plugin->registerEvent('sites:web_database_user:on_after_insert', 'sites_web_database_user_plugin', 'sites_web_database_user_edit');
 	}
-}              	
\ No newline at end of file
+
+	/*
+		Function to create the sites_web_database_user rule and insert it into the custom rules
+    */
+	function sites_web_database_user_edit($event_name, $page_form) {
+		global $app, $conf;
+
+		// make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
+		// also make sure that the user can not delete entry created by an admin
+		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) {
+			$client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE database_user_id = ".$page_form->id);
+		}
+		if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($page_form->dataRecord["client_group_id"])) {
+			$client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$page_form->id);
+		}
+		//$app->db->query("UPDATE web_database_user SET server_id = '" . $app->functions->intval($conf['server_id']) . "' WHERE database_user_id = ".$page_form->id);
+	}
+
+}

--
Gitblit v1.9.1