use Friendica\Model\Contact;
use Friendica\Model\Conversation;
use Friendica\Model\FileTag;
use Friendica\Model\Contact;
use Friendica\Model\Conversation;
use Friendica\Model\FileTag;
- * [ // categories array
- * {
- * 'name': 'category name',
- * 'removeurl': 'url to remove this category',
- * 'first': 'is the first in this array? true/false',
- * 'last': 'is the last in this array? true/false',
- * } ,
- * ....
- * ],
- * [ //folders array
- * {
- * 'name': 'folder name',
- * 'removeurl': 'url to remove this folder',
- * 'first': 'is the first in this array? true/false',
- * 'last': 'is the last in this array? true/false',
- * } ,
- * ....
- * ]
- * ]
+ * [ // categories array
+ * {
+ * 'name': 'category name',
+ * 'removeurl': 'url to remove this category',
+ * 'first': 'is the first in this array? true/false',
+ * 'last': 'is the last in this array? true/false',
+ * },
+ * ...
+ * ],
+ * [ //folders array
+ * {
+ * 'name': 'folder name',
+ * 'removeurl': 'url to remove this folder',
+ * 'first': 'is the first in this array? true/false',
+ * 'last': 'is the last in this array? true/false',
+ * } ,
+ * ...
+ * ]
+ * ]
+ *
+ * @throws \Exception
- $sparkle = (strpos($profile_link, 'contact/redir/') === 0);
+ if (strpos($profile_link, 'contact/redir/') === 0) {
+ $status_link = $profile_link . '?' . http_build_query(['url' => $item['author-link'] . '/status']);
+ $photos_link = $profile_link . '?' . http_build_query(['url' => $item['author-link'] . '/photos']);
+ $profile_link = $profile_link . '?' . http_build_query(['url' => $item['author-link'] . '/profile']);
+ }
$receivers = [];
// Convert mentions in the body to a unified format
$item['body'] = BBCode::setMentions($item['body'], $item['uid'], $item['network']);
$receivers = [];
// Convert mentions in the body to a unified format
$item['body'] = BBCode::setMentions($item['body'], $item['uid'], $item['network']);
foreach (Tag::getFromBody($item['body'], Tag::TAG_CHARACTER[Tag::MENTION] . Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION]) as $tag) {
$contact = Contact::getByURLForUser($tag[2], $item['uid']);
if (empty($contact)) {
foreach (Tag::getFromBody($item['body'], Tag::TAG_CHARACTER[Tag::MENTION] . Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION]) as $tag) {
$contact = Contact::getByURLForUser($tag[2], $item['uid']);
if (empty($contact)) {
- $private_forum = $contact['prv'];
- $only_to_forum = ($tag[1] == Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION]);
+ $private_group = $contact['prv'];
+ $only_to_group = ($tag[1] == Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION]);
- $forum_contact = $contact;
- Logger::info('Private forum or exclusive mention', ['url' => $tag[2], 'mention' => $tag[1]]);
+ $group_contact = $contact;
+ Logger::info('Private group or exclusive mention', ['url' => $tag[2], 'mention' => $tag[1]]);
- $forum_contact = $contact;
- Logger::info('Public forum', ['url' => $tag[2], 'mention' => $tag[1]]);
+ $group_contact = $contact;
+ Logger::info('Public group', ['url' => $tag[2], 'mention' => $tag[1]]);
- Logger::info('Post with forum mention will not be converted to a forum post', ['url' => $tag[2], 'mention' => $tag[1]]);
+ Logger::info('Post with group mention will not be converted to a group post', ['url' => $tag[2], 'mention' => $tag[1]]);
- if (($item['gravity'] == ItemModel::GRAVITY_PARENT) && !empty($forum_contact) && ($private_forum || $only_to_forum)) {
- // we tagged a forum in a top level post. Now we change the post
- $item['private'] = $private_forum ? ItemModel::PRIVATE : ItemModel::UNLISTED;
-
- if ($only_to_forum) {
+ if (($item['gravity'] == ItemModel::GRAVITY_PARENT) && !empty($group_contact) && ($private_group || $only_to_group)) {
+ // we tagged a group in a top level post. Now we change the post
+ $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']);
+ }
+
if (empty($receivers)) {
// For security reasons direct posts without any receiver will be posts to yourself
$self = Contact::selectFirst(['id'], ['uid' => $item['uid'], 'self' => true]);
if (empty($receivers)) {
// For security reasons direct posts without any receiver will be posts to yourself
$self = Contact::selectFirst(['id'], ['uid' => $item['uid'], 'self' => true]);
- * @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, ...
- $item['body'] = preg_replace("/\[share.*?\](.*)\[\/share\]/ism", $encaspulated_share, $item['body']);
+ $item['body'] = preg_replace("/\[share.*?\](.*)\[\/share\]/ism", $encapsulated_share, $item['body']);
}
}
$item['body'] = HTML::toBBCode(BBCode::convertForUriId($item['uri-id'], $item['body'], BBCode::ACTIVITYPUB));
}
}
$item['body'] = HTML::toBBCode(BBCode::convertForUriId($item['uri-id'], $item['body'], BBCode::ACTIVITYPUB));
if ($post['post-type'] != ItemModel::PT_PERSONAL_NOTE) {
// Look for any tags and linkify them
$post = $this->expandTags($post);
if ($post['post-type'] != ItemModel::PT_PERSONAL_NOTE) {
// Look for any tags and linkify them
$post = $this->expandTags($post);