mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-24 18:30:11 +01:00
added language option to preferences
This commit is contained in:
parent
7ab1478655
commit
266003afb6
@ -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`);
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
@ -389,5 +389,6 @@ $_['text_clear'] = 'Clear';
|
||||
$_['text_select_letter'] = 'Select Addresses by Letter';
|
||||
$_['text_working'] = 'Working...';
|
||||
|
||||
$_['text_use_browser_settings'] = 'Use browser settings';
|
||||
|
||||
?>
|
||||
|
@ -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';
|
||||
|
||||
?>
|
||||
|
@ -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';
|
||||
|
||||
?>
|
||||
|
@ -389,4 +389,6 @@ $_['text_clear'] = 'Clear';
|
||||
$_['text_select_letter'] = 'Select Addresses by Letter';
|
||||
$_['text_working'] = 'Working...';
|
||||
|
||||
$_['text_use_browser_settings'] = 'Use browser settings';
|
||||
|
||||
?>
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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']);
|
||||
}
|
||||
|
@ -79,6 +79,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="cell1"><?php print $text_language; ?>:</div>
|
||||
<div class="cell2">
|
||||
<select name="lang">
|
||||
<option value=""><?php print $text_use_browser_settings; ?></option>
|
||||
<?php foreach(Registry::get('langs') as $t) { ?>
|
||||
<option value="<?php print $t; ?>"<?php if(isset($_SESSION['lang']) && $_SESSION['lang'] == $t) { ?> selected="selected"<?php } ?>><?php print $t; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="cell1"> </div>
|
||||
|
Loading…
Reference in New Issue
Block a user