Merge branch 'dev' of ../hz into dev

This commit is contained in:
zotlabs 2019-03-18 19:10:38 -07:00
commit a743feb040
2 changed files with 21 additions and 3 deletions

View File

@ -19,7 +19,7 @@ class MessageFilter {
$lang = null; $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); $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) === '*'))) if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return false; 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)) elseif((strpos($word,'/') === 0) && preg_match($word,$text))
return false; return false;
elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0)) elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0))
return false; return false;
elseif((strpos($word,'lang!=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,6))) != 0))
return false;
elseif(stristr($text,$word) !== false) elseif(stristr($text,$word) !== false)
return 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) === '*'))) if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
return true; 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)) elseif((strpos($word,'/') === 0) && preg_match($word,$text))
return true; return true;
elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0)) elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0))
return true; return true;
elseif((strpos($word,'lang!=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,6))) != 0))
return true;
elseif(stristr($text,$word) !== false) elseif(stristr($text,$word) !== false)
return true; return true;
} }

View File

@ -1712,13 +1712,17 @@ function allowed_public_recips($msg) {
$condensed_recips[] = $rr['hash']; $condensed_recips[] = $rr['hash'];
$results = array(); $results = array();
$r = q("select channel_hash as hash from channel left join abook on abook_channel = channel_id where abook_xchan = '%s' and channel_removed = 0 ", $r = q("select channel_hash as hash, channel_id from channel left join abook on abook_channel = channel_id where abook_xchan = '%s' and channel_removed = 0 ",
dbesc($hash) dbesc($hash)
); );
if($r) { if($r) {
foreach($r as $rr) foreach($r as $rr) {
$cfg = get_abconfig($rr['channel_id'],$rr['hash'],'their_perms','view_stream');
if((! $cfg) && $scope !== 'any connections')
continue;
if(in_array($rr['hash'],$condensed_recips)) if(in_array($rr['hash'],$condensed_recips))
$results[] = array('hash' => $rr['hash']); $results[] = array('hash' => $rr['hash']);
}
} }
return $results; return $results;
} }