]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Item.php
Unified BBCode conversion, improved proxy functionality
[friendica.git] / src / Content / Item.php
index 3981978f4eae6abcfbeb9a234a31f9d0b18b8c9d..f7dda6c65f4030c24de79e24e645009a90ae3e1b 100644 (file)
@@ -305,18 +305,20 @@ class Item
                                }
 
                                $author_arr = [
-                                       'uid' => 0,
-                                       'id' => $item['author-id'],
+                                       'uid'     => 0,
+                                       'id'      => $item['author-id'],
                                        'network' => $item['author-network'],
-                                       'url' => $item['author-link'],
+                                       'url'     => $item['author-link'],
+                                       'alias'   => $item['author-alias'],
                                ];
                                $author  = '[url=' . Contact::magicLinkByContact($author_arr) . ']' . $item['author-name'] . '[/url]';
 
                                $author_arr = [
-                                       'uid' => 0,
-                                       'id' => $obj['author-id'],
+                                       'uid'     => 0,
+                                       'id'      => $obj['author-id'],
                                        'network' => $obj['author-network'],
-                                       'url' => $obj['author-link'],
+                                       'url'     => $obj['author-link'],
+                                       'alias'   => $obj['author-alias'],
                                ];
                                $objauthor  = '[url=' . Contact::magicLinkByContact($author_arr) . ']' . $obj['author-name'] . '[/url]';
 
@@ -372,10 +374,11 @@ class Item
                }
 
                $author = [
-                       'uid' => 0,
-                       'id' => $item['author-id'],
+                       'uid'     => 0,
+                       'id'      => $item['author-id'],
                        'network' => $item['author-network'],
-                       'url' => $item['author-link'],
+                       'url'     => $item['author-link'],
+                       'alias'   => $item['author-alias'],
                ];
                $profile_link = Contact::magicLinkByContact($author, $item['author-link']);
                if (strpos($profile_link, 'contact/redir/') === 0) {
@@ -534,6 +537,14 @@ class Item
                        $item['private'] = $private_group ? ItemModel::PRIVATE : ItemModel::UNLISTED;
 
                        if ($only_to_group) {
+                               $cdata = Contact::getPublicAndUserContactID($group_contact['id'], $item['uid']);
+                               if (!empty($cdata['user'])) {
+                                       $item['owner-id'] = $cdata['user'];
+                                       unset($item['owner-link']);
+                                       unset($item['owner-name']);
+                                       unset($item['owner-avatar']);
+                               }
+       
                                $item['postopts'] = '';
                        }
 
@@ -658,14 +669,15 @@ class Item
         * Add a share block for the given item array
         *
         * @param array $item
-        * @param bool $add_media
+        * @param bool $add_media   true = Media is added to the body
+        * @param bool $for_display true = The share block is used for display purposes, false = used for connectors, transport to other systems, ...
         * @return string
         */
-       public function createSharedBlockByArray(array $item, bool $add_media = false): string
+       public function createSharedBlockByArray(array $item, bool $add_media = false, bool $for_display = false): string
        {
                if ($item['network'] == Protocol::FEED) {
                        return PageInfo::getFooterFromUrl($item['plink']);
-               } elseif (!in_array($item['network'] ?? '', Protocol::FEDERATED)) {
+               } elseif (!in_array($item['network'] ?? '', Protocol::FEDERATED) && !$for_display) {
                        $item['guid'] = '';
                        $item['uri']  = '';
                }
@@ -684,7 +696,7 @@ class Item
 
                // If it is a reshared post then reformat it to avoid display problems with two share elements
                if (!empty($shared)) {
-                       if (!empty($shared['guid']) && ($encapsulated_share = $this->createSharedPostByGuid($shared['guid'], true))) {
+                       if (($item['network'] != Protocol::BLUESKY) && !empty($shared['guid']) && ($encapsulated_share = $this->createSharedPostByGuid($shared['guid'], true))) {
                                if (!empty(BBCode::fetchShareAttributes($item['body']))) {
                                        $item['body'] = preg_replace("/\[share.*?\](.*)\[\/share\]/ism", $encapsulated_share, $item['body']);
                                } else {