From: Florent Bruneau Date: Sat, 28 May 2011 21:27:11 +0000 (+0200) Subject: Reply composition support pre-filled answers. X-Git-Url: http://git.polytechnique.org/?p=banana.git;a=commitdiff_plain;h=3958da5df280bd8b4125ca6013c3fda9f538ae96 Reply composition support pre-filled answers. Signed-off-by: Florent Bruneau --- diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in index 3f01181..4bbd578 100644 --- a/banana/banana.inc.php.in +++ b/banana/banana.inc.php.in @@ -548,7 +548,20 @@ class Banana } else { if (!is_null($artid)) { $msg =& $this->loadMessage($group, $artid); - $body = $msg->getSender() . _b_(' a écrit :') . "\n" . $msg->quote(); + $body = $msg->quote(); + + if (isset($_POST['reply'])) { + $body = explode("\n", $body); + $replies = $_POST['reply']; + krsort($replies); + foreach ($replies as $line => $text) { + $text = explode("\n", "\n" . $text . "\n"); + array_splice($body, $line + 1, 0, $text); + } + $body = implode("\n", $body); + } + $body = $msg->getSender() . _b_(' a écrit :') . "\n" . $body; + $subject = $msg->getHeaderValue('subject'); $headers['Subject']['user'] = 'Re: ' . preg_replace("/^re\s*:\s*/i", '', $subject); $target = $msg->getHeaderValue($hdrs['reply']); diff --git a/banana/message.func.inc.php b/banana/message.func.inc.php index 928dbb9..8df5cd4 100644 --- a/banana/message.func.inc.php +++ b/banana/message.func.inc.php @@ -223,7 +223,7 @@ function banana_wrap($text, $base_level = 0, $strict = true) if (!empty($buffer)) { $text .= banana_wordwrap(implode("\n", $buffer), $level + $base_level) . "\n"; $buffer = array(); - } + } $level = $lvl; } $buffer[] = $line;