diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index efbfcbee3..9c920b362 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1603,11 +1603,9 @@ class Activity { } - if($abook) { - if(! post_is_importable($s,$abook[0])) { - logger('post is filtered'); - return; - } + if(! post_is_importable($channel['channel_id'],$s,$abook[0])) { + logger('post is filtered'); + return; } if($act->obj['conversation']) { @@ -2139,13 +2137,11 @@ class Activity { intval($channel['channel_id']) ); - if($abook) { - if(! post_is_importable($item,$abook[0])) { - logger('post is filtered'); - return; - } - } + 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,11 +2370,9 @@ class Activity { intval($channel['channel_id']) ); - if($abook) { - if(! post_is_importable($s,$abook[0])) { - logger('post is filtered'); - return; - } + if(! post_is_importable($channel['channel_id'],$s,$abook[0])) { + logger('post is filtered'); + return; } if($act->obj['conversation']) { diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index aa3af4ae3..14893f71b 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -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(); } diff --git a/Zotlabs/Lib/MessageFilter.php b/Zotlabs/Lib/MessageFilter.php index 281a47c83..b45a1f229 100644 --- a/Zotlabs/Lib/MessageFilter.php +++ b/Zotlabs/Lib/MessageFilter.php @@ -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); } diff --git a/include/feedutils.php b/include/feedutils.php index 6de7d86e0..1bc006211 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -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); diff --git a/include/items.php b/include/items.php index 17b261e21..9a64ce66a 100755 --- a/include/items.php +++ b/include/items.php @@ -3261,25 +3261,26 @@ function check_item_source($uid, $item) { return false; } -function post_is_importable($item,$abook) { +function post_is_importable($channel_id,$item,$abook) { - if(! $abook) - return true; + if(! $item) + return false; - $incl = PConfig::get($abook['abook_channel'],'system','message_filter_incl',EMPTY_STR); - $excl = PConfig::get($abook['abook_channel'],'system','message_filter_excl',EMPTY_STR); + $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(($abook['abook_channel']) && (! feature_enabled($abook['abook_channel'],'connfilter'))) + if(($channel_id) && (! feature_enabled($channel_id,'connfilter'))) return true; - if(! $item) - return false; + if(! $abook) + return true; if(! ($abook['abook_incl'] || $abook['abook_excl'])) return true;