*/
use Friendica\App;
+use Friendica\Content\Text\BBCode;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
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) {
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;