diff options
Diffstat (limited to 'Zotlabs/Module/Channel.php')
-rw-r--r-- | Zotlabs/Module/Channel.php | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index b1639b213..d975ac1bf 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -13,6 +13,7 @@ require_once('include/items.php'); require_once('include/security.php'); require_once('include/conversation.php'); require_once('include/acl_selectors.php'); +require_once('include/opengraph.php'); /** @@ -109,19 +110,20 @@ class Channel extends Controller { // Run profile_load() here to make sure the theme is set before // we start loading content - profile_load($which,$profile); - - App::$page['htmlhead'] .= '<meta property="og:title" content="' . htmlspecialchars($channel['channel_name']) . '">' . "\r\n"; - App::$page['htmlhead'] .= '<meta property="og:image" content="' . $channel['xchan_photo_l'] . '">' . "\r\n"; - - if(App::$profile['about'] && perm_is_allowed($channel['channel_id'],get_observer_hash(),'view_profile')) { - App::$page['htmlhead'] .= '<meta property="og:description" content="' . htmlspecialchars(App::$profile['about']) . '">' . "\r\n"; - } - else { - App::$page['htmlhead'] .= '<meta property="og:description" content="' . htmlspecialchars(sprintf( t('This is the home page of %s.'), $channel['channel_name'])) . '">' . "\r\n"; - } - + + // Add Opengraph markup + $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); + if(strpos($mid,'b64.') === 0) + $mid = @base64url_decode(substr($mid,4)); + + if($mid) + $r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d AND item_private = 0 LIMIT 1", + dbesc($mid), + intval($channel['channel_id']) + ); + + opengraph_add_meta($r ? $r[0] : [], $channel); } function get($update = 0, $load = false) { @@ -362,7 +364,7 @@ class Channel extends Controller { $parents_str = ids_to_querystr($r,'item_id'); - $items = q("SELECT item.*, item.id AS item_id + $r = q("SELECT item.*, item.id AS item_id FROM item WHERE item.uid = %d $item_normal AND item.parent IN ( %s ) @@ -371,8 +373,8 @@ class Channel extends Controller { dbesc($parents_str) ); - xchan_query($items); - $items = fetch_post_tags($items, true); + xchan_query($r); + $items = fetch_post_tags($r, true); $items = conv_sort($items,$ordering); if($load && $mid && (! count($items))) { |