From: Michael Date: Fri, 7 Oct 2022 21:09:15 +0000 (+0000) Subject: Issue 11969: Only use the simple share with federated posts X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d646d4eb1d9ea0820e22942353a70d318124d546;p=friendica.git Issue 11969: Only use the simple share with federated posts --- diff --git a/mod/share.php b/mod/share.php index 792ee40082..8392cad8df 100644 --- a/mod/share.php +++ b/mod/share.php @@ -20,6 +20,8 @@ */ use Friendica\App; +use Friendica\Content\Text\BBCode; +use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; @@ -33,7 +35,8 @@ function share_init(App $a) { System::exit(); } - $fields = ['private', 'body', 'uri']; + $fields = ['private', 'body', 'author-name', 'author-link', 'author-avatar', + 'guid', 'created', 'plink', 'uri', 'title', 'network']; $item = Post::selectFirst($fields, ['id' => $post_id]); if (!DBA::isResult($item) || $item['private'] == Item::PRIVATE) { @@ -43,8 +46,17 @@ function share_init(App $a) { if (strpos($item['body'], "[/share]") !== false) { $pos = strpos($item['body'], "[share"); $o = substr($item['body'], $pos); - } else { + } elseif (in_array($item['network'], Protocol::FEDERATED)) { $o = "[share]" . $item['uri'] . "[/share]"; + } else { + $o = BBCode::getShareOpeningTag($item['author-name'], $item['author-link'], $item['author-avatar'], $item['plink'], $item['created'], $item['guid']); + + if ($item['title']) { + $o .= '[h3]'.$item['title'].'[/h3]'."\n"; + } + + $o .= $item['body']; + $o .= "[/share]"; } echo $o;