X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fshare.php;h=f0a2170b5e90b683c9d2b2b080181e96f9f05d5d;hb=f826ce70ceb9f810a16b70d3d77b9ba2c8d9097d;hp=b606c1a66916fb096c3c0841e67f1b44786c65e6;hpb=a6423031eba1236127160ced3028e36401f40536;p=friendica.git diff --git a/mod/share.php b/mod/share.php index b606c1a669..f0a2170b5e 100644 --- a/mod/share.php +++ b/mod/share.php @@ -1,6 +1,6 @@ argc > 1) ? intval($a->argv[1]) : 0); + $post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0); - if (!$post_id || !local_user()) { - exit(); + if (!$post_id || !DI::userSession()->getLocalUserId()) { + System::exit(); } - $fields = ['private', 'body', 'author-name', 'author-link', 'author-avatar', - 'guid', 'created', 'plink', 'title']; + $fields = ['private', 'body', 'uri']; $item = Post::selectFirst($fields, ['id' => $post_id]); if (!DBA::isResult($item) || $item['private'] == Item::PRIVATE) { - exit(); + System::exit(); } - if (strpos($item['body'], "[/share]") !== false) { - $pos = strpos($item['body'], "[share"); - $o = substr($item['body'], $pos); + $shared = DI::contentItem()->getSharedPost($item, ['uri']); + if (!empty($shared) && empty($shared['comment'])) { + $content = '[share]' . $shared['post']['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]"; + $content = '[share]' . $item['uri'] . '[/share]'; } - - echo $o; - exit(); + System::httpExit($content); }