mirror of
https://github.com/friendica/friendica
synced 2024-11-18 00:23:47 +00:00
Issue 11969: Only use the simple share with federated posts
This commit is contained in:
parent
616c4695f4
commit
d646d4eb1d
1 changed files with 14 additions and 2 deletions
|
@ -20,6 +20,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
use Friendica\Content\Text\BBCode;
|
||||||
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
@ -33,7 +35,8 @@ function share_init(App $a) {
|
||||||
System::exit();
|
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]);
|
$item = Post::selectFirst($fields, ['id' => $post_id]);
|
||||||
|
|
||||||
if (!DBA::isResult($item) || $item['private'] == Item::PRIVATE) {
|
if (!DBA::isResult($item) || $item['private'] == Item::PRIVATE) {
|
||||||
|
@ -43,8 +46,17 @@ function share_init(App $a) {
|
||||||
if (strpos($item['body'], "[/share]") !== false) {
|
if (strpos($item['body'], "[/share]") !== false) {
|
||||||
$pos = strpos($item['body'], "[share");
|
$pos = strpos($item['body'], "[share");
|
||||||
$o = substr($item['body'], $pos);
|
$o = substr($item['body'], $pos);
|
||||||
} else {
|
} elseif (in_array($item['network'], Protocol::FEDERATED)) {
|
||||||
$o = "[share]" . $item['uri'] . "[/share]";
|
$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;
|
echo $o;
|
||||||
|
|
Loading…
Reference in a new issue