networkpublic.php 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. if (!defined('GNUSOCIAL')) { exit(1); }
  3. class NetworkpublicAction extends SitestreamAction
  4. {
  5. protected function streamPrepare()
  6. {
  7. if (!$this->scoped instanceof Profile && common_config('public', 'localonly')) {
  8. $this->clientError(_('Network wide public feed is not permitted without authorization'), 403);
  9. }
  10. if ($this->scoped instanceof Profile && $this->scoped->isLocal() && $this->scoped->getUser()->streamModeOnly()) {
  11. $this->stream = new NetworkPublicNoticeStream($this->scoped);
  12. } else {
  13. $this->stream = new ThreadingNetworkPublicNoticeStream($this->scoped);
  14. }
  15. }
  16. function title()
  17. {
  18. if ($this->page > 1) {
  19. // TRANS: Title for all public timeline pages but the first.
  20. // TRANS: %d is the page number.
  21. return sprintf(_('Network public timeline, page %d'), $this->page);
  22. } else {
  23. // TRANS: Title for the first public timeline page.
  24. return _('Network public timeline');
  25. }
  26. }
  27. function showSections()
  28. {
  29. // Show invite button, as long as site isn't closed, and
  30. // we have a logged in user.
  31. if (common_config('invite', 'enabled') && !common_config('site', 'closed') && common_logged_in()) {
  32. if (!common_config('site', 'private')) {
  33. $ibs = new InviteButtonSection(
  34. $this,
  35. // TRANS: Button text for inviting more users to the StatusNet instance.
  36. // TRANS: Less business/enterprise-oriented language for public sites.
  37. _m('BUTTON', 'Send invite')
  38. );
  39. } else {
  40. $ibs = new InviteButtonSection($this);
  41. }
  42. $ibs->show();
  43. }
  44. // Network public tag cloud?
  45. }
  46. function getFeeds()
  47. {
  48. return array(new Feed(Feed::JSON,
  49. common_local_url('ApiTimelineNetworkPublic',
  50. array('format' => 'as')),
  51. // TRANS: Link description for the _global_ network public timeline feed.
  52. _('Network Public Timeline Feed (Activity Streams JSON)')),
  53. new Feed(Feed::RSS1, common_local_url('publicrss'),
  54. // TRANS: Link description for the _global_ network public timeline feed.
  55. _('Network Public Timeline Feed (RSS 1.0)')),
  56. new Feed(Feed::RSS2,
  57. common_local_url('ApiTimelineNetworkPublic',
  58. array('format' => 'rss')),
  59. // TRANS: Link description for the _global_ network public timeline feed.
  60. _('Network Public Timeline Feed (RSS 2.0)')),
  61. new Feed(Feed::ATOM,
  62. common_local_url('ApiTimelineNetworkPublic',
  63. array('format' => 'atom')),
  64. // TRANS: Link description for the _global_ network public timeline feed.
  65. _('Network Public Timeline Feed (Atom)')));
  66. }
  67. }