diff options
Diffstat (limited to 'program/steps/settings')
-rw-r--r-- | program/steps/settings/edit_identity.inc | 7 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 17 | ||||
-rw-r--r-- | program/steps/settings/save_identity.inc | 41 | ||||
-rw-r--r-- | program/steps/settings/save_prefs.inc | 1 |
4 files changed, 35 insertions, 31 deletions
diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc index 39076f408..d70a7aef7 100644 --- a/program/steps/settings/edit_identity.inc +++ b/program/steps/settings/edit_identity.inc @@ -99,6 +99,13 @@ function rcube_identity_form($attrib) $form['addressing']['content']['email']['class'] = 'disabled'; } + if (IDENTITIES_LEVEL == 4) { + foreach($form['addressing']['content'] as $formfield => $value){ + $form['addressing']['content'][$formfield]['disabled'] = true; + $form['addressing']['content'][$formfield]['class'] = 'disabled'; + } + } + $IDENTITY_RECORD['email'] = rcube_idn_to_utf8($IDENTITY_RECORD['email']); // Allow plugins to modify identity form content diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 3bcca21bf..319c58db9 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -483,8 +483,8 @@ function rcmail_user_prefs($current=null) $blocks = array( 'main' => array('name' => Q(rcube_label('mainoptions'))), - 'spellcheck' => array('name' => Q(rcube_label('spellcheckoptions'))), 'sig' => array('name' => Q(rcube_label('signatureoptions'))), + 'spellcheck' => array('name' => Q(rcube_label('spellcheckoptions'))), ); // show checkbox to compose messages in a new window @@ -581,8 +581,7 @@ function rcmail_user_prefs($current=null) if (!isset($no_override['reply_mode'])) { $field_id = 'rcmfd_reply_mode'; - $select_replymode = new html_select(array('name' => '_reply_mode', 'id' => $field_id, - 'onchange' => "\$('#rcmfd_sig_above').attr('disabled',this.selectedIndex<2)")); + $select_replymode = new html_select(array('name' => '_reply_mode', 'id' => $field_id)); $select_replymode->add(rcube_label('replyempty'), -1); $select_replymode->add(rcube_label('replybottomposting'), 0); $select_replymode->add(rcube_label('replytopposting'), 1); @@ -631,18 +630,6 @@ function rcmail_user_prefs($current=null) ); } - if (!isset($no_override['sig_above'])) { - $field_id = 'rcmfd_sig_above'; - $select_sigabove = new html_select(array('name' => '_sig_above', 'id' => $field_id, 'disabled' => $config['reply_mode'] < 1)); - $select_sigabove->add(rcube_label('belowquote'), 0); - $select_sigabove->add(rcube_label('abovequote'), 1); - - $blocks['sig']['options']['sig_above'] = array( - 'title' => html::label($field_id, Q(rcube_label('replysignaturepos'))), - 'content' => $select_sigabove->show($config['sig_above']?1:0), - ); - } - if (!isset($no_override['strip_existing_sig'])) { $field_id = 'rcmfd_strip_existing_sig'; $input_stripexistingsig = new html_checkbox(array('name' => '_strip_existing_sig', 'id' => $field_id, 'value' => 1)); diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc index d579ee61f..34d8be268 100644 --- a/program/steps/settings/save_identity.inc +++ b/program/steps/settings/save_identity.inc @@ -26,17 +26,14 @@ $a_boolean_cols = array('standard', 'html_signature'); $updated = $default_id = false; // check input -if (empty($_POST['_name']) || (empty($_POST['_email']) && IDENTITIES_LEVEL != 1 && IDENTITIES_LEVEL != 3)) -{ +if (IDENTITIES_LEVEL != 4 && (empty($_POST['_name']) || (empty($_POST['_email']) && IDENTITIES_LEVEL != 1 && IDENTITIES_LEVEL != 3))) { $OUTPUT->show_message('formincomplete', 'warning'); rcmail_overwrite_action('edit-identity'); return; } - $save_data = array(); -foreach ($a_save_cols as $col) -{ +foreach ($a_save_cols as $col) { $fname = '_'.$col; if (isset($_POST[$fname])) $save_data[$col] = get_input_value($fname, RCUBE_INPUT_POST, true); @@ -44,16 +41,24 @@ foreach ($a_save_cols as $col) // set "off" values for checkboxes that were not checked, and therefore // not included in the POST body. -foreach ($a_boolean_cols as $col) -{ +foreach ($a_boolean_cols as $col) { $fname = '_' . $col; if (!isset($_POST[$fname])) $save_data[$col] = 0; } // unset email address if user has no rights to change it -if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3) +if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3) { unset($save_data['email']); +} +// unset all fields except signature +else if (IDENTITIES_LEVEL == 4) { + foreach ($save_data as $idx => $value) { + if ($idx != 'signature' && $idx != 'html_signature') { + unset($save_data[$idx]); + } + } +} // Validate e-mail addresses $email_checks = array(rcube_idn_to_ascii($save_data['email'])); @@ -72,9 +77,16 @@ foreach ($email_checks as $email) { } // update an existing contact -if ($_POST['_iid']) -{ +if ($_POST['_iid']) { $iid = get_input_value('_iid', RCUBE_INPUT_POST); + + if (in_array(IDENTITIES_LEVEL, array(1,3,4))) { + // merge with old identity data, fixes #1488834 + $identity = $RCMAIL->user->get_identity($iid); + $save_data = array_merge($identity, $save_data); + unset($save_data['changed'], $save_data['del'], $save_data['user_id'], $save_data['identity_id']); + } + $plugin = $RCMAIL->plugins->exec_hook('identity_update', array('id' => $iid, 'record' => $save_data)); $save_data = $plugin['record']; @@ -88,8 +100,8 @@ if ($_POST['_iid']) if ($updated) { $OUTPUT->show_message('successfullysaved', 'confirmation'); - if (!empty($_POST['_standard'])) - $default_id = get_input_value('_iid', RCUBE_INPUT_POST); + if (!empty($save_data['standard'])) + $default_id = $iid; if ($_POST['_framed']) { // update the changed col in list @@ -105,8 +117,7 @@ if ($_POST['_iid']) } // insert a new identity record -else if (IDENTITIES_LEVEL < 2) -{ +else if (IDENTITIES_LEVEL < 2) { if (IDENTITIES_LEVEL == 1) { $save_data['email'] = $RCMAIL->get_user_email(); } @@ -127,7 +138,7 @@ else if (IDENTITIES_LEVEL < 2) $_GET['_iid'] = $insert_id; - if (!empty($_POST['_standard'])) + if (!empty($save_data['standard'])) $default_id = $insert_id; if ($_POST['_framed']) { diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 5daab0d24..140f173c6 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -86,7 +86,6 @@ switch ($CURR_SECTION) 'show_sig' => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 1, 'reply_mode' => isset($_POST['_reply_mode']) ? intval($_POST['_reply_mode']) : 0, 'strip_existing_sig' => isset($_POST['_strip_existing_sig']), - 'sig_above' => !empty($_POST['_sig_above']) && $_POST['_reply_mode'] > 0, 'default_font' => get_input_value('_default_font', RCUBE_INPUT_POST), 'forward_attachment' => !empty($_POST['_forward_attachment']), ); |