aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-10-24 20:39:24 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-10-24 20:39:24 -0700
commitb41218ca303b9fd8258fd613915d3c4b9fd411c0 (patch)
treec1b08bee4f7b3737e3717d4d5eb4be9b781dc044 /boot.php
parentb8b227b32882fb511c8481a41c53637e7ce7707a (diff)
downloadvolse-hubzilla-b41218ca303b9fd8258fd613915d3c4b9fd411c0.tar.gz
volse-hubzilla-b41218ca303b9fd8258fd613915d3c4b9fd411c0.tar.bz2
volse-hubzilla-b41218ca303b9fd8258fd613915d3c4b9fd411c0.zip
workflow for federated/non-dfrn followers
Diffstat (limited to 'boot.php')
-rw-r--r--boot.php64
1 files changed, 57 insertions, 7 deletions
diff --git a/boot.php b/boot.php
index 7885bb4ea..8c9248703 100644
--- a/boot.php
+++ b/boot.php
@@ -52,10 +52,12 @@ define ( 'NAMESPACE_DFRN' , 'http://purl.org/macgirvin/dfrn/1.0' );
define ( 'NAMESPACE_THREAD' , 'http://purl.org/syndication/thread/1.0' );
define ( 'NAMESPACE_TOMB' , 'http://purl.org/atompub/tombstones/1.0' );
define ( 'NAMESPACE_ACTIVITY', 'http://activitystrea.ms/spec/1.0/' );
-define ( 'NAMESPACE_ACTIVITY_SCHEMA', 'http://activitystrea.ms/schema/1.0/');
-define ( 'NAMESPACE_SALMON_ME', 'http://salmon-protocol.org/ns/magic-env');
-define ( 'NAMESPACE_OSTATUSSUB', 'http://ostatus.org/schema/1.0/subscribe');
-define ( 'NAMESPACE_GEORSS', 'http://www.georss.org/georss');
+define ( 'NAMESPACE_ACTIVITY_SCHEMA', 'http://activitystrea.ms/schema/1.0/' );
+define ( 'NAMESPACE_SALMON_ME', 'http://salmon-protocol.org/ns/magic-env' );
+define ( 'NAMESPACE_OSTATUSSUB', 'http://ostatus.org/schema/1.0/subscribe' );
+define ( 'NAMESPACE_GEORSS', 'http://www.georss.org/georss' );
+define ( 'NAMESPACE_POCO', 'http://portablecontacts.net/spec/1.0' );
+define ( 'NAMESPACE_FEED', 'http://schemas.google.com/g/2010#updates-from' );
// activity stream defines
@@ -961,11 +963,11 @@ function webfinger($s) {
if(strlen($host)) {
$tpl = fetch_lrdd_template($host);
if(strlen($tpl)) {
- $pxrd = str_replace('{uri}', urlencode('acct://'.$s), $tpl);
+ $pxrd = str_replace('{uri}', urlencode('acct:'.$s), $tpl);
$links = fetch_xrd_links($pxrd);
if(! count($links)) {
- // try without the double slashes
- $pxrd = str_replace('{uri}', urlencode('acct:'.$s), $tpl);
+ // try with double slashes
+ $pxrd = str_replace('{uri}', urlencode('acct://'.$s), $tpl);
$links = fetch_xrd_links($pxrd);
}
return $links;
@@ -974,6 +976,54 @@ function webfinger($s) {
return array();
}}
+if(! function_exists('lrdd')) {
+function lrdd($uri) {
+
+ $a = get_app();
+
+ if(strstr($uri,'@')) {
+ return(webfinger($uri));
+ }
+ else {
+ $html = fetch_url($uri);
+ $headers = $a->get_curl_headers();
+ $lines = explode("\n",$headers);
+ if(count($lines)) {
+ foreach($lines as $line) {
+ // TODO alter the following regex to support multiple relations (space separated)
+ if((stristr($line,'link:')) && preg_match('/<([^>].*)>.*rel\=[\'\"]lrdd[\'\"]/',$line,$matches)) {
+ $link = $matches[1];
+ break;
+ }
+ }
+ }
+ if(! isset($link)) {
+ // parse the page of the supplied URL looking for rel links
+
+ require_once('library/HTML5/Parser.php');
+ $dom = HTML5_Parser::parse($html);
+
+ if($dom) {
+ $items = $dom->getElementsByTagName('link');
+
+ foreach($items as $item) {
+ $x = $item->getAttribute('rel');
+ if($x == "lrdd") {
+ $link = $item->getAttribute('href');
+ break;
+ }
+ }
+ }
+ }
+
+ if(isset($link))
+ return(fetch_xrd_links($link));
+ }
+ return array();
+}}
+
+
+
// Given a host name, locate the LRDD template from that
// host. Returns the LRDD template or an empty string on
// error/failure.