X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapitimelineuser.php;h=24aa08e27953c42ffe8416f2f8c68a11868c058b;hb=ca4bf541310eb36fae5a69697bba76a2211218f4;hp=81809670b4b4b5aa8a734ba99c59c2fd6ef48b37;hpb=82a9560a2d11f6b9355b26f23fb1bfe224d60bfd;p=quix0rs-gnu-social.git diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index 81809670b4..24aa08e279 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -235,7 +235,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction } /** - * Is this action read only? + * We expose AtomPub here, so non-GET/HEAD reqs must be read/write. * * @param array $args other arguments * @@ -244,11 +244,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction function isReadOnly($args) { - if ($_SERVER['REQUEST_METHOD'] == 'GET') { - return true; - } else { - return false; - } + return ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD'); } /** @@ -328,7 +324,9 @@ class ApiTimelineUserAction extends ApiBareAuthAction $activity = new Activity($dom->documentElement); - if (Event::handle('StartAtomPubNewActivity', array(&$activity))) { + $saved = null; + + if (Event::handle('StartAtomPubNewActivity', array(&$activity, $this->user, &$saved))) { if ($activity->verb != ActivityVerb::POST) { // TRANS: Client error displayed when not using the POST verb. @@ -351,7 +349,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction $saved = $this->postNote($activity); - Event::handle('EndAtomPubNewActivity', array($activity, $saved)); + Event::handle('EndAtomPubNewActivity', array($activity, $this->user, $saved)); } if (!empty($saved)) { @@ -429,11 +427,11 @@ class ApiTimelineUserAction extends ApiBareAuthAction $profile = Profile::fromURI($uri); if (!empty($profile)) { - $options['replies'] = $uri; + $options['replies'][] = $uri; } else { $group = User_group::staticGet('uri', $uri); if (!empty($group)) { - $options['groups'] = $uri; + $options['groups'][] = $uri; } else { // @fixme: hook for discovery here common_log(LOG_WARNING, sprintf(_('AtomPub post with unknown attention URI %s'), $uri));