mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:35:30 +00:00
issues with language filtering
This commit is contained in:
parent
0a2eae6612
commit
50ad168ad0
5 changed files with 24 additions and 30 deletions
|
@ -1603,12 +1603,10 @@ class Activity {
|
|||
}
|
||||
|
||||
|
||||
if($abook) {
|
||||
if(! post_is_importable($s,$abook[0])) {
|
||||
if(! post_is_importable($channel['channel_id'],$s,$abook[0])) {
|
||||
logger('post is filtered');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if($act->obj['conversation']) {
|
||||
set_iconfig($s,'ostatus','conversation',$act->obj['conversation'],1);
|
||||
|
@ -2139,13 +2137,11 @@ class Activity {
|
|||
intval($channel['channel_id'])
|
||||
);
|
||||
|
||||
if($abook) {
|
||||
if(! post_is_importable($item,$abook[0])) {
|
||||
|
||||
if(! post_is_importable($channel['channel_id'],$item,$abook[0])) {
|
||||
logger('post is filtered');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($act->obj['conversation']) {
|
||||
set_iconfig($item,'ostatus','conversation',$act->obj['conversation'],1);
|
||||
|
@ -2374,12 +2370,10 @@ class Activity {
|
|||
intval($channel['channel_id'])
|
||||
);
|
||||
|
||||
if($abook) {
|
||||
if(! post_is_importable($s,$abook[0])) {
|
||||
if(! post_is_importable($channel['channel_id'],$s,$abook[0])) {
|
||||
logger('post is filtered');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if($act->obj['conversation']) {
|
||||
set_iconfig($s,'ostatus','conversation',$act->obj['conversation'],1);
|
||||
|
|
|
@ -1666,7 +1666,7 @@ class Libzot {
|
|||
elseif($arr['edited'] > $r[0]['edited']) {
|
||||
$arr['id'] = $r[0]['id'];
|
||||
$arr['uid'] = $channel['channel_id'];
|
||||
if(($arr['mid'] == $arr['parent_mid']) && (! post_is_importable($arr,$abook))) {
|
||||
if(($arr['mid'] == $arr['parent_mid']) && (! post_is_importable($channel['channel_id'],$arr,$abook))) {
|
||||
$DR->update('update ignored');
|
||||
$result[] = $DR->get();
|
||||
}
|
||||
|
@ -1706,7 +1706,7 @@ class Libzot {
|
|||
|
||||
$item_id = 0;
|
||||
|
||||
if(($arr['mid'] == $arr['parent_mid']) && (! post_is_importable($arr,$abook))) {
|
||||
if(($arr['mid'] == $arr['parent_mid']) && (! post_is_importable($arr['uid'],$arr,$abook))) {
|
||||
$DR->update('post ignored');
|
||||
$result[] = $DR->get();
|
||||
}
|
||||
|
|
|
@ -16,10 +16,9 @@ class MessageFilter {
|
|||
$text = prepare_text($item['body'],$item['mimetype']);
|
||||
$text = html2plain(($item['title']) ? $item['title'] . ' ' . $text : $text);
|
||||
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1338,7 +1338,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
|
|||
}
|
||||
}
|
||||
|
||||
if(! post_is_importable($datarray, $contact))
|
||||
if(! post_is_importable($importer['channel_id'],$datarray, $contact))
|
||||
continue;
|
||||
|
||||
$datarray['parent_mid'] = $datarray['mid'];
|
||||
|
@ -1494,7 +1494,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
|
|||
}
|
||||
}
|
||||
|
||||
if(! post_is_importable($datarray, $contact))
|
||||
if(! post_is_importable($importer['channel_id'],$datarray, $contact))
|
||||
continue;
|
||||
|
||||
logger('author: ' . print_r($author, true), LOGGER_DEBUG);
|
||||
|
|
|
@ -3261,26 +3261,27 @@ function check_item_source($uid, $item) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function post_is_importable($item,$abook) {
|
||||
|
||||
if(! $abook)
|
||||
return true;
|
||||
|
||||
$incl = PConfig::get($abook['abook_channel'],'system','message_filter_incl',EMPTY_STR);
|
||||
$excl = PConfig::get($abook['abook_channel'],'system','message_filter_excl',EMPTY_STR);
|
||||
if($incl || $excl) {
|
||||
$x = MessageFilter::evaluate($item,$incl,$excl);
|
||||
if(! $x) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(($abook['abook_channel']) && (! feature_enabled($abook['abook_channel'],'connfilter')))
|
||||
return true;
|
||||
function post_is_importable($channel_id,$item,$abook) {
|
||||
|
||||
if(! $item)
|
||||
return false;
|
||||
|
||||
$incl = PConfig::get($channel_id,'system','message_filter_incl',EMPTY_STR);
|
||||
$excl = PConfig::get($channel_id,'system','message_filter_excl',EMPTY_STR);
|
||||
if($incl || $excl) {
|
||||
$x = MessageFilter::evaluate($item,$incl,$excl);
|
||||
if(! $x) {
|
||||
logger('MessageFilter: channel blocked content',LOGGER_DEBUG,LOG_INFO);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(($channel_id) && (! feature_enabled($channel_id,'connfilter')))
|
||||
return true;
|
||||
|
||||
if(! $abook)
|
||||
return true;
|
||||
|
||||
if(! ($abook['abook_incl'] || $abook['abook_excl']))
|
||||
return true;
|
||||
|
||||
|
|
Loading…
Reference in a new issue