From e1ceb050e19c7574bca146a8da7047ee4ff456b5 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Sun, 10 Jul 2016 05:02:35 -0400
Subject: [PATCH] Merge branch 'stable-3.1'

---
 interface/web/mail/mail_user_edit.php |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php
index ab980ca..aedcd22 100644
--- a/interface/web/mail/mail_user_edit.php
+++ b/interface/web/mail/mail_user_edit.php
@@ -209,7 +209,7 @@
 
 		// Set Maildir format
 		if ($this->id == 0) {
-			$this->dataRecord['maildir_format'] = $sys_config['maildir_format'];
+			$this->dataRecord['maildir_format'] = $mail_config['maildir_format'];
 		}
 		else {
 			// restore Maildir format
@@ -237,8 +237,13 @@
 			$this->dataRecord["homedir"] = $mail_config["homedir_path"];
 			
 			// Will be overwritten by mail_plugin
-			$this->dataRecord['uid'] = -1;
-			$this->dataRecord['gid'] = -1;
+			if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') {
+				$this->dataRecord['uid'] = -1;
+				$this->dataRecord['gid'] = -1;
+			} else {
+				$this->dataRecord['uid'] = intval($mail_config["mailuser_uid"]);
+				$this->dataRecord['gid'] = intval($mail_config["mailuser_gid"]);
+			}
 				
 			//* Check if there is no alias or forward with this address
 			$tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE active = 'y' AND source = ?", $this->dataRecord["email"]);
@@ -255,9 +260,9 @@
 			$this->dataRecord["login"] = isset($this->dataRecord["email"]) ? $this->dataRecord["email"] : '';
 		}
 		//* if autoresponder checkbox not selected, do not save dates
-		if (!isset($_POST['autoresponder']) && array_key_exists('autoresponder_start_date', $_POST)) {
-			$this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item', 'return 0;'), $this->dataRecord['autoresponder_start_date']);
-			$this->dataRecord['autoresponder_end_date'] = array_map(create_function('$item', 'return 0;'), $this->dataRecord['autoresponder_end_date']);
+		if (!isset($_POST['autoresponder'])) {
+			$this->dataRecord['autoresponder_start_date'] = '';
+			$this->dataRecord['autoresponder_end_date'] = '';
 		}
 
 		parent::onSubmit();

--
Gitblit v1.9.1