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