From 6c9798e50379cb35d75a941073070662a603c3ea Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Wed, 20 Jul 2016 12:45:21 -0400
Subject: [PATCH] Fixed: Issue #4007 Language in mail user interface is not the language of the client.

---
 interface/web/login/index.php |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/interface/web/login/index.php b/interface/web/login/index.php
index 2ecf4ac..349f233 100644
--- a/interface/web/login/index.php
+++ b/interface/web/login/index.php
@@ -159,6 +159,9 @@
 						$saved_password = stripslashes($mailuser['password']);
 						//* Check if mailuser password is correct
 						if(crypt(stripslashes($password), $saved_password) == $saved_password) {
+							//* Get the sys_user language of the client of the mailuser
+							$sys_user_lang = $app->db->queryOneRecord("SELECT language FROM sys_user WHERE default_group = ?", $mailuser['sys_groupid'] );
+							
 							//* we build a fake user here which has access to the mailuser module only and userid 0
 							$user = array();
 							$user['userid'] = 0;
@@ -168,7 +171,11 @@
 							$user['typ'] = 'user';
 							$user['email'] = $mailuser['email'];
 							$user['username'] = $username;
-							$user['language'] = $conf['language'];
+							if(is_array($sys_user_lang) && $sys_user_lang['language'] != '') {
+								$user['language'] = $sys_user_lang['language'];
+							} else {
+								$user['language'] = $conf['language'];
+							}
 							$user['theme'] = $conf['theme'];
 							$user['app_theme'] = $conf['theme'];
 							$user['mailuser_id'] = $mailuser['mailuser_id'];

--
Gitblit v1.9.1