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/web/sites/database_edit.php |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php
index 9a1c9d8..139c971 100644
--- a/interface/web/sites/database_edit.php
+++ b/interface/web/sites/database_edit.php
@@ -269,11 +269,11 @@
 		}
 
 		//* Check for duplicates
-		$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$this->dataRecord['database_name']."' AND server_id = '".$this->dataRecord["server_id"]."' AND database_id != '".$this->id."'");
+		$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$app->db->quote($this->dataRecord['database_name'])."' AND server_id = '".$app->functions->intval($this->dataRecord["server_id"])."' AND database_id != '".$this->id."'");
 		if($tmp['dbnum'] > 0) $app->tform->errorMessage .= $app->lng('database_name_error_unique').'<br />';
 
 		// get the web server ip (parent domain)
-		$tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'");
+		$tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$app->functions->intval($this->dataRecord['parent_domain_id'])."'");
 		if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) {
 			// we need remote access rights for this server, so get it's ip address
 			$server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
@@ -337,11 +337,11 @@
 		}
 
 		//* Check for duplicates
-		$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$this->dataRecord['database_name']."' AND server_id = '".$this->dataRecord["server_id"]."'");
+		$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$app->db->quote($this->dataRecord['database_name'])."' AND server_id = '".$app->functions->intval($this->dataRecord["server_id"])."'");
 		if($tmp['dbnum'] > 0) $app->tform->errorMessage .= $app->tform->lng('database_name_error_unique').'<br />';
 
 		// get the web server ip (parent domain)
-		$tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'");
+		$tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$app->functions->intval($this->dataRecord['parent_domain_id'])."'");
 		if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) {
 			// we need remote access rights for this server, so get it's ip address
 			$server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
@@ -407,9 +407,9 @@
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
 
 			//* The Database user shall be owned by the same group then the website
-			$sys_groupid = $web['sys_groupid'];
-			$backup_interval = $web['backup_interval'];
-			$backup_copies = $web['backup_copies'];
+			$sys_groupid = $app->functions->intval($web['sys_groupid']);
+			$backup_interval = $app->functions->intval($web['backup_interval']);
+			$backup_copies = $app->functions->intval($web['backup_copies']);
 
 			$sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id;
 			$app->db->query($sql);
@@ -423,9 +423,9 @@
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
 
 			//* The Database user shall be owned by the same group then the website
-			$sys_groupid = $web['sys_groupid'];
-			$backup_interval = $web['backup_interval'];
-			$backup_copies = $web['backup_copies'];
+			$sys_groupid = $app->functions->intval($web['sys_groupid']);
+			$backup_interval = $app->functions->intval($web['backup_interval']);
+			$backup_copies = $app->functions->intval($web['backup_copies']);
 
 			$sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id;
 			$app->db->query($sql);

--
Gitblit v1.9.1