From 40b00ab3624ba935e9bfdc1bccac373c0daf4597 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 4 Feb 2016 16:09:36 -0800 Subject: add system black/white list for embeds ahead of personal config --- include/oembed.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'include') diff --git a/include/oembed.php b/include/oembed.php index 7c577b6c2..cac0154f6 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -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 '' . $embedurl . ''; + } + } + } + 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 '' . $embedurl . ''; + } + } + // implements a personal embed white/black list for logged in members if(local_channel()) { if(($x = get_pconfig(local_channel(),'system','embed_deny'))) { -- cgit v1.2.3