. */ /** * @package OStatusPlugin * @maintainer James Walker */ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } class WebfingerAction extends Action { public $uri; function prepare($args) { parent::prepare($args); $this->uri = $this->trimmed('uri'); return true; } function handle() { $acct = Webfinger::normalize($this->uri); $xrd = new XRD(); list($nick, $domain) = explode('@', urldecode($acct)); $nick = common_canonical_nickname($nick); $this->user = User::staticGet('nickname', $nick); if (!$this->user) { $this->clientError(_('No such user.'), 404); return false; } $xrd->subject = $this->uri; $xrd->alias[] = common_profile_url($nick); $xrd->links[] = array('rel' => 'http://webfinger.net/rel/profile-page', 'type' => 'text/html', 'href' => common_profile_url($nick)); // TODO - finalize where the redirect should go on the publisher $url = common_local_url('ostatussub') . '?feed={uri}'; $xrd->links[] = array('rel' => 'http://ostatus.org/schema/1.0/subscribe', 'template' => $url ); header('Content-type: text/xml'); print $xrd->toXML(); } }