123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
-
- if (!defined('GNUSOCIAL')) { exit(1); }
- class ApiQvitterSilenceCreateAction extends ApiAuthAction
- {
- protected $needPost = true;
-
- protected function prepare(array $args=array())
- {
- parent::prepare($args);
- $this->format = 'json';
- $this->other = $this->getTargetProfile($this->arg('id'));
- return true;
- }
-
- protected function handle()
- {
- parent::handle();
- if (!$this->other instanceof Profile) {
- $this->clientError(_('No such user.'), 404);
- }
- if ($this->scoped->id == $this->other->id) {
- $this->clientError(_("You cannot silence yourself!"), 403);
- }
- try {
- $this->other->silenceAs($this->scoped);
- } catch (AlreadyFulfilledException $e) {
-
-
-
- } catch (Exception $e) {
- $this->clientError($e->getMessage(), $e->getCode());
- }
- $this->initDocument('json');
- $this->showJsonObjects($this->twitterUserArray($this->other));
- $this->endDocument('json');
- }
- }
|