diff options
author | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-08-06 23:57:28 +0200 |
---|---|---|
committer | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-08-06 23:57:28 +0200 |
commit | 07cd0c870f48ec838c23fa7c6966ceb1c41f06ab (patch) | |
tree | 26a1177441c40c2d3e42d3fc3617302dc2d86f12 /include/oembed.php | |
parent | 2b1e6723168665039cdccb951e29c4220351367a (diff) | |
parent | 1b0cb9388cd5c416af5ba270127b14efdd1c0a6b (diff) | |
download | volse-hubzilla-07cd0c870f48ec838c23fa7c6966ceb1c41f06ab.tar.gz volse-hubzilla-07cd0c870f48ec838c23fa7c6966ceb1c41f06ab.tar.bz2 volse-hubzilla-07cd0c870f48ec838c23fa7c6966ceb1c41f06ab.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/oembed.php')
-rwxr-xr-x | include/oembed.php | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/include/oembed.php b/include/oembed.php index 0628afaa9..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; @@ -95,7 +124,8 @@ function oembed_fetch_url($embedurl){ Cache::set($a->videowidth . $embedurl,$txt); } - + + $j = json_decode($txt); $j->embedurl = $embedurl; return $j; |