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/personal.php');
24 class StreamAction extends PersonalAction {
26 function show_notice($notice) {
28 $profile = $notice->getProfile();
29 $user = common_current_user();
32 common_element_start('li', array('class' => 'notice_single',
33 'id' => 'notice-' . $notice->id));
35 if ($user->hasFave($notice)) {
36 common_disfavor_form($notice);
38 common_favor_form($notice);
41 $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
42 common_element_start('a', array('href' => $profile->profileurl));
43 common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
44 'class' => 'avatar stream',
45 'width' => AVATAR_STREAM_SIZE,
46 'height' => AVATAR_STREAM_SIZE,
48 ($profile->fullname) ? $profile->fullname :
50 common_element_end('a');
51 common_element('a', array('href' => $profile->profileurl,
52 'class' => 'nickname'),
54 # FIXME: URL, image, video, audio
55 common_element_start('p', array('class' => 'content'));
56 if ($notice->rendered) {
57 common_raw($notice->rendered);
59 # XXX: may be some uncooked notices in the DB,
60 # we cook them right now. This should probably disappear in future
62 common_raw(common_render_content($notice->content, $notice));
64 common_element_end('p');
65 $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
66 # XXX: we need to figure this out better. Is this right?
67 if (strcmp($notice->uri, $noticeurl) != 0 && preg_match('/^http/', $notice->uri)) {
68 $noticeurl = $notice->uri;
70 common_element_start('p', 'time');
71 common_element('a', array('class' => 'permalink',
73 'title' => common_exact_date($notice->created)),
74 common_date_string($notice->created));
75 if ($notice->source) {
76 common_text(_(' from '));
77 $this->source_link($notice->source);
79 if ($notice->reply_to) {
80 $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
82 common_element('a', array('class' => 'inreplyto',
87 common_element_start('a',
88 array('href' => common_local_url('newnotice',
89 array('replyto' => $profile->nickname)),
90 'onclick' => 'return doreply("'.$profile->nickname.'");',
91 'title' => _('reply'),
92 'class' => 'replybutton'));
94 common_element_end('a');
95 if ($user && $notice->profile_id == $user->id) {
96 $deleteurl = common_local_url('deletenotice', array('notice' => $notice->id));
97 common_element_start('a', array('class' => 'deletenotice',
99 'title' => _('delete')));
100 common_raw('×');
101 common_element_end('a');
103 common_element_end('p');
104 common_element_end('li');