]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/ModPlus/remoteprofileaction.php
visual tweaks for RemoteProfileAction
[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(_('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 profile is registered on another site; see [the profile page on %s](%s).'),
63                 $host,
64                 $url);
65         $html = common_markup_to_html($markdown);
66         $this->raw($html);
67     }
68
69     function getFeeds()
70     {
71         // none
72     }
73
74     function extraHead()
75     {
76         // none
77     }
78
79     function showLocalNav()
80     {
81         $nav = new PublicGroupNav($this);
82         $nav->show();
83     }
84
85     function showSections()
86     {
87         ProfileAction::showSections();
88         // skip tag cloud
89     }
90
91 }