]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/ModPlus/remoteprofileaction.php
Harmonize message for 'User has no profile.' and update translator documentation.
[quix0rs-gnu-social.git] / plugins / ModPlus / remoteprofileaction.php
1 <?php
2 /* 
3  * To change this template, choose Tools | Templates
4  * and open the template in the editor.
5  */
6
7 class RemoteProfileAction extends ShowstreamAction
8 {
9     function prepare($args)
10     {
11         OwnerDesignAction::prepare($args); // skip the ProfileAction code and replace it...
12
13         $id = $this->arg('id');
14         $this->user = false;
15         $this->profile = Profile::staticGet('id', $id);
16
17         if (!$this->profile) {
18             // TRANS: Error message displayed when referring to a user without a profile.
19             $this->serverError(_m('User has no profile.'));
20             return false;
21         }
22
23         $user = User::staticGet('id', $this->profile->id);
24         if ($user) {
25             // This is a local user -- send to their regular profile.
26             $url = common_local_url('showstream', array('nickname' => $user->nickname));
27             common_redirect($url);
28             return false;
29         }
30
31         $this->tag = $this->trimmed('tag');
32         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
33         common_set_returnto($this->selfUrl());
34         return true;
35     }
36
37     function handle($args)
38     {
39         // skip yadis thingy
40         $this->showPage();
41     }
42
43     function title()
44     {
45         // maybe fixed in 0.9.x
46         if (!empty($this->profile->fullname)) {
47             $base = $this->profile->fullname . ' (' . $this->profile->nickname . ') ';
48         } else {
49             $base = $this->profile->nickname;
50         }
51         $host = parse_url($this->profile->profileurl, PHP_URL_HOST);
52         return sprintf(_m('%s on %s'), $base, $host);
53     }
54
55     /**
56      * Instead of showing notices, link to the original offsite profile.
57      */
58     function showNotices()
59     {
60         $url = $this->profile->profileurl;
61         $host = parse_url($url, PHP_URL_HOST);
62         $markdown = sprintf(
63                 _m('This remote profile is registered on another site; see [%s\'s original profile page on %s](%s).'),
64                 $this->profile->nickname,
65                 $host,
66                 $url);
67         $html = common_markup_to_html($markdown);
68         $this->raw($html);
69
70         if ($this->profile->hasRole(Profile_role::SILENCED)) {
71             $markdown = _m('Site moderators have silenced this profile, which prevents delivery of new messages to any users on this site.');
72             $this->raw(common_markup_to_html($markdown));
73         }
74     }
75
76     function getFeeds()
77     {
78         // none
79     }
80
81     /**
82      * Don't do various extra stuff, and also trim some things to avoid crawlers.
83      */
84     function extraHead()
85     {
86         $this->element('meta', array('name' => 'robots',
87                                      'content' => 'noindex,nofollow'));
88     }
89
90     function showLocalNav()
91     {
92         $nav = new PublicGroupNav($this);
93         $nav->show();
94     }
95
96     function showSections()
97     {
98         ProfileAction::showSections();
99         // skip tag cloud
100     }
101
102     function showStatistics()
103     {
104         // skip
105     }
106
107 }