provide the site blacklist everywhere it is needed
This commit is contained in:
parent
72a766432d
commit
69d3e5468d
@ -106,6 +106,26 @@ function diaspora_dispatch($importer,$msg,$attempt=1) {
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function diaspora_is_blacklisted($s) {
|
||||||
|
|
||||||
|
$bl1 = get_config('system','blacklisted_sites');
|
||||||
|
if(is_array($bl1) && $bl1) {
|
||||||
|
foreach($bl1 as $bl) {
|
||||||
|
if($bl && strpos($s,$bl) !== false) {
|
||||||
|
logger('diaspora_is_blacklisted: blacklisted ' . $s);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function diaspora_handle_from_contact($contact_id) {
|
function diaspora_handle_from_contact($contact_id) {
|
||||||
$handle = false;
|
$handle = false;
|
||||||
|
|
||||||
@ -122,6 +142,10 @@ function diaspora_handle_from_contact($contact_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function diaspora_get_contact_by_handle($uid,$handle) {
|
function diaspora_get_contact_by_handle($uid,$handle) {
|
||||||
|
|
||||||
|
if(diaspora_is_blacklisted($handle))
|
||||||
|
return false;
|
||||||
|
|
||||||
$r = q("SELECT * FROM abook left join xchan on xchan_hash = abook_xchan where xchan_addr = '%s' and abook_channel = %d limit 1",
|
$r = q("SELECT * FROM abook left join xchan on xchan_hash = abook_xchan where xchan_addr = '%s' and abook_channel = %d limit 1",
|
||||||
dbesc($handle),
|
dbesc($handle),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
@ -140,6 +164,8 @@ function find_diaspora_person_by_handle($handle) {
|
|||||||
$endlessloop = 0;
|
$endlessloop = 0;
|
||||||
$maxloops = 10;
|
$maxloops = 10;
|
||||||
|
|
||||||
|
if(diaspora_is_blacklisted($handle))
|
||||||
|
return false;
|
||||||
|
|
||||||
$r = q("select * from xchan where xchan_addr = '%s' limit 1",
|
$r = q("select * from xchan where xchan_addr = '%s' limit 1",
|
||||||
dbesc($handle)
|
dbesc($handle)
|
||||||
|
@ -41,7 +41,7 @@ function externals_run($argv, $argc){
|
|||||||
$bl1 = get_config('system','blacklisted_sites');
|
$bl1 = get_config('system','blacklisted_sites');
|
||||||
if(is_array($bl1) && $bl1) {
|
if(is_array($bl1) && $bl1) {
|
||||||
foreach($bl1 as $bl) {
|
foreach($bl1 as $bl) {
|
||||||
if(strpos($url,$bl) !== false) {
|
if($bl && strpos($url,$bl) !== false) {
|
||||||
$blacklisted = true;
|
$blacklisted = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -507,6 +507,22 @@ function zot_refresh($them,$channel = null, $force = false) {
|
|||||||
function zot_gethub($arr) {
|
function zot_gethub($arr) {
|
||||||
|
|
||||||
if($arr['guid'] && $arr['guid_sig'] && $arr['url'] && $arr['url_sig']) {
|
if($arr['guid'] && $arr['guid_sig'] && $arr['url'] && $arr['url_sig']) {
|
||||||
|
|
||||||
|
$blacklisted = false;
|
||||||
|
$bl1 = get_config('system','blacklisted_sites');
|
||||||
|
if(is_array($bl1) && $bl1) {
|
||||||
|
foreach($bl1 as $bl) {
|
||||||
|
if($bl && strpos($arr['url'],$bl) !== false) {
|
||||||
|
$blacklisted = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($blacklisted) {
|
||||||
|
logger('zot_gethub: blacklisted site: ' . $arr['url']);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$r = q("select * from hubloc
|
$r = q("select * from hubloc
|
||||||
where hubloc_guid = '%s' and hubloc_guid_sig = '%s'
|
where hubloc_guid = '%s' and hubloc_guid_sig = '%s'
|
||||||
and hubloc_url = '%s' and hubloc_url_sig = '%s'
|
and hubloc_url = '%s' and hubloc_url_sig = '%s'
|
||||||
|
Reference in New Issue
Block a user