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