var $profile;
var $err;
- function prepare($args)
+ function prepare(array $args = array())
{
parent::prepare($args);
if (common_logged_in()) {
- // TRANS: Client error displayed when trying to tag a local object as if it is remote.
- $this->clientError(_m('You can use the local tagging!'));
- return false;
+ // TRANS: Client error displayed when trying to list a local object as if it is remote.
+ $this->clientError(_m('You can use the local list functionality!'));
}
$this->nickname = $this->trimmed('nickname');
function showContent()
{
- // TRANS: Header for tagging a remote object. %s is a remote object's name.
- $header = sprintf(_m('Tag %s'), $this->nickname);
- // TRANS: Button text to tag a remote object.
+ // TRANS: Header for listing a remote object. %s is a remote object's name.
+ $header = sprintf(_m('List %s'), $this->nickname);
+ // TRANS: Button text to list a remote object.
$submit = _m('BUTTON','Go');
$this->elementStart('form', array('id' => 'form_ostatus_connect',
'method' => 'post',
// TRANS: Field label.
$this->input('nickname', _m('User nickname'), $this->nickname,
// TRANS: Field title.
- _m('Nickname of the user you want to tag.'));
+ _m('Nickname of the user you want to list.'));
$this->elementEnd('li');
$this->elementStart('li', array('id' => 'ostatus_profile'));
// TRANS: Field label.
$this->input('profile', _m('Profile Account'), $this->profile,
// TRANS: Field title.
- _m('Your account id (for example user@identi.ca).'));
+ _m('Your account id (for example user@example.com).'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->submit('submit', $submit);
$target_profile = $this->targetProfile();
$disco = new Discovery;
- $result = $disco->lookup($acct);
- if (!$result) {
- // TRANS: Client error displayed when remote profile could not be looked up.
- $this->clientError(_m('Could not look up OStatus account profile.'));
- }
-
- foreach ($result->links as $link) {
- if ($link['rel'] == 'http://ostatus.org/schema/1.0/tag') {
- // We found a URL - let's redirect!
- $url = Discovery::applyTemplate($link['template'], $target_profile);
- common_log(LOG_INFO, "Sending remote subscriber $acct to $url");
- common_redirect($url, 303);
+ $xrd = $disco->lookup($acct);
+
+ $link = $xrd->get('http://ostatus.org/schema/1.0/tag');
+ if (!is_null($link)) {
+ // We found a URL - let's redirect!
+ if (!empty($link->template)) {
+ $url = Discovery::applyTemplate($link->template, $target_profile);
+ } else {
+ $url = $link->href;
}
-
+ common_log(LOG_INFO, "Sending remote subscriber $acct to $url");
+ common_redirect($url, 303);
}
// TRANS: Client error displayed when remote profile address could not be confirmed.
$this->clientError(_m('Could not confirm remote profile address.'));