diff options
author | alecpl <alec@alec.pl> | 2008-10-26 17:06:23 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2008-10-26 17:06:23 +0000 |
commit | 95d90f86d9c5482b531092776181943c9bf57642 (patch) | |
tree | 53fce503e46e85f1a3e6c96b97f771bf86ea34f1 /program/steps | |
parent | 7ce1931bbbb740edf2e95a5eaa64959b0be07269 (diff) |
- Added 'keep_alive' and 'min_keep_alive' options (#1485360)
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/settings/func.inc | 14 | ||||
-rw-r--r-- | program/steps/settings/save_prefs.inc | 8 |
2 files changed, 22 insertions, 0 deletions
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 6f378fd0e..980108ad9 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -175,6 +175,20 @@ function rcmail_user_prefs_form($attrib) $table->add(null, $select_mdn_requests->show($config['mdn_requests'])); } + if (!isset($no_override['keep_alive'])) { + $field_id = 'rcmfd_keep_alive'; + $select_keep_alive = new html_select(array('name' => '_keep_alive', 'id' => $field_id)); + + foreach(array(1, 3, 5, 10, 15, 30, 60) as $min) + if((!$config['min_keep_alive'] || $config['min_keep_alive'] <= $min * 60) + && (!$config['session_lifetime'] || $config['session_lifetime'] > $min)) { + $select_keep_alive->add(rcube_label(array('name' => 'keepaliveevery', 'vars' => array('n' => $min))), $min); + } + + $table->add('title', html::label($field_id, Q(rcube_label('keepalive')))); + $table->add(null, $select_keep_alive->show($config['keep_alive']/60)); + } + $out .= html::tag('fieldset', null, html::tag('legend', null, Q(rcube_label('mailboxview'))) . $table->show($attrib)); $table = new html_table(array('cols' => 2)); diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 3f6328d0d..debd345e3 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -37,6 +37,7 @@ $a_user_prefs = array( 'logout_purge' => isset($_POST['_logout_purge']) ? TRUE : FALSE, 'logout_expunge' => isset($_POST['_logout_expunge']) ? TRUE : FALSE, 'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0, + 'keep_alive' => isset($_POST['_keep_alive']) ? intval($_POST['_keep_alive'])*60 : $CONFIG['keep_alive'], 'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0, 'mdn_requests' => isset($_POST['_mdn_requests']) ? intval($_POST['_mdn_requests']) : 0, 'skin' => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'], @@ -78,6 +79,13 @@ if ($a_user_prefs['pagesize'] < 1) if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['pagesize'] > $CONFIG['max_pagesize'])) $a_user_prefs['pagesize'] = (int) $CONFIG['max_pagesize']; +// force keep_alive +if (isset($a_user_prefs['keep_alive'])) { + $a_user_prefs['keep_alive'] = max(60, $CONFIG['min_keep_alive'], $a_user_prefs['keep_alive']); + if (!empty($CONFIG['session_lifetime'])) + $a_user_prefs['keep_alive'] = min($CONFIG['session_lifetime']*60, $a_user_prefs['keep_alive']); +} + if ($USER->save_prefs($a_user_prefs)) $OUTPUT->show_message('successfullysaved', 'confirmation'); |