X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapimediaupload.php;h=c2b4a47b9a277d799acd799d5d1e2c4a597f22fb;hb=e2d85a39e7f82ceef2cb2fe66a3a9a62ac9a363e;hp=8580b209a541893c0a699c32660a1ae2835dd751;hpb=7a106f6669a62e401fc0c4c09c6c6859328ec3a2;p=quix0rs-gnu-social.git diff --git a/actions/apimediaupload.php b/actions/apimediaupload.php index 8580b209a5..c2b4a47b9a 100644 --- a/actions/apimediaupload.php +++ b/actions/apimediaupload.php @@ -30,7 +30,7 @@ if (!defined('GNUSOCIAL')) { exit(1); } /** * Upload an image via the API. Returns a shortened URL for the image - * to the user. + * to the user. Apparently modelled after a former Twitpic API. * * @category API * @package StatusNet @@ -88,9 +88,14 @@ class ApiMediaUploadAction extends ApiAuthAction function showResponse(MediaFile $upload) { $this->initDocument(); - $this->elementStart('rsp', array('stat' => 'ok')); + $this->elementStart('rsp', array('stat' => 'ok', 'xmlns:atom'=>Activity::ATOM)); $this->element('mediaid', null, $upload->fileRecord->id); $this->element('mediaurl', null, $upload->shortUrl()); + + $enclosure = $upload->fileRecord->getEnclosure(); + $this->element('atom:link', array('rel' => 'enclosure', + 'href' => $enclosure->url, + 'type' => $enclosure->mimetype)); $this->elementEnd('rsp'); $this->endDocument(); } @@ -100,7 +105,7 @@ class ApiMediaUploadAction extends ApiAuthAction * * @param String $msg an error message */ - function clientError($msg) + function clientError($msg, $code=400, $format=null) { $this->initDocument(); $this->elementStart('rsp', array('stat' => 'fail')); @@ -111,5 +116,6 @@ class ApiMediaUploadAction extends ApiAuthAction $this->element('err', $errAttr, null); $this->elementEnd('rsp'); $this->endDocument(); + exit; } }