123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class ApiExternalProfileShowAction extends ApiPrivateAuthAction
- {
-
- protected function prepare(array $args=array())
- {
- parent::prepare($args);
- if ($this->format !== 'json') {
- $this->clientError('This method currently only serves JSON.', 415);
- }
- $profileurl = urldecode($this->arg('profileurl'));
-
- $this->profile = Profile::getKV('profileurl', $profileurl);
- if (!($this->profile instanceof Profile)) {
-
- $this->clientError(_('Profile not found.'), 404);
- }
- return true;
- }
-
- protected function handle()
- {
- parent::handle();
- $twitter_user = $this->twitterUserArray($this->profile, true);
- $this->initDocument('json');
- $this->showJsonObjects($twitter_user);
- $this->endDocument('json');
- }
-
- function isReadOnly($args)
- {
- return true;
- }
- }
|