* @link http://status.net/
*/
-if (!defined('STATUSNET')) {
- exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
/**
* Returns the most recent notices (default 20) posted by the authenticating
{
// We'll use the shared params from the Atom stub
// for other feed types.
- $atom = new AtomUserNoticeFeed($this->target->getUser(), $this->auth_user);
+ $atom = new AtomUserNoticeFeed($this->target->getUser(), $this->scoped);
$link = common_local_url(
'showstream',
- array('nickname' => $this->target->nickname)
+ array('nickname' => $this->target->getNickname())
);
$self = $this->getSelfUri();
// FriendFeed's SUP protocol
// Also added RSS and Atom feeds
- $suplink = common_local_url('sup', null, null, $this->target->id);
+ $suplink = common_local_url('sup', null, null, $this->target->getID());
header('X-SUP-ID: ' . $suplink);
$nextUrl = !empty($this->next_id)
? common_local_url('ApiTimelineUser',
array('format' => $this->format,
- 'id' => $this->target->id),
+ 'id' => $this->target->getID()),
array('max_id' => $this->next_id))
: null;
$prevUrl = common_local_url('ApiTimelineUser',
array('format' => $this->format,
- 'id' => $this->target->id),
+ 'id' => $this->target->getID()),
$prevExtra);
$firstUrl = common_local_url('ApiTimelineUser',
array('format' => $this->format,
- 'id' => $this->target->id));
+ 'id' => $this->target->getID()));
switch($this->format) {
case 'xml':
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
- $doc = new ActivityStreamJSONDocument($this->auth_user);
+ $doc = new ActivityStreamJSONDocument($this->scoped);
$doc->setTitle($atom->title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($this->notices);
return '"' . implode(
':',
array($this->arg('action'),
- common_user_cache_hash($this->auth_user),
+ common_user_cache_hash($this->scoped),
common_language(),
- $this->target->id,
+ $this->target->getID(),
strtotime($this->notices[0]->created),
strtotime($this->notices[$last]->created))
)
function handlePost()
{
- if (empty($this->auth_user) ||
- $this->auth_user->id != $this->target->id) {
+ if (empty($this->scoped) ||
+ $this->target->sameAs($this->scoped)) {
// TRANS: Client error displayed trying to add a notice to another user's timeline.
- $this->clientError(_('Only the user can add to their own timeline.'));
+ $this->clientError(_('Only the user can add to their own timeline.'), 403);
}
// Only handle posts for Atom
$rendered = common_purify($sourceContent);
$content = common_strip_html($rendered);
- $shortened = $this->auth_user->shortenLinks($content);
+ $shortened = $this->target->shortenLinks($content);
$options = array('is_local' => Notice::LOCAL_PUBLIC,
'rendered' => $rendered,
$options['urls'][] = $href;
}
- $saved = Notice::saveNew($this->target->id,
+ $saved = Notice::saveNew($this->target->getID(),
$content,
'atompub', // TODO: deal with this
$options);