Merge pull request #10346 from MrPetovan/bug/notices
Fix several notices
This commit is contained in:
commit
8fa791073b
7 changed files with 34 additions and 43 deletions
|
@ -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);
|
||||
|
|
31
mod/item.php
31
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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 .= '<h3>' . DI::l10n()->t('Remove Item Tag') . '</h3>';
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue