add system black/white list for embeds ahead of personal config

This commit is contained in:
redmatrix 2016-02-04 16:09:36 -08:00
parent 18208fab84
commit 40b00ab362

View file

@ -3,6 +3,34 @@ function oembed_replacecb($matches){
$embedurl=$matches[1];
// site white/black list
if(($x = get_config('system','embed_deny'))) {
$l = explode("\n",$x);
if($l) {
foreach($l as $ll) {
if(trim($ll) && strpos($embedurl,trim($ll)) !== false)
return '<a href="' . $embedurl . '">' . $embedurl . '</a>';
}
}
}
if(($x = get_config('system','embed_allow'))) {
$found = false;
$l = explode("\n",$x);
if($l) {
foreach($l as $ll) {
if(trim($ll) && strpos($embedurl,trim($ll)) !== false) {
$found = true;
break;
}
}
}
if(! $found) {
return '<a href="' . $embedurl . '">' . $embedurl . '</a>';
}
}
// implements a personal embed white/black list for logged in members
if(local_channel()) {
if(($x = get_pconfig(local_channel(),'system','embed_deny'))) {