123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class ApiStatusesRetweetAction extends ApiAuthAction
- {
- protected $needPost = true;
- var $original = null;
-
- protected function prepare(array $args=array())
- {
- parent::prepare($args);
- $id = $this->trimmed('id');
- $this->original = Notice::getKV('id', $id);
- if (!$this->original instanceof Notice) {
-
- $this->clientError(_('No such notice.'), 400, $this->format);
- }
- return true;
- }
-
- protected function handle()
- {
- parent::handle();
- $repeat = $this->original->repeat($this->scoped, $this->source);
- $this->showNotice($repeat);
- }
-
- function showNotice($notice)
- {
- if (!empty($notice)) {
- if ($this->format == 'xml') {
- $this->showSingleXmlStatus($notice);
- } elseif ($this->format == 'json') {
- $this->show_single_json_status($notice);
- }
- }
- }
- }
|