From: Michael Date: Sat, 9 Sep 2017 07:43:50 +0000 (+0000) Subject: OStatus: Attached pictures now show up in repeated posts as well. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=52b12fccc94a7ed1f0304e24e746436971f08a4f;p=friendica.git OStatus: Attached pictures now show up in repeated posts as well. --- diff --git a/include/ostatus.php b/include/ostatus.php index 7fd920d635..1f81d96157 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -458,6 +458,8 @@ class ostatus { $self = ""; + $add_body = ""; + $links = $xpath->query('atom:link', $entry); if ($links) { foreach ($links AS $link) { @@ -482,7 +484,7 @@ class ostatus { case "enclosure": $filetype = strtolower(substr($attribute['type'], 0, strpos($attribute['type'],'/'))); if ($filetype == 'image') { - $item['body'] .= "\n[img]".$attribute['href'].'[/img]'; + $add_body .= "\n[img]".$attribute['href'].'[/img]'; } else { if (strlen($item["attach"])) { $item["attach"] .= ','; @@ -519,18 +521,6 @@ class ostatus { } } - // Only add additional data when there is no picture in the post - if (!strstr($item["body"],'[/img]')) { - $item["body"] = add_page_info_to_body($item["body"]); - } - - // Mastodon Content Warning - if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) { - $clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue; - - $item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]'; - } - $local_id = ""; $repeat_of = ""; @@ -587,7 +577,7 @@ class ostatus { $item["author-link"] = $orig_author["author-link"]; $item["author-avatar"] = $orig_author["author-avatar"]; - $item["body"] = add_page_info_to_body(html2bbcode($orig_body)); + $item["body"] = html2bbcode($orig_body); $item["created"] = $orig_created; $item["edited"] = $orig_edited; @@ -622,6 +612,20 @@ class ostatus { } } + $item["body"] .= $add_body; + + // Only add additional data when there is no picture in the post + if (!strstr($item["body"],'[/img]')) { + $item["body"] = add_page_info_to_body($item["body"]); + } + + // Mastodon Content Warning + if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) { + $clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue; + + $item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]'; + } + if (isset($item["parent-uri"])) { $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s'", intval($importer["uid"]), dbesc($item["parent-uri"]));