From 999ef7f6793f790aefdf8a40e1b0c5cb30b9be7e Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 18 Apr 2016 12:13:54 +0200 Subject: [PATCH 1/3] Attachments: Better handling of preview pictures --- include/plaintext.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/include/plaintext.php b/include/plaintext.php index a6738ca93..a4f6b6bf6 100644 --- a/include/plaintext.php +++ b/include/plaintext.php @@ -1,4 +1,7 @@ = 500) AND ($picturedata[0] >= $picturedata[1])) + $post["image"] = $matches[1]; + else + $post["preview"] = $matches[1]; + } if (preg_match("/\[bookmark\=([$URLSearchString]*)\](.*?)\[\/bookmark\]/ism", $attacheddata, $matches)) { $post["url"] = $matches[1]; @@ -144,9 +154,7 @@ function get_attachment_data($body) { $preview = $matches[1]; } - if (($image == "") AND ($preview != "")) - $data["image"] = $preview; - else + if ($preview != "") $data["preview"] = $preview; $data["description"] = trim($match[3]); From 3e76ad77931a334fddf084ab5806113110c17f03 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 18 Apr 2016 20:57:01 +0200 Subject: [PATCH 2/3] Bugfix: ' in titles were a problem. --- mod/parse_url.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mod/parse_url.php b/mod/parse_url.php index bf111f143..6a1fc1101 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -488,7 +488,14 @@ function parse_url_content(&$a) { unset($siteinfo["keywords"]); - echo add_page_info_data($siteinfo); + $info = add_page_info_data($siteinfo); + + if (!$textmode) + // Replace ' with ’ - not perfect - but the richtext editor has problems otherwise + $info = str_replace(array("'"), array("’"), $info); + + echo $info; + killme(); } ?> From 432c1ec5e4c7d16127b79d16a4dd2d7ee34ee9a2 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 18 Apr 2016 21:28:09 +0200 Subject: [PATCH 3/3] 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 a4f6b6bf6..08581cf33 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];