- if(! $profile)
- $profile = $url;
-
-
- if(! x($vcard,'fn'))
- if(x($vcard,'nick'))
- $vcard['fn'] = $vcard['nick'];
-
- if((! isset($vcard)) && (! $poll)) {
-
- $ret = scrape_feed($url);
-
- if(count($ret) && ($ret['feed_atom'] || $ret['feed_rss'])) {
- $poll = ((x($ret,'feed_atom')) ? $ret['feed_atom'] : $ret['feed_rss']);
- $vcard = array();
- require_once('simplepie/simplepie.inc');
- $feed = new SimplePie();
- $xml = fetch_url($poll);
-
- $feed->set_raw_data($xml);
-
- $feed->init();
-
- $vcard['photo'] = $feed->get_image_url();
- $author = $feed->get_author();
- if($author) {
- $vcard['fn'] = trim($author->get_name());
- $vcard['nick'] = strtolower($vcard['fn']);
- if(strpos($vcard['nick'],' '))
- $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
- $email = $author->get_email();
- }
- else {
- $item = $feed->get_item(0);
- if($item) {
- $author = $item->get_author();
- if($author) {
- $vcard['fn'] = trim($author->get_name());
- $vcard['nick'] = strtolower($vcard['fn']);
- if(strpos($vcard['nick'],' '))
- $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
- $email = $author->get_email();
- }
- }
- }
- if((! $vcard['photo']) && strlen($email))
- $vcard['photo'] = gravatar_img($email);
- $network = 'feed';
- $priority = 2;
+ $ret = probe_url($url);
+
+ if($ret['network'] === NETWORK_DFRN) {
+ if(strlen($a->path))
+ $myaddr = bin2hex($a->get_baseurl() . '/profile/' . $a->user['nickname']);
+ else
+ $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
+
+ goaway($ret['request'] . "&addr=$myaddr");
+
+ // NOTREACHED
+ }
+ else {
+ if(get_config('system','dfrn_only')) {
+ notice( t('This site is not configured to allow communications with other networks.') . EOL);
+ notice( t('No compatible communication protocols or feeds were discovered.') . EOL);
+ goaway($_SESSION['return_url']);