diff --git a/util/db-mysql.sql b/util/db-mysql.sql index f8fa72a7..70c45f2f 100644 --- a/util/db-mysql.sql +++ b/util/db-mysql.sql @@ -184,7 +184,7 @@ create table if not exists `user_settings` ( `username` char(64) not null unique, `pagelen` int default 20, `theme` char(8) default 'default', - `lang` char(2) default 'en' + `lang` char(2) default NULL ); create index `user_settings_idx` on `user_settings`(`username`); diff --git a/util/db-upgrade-0.1.22-vs-0.1.23.sql b/util/db-upgrade-0.1.22-vs-0.1.23.sql index 297c17f5..db1f5603 100644 --- a/util/db-upgrade-0.1.22-vs-0.1.23.sql +++ b/util/db-upgrade-0.1.22-vs-0.1.23.sql @@ -29,4 +29,6 @@ drop view if exists `v_messages`; create view `v_messages` AS select `metadata`.`id` AS `id`,`metadata`.`piler_id` AS `piler_id`,`metadata`.`from` AS `from`,`metadata`.`fromdomain` AS `fromdomain`,`rcpt`.`to` AS `to`,`rcpt`.`todomain` AS `todomain`,`metadata`.`subject` AS `subject`, `metadata`.`size` AS `size`, `metadata`.`direction` AS `direction`, `metadata`.`sent` AS `sent`, `metadata`.`arrived` AS `arrived`, `metadata`.`digest` AS `digest`, `metadata`.`bodydigest` AS `bodydigest` from (`metadata` join `rcpt`) where (`metadata`.`id` = `rcpt`.`id`); +alter table `user_settings` change column `lang` `lang` char(2) default NULL; + diff --git a/webui/language/en/messages.php b/webui/language/en/messages.php index 3f22d8b2..03577ba5 100644 --- a/webui/language/en/messages.php +++ b/webui/language/en/messages.php @@ -389,5 +389,6 @@ $_['text_clear'] = 'Clear'; $_['text_select_letter'] = 'Select Addresses by Letter'; $_['text_working'] = 'Working...'; +$_['text_use_browser_settings'] = 'Use browser settings'; ?> diff --git a/webui/language/hu/messages.iso-8859-2.php b/webui/language/hu/messages.iso-8859-2.php index e724e7bd..326d9d2c 100644 --- a/webui/language/hu/messages.iso-8859-2.php +++ b/webui/language/hu/messages.iso-8859-2.php @@ -390,4 +390,6 @@ $_['text_clear'] = 'T $_['text_select_letter'] = 'Cím kiválasztása betű szerint'; $_['text_working'] = 'Keresés...'; +$_['text_use_browser_settings'] = 'Böngésző beállításainak használata'; + ?> diff --git a/webui/language/hu/messages.php b/webui/language/hu/messages.php index 96630263..e39a0754 100644 --- a/webui/language/hu/messages.php +++ b/webui/language/hu/messages.php @@ -390,4 +390,6 @@ $_['text_clear'] = 'TörlĂ©s'; $_['text_select_letter'] = 'CĂ­m kiválasztása betű szerint'; $_['text_working'] = 'KeresĂ©s...'; +$_['text_use_browser_settings'] = 'BöngĂ©szĹ‘ beállĂ­tásainak használata'; + ?> diff --git a/webui/language/pt/messages.php b/webui/language/pt/messages.php index 09a76b74..90645f4b 100644 --- a/webui/language/pt/messages.php +++ b/webui/language/pt/messages.php @@ -389,4 +389,6 @@ $_['text_clear'] = 'Clear'; $_['text_select_letter'] = 'Select Addresses by Letter'; $_['text_working'] = 'Working...'; +$_['text_use_browser_settings'] = 'Use browser settings'; + ?> diff --git a/webui/model/user/prefs.php b/webui/model/user/prefs.php index 145e80f8..41dbbd6b 100644 --- a/webui/model/user/prefs.php +++ b/webui/model/user/prefs.php @@ -9,6 +9,7 @@ class ModelUserPrefs extends Model { if(isset($query->row['pagelen'])) { $_SESSION['pagelen'] = $query->row['pagelen']; } else { $_SESSION['pagelen'] = PAGE_LEN; } if(isset($query->row['theme'])) { $_SESSION['theme'] = $query->row['theme']; } else { $_SESSION['theme'] = THEME; } + if(isset($query->row['lang'])) { $_SESSION['lang'] = $query->row['lang']; } else { $_SESSION['lang'] = DEFAULT_LANG; } return 1; } @@ -22,15 +23,16 @@ class ModelUserPrefs extends Model { $query = $this->db->query("SELECT COUNT(*) AS num FROM " . TABLE_USER_SETTINGS . " WHERE username=?", array($username)); if((int)@$query->row['num'] == 1) { - $query = $this->db->query("UPDATE " . TABLE_USER_SETTINGS . " SET pagelen=?, theme=? WHERE username=?", array((int)@$prefs['pagelen'], $prefs['theme'], $username)); + $query = $this->db->query("UPDATE " . TABLE_USER_SETTINGS . " SET pagelen=?, theme=?, lang=? WHERE username=?", array((int)@$prefs['pagelen'], $prefs['theme'], $prefs['lang'], $username)); } else { - $query = $this->db->query("INSERT INTO " . TABLE_USER_SETTINGS . " (username, pagelen, theme) VALUES(?,?,?)", array($username, (int)@$prefs['pagelen'], $prefs['theme'])); + $query = $this->db->query("INSERT INTO " . TABLE_USER_SETTINGS . " (username, pagelen, theme, lang) VALUES(?,?,?,?)", array($username, (int)@$prefs['pagelen'], $prefs['theme'], $prefs['lang'])); } $_SESSION['pagelen'] = $prefs['pagelen']; $_SESSION['theme'] = $prefs['theme']; + $_SESSION['lang'] = $prefs['lang']; LOGGER("set user preference", $username); diff --git a/webui/system/language.php b/webui/system/language.php index e52443cd..e3540135 100644 --- a/webui/system/language.php +++ b/webui/system/language.php @@ -9,7 +9,7 @@ class Language { $lang = ''; - if(isset($_SESSION['lang'])) { + if(isset($_SESSION['lang']) && $_SESSION['lang'] != '') { $file = DIR_LANGUAGE . $_SESSION['lang'] . '/messages.php'; define('LANG', $_SESSION['lang']); } diff --git a/webui/view/theme/default/templates/user/settings.tpl b/webui/view/theme/default/templates/user/settings.tpl index af5c45f1..4075c1c4 100644 --- a/webui/view/theme/default/templates/user/settings.tpl +++ b/webui/view/theme/default/templates/user/settings.tpl @@ -79,6 +79,18 @@ +
+
:
+
+ +
+
+