-
- private static function performDiasporaReshare(int $itemId)
- {
- $fields = ['uri-id', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink'];
- $item = Post::selectFirst($fields, ['id' => $itemId, 'private' => [Item::PUBLIC, Item::UNLISTED]]);
- if (!DBA::isResult($item) || ($item['body'] == '')) {
- return;
- }
-
- if (strpos($item['body'], '[/share]') !== false) {
- $pos = strpos($item['body'], '[share');
- $post = substr($item['body'], $pos);
- } else {
- $post = BBCode::getShareOpeningTag($item['author-name'], $item['author-link'], $item['author-avatar'], $item['plink'], $item['created'], $item['guid']);
-
- if (!empty($item['title'])) {
- $post .= '[h3]' . $item['title'] . "[/h3]\n";
- }
-
- $post .= $item['body'];
- $post .= '[/share]';
- }
- $_REQUEST['body'] = $post;
- $_REQUEST['profile_uid'] = local_user();
-
- require_once 'mod/item.php';
- item_post(DI::app());
- }