networkpublic.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. if (!defined('GNUSOCIAL')) { exit(1); }
  3. class NetworkpublicAction extends PublicAction
  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 extraHead()
  28. {
  29. // the PublicAction has some XRDS stuff that might be unique to the non-network public feed
  30. // FIXME: Solve this with a call that doesn't rely on parent:: and is unique for each class.
  31. ManagedAction::extraHead();
  32. }
  33. function showSections()
  34. {
  35. // Show invite button, as long as site isn't closed, and
  36. // we have a logged in user.
  37. if (common_config('invite', 'enabled') && !common_config('site', 'closed') && common_logged_in()) {
  38. if (!common_config('site', 'private')) {
  39. $ibs = new InviteButtonSection(
  40. $this,
  41. // TRANS: Button text for inviting more users to the StatusNet instance.
  42. // TRANS: Less business/enterprise-oriented language for public sites.
  43. _m('BUTTON', 'Send invite')
  44. );
  45. } else {
  46. $ibs = new InviteButtonSection($this);
  47. }
  48. $ibs->show();
  49. }
  50. // Network public tag cloud?
  51. }
  52. function getFeeds()
  53. {
  54. return array(new Feed(Feed::JSON,
  55. common_local_url('ApiTimelineNetworkPublic',
  56. array('format' => 'as')),
  57. // TRANS: Link description for the _global_ network public timeline feed.
  58. _('Network Public Timeline Feed (Activity Streams JSON)')),
  59. new Feed(Feed::RSS1, common_local_url('publicrss'),
  60. // TRANS: Link description for the _global_ network public timeline feed.
  61. _('Network Public Timeline Feed (RSS 1.0)')),
  62. new Feed(Feed::RSS2,
  63. common_local_url('ApiTimelineNetworkPublic',
  64. array('format' => 'rss')),
  65. // TRANS: Link description for the _global_ network public timeline feed.
  66. _('Network Public Timeline Feed (RSS 2.0)')),
  67. new Feed(Feed::ATOM,
  68. common_local_url('ApiTimelineNetworkPublic',
  69. array('format' => 'atom')),
  70. // TRANS: Link description for the _global_ network public timeline feed.
  71. _('Network Public Timeline Feed (Atom)')));
  72. }
  73. }