3 * Laconica - a distributed open-source microblogging tool
4 * Copyright (C) 2008, Controlez-Vous, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('LACONICA')) { exit(1); }
22 require_once INSTALLDIR.'/lib/personalgroupnav.php';
23 require_once INSTALLDIR.'/lib/noticelist.php';
24 require_once INSTALLDIR.'/lib/feedlist.php';
26 class AllAction extends Action
36 function prepare($args)
38 parent::prepare($args);
39 $nickname = common_canonical_nickname($this->arg('nickname'));
40 $this->user = User::staticGet('nickname', $nickname);
41 $this->page = $this->trimmed('page');
46 common_set_returnto($this->selfUrl());
51 function handle($args)
53 parent::handle($args);
56 $this->clientError(_('No such user.'));
65 if ($this->page > 1) {
66 return sprintf(_("%s and friends, page %d"), $this->user->nickname, $this->page);
68 return sprintf(_("%s and friends"), $this->user->nickname);
74 return array(new Feed(Feed::RSS1,
75 common_local_url('allrss', array('nickname' =>
76 $this->user->nickname)),
77 sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
79 common_local_url('api', array('apiaction' => 'statuses',
80 'method' => 'friends',
81 'argument' => $this->user->nickname.'.rss')),
82 sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
84 common_local_url('api', array('apiaction' => 'statuses',
85 'method' => 'friends',
86 'argument' => $this->user->nickname.'.atom')),
87 sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname)));
90 function showLocalNav()
92 $nav = new PersonalGroupNav($this);
96 function showContent()
98 $notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
100 $nl = new NoticeList($notice, $this);
104 $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
105 $this->page, 'all', array('nickname' => $this->user->nickname));
108 function showPageTitle()
110 $user =& common_current_user();
111 if ($user && ($user->id == $this->user->id)) {
112 $this->element('h1', NULL, _("You and friends"));
114 $this->element('h1', NULL, sprintf(_('%s and friends'), $this->user->nickname));