]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/shownotice.php
correct order of params in get_token
[quix0rs-gnu-social.git] / actions / shownotice.php
1 <?php
2 /*
3  * Laconica - a distributed open-source microblogging tool
4  * Copyright (C) 2008, Controlez-Vous, Inc.
5  *
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.
10  *
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.
15  *
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/>.
18  */
19
20 if (!defined('LACONICA')) { exit(1); }
21
22 class ShownoticeAction extends Action {
23
24         function handle($args) {
25                 parent::handle($args);
26                 $id = $this->arg('notice');
27                 $notice = Notice::staticGet($id);
28
29                 if (!$notice) {
30                         $this->no_such_notice();
31                 }
32
33                 if (!$notice->getProfile()) {
34                         $this->no_such_notice();
35                 }
36
37                 # Looks like we're good; show the header
38
39                 common_show_header($profile->nickname." status on ".$notice->created);
40
41                 $this->show_notice($notice);
42
43                 common_show_footer();
44         }
45
46         function no_such_notice() {
47                 common_user_error('No such notice.');
48         }
49
50         function show_notice($notice) {
51                 $profile = $notice->getProfile();
52                 # XXX: RDFa
53                 common_element_start('div', array('class' => 'notice greenBg'));
54                 $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
55                 if ($avatar) {
56                         common_element('img', array('src' => $avatar->url,
57                                                                                 'class' => 'avatar profile',
58                                                                                 'width' => AVATAR_PROFILE_SIZE,
59                                                                                 'height' => AVATAR_PROFILE_SIZE,
60                                                                                 'alt' =>
61                                                                                 ($profile->fullname) ? $profile->fullname :
62                                                                                                        $profile->nickname));
63                 }
64                 common_element('a', array('href' => $profile->profileurl,
65                                                                   'class' => 'nickname',
66                                                                   'title' =>
67                                                                   ($profile->fullname) ? $profile->fullname :
68                                                                   $profile->nickname),
69                                            $profile->nickname);
70                 # FIXME: URL, image, video, audio
71                 common_element_start('span', array('class' => 'content'));
72                 common_raw(common_render_content($notice->content, $notice));
73                 common_element_end('span');
74                 common_element('span', array('class' => 'date'),
75                                            common_date_string($notice->created));
76                 common_element_end('div');
77         }
78 }