diff --git a/include/enotify.php b/include/enotify.php index 1edad36ac0..409fc66fac 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -184,9 +184,9 @@ function notification($params) // First go for the general message // "George Bull's post" - if ($params['activity']['origin_comment']) { + if (!empty($params['activity']['origin_comment'])) { $message = $l10n->t('%1$s replied to you on %2$s\'s %3$s %4$s'); - } elseif ($params['activity']['explicit_tagged']) { + } elseif (!empty($params['activity']['explicit_tagged'])) { $message = $l10n->t('%1$s tagged you on %2$s\'s %3$s %4$s'); } else { $message = $l10n->t('%1$s commented on %2$s\'s %3$s %4$s'); @@ -197,10 +197,10 @@ function notification($params) // Then look for the special cases // "your post" - if ($params['activity']['origin_thread']) { - if ($params['activity']['origin_comment']) { + if (!empty($params['activity']['origin_thread'])) { + if (!empty($params['activity']['origin_comment'])) { $message = $l10n->t('%1$s replied to you on your %2$s %3$s'); - } elseif ($params['activity']['explicit_tagged']) { + } elseif (!empty($params['activity']['explicit_tagged'])) { $message = $l10n->t('%1$s tagged you on your %2$s %3$s'); } else { $message = $l10n->t('%1$s commented on your %2$s %3$s'); @@ -209,9 +209,9 @@ function notification($params) $dest_str = sprintf($message, $params['source_name'], $item_post_type, $title); // "their post" } elseif ($item['author-link'] == $params['source_link']) { - if ($params['activity']['origin_comment']) { + if (!empty($params['activity']['origin_comment'])) { $message = $l10n->t('%1$s replied to you on their %2$s %3$s'); - } elseif ($params['activity']['explicit_tagged']) { + } elseif (!empty($params['activity']['explicit_tagged'])) { $message = $l10n->t('%1$s tagged you on their %2$s %3$s'); } else { $message = $l10n->t('%1$s commented on their %2$s %3$s'); @@ -224,7 +224,7 @@ function notification($params) // So, we cannot have different subjects for notifications of the same thread. // Before this we have the name of the replier on the subject rendering // different subjects for messages on the same thread. - if ($params['activity']['explicit_tagged']) { + if (!empty($params['activity']['explicit_tagged'])) { $subject = $l10n->t('%s %s tagged you', $subjectPrefix, $params['source_name']); $preamble = $l10n->t('%1$s tagged you at %2$s', $params['source_name'], $sitename); diff --git a/mod/item.php b/mod/item.php index 71793f14dc..208477b19a 100644 --- a/mod/item.php +++ b/mod/item.php @@ -410,21 +410,22 @@ function item_post(App $a) { } } - $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']; + if ($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']; + } } } diff --git a/mod/tagrm.php b/mod/tagrm.php index e81bd2af38..145f636cc4 100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php @@ -81,25 +81,27 @@ function tagrm_content(App $a) { $o = ''; + $photo_return = $_SESSION['photo_return'] ?? ''; + if (!local_user()) { - DI::baseUrl()->redirect($_SESSION['photo_return']); + DI::baseUrl()->redirect($photo_return); // NOTREACHED } if ($a->argc == 3) { update_tags($a->argv[1], [Strings::escapeTags(trim(hex2bin($a->argv[2])))]); - DI::baseUrl()->redirect($_SESSION['photo_return']); + DI::baseUrl()->redirect($photo_return); } $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); if (!$item_id) { - DI::baseUrl()->redirect($_SESSION['photo_return']); + DI::baseUrl()->redirect($photo_return); // NOTREACHED } $item = Post::selectFirst(['uri-id'], ['id' => $item_id, 'uid' => local_user()]); if (!DBA::isResult($item)) { - DI::baseUrl()->redirect($_SESSION['photo_return']); + DI::baseUrl()->redirect($photo_return); } $tag_text = Tag::getCSVByURIId($item['uri-id']); @@ -107,7 +109,7 @@ function tagrm_content(App $a) $arr = explode(',', $tag_text); if (empty($arr)) { - DI::baseUrl()->redirect($_SESSION['photo_return']); + DI::baseUrl()->redirect($photo_return); } $o .= '

' . DI::l10n()->t('Remove Item Tag') . '

'; diff --git a/src/Content/Item.php b/src/Content/Item.php index f0d08d48e6..56836903b3 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -127,16 +127,6 @@ class Item $tag_type = substr($tag, 0, 1); //is it already replaced? if (strpos($tag, '[url=')) { - // Checking for the alias that is used for OStatus - $pattern = '/[@!]\[url\=(.*?)\](.*?)\[\/url\]/ism'; - if (preg_match($pattern, $tag, $matches)) { - $data = Contact::getByURL($matches[1], false, ['alias', 'nick']); - - if ($data['alias'] != '') { - $newtag = '@[url=' . $data['alias'] . ']' . $data['nick'] . '[/url]'; - } - } - return $replaced; } diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 03ccd889a4..2bb563e74a 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -2196,9 +2196,7 @@ class BBCode } } - $success = Item::replaceTag($body, $inform, $profile_uid, $tag, $network); - - if ($success['replaced']) { + if (($success = Item::replaceTag($body, $inform, $profile_uid, $tag, $network)) && $success['replaced']) { $tagged[] = $tag; } } diff --git a/src/Model/Item.php b/src/Model/Item.php index 0ca1138f9e..b7267428ab 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -2864,7 +2864,7 @@ class Item 'mime' => $attachment['mimetype'], ], ]); - if ($item['post-type'] == Item::PT_VIDEO) { + if (($item['post-type'] ?? null) == Item::PT_VIDEO) { $leading .= $media; } else { $trailing .= $media; diff --git a/update.php b/update.php index 0a97b4e10c..551d208fe4 100644 --- a/update.php +++ b/update.php @@ -835,7 +835,7 @@ function update_1404() while ($task = DBA::fetch($tasks)) { $parameters = json_decode($task['parameter'], true); - if (in_array($parameters[0], [Delivery::MAIL, Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION])) { + if (is_array($parameters) && count($parameters) && in_array($parameters[0], [Delivery::MAIL, Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION])) { continue; }