aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-03-18 19:09:12 -0700
committerzotlabs <mike@macgirvin.com>2019-03-18 19:09:12 -0700
commitb028667de17a122d3255b8db285866c66fda9fcf (patch)
treefa851ba9d67556491c3f3639f2a81da7a3efef0c /Zotlabs/Lib
parent136b2ae37f36d0b772166f7c8fac5a27b4b8a4d3 (diff)
downloadvolse-hubzilla-b028667de17a122d3255b8db285866c66fda9fcf.tar.gz
volse-hubzilla-b028667de17a122d3255b8db285866c66fda9fcf.tar.bz2
volse-hubzilla-b028667de17a122d3255b8db285866c66fda9fcf.zip
messagefilter enhancements, fix edge case in unsupported advisory privacy
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/MessageFilter.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/Zotlabs/Lib/MessageFilter.php b/Zotlabs/Lib/MessageFilter.php
index eb0fc3d2c..750d6d424 100644
--- a/Zotlabs/Lib/MessageFilter.php
+++ b/Zotlabs/Lib/MessageFilter.php
@@ -19,7 +19,7 @@ class MessageFilter {
$lang = null;
- if((strpos($incl,'lang=') !== false) || (strpos($excl,'lang=') !== false)) {
+ if((strpos($incl,'lang=') !== false) || (strpos($excl,'lang=') !== false) || (strpos($incl,'lang!=') !== false) || (strpos($excl,'lang!=') !== false)) {
$lang = detect_language($text);
}
@@ -39,10 +39,17 @@ class MessageFilter {
if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return false;
}
+ elseif(substr($word,0,1) === '$' && $tags) {
+ foreach($tags as $t)
+ if(($t['ttype'] == TERM_CATEGORY) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
+ return false;
+ }
elseif((strpos($word,'/') === 0) && preg_match($word,$text))
return false;
elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0))
return false;
+ elseif((strpos($word,'lang!=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,6))) != 0))
+ return false;
elseif(stristr($text,$word) !== false)
return false;
}
@@ -60,10 +67,17 @@ class MessageFilter {
if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return true;
}
+ elseif(substr($word,0,1) === '$' && $tags) {
+ foreach($tags as $t)
+ if(($t['ttype'] == TERM_CATEGORY) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
+ return true;
+ }
elseif((strpos($word,'/') === 0) && preg_match($word,$text))
return true;
elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0))
return true;
+ elseif((strpos($word,'lang!=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,6))) != 0))
+ return true;
elseif(stristr($text,$word) !== false)
return true;
}