From 432c1ec5e4c7d16127b79d16a4dd2d7ee34ee9a2 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 18 Apr 2016 21:28:09 +0200 Subject: [PATCH] Now we are having "after" at the old attach mechanism as well --- include/plaintext.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/plaintext.php b/include/plaintext.php index a4f6b6bf68..08581cf338 100644 --- a/include/plaintext.php +++ b/include/plaintext.php @@ -8,7 +8,8 @@ require_once("include/Photo.php"); * @param string $body Message body * @return array * 'type' -> Message type ("link", "video", "photo") - * 'text' -> Text outside of the shared message + * 'text' -> Text before the shared message + * 'after' -> Text after the shared message * 'image' -> Preview image of the message * 'url' -> Url to the attached message * 'title' -> Title of the attachment @@ -28,7 +29,12 @@ function get_old_attachment_data($body) { $post["type"] = substr($data[1], 5); - $post["text"] = trim(str_replace($data[0], "", $body)); + $pos = strpos($body, $data[0]); + if ($pos > 0) { + $post["text"] = trim(substr($body, 0, $pos)); + $post["after"] = trim(substr($body, $pos + strlen($data[0]))); + } else + $post["text"] = trim(str_replace($data[0], "", $body)); $attacheddata = $data[2]; -- 2.39.5