Reply composition support pre-filled answers.
[banana.git] / banana / banana.inc.php.in
index 80b07ff..4bbd578 100644 (file)
@@ -480,6 +480,9 @@ class Banana
             $groups    = Banana::$protocole->getBoxList(Banana::BOXES_SUB, Banana::$profile['lastnews'], true);
             Banana::$page->assign('groups', $groups);
         }
+        if (function_exists('hook_markAsRead')) {
+            hook_markAsRead($group, $artid, $msg);
+        }
         Banana::$page->assign_by_ref('message', $msg);
         Banana::$page->assign('extimages', Banana::$msgshow_hasextimages);
         Banana::$page->assign('headers', Banana::$msgshow_headers);
@@ -545,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']);