Improved check against profile

pull/2301/head
Michael Vogel 2016-01-29 01:18:18 +01:00
rodzic b3e86f4e6b
commit 8767ea5f52
1 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -654,13 +654,17 @@ function check_item_notification($itemid, $uid, $profile = "", $defaulttype = ""
if ($profile == "") if ($profile == "")
$profile = $local_profile; $profile = $local_profile;
$profile = normalise_link($profile);
$profile_ssl = str_replace("http://", "https://", normalise_link($profile));
// Only act if it is a "real" post // Only act if it is a "real" post
// We need the additional check for the "local_profile" because of mixed situations on connector networks // We need the additional check for the "local_profile" because of mixed situations on connector networks
$item = q("SELECT `id`, `mention`, `tag`,`parent`, `title`, `body`, `author-name`, `author-link`, `author-avatar`, `guid`, $item = q("SELECT `id`, `mention`, `tag`,`parent`, `title`, `body`, `author-name`, `author-link`, `author-avatar`, `guid`,
`parent-uri`, `uri`, `contact-id` `parent-uri`, `uri`, `contact-id`
FROM `item` WHERE `id` = %d AND `verb` IN ('%s', '') AND `type` != 'activity' AND FROM `item` WHERE `id` = %d AND `verb` IN ('%s', '') AND `type` != 'activity' AND
`author-link` != '%s' AND `author-link` != '%s' LIMIT 1", NOT (`author-link` IN ('%s', '%s', '%s')) LIMIT 1",
intval($itemid), dbesc(ACTIVITY_POST), dbesc($profile), dbesc($local_profile)); intval($itemid), dbesc(ACTIVITY_POST), dbesc($profile), dbesc($profile_ssl), dbesc($local_profile));
if (!$item) if (!$item)
return false; return false;
@ -708,7 +712,8 @@ function check_item_notification($itemid, $uid, $profile = "", $defaulttype = ""
} }
// Is the user mentioned in this post? // Is the user mentioned in this post?
if ($item[0]["mention"] OR strpos($item[0]["tag"], "=".$profile."]") OR ($defaulttype == NOTIFY_TAGSELF)) { if ($item[0]["mention"] OR strpos($item[0]["tag"], "=".$profile."]") OR strpos($item[0]["tag"], "=".$profile_ssl."]") OR
strpos($item[0]["tag"], "=".$local_profile."]") OR ($defaulttype == NOTIFY_TAGSELF)) {
$params["type"] = NOTIFY_TAGSELF; $params["type"] = NOTIFY_TAGSELF;
$params["verb"] = ACTIVITY_TAG; $params["verb"] = ACTIVITY_TAG;
} }
@ -716,9 +721,10 @@ function check_item_notification($itemid, $uid, $profile = "", $defaulttype = ""
// Is it a post that the user had started or where he interacted? // Is it a post that the user had started or where he interacted?
$parent = q("SELECT `thread`.`iid` FROM `thread` INNER JOIN `item` ON `item`.`parent` = `thread`.`iid` $parent = q("SELECT `thread`.`iid` FROM `thread` INNER JOIN `item` ON `item`.`parent` = `thread`.`iid`
WHERE `thread`.`iid` = %d AND `thread`.`uid` = %d AND NOT `thread`.`ignored` AND WHERE `thread`.`iid` = %d AND `thread`.`uid` = %d AND NOT `thread`.`ignored` AND
(`thread`.`mention` OR `item`.`author-link` = '%s') (`thread`.`mention` OR `item`.`author-link` IN ('%s', '%s', '%s'))
LIMIT 1", LIMIT 1",
intval($item[0]["parent"]), intval($uid), dbesc($profile)); intval($item[0]["parent"]), intval($uid),
dbesc($profile), dbesc($profile_ssl), dbesc($local_profile));
if ($parent AND !isset($params["type"])) { if ($parent AND !isset($params["type"])) {
$params["type"] = NOTIFY_COMMENT; $params["type"] = NOTIFY_COMMENT;
$params["verb"] = ACTIVITY_POST; $params["verb"] = ACTIVITY_POST;