123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <?php
- if (!defined('STATUSNET')) {
- exit(1);
- }
- class ApiAtomServiceAction extends ApiBareAuthAction
- {
-
- function prepare(array $args = array())
- {
- parent::prepare($args);
- $this->user = $this->getTargetUser($this->arg('id'));
- if (empty($this->user)) {
-
- $this->clientError(_('No such user.'), 404);
- }
- return true;
- }
-
- function handle()
- {
- parent::handle();
- header('Content-Type: application/atomsvc+xml');
- $this->startXML();
- $this->elementStart('service', array('xmlns' => 'http://www.w3.org/2007/app',
- 'xmlns:atom' => 'http://www.w3.org/2005/Atom',
- 'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/'));
- $this->elementStart('workspace');
-
- $this->element('atom:title', null, _m('ATOM','Main'));
- $this->elementStart('collection',
- array('href' => common_local_url('ApiTimelineUser',
- array('id' => $this->user->id,
- 'format' => 'atom'))));
- $this->element('atom:title',
- null,
-
- sprintf(_("%s timeline"),
- $this->user->nickname));
- $this->element('accept', null, 'application/atom+xml;type=entry');
- $this->element('activity:verb', null, ActivityVerb::POST);
- $this->elementEnd('collection');
- $this->elementStart('collection',
- array('href' => common_local_url('AtomPubSubscriptionFeed',
- array('subscriber' => $this->user->id))));
- $this->element('atom:title',
- null,
-
- sprintf(_("%s subscriptions"),
- $this->user->nickname));
- $this->element('accept', null, 'application/atom+xml;type=entry');
- $this->element('activity:verb', null, ActivityVerb::FOLLOW);
- $this->elementEnd('collection');
- $this->elementStart('collection',
- array('href' => common_local_url('AtomPubFavoriteFeed',
- array('profile' => $this->user->id))));
- $this->element('atom:title',
- null,
-
- sprintf(_("%s favorites"),
- $this->user->nickname));
- $this->element('accept', null, 'application/atom+xml;type=entry');
- $this->element('activity:verb', null, ActivityVerb::FAVORITE);
- $this->elementEnd('collection');
- $this->elementStart('collection',
- array('href' => common_local_url('AtomPubMembershipFeed',
- array('profile' => $this->user->id))));
- $this->element('atom:title',
- null,
-
- sprintf(_("%s memberships"),
- $this->user->nickname));
- $this->element('accept', null, 'application/atom+xml;type=entry');
- $this->element('activity:verb', null, ActivityVerb::JOIN);
- $this->elementEnd('collection');
- $this->elementEnd('workspace');
- $this->elementEnd('service');
- $this->endXML();
- }
- }
|