diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-08-04 20:07:55 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-08-04 20:07:55 -0700 |
commit | ea63f3312fc69df6c9e9b55568933a65adafee77 (patch) | |
tree | ffb6192a7e8beb00a7ce39a4439318292e3057ce /include/oembed.php | |
parent | 5344431fc07e03d84a1e0c2ff7fb3e4c4d731cfe (diff) | |
download | volse-hubzilla-ea63f3312fc69df6c9e9b55568933a65adafee77.tar.gz volse-hubzilla-ea63f3312fc69df6c9e9b55568933a65adafee77.tar.bz2 volse-hubzilla-ea63f3312fc69df6c9e9b55568933a65adafee77.zip |
personal oembed black/white list
Diffstat (limited to 'include/oembed.php')
-rwxr-xr-x | include/oembed.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/oembed.php b/include/oembed.php index a11a64eec..e50d34c7d 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -2,6 +2,35 @@ function oembed_replacecb($matches){ $embedurl=$matches[1]; + + // implements a personal embed white/black list for logged in members + if(local_channel()) { + if(($x = get_pconfig(local_channel(),'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_pconfig(local_channel(),'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>'; + } + } + } + $j = oembed_fetch_url($embedurl); $s = oembed_format_object($j); return $s; |