diff --git a/include/enotify.php b/include/enotify.php index 1edad36ac..409fc66fa 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 71793f14d..208477b19 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 e81bd2af3..145f636cc 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 .= '