From d3b5e678908864d889b916ad2f976c1af16ca360 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 25 Apr 2013 01:55:35 -0700 Subject: odds and ends in prepearation for photo abstraction, plus red-to-friendica addon --- mod/oexchange.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'mod/oexchange.php') diff --git a/mod/oexchange.php b/mod/oexchange.php index 791a493ff..63b48751c 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -32,18 +32,19 @@ function oexchange_content(&$a) { $tags = (((x($_REQUEST,'tags')) && strlen($_REQUEST['tags'])) ? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : ''); - $s = fetch_url($a->get_baseurl() . '/parse_url?f=&url=' . $url . $title . $description . $tags); + $ret = z_fetch_url($a->get_baseurl() . '/parse_url?f=&url=' . $url . $title . $description . $tags); + + if($ret['success']) + $s = $ret['body']; if(! strlen($s)) return; - require_once('include/html2bbcode.php'); - $post = array(); $post['profile_uid'] = local_user(); $post['return'] = '/oexchange/done' ; - $post['body'] = html2bbcode($s); + $post['body'] = $s; $post['type'] = 'wall'; $_REQUEST = $post; -- cgit v1.2.3 From c88fd0120542a56da98cda6427d9bf5b689e21f2 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 23 Oct 2013 21:49:50 -0700 Subject: basic support (still needs some js to expose it) for sharing an item on a remote site by sending it through oexchange on your home hub. Untested. --- mod/oexchange.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mod/oexchange.php') diff --git a/mod/oexchange.php b/mod/oexchange.php index 63b48751c..27c8b388d 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -15,6 +15,21 @@ function oexchange_init(&$a) { function oexchange_content(&$a) { if(! local_user()) { + if(remote_user()) { + $observer = $a->get_observer(); + if($observer && $observer['xchan_url']) { + $parsed = @parse_url($observer['xchan_url']); + if(! $parsed) { + notice( t('Unable to find your hub.') . EOL); + return; + } + $url = $parsed['scheme'] . '://' . $parsed['host'] . (($parsed['port']) ? ':' . $parsed['port'] : ''); + $url .= '/oexchange'; + $result = z_post_url($url,$_REQUEST); + json_return_and_die($result); + } + } + return login(false); } -- cgit v1.2.3