From 50f56d2046a28e7d8ae48e84ddd32dd022d9cf8d Mon Sep 17 00:00:00 2001 From: alecpl Date: Mon, 2 Nov 2009 08:31:29 +0000 Subject: - top posting (#1484272) --- program/steps/mail/compose.inc | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'program/steps/mail') 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:
\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 .= '
'; - $suffix = "

"; + + if ($rcmail->config->get('top_posting')) { + $prefix = "

" . $prefix; + $suffix = ""; + } + else { + $suffix = "

"; + } } return $prefix.$body.$suffix; -- cgit v1.2.3