more work on oembed from /display

This commit is contained in:
zotlabs 2017-08-21 15:00:45 -07:00
parent 9d5b6858ea
commit 894f0156af
3 changed files with 10 additions and 8 deletions

View File

@ -174,6 +174,8 @@ class Display extends \Zotlabs\Web\Controller {
'$verb' => '', '$verb' => '',
'$mid' => $item_hash '$mid' => $item_hash
)); ));
\App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string) . '" title="oembed" />' . "\r\n";
} }
@ -218,13 +220,13 @@ class Display extends \Zotlabs\Web\Controller {
if(! perm_is_allowed($sysid,$observer_hash,'view_stream')) if(! perm_is_allowed($sysid,$observer_hash,'view_stream'))
$sysid = 0; $sysid = 0;
dbg(1);
$r = q("SELECT item.id as item_id from item $r = q("SELECT item.id as item_id from item
WHERE mid = '%s' WHERE mid = '%s'
AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
AND item.deny_gid = '' AND item_private = 0 ) AND item.deny_gid = '' AND item_private = 0 )
and owner_xchan in ( " . stream_perms_xchans(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " )) and uid in ( " . stream_perms_api_uids(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
OR uid = %d ) OR uid = %d )
$sql_extra ) $sql_extra )
$item_normal $item_normal
@ -232,7 +234,7 @@ class Display extends \Zotlabs\Web\Controller {
dbesc($target_item['parent_mid']), dbesc($target_item['parent_mid']),
intval($sysid) intval($sysid)
); );
dbg(0);
} }
} }
} }

View File

@ -95,7 +95,7 @@ class Linkinfo extends \Zotlabs\Web\Controller {
echo $arr['text']; echo $arr['text'];
killme(); killme();
} }
if($process_oembed) { if($process_oembed) {
$x = oembed_process($url); $x = oembed_process($url);
if($x) { if($x) {

View File

@ -66,9 +66,9 @@ class Oep extends \Zotlabs\Web\Controller {
$url = $args['url']; $url = $args['url'];
$maxwidth = intval($args['maxwidth']); $maxwidth = intval($args['maxwidth']);
$maxheight = intval($args['maxheight']); $maxheight = intval($args['maxheight']);
logger('processing display');
if(preg_match('#//display/(.*?)(&|\?|$)#',$url,$matches)) { if(preg_match('#//(.*?)/display/(.*?)(&|\?|$)#',$url,$matches)) {
$res = $matches[1]; $res = $matches[2];
} }
if(strpos($res,'b64.') === 0) { if(strpos($res,'b64.') === 0) {
@ -78,7 +78,7 @@ class Oep extends \Zotlabs\Web\Controller {
$item_normal = item_normal(); $item_normal = item_normal();
$p = q("select * from item where mid like '%s' limit 1", $p = q("select * from item where mid like '%s' limit 1",
dbesc($res . '%'), dbesc($res . '%')
); );
if(! $p) if(! $p)