3 * To change this template, choose Tools | Templates
4 * and open the template in the editor.
7 class RemoteProfileAction extends ShowstreamAction
9 function prepare($args)
11 Action::prepare($args); // skip the ProfileAction code and replace it...
13 $id = $this->arg('id');
15 $this->profile = Profile::getKV('id', $id);
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.'));
23 $user = User::getKV('id', $this->profile->id);
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);
31 $this->tag = $this->trimmed('tag');
32 $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
33 common_set_returnto($this->selfUrl());
35 $p = Profile::current();
36 if (empty($this->tag)) {
37 $stream = new ProfileNoticeStream($this->profile, $p);
39 $stream = new TaggedProfileNoticeStream($this->profile, $this->tag, $p);
41 $this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
46 function handle($args)
54 $base = $this->profile->getBestName();
55 $host = parse_url($this->profile->profileurl, PHP_URL_HOST);
56 // TRANS: Remote profile action page title.
57 // TRANS: %1$s is a username, %2$s is a hostname.
58 return sprintf(_m('%1$s on %2$s'), $base, $host);
62 * Instead of showing notices, link to the original offsite profile.
64 function showNotices()
66 $url = $this->profile->profileurl;
67 $host = parse_url($url, PHP_URL_HOST);
69 // TRANS: Message on remote profile page.
70 // TRANS: This message contains Markdown links in the form [description](link).
71 // TRANS: %1$s is a profile nickname, %2$s is a hostname, %3$s is a URL.
72 _m('This remote profile is registered on another site; see [%1$s\'s original profile page on %2$s](%3$s).'),
73 $this->profile->nickname,
76 $html = common_markup_to_html($markdown);
79 if ($this->profile->hasRole(Profile_role::SILENCED)) {
80 // TRANS: Message on blocked remote profile page.
81 $markdown = _m('Site moderators have silenced this profile, which prevents delivery of new messages to any users on this site.');
82 $this->raw(common_markup_to_html($markdown));
86 if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) {
87 $pnl = new ProfileNoticeList($this->notice, $this);
91 $this->showEmptyListMessage();
94 $args = array('id' => $this->profile->id);
95 if (!empty($this->tag))
97 $args['tag'] = $this->tag;
99 $this->pagination($this->page>1, $cnt>NOTICES_PER_PAGE, $this->page,
100 'remoteprofile', $args);
111 * Don't do various extra stuff, and also trim some things to avoid crawlers.
115 $this->element('meta', array('name' => 'robots',
116 'content' => 'noindex,nofollow'));
119 function showLocalNav()
124 function showSections()
129 function showStatistics()