diff options
author | zotlabs <mike@macgirvin.com> | 2018-11-22 04:25:59 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2018-12-02 10:13:12 +0100 |
commit | 4010ea814a190e72ed99a32723db1f59e7b6542a (patch) | |
tree | 5e0b98370ffe8c56a7b60d468249168fd85cf506 | |
parent | 8e25c091f4c10494e0c7a4c026f80070eaeabc4a (diff) | |
download | volse-hubzilla-4010ea814a190e72ed99a32723db1f59e7b6542a.tar.gz volse-hubzilla-4010ea814a190e72ed99a32723db1f59e7b6542a.tar.bz2 volse-hubzilla-4010ea814a190e72ed99a32723db1f59e7b6542a.zip |
fix mastodon tag notifications (again)
(cherry picked from commit 8e713245144d0bcedca0d3345017b5fa232c8ca3)
-rwxr-xr-x | include/items.php | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/include/items.php b/include/items.php index a679ebf3f..c1613ea8c 100755 --- a/include/items.php +++ b/include/items.php @@ -2625,28 +2625,30 @@ function tag_deliver($uid, $item_id) { $plustagged = false; $matches = array(); - $pattern = '/[\!@]\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($term['term'],'/') . '\[\/zrl\]/'; + $pattern = '/[\!@]\!?\[[uz]rl\=' . preg_quote($term['url'],'/') . '\](.*?)\[\/[uz]rl\]/'; if(preg_match($pattern,$body,$matches)) $tagged = true; - // original red forum tagging sequence @forumname+ + $pattern = '/\[url\=' . preg_quote($term['url'],'/') . '\]\@(.*?)\[\/url\]/'; + if(preg_match($pattern,$body,$matches)) + $tagged = true; + + // standard forum tagging sequence !forumname - $pluspattern = '/@\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\+\[\/zrl\]/'; + $forumpattern = '/\!\!?\[[uz]rl\=([^\]]*?)\]((?:.(?!\[[uz]rl\=))*?)\[\/[uz]rl\]/'; - $forumpattern = '/\!\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\[\/zrl\]/'; + $forumpattern2 = '/\[[uz]rl\=([^\]]*?)\]\!((?:.(?!\[[uz]rl\=))*?)\[\/[uz]rl\]/'; - $found = false; $matches = array(); - if(preg_match_all($pluspattern,$body,$matches,PREG_SET_ORDER)) { + if(preg_match_all($forumpattern,$body,$matches,PREG_SET_ORDER)) { foreach($matches as $match) { $matched_forums ++; - if($term['url'] === $match[1] && intval($term['ttype']) === TERM_MENTION) { + if($term['url'] === $match[1] && intval($term['ttype']) === TERM_FORUM) { if($matched_forums <= $max_forums) { $plustagged = true; - $found = true; break; } logger('forum ' . $term['term'] . ' exceeded max_tagged_forums - ignoring'); @@ -2654,13 +2656,12 @@ function tag_deliver($uid, $item_id) { } } - if(preg_match_all($forumpattern,$body,$matches,PREG_SET_ORDER)) { + if(preg_match_all($forumpattern2,$body,$matches,PREG_SET_ORDER)) { foreach($matches as $match) { $matched_forums ++; if($term['url'] === $match[1] && intval($term['ttype']) === TERM_FORUM) { if($matched_forums <= $max_forums) { $plustagged = true; - $found = true; break; } logger('forum ' . $term['term'] . ' exceeded max_tagged_forums - ignoring'); @@ -2882,18 +2883,19 @@ function tgroup_check($uid, $item) { $body = preg_replace('/\[share(.*?)\[\/share\]/','',$item['body']); - $pluspattern = '/@\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\+\[\/zrl\]/'; - $forumpattern = '/\!\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\[\/zrl\]/'; + $forumpattern2 = '/\[zrl\=([^\]]*?)\]\!((?:.(?!\[zrl\=))*?)\[\/zrl\]/'; + + $found = false; $matches = array(); - if(preg_match_all($pluspattern,$body,$matches,PREG_SET_ORDER)) { + if(preg_match_all($forumpattern,$body,$matches,PREG_SET_ORDER)) { foreach($matches as $match) { $matched_forums ++; - if($term['url'] === $match[1] && intval($term['ttype']) === TERM_MENTION) { + if($term['url'] === $match[1] && intval($term['ttype']) === TERM_FORUM) { if($matched_forums <= $max_forums) { $found = true; break; @@ -2903,7 +2905,7 @@ function tgroup_check($uid, $item) { } } - if(preg_match_all($forumpattern,$body,$matches,PREG_SET_ORDER)) { + if(preg_match_all($forumpattern2,$body,$matches,PREG_SET_ORDER)) { foreach($matches as $match) { $matched_forums ++; if($term['url'] === $match[1] && intval($term['ttype']) === TERM_FORUM) { |