exit(1);
}
-require_once INSTALLDIR . '/lib/apiauth.php';
-
/**
* Subscription feed class for AtomPub
*
$subscriber = $this->trimmed('subscriber');
- $this->_profile = Profile::staticGet('id', $subscriber);
+ $this->_profile = Profile::getKV('id', $subscriber);
if (empty($this->_profile)) {
// TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID.
default:
// TRANS: Client exception thrown when using an unsupported HTTP method.
$this->clientError(_('HTTP method not supported.'), 405);
- return;
}
return;
// TRANS: Subtitle for Atom subscription feed.
// TRANS: %1$s is a user nickname, %s$s is the StatusNet sitename.
- $feed->setSubtitle(sprintf(_("People %1$s has subscribed to on %2$s"),
+ $feed->setSubtitle(sprintf(_("People %1\$s has subscribed to on %2\$s"),
$this->_profile->getBestName(),
common_config('site', 'name')));
$dom->documentElement->localName != 'entry') {
// TRANS: Client error displayed when not using an Atom entry.
$this->clientError(_('Atom post must be an Atom entry.'));
- return;
}
$activity = new Activity($dom->documentElement);
if ($activity->verb != ActivityVerb::FOLLOW) {
// TRANS: Client error displayed when not using the follow verb.
$this->clientError(_('Can only handle Follow activities.'));
- return;
}
$person = $activity->objects[0];
if ($person->type != ActivityObject::PERSON) {
// TRANS: Client exception thrown when subscribing to an object that is not a person.
$this->clientError(_('Can only follow people.'));
- return;
}
// XXX: OStatus discovery (maybe)
-
- $profile = Profile::fromURI($person->id);
-
- if (empty($profile)) {
+ try {
+ $profile = Profile::fromUri($person->id);
+ } catch (UnknownUriException $e) {
// TRANS: Client exception thrown when subscribing to a non-existing profile.
// TRANS: %s is the unknown profile ID.
$this->clientError(sprintf(_('Unknown profile %s.'), $person->id));
- return;
}
if (Subscription::exists($this->_profile, $profile)) {
$this->clientError(sprintf(_('Already subscribed to %s.'),
$person->id),
409);
- return;
}
if (Subscription::start($this->_profile, $profile)) {