- // Look for any tags and linkify them
- $inform = '';
- $private_forum = false;
- $private_id = null;
- $only_to_forum = false;
- $forum_contact = [];
-
- $body = BBCode::performWithEscapedTags($body, ['noparse', 'pre', 'code', 'img'], function ($body) use ($profile_uid, $network, $str_contact_allow, &$inform, &$private_forum, &$private_id, &$only_to_forum, &$forum_contact) {
- $tags = BBCode::getTags($body);
-
- $tagged = [];
-
- foreach ($tags as $tag) {
- $tag_type = substr($tag, 0, 1);
-
- if ($tag_type == Tag::TAG_CHARACTER[Tag::HASHTAG]) {
- continue;
- }
-
- /* If we already tagged 'Robert Johnson', don't try and tag 'Robert'.
- * Robert Johnson should be first in the $tags array
- */
- foreach ($tagged as $nextTag) {
- if (stristr($nextTag, $tag . ' ')) {
- continue 2;
- }
- }
-
- $success = ItemHelper::replaceTag($body, $inform, local_user() ? local_user() : $profile_uid, $tag, $network);
- if ($success['replaced']) {
- $tagged[] = $tag;
- }
- // When the forum is private or the forum is addressed with a "!" make the post private
- if (!empty($success['contact']['prv']) || ($tag_type == Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION])) {
- $private_forum = $success['contact']['prv'];
- $only_to_forum = ($tag_type == Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION]);
- $private_id = $success['contact']['id'];
- $forum_contact = $success['contact'];
- } elseif (!empty($success['contact']['forum']) && ($str_contact_allow == '<' . $success['contact']['id'] . '>')) {
- $private_forum = false;
- $only_to_forum = true;
- $private_id = $success['contact']['id'];
- $forum_contact = $success['contact'];
- }
- }
-
- return $body;
- });
-
- $original_contact_id = $contact_id;
+ // Personal notes must never be altered to a forum post.
+ if ($posttype != Item::PT_PERSONAL_NOTE) {
+ // Look for any tags and linkify them
+ $item = [
+ 'uid' => local_user() ? local_user() : $profile_uid,
+ 'gravity' => $toplevel_item_id ? GRAVITY_COMMENT : GRAVITY_PARENT,
+ 'network' => $network,
+ 'body' => $body,
+ 'postopts' => $postopts,
+ 'private' => $private,
+ 'allow_cid' => $str_contact_allow,
+ 'allow_gid' => $str_group_allow,
+ 'deny_cid' => $str_contact_deny,
+ 'deny_gid' => $str_group_deny,
+ ];