aboutsummaryrefslogtreecommitdiffstats
path: root/include/oembed.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-02-04 16:09:36 -0800
committerredmatrix <git@macgirvin.com>2016-02-04 16:09:36 -0800
commit40b00ab3624ba935e9bfdc1bccac373c0daf4597 (patch)
tree50ee05fbd429c64247081e5e3ef0cf26030ef9cb /include/oembed.php
parent18208fab8462ebeffe047110d696c6d6cbf13a05 (diff)
downloadvolse-hubzilla-40b00ab3624ba935e9bfdc1bccac373c0daf4597.tar.gz
volse-hubzilla-40b00ab3624ba935e9bfdc1bccac373c0daf4597.tar.bz2
volse-hubzilla-40b00ab3624ba935e9bfdc1bccac373c0daf4597.zip
add system black/white list for embeds ahead of personal config
Diffstat (limited to 'include/oembed.php')
-rwxr-xr-xinclude/oembed.php28
1 files changed, 28 insertions, 0 deletions
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 '<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'))) {