From 3f478f7b37eb314c7dba33af10e8d32d5f2fa579 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 19 Apr 2013 05:35:57 -0400
Subject: [PATCH] Merged revisions 3922-3958 from stable branch.

---
 interface/web/tools/import_ispconfig.php |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/interface/web/tools/import_ispconfig.php b/interface/web/tools/import_ispconfig.php
index a063664..432bb31 100644
--- a/interface/web/tools/import_ispconfig.php
+++ b/interface/web/tools/import_ispconfig.php
@@ -149,6 +149,12 @@
 	if($sys_groupid == 0) $error .= 'Inavlid groupid<br />';
 	if($sys_userid == 0) $error .= 'Inavlid Userid<br />';
 	
+	//* Get the mail server ID
+	$tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE mail_server = 1 LIMIT 0,1");
+	$server_id = intval($tmp['server_id']);
+	unset($tmp);
+	if($server_id == 0) $server_id = 1;
+	
 	//* get the mail domain record
 	$mail_domain_rec = $client->mail_domain_get($remote_session_id, array('domain' => $mail_domain));
 	if(is_array($mail_domain_rec)) {
@@ -160,6 +166,7 @@
 		//* Change the record owner and remove the index field
 		$mail_domain_rec['sys_userid'] = $sys_userid;
 		$mail_domain_rec['sys_groupid'] = $sys_groupid;
+		$mail_domain_rec['server_id'] = $server_id;
 		unset($mail_domain_rec['domain_id']);
 		
 		//* Insert domain if no error occurred
@@ -181,6 +188,7 @@
 						//* Prepare record
 						$mail_user['sys_userid'] = $sys_userid;
 						$mail_user['sys_groupid'] = $sys_groupid;
+						$mail_user['server_id'] = $server_id;
 						$remote_mailuser_id = $mail_user['mailuser_id'];
 						unset($mail_user['mailuser_id']);
 						if(!isset($_POST['import_user_filter'])) $mail_user['custom_mailfilter'] = '';
@@ -199,6 +207,7 @@
 									$mail_user_filter['sys_userid'] = $sys_userid;
 									$mail_user_filter['sys_groupid'] = $sys_groupid;
 									$mail_user_filter['mailuser_id'] = $local_mailuser_id;
+									$mail_user_filter['server_id'] = $server_id;
 									unset($mail_user_filter['filter_id']);
 									
 									//* Insert record in DB
@@ -224,6 +233,7 @@
 					if($tmp['number'] == 0) {
 						$mail_alias['sys_userid'] = $sys_userid;
 						$mail_alias['sys_groupid'] = $sys_groupid;
+						$mail_alias['server_id'] = $server_id;
 						unset($mail_alias['forwarding_id']);
 						$app->db->datalogInsert('mail_forwarding', $mail_alias, 'forwarding_id');
 						$msg .= "Imported email alias ".$mail_alias['source']."<br />";
@@ -244,6 +254,7 @@
 					if($tmp['number'] == 0) {
 						$mail_alias['sys_userid'] = $sys_userid;
 						$mail_alias['sys_groupid'] = $sys_groupid;
+						$mail_alias['server_id'] = $server_id;
 						unset($mail_alias['forwarding_id']);
 						$app->db->datalogInsert('mail_forwarding', $mail_alias, 'forwarding_id');
 						$msg .= "Imported email aliasdomain ".$mail_alias['source']."<br />";
@@ -264,6 +275,7 @@
 					if($tmp['number'] == 0) {
 						$mail_forward['sys_userid'] = $sys_userid;
 						$mail_forward['sys_groupid'] = $sys_groupid;
+						$mail_forward['server_id'] = $server_id;
 						unset($mail_forward['forwarding_id']);
 						$app->db->datalogInsert('mail_forwarding', $mail_forward, 'forwarding_id');
 						$msg .= "Imported email forward ".$mail_forward['source']."<br />";
@@ -284,6 +296,7 @@
 					if($tmp['number'] == 0) {
 						$mail_spamfilter['sys_userid'] = $sys_userid;
 						$mail_spamfilter['sys_groupid'] = $sys_groupid;
+						$mail_spamfilter['server_id'] = $server_id;
 						unset($mail_spamfilter['id']);
 						$app->db->datalogInsert('spamfilter_users', $mail_spamfilter, 'id');
 						$msg .= "Imported spamfilter user ".$mail_spamfilter['email']."<br />";

--
Gitblit v1.9.1