123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <?php
- if (!defined('STATUSNET')) {
-
-
- exit(1);
- }
- class NoticebyurlAction extends Action
- {
- protected $url = null;
- protected $file = null;
- protected $notices = null;
- protected $page = null;
-
- function prepare(array $args = [])
- {
- parent::prepare($args);
- $this->file = File::getKV('id', $this->trimmed('id'));
- if (empty($this->file)) {
-
- throw new ClientException(_m('Unknown URL.'));
- }
- $pageArg = $this->trimmed('page');
- $this->page = (empty($pageArg)) ? 1 : intval($pageArg);
- $this->notices = $this->file->stream(($this->page - 1) * NOTICES_PER_PAGE,
- NOTICES_PER_PAGE + 1);
- return true;
- }
-
- function title()
- {
- if ($this->page == 1) {
-
-
- return sprintf(_m('Notices linking to %s'), $this->file->url);
- } else {
-
-
- return sprintf(_m('Notices linking to %1$s, page %2$d'),
- $this->file->url,
- $this->page);
- }
- }
-
- function handle()
- {
- $this->showPage();
- }
-
- function showContent()
- {
- $nl = new NoticeList($this->notices, $this);
- $nl->show();
- $cnt = $nl->show();
- $this->pagination($this->page > 1,
- $cnt > NOTICES_PER_PAGE,
- $this->page,
- 'noticebyurl',
- array('id' => $this->file->id));
- }
-
- function isReadOnly($args)
- {
- return true;
- }
-
- function lastModified()
- {
-
-
- return null;
- }
-
- function etag()
- {
- return null;
- }
- }
|