123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?php
- if (!defined('STATUSNET')) {
- exit(1);
- }
- class ApiStatusesRetweetsAction extends ApiAuthAction
- {
- const MAXCOUNT = 100;
- var $original = null;
- var $cnt = self::MAXCOUNT;
-
- function prepare(array $args = array())
- {
- parent::prepare($args);
- $id = $this->trimmed('id');
- $this->original = Notice::getKV('id', $id);
- if (empty($this->original)) {
-
- $this->clientError(_('No such notice.'),
- 400, $this->format);
- return false;
- }
- $cnt = $this->trimmed('count');
- if (empty($cnt) || !is_integer($cnt)) {
- $cnt = 100;
- } else {
- $this->cnt = min((int)$cnt, self::MAXCOUNT);
- }
- return true;
- }
-
- function handle()
- {
- parent::handle();
- $strm = $this->original->repeatStream($this->cnt);
- switch ($this->format) {
- case 'xml':
- $this->showXmlTimeline($strm);
- break;
- case 'json':
- $this->showJsonTimeline($strm);
- break;
- default:
-
- $this->clientError(_('API method not found.'), $code = 404);
- break;
- }
- }
-
- function isReadOnly($args)
- {
- return true;
- }
- }
|