2008-05-09 11:16:04 +09:00
|
|
|
<?php
|
2009-01-14 13:48:05 +09:00
|
|
|
/**
|
2009-08-26 07:12:20 +09:00
|
|
|
* StatusNet, the distributed open-source microblogging tool
|
2008-05-21 04:14:12 +09:00
|
|
|
*
|
2009-01-14 13:48:05 +09:00
|
|
|
* Action for displaying the public stream
|
|
|
|
*
|
|
|
|
* PHP version 5
|
|
|
|
*
|
|
|
|
* LICENCE: This program is free software: you can redistribute it and/or modify
|
2008-05-15 04:26:48 +09:00
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2008-05-21 04:14:12 +09:00
|
|
|
*
|
2008-05-15 04:26:48 +09:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
2008-05-21 04:14:12 +09:00
|
|
|
*
|
2008-05-15 04:26:48 +09:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2009-01-14 13:48:05 +09:00
|
|
|
*
|
|
|
|
* @category Public
|
2009-08-26 07:12:20 +09:00
|
|
|
* @package StatusNet
|
2009-08-26 07:19:04 +09:00
|
|
|
* @author Evan Prodromou <evan@status.net>
|
2009-08-26 07:12:20 +09:00
|
|
|
* @copyright 2008-2009 StatusNet, Inc.
|
2009-01-14 13:48:05 +09:00
|
|
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
2009-08-26 07:16:46 +09:00
|
|
|
* @link http://status.net/
|
2008-05-15 04:26:48 +09:00
|
|
|
*/
|
|
|
|
|
2014-06-28 23:09:46 +09:00
|
|
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
2009-01-16 05:13:11 +09:00
|
|
|
|
2009-01-14 13:48:05 +09:00
|
|
|
/**
|
|
|
|
* Action for displaying the public stream
|
|
|
|
*
|
|
|
|
* @category Public
|
2009-08-26 07:12:20 +09:00
|
|
|
* @package StatusNet
|
2009-08-26 07:19:04 +09:00
|
|
|
* @author Evan Prodromou <evan@status.net>
|
2009-01-14 13:48:05 +09:00
|
|
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
2009-08-26 07:16:46 +09:00
|
|
|
* @link http://status.net/
|
2009-01-14 13:48:05 +09:00
|
|
|
*
|
|
|
|
* @see PublicrssAction
|
|
|
|
*/
|
2015-06-04 07:50:08 +09:00
|
|
|
class PublicAction extends SitestreamAction
|
2008-12-24 04:49:23 +09:00
|
|
|
{
|
2015-01-22 07:45:49 +09:00
|
|
|
protected function streamPrepare()
|
|
|
|
{
|
|
|
|
if ($this->scoped instanceof Profile && $this->scoped->isLocal() && $this->scoped->getUser()->streamModeOnly()) {
|
|
|
|
$this->stream = new PublicNoticeStream($this->scoped);
|
|
|
|
} else {
|
|
|
|
$this->stream = new ThreadingPublicNoticeStream($this->scoped);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-14 13:48:05 +09:00
|
|
|
/**
|
|
|
|
* Title of the page
|
|
|
|
*
|
|
|
|
* @return page title, including page number if over 1
|
|
|
|
*/
|
|
|
|
function title()
|
2008-12-24 04:33:23 +09:00
|
|
|
{
|
2009-01-14 13:48:05 +09:00
|
|
|
if ($this->page > 1) {
|
2011-03-12 01:07:27 +09:00
|
|
|
// TRANS: Title for all public timeline pages but the first.
|
|
|
|
// TRANS: %d is the page number.
|
2009-01-14 13:48:05 +09:00
|
|
|
return sprintf(_('Public timeline, page %d'), $this->page);
|
2008-12-24 04:19:07 +09:00
|
|
|
} else {
|
2011-03-12 01:07:27 +09:00
|
|
|
// TRANS: Title for the first public timeline page.
|
2009-01-14 13:48:05 +09:00
|
|
|
return _('Public timeline');
|
2008-12-24 04:19:07 +09:00
|
|
|
}
|
|
|
|
}
|
2010-02-01 05:16:59 +09:00
|
|
|
|
2009-01-23 04:08:16 +09:00
|
|
|
function showSections()
|
|
|
|
{
|
2011-07-06 09:27:11 +09:00
|
|
|
// Show invite button, as long as site isn't closed, and
|
|
|
|
// we have a logged in user.
|
2012-10-17 23:09:40 +09:00
|
|
|
if (common_config('invite', 'enabled') && !common_config('site', 'closed') && common_logged_in()) {
|
2011-07-06 09:27:11 +09:00
|
|
|
if (!common_config('site', 'private')) {
|
|
|
|
$ibs = new InviteButtonSection(
|
|
|
|
$this,
|
|
|
|
// TRANS: Button text for inviting more users to the StatusNet instance.
|
|
|
|
// TRANS: Less business/enterprise-oriented language for public sites.
|
|
|
|
_m('BUTTON', 'Send invite')
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$ibs = new InviteButtonSection($this);
|
|
|
|
}
|
|
|
|
$ibs->show();
|
|
|
|
}
|
|
|
|
|
2009-01-23 06:42:34 +09:00
|
|
|
$feat = new FeaturedUsersSection($this);
|
|
|
|
$feat->show();
|
2009-01-23 04:08:16 +09:00
|
|
|
}
|
2009-01-23 12:06:03 +09:00
|
|
|
|
2015-06-04 07:50:08 +09:00
|
|
|
/**
|
|
|
|
* Output <head> elements for RSS and Atom feeds
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function getFeeds()
|
2009-01-23 12:06:03 +09:00
|
|
|
{
|
2019-05-03 21:26:06 +09:00
|
|
|
return [
|
|
|
|
new Feed(Feed::ATOM,
|
|
|
|
common_local_url('ApiTimelinePublic',
|
|
|
|
array('format' => 'atom')),
|
|
|
|
// TRANS: Link description for public timeline feed.
|
|
|
|
_('Public Timeline Feed (Atom)')
|
|
|
|
),
|
|
|
|
new Feed(Feed::JSON,
|
|
|
|
common_local_url('ApiTimelinePublic',
|
|
|
|
array('format' => 'as')),
|
|
|
|
// TRANS: Link description for public timeline feed.
|
|
|
|
_('Public Timeline Feed (Activity Streams JSON)')
|
|
|
|
),
|
|
|
|
new Feed(Feed::RSS1, common_local_url('publicrss'),
|
|
|
|
// TRANS: Link description for public timeline feed.
|
|
|
|
_('Public Timeline Feed (RSS 1.0)')
|
|
|
|
),
|
|
|
|
new Feed(Feed::RSS2,
|
|
|
|
common_local_url('ApiTimelinePublic',
|
|
|
|
array('format' => 'rss')),
|
|
|
|
// TRANS: Link description for public timeline feed.
|
|
|
|
_('Public Timeline Feed (RSS 2.0)')
|
|
|
|
),
|
|
|
|
];
|
2009-01-23 12:06:03 +09:00
|
|
|
}
|
2008-12-06 07:14:02 +09:00
|
|
|
}
|