diff options
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/compose.inc | 28 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 24 | ||||
-rw-r--r-- | program/steps/settings/save_prefs.inc | 2 |
3 files changed, 50 insertions, 4 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 276efda56..0f4b6ac81 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -103,6 +103,7 @@ if (!empty($CONFIG['drafts_mbox'])) { } // set current mailbox in client environment $OUTPUT->set_env('mailbox', $IMAP->get_mailbox_name()); +$OUTPUT->set_env('top_posting', $CONFIG['top_posting']); // get reference message and set compose mode if ($msg_uid = $_SESSION['compose']['param']['reply_uid']) @@ -116,6 +117,13 @@ else if ($msg_uid = $_SESSION['compose']['param']['draft_uid']) { $compose_mode = RCUBE_COMPOSE_DRAFT; } +if (!$CONFIG['show_sig']) + $OUTPUT->set_env('show_sig', true); +else if ($CONFIG['show_sig'] == 2 && empty($compose_mode)) + $OUTPUT->set_env('show_sig', true); +else if ($CONFIG['show_sig'] == 3 && ($compose_mode == RCUBE_COMPOSE_REPLY || $compose_mode == RCUBE_COMPOSE_FORWARD)) + $OUTPUT->set_env('show_sig', true); + if (!empty($msg_uid)) { // similar as in program/steps/mail/show.inc @@ -510,12 +518,14 @@ function rcmail_compose_body($attrib) function rcmail_create_reply_body($body, $bodyIsHtml) { - global $IMAP, $MESSAGE, $OUTPUT; + global $MESSAGE; + + $rcmail = rcmail::get_instance(); if (! $bodyIsHtml) { // try to remove the signature - if (($sp = strrpos($body, '-- ')) !== false && ($sp == 0 || $body{$sp-1} == "\n")) + if (!$rcmail->config->get('top_posting') && ($sp = strrpos($body, '-- ')) !== false && ($sp == 0 || $body{$sp-1} == "\n")) { if ($body{$sp+3}==' ' || $body{$sp+3}=="\n" || $body{$sp+3}=="\r") $body = substr($body, 0, max(0, $sp-1)); @@ -547,6 +557,9 @@ function rcmail_create_reply_body($body, $bodyIsHtml) $MESSAGE->get_header('from')), 76); $suffix = ''; + + if ($rcmail->config->get('top_posting')) + $prefix = "\n\n\n" . $prefix; } else { @@ -560,9 +573,16 @@ function rcmail_create_reply_body($body, $bodyIsHtml) // build reply (quote content) $prefix = sprintf("On %s, %s wrote:<br />\n", $MESSAGE->headers->date, - htmlspecialchars(Q($MESSAGE->get_header('from'), 'replace'), ENT_COMPAT, $OUTPUT->get_charset())); + htmlspecialchars(Q($MESSAGE->get_header('from'), 'replace'), ENT_COMPAT, $rcmail->output->get_charset())); $prefix .= '<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%">'; - $suffix = "</blockquote><p></p>"; + + if ($rcmail->config->get('top_posting')) { + $prefix = "<p></p>" . $prefix; + $suffix = "</blockquote>"; + } + else { + $suffix = "</blockquote><p></p>"; + } } return $prefix.$body.$suffix; diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 7bd30a3f4..e451d57d5 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -448,6 +448,30 @@ function rcmail_user_prefs($current=null) 'content' => $select_param_folding->show($config['mime_param_folding']), ); } + + if (!isset($no_override['top_posting'])) { + $field_id = 'rcmfd_top_posting'; + $input_topposting = new html_checkbox(array('name' => '_top_posting', 'id' => $field_id, 'value' => 1)); + + $blocks['main']['options']['top_posting'] = array( + 'title' => html::label($field_id, Q(rcube_label('top_posting'))), + 'content' => $input_topposting->show($config['top_posting']?1:0), + ); + } + + if (!isset($no_override['show_sig'])) { + $field_id = 'rcmfd_show_sig'; + $select_show_sig = new html_select(array('name' => '_show_sig', 'id' => $field_id)); + $select_show_sig->add(rcube_label('always'), 0); + $select_show_sig->add(rcube_label('never'), 1); + $select_show_sig->add(rcube_label('new_msg_only'), 2); + $select_show_sig->add(rcube_label('reply_forward_only'), 3); + + $blocks['main']['options']['show_sig'] = array( + 'title' => html::label($field_id, Q(rcube_label('auto_add_sig'))), + 'content' => $select_show_sig->show(intval($config['show_sig'])), + ); + } break; diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index ddb1367c8..e38a695a4 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -62,6 +62,8 @@ switch ($CURR_SECTION) 'htmleditor' => isset($_POST['_htmleditor']) ? TRUE : FALSE, 'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0, 'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0, + 'show_sig' => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 0, + 'top_posting' => isset($_POST['_top_posting']) ? TRUE : FALSE, ); break; |