gnu-social/plugins/ModPlus/remoteprofileaction.php
Zach Copley 36d619480a Rip out user, group and site design customization code
Squashed commit of the following:

commit 0bcfb6535115ec0a11669420f8689aeedc417bc8
Author: Zach Copley <zach@status.net>
Date:   Thu Jun 9 15:51:47 2011 -0400

    Remove design-related stuff from the API

commit 88da010256fbcaee1ff01d9507ea47d3225f2825
Author: Zach Copley <zach@status.net>
Date:   Thu Jun 9 15:40:16 2011 -0400

    Mop up misc design related code

commit 11958b064745b797b4c9f9f4b7e8f65e4c82ce83
Author: Zach Copley <zach@status.net>
Date:   Thu Jun 9 15:21:00 2011 -0400

    Remove Design DB_DataObject class and references to it in schema

commit f8540594728ce6ba4697eb21657ccb897a9fc127
Author: Zach Copley <zach@status.net>
Date:   Thu Jun 9 13:15:54 2011 -0400

    Remove design-related actions and widgets

commit ddf7b4d425b88b58956b8be06047d2a3e0560bd2
Author: Zach Copley <zach@status.net>
Date:   Thu Jun 9 13:10:57 2011 -0400

    Remove navigation / routing to design settings actions

commit e3f280f8780d99168edf37ef766956f281e9c5da
Author: Zach Copley <zach@status.net>
Date:   Thu Jun 9 13:03:09 2011 -0400

    CurrentUserDesignAction -> Action

commit 6780b1a07e1375a7fa0fd48c8bf3109d9a12e33e
Author: Zach Copley <zach@status.net>
Date:   Thu Jun 9 12:54:22 2011 -0400

    * GroupDesignAction -> GroupAction (new base class for group actions)

commit 2136377e895db274709a1d486f377f13946ccfd6
Author: Zach Copley <zach@status.net>
Date:   Thu Jun 9 12:36:40 2011 -0400

    OwnerDesignAction -> Action
2011-06-09 16:20:19 -04:00

108 lines
3.2 KiB
PHP

<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class RemoteProfileAction extends ShowstreamAction
{
function prepare($args)
{
Action::prepare($args); // skip the ProfileAction code and replace it...
$id = $this->arg('id');
$this->user = false;
$this->profile = Profile::staticGet('id', $id);
if (!$this->profile) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->serverError(_m('User has no profile.'));
return false;
}
$user = User::staticGet('id', $this->profile->id);
if ($user) {
// This is a local user -- send to their regular profile.
$url = common_local_url('showstream', array('nickname' => $user->nickname));
common_redirect($url);
return false;
}
$this->tag = $this->trimmed('tag');
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
common_set_returnto($this->selfUrl());
return true;
}
function handle($args)
{
// skip yadis thingy
$this->showPage();
}
function title()
{
$base = $this->profile->getBestName();
$host = parse_url($this->profile->profileurl, PHP_URL_HOST);
// TRANS: Remote profile action page title.
// TRANS: %1$s is a username, %2$s is a hostname.
return sprintf(_m('%1$s on %2$s'), $base, $host);
}
/**
* Instead of showing notices, link to the original offsite profile.
*/
function showNotices()
{
$url = $this->profile->profileurl;
$host = parse_url($url, PHP_URL_HOST);
$markdown = sprintf(
// TRANS: Message on remote profile page.
// TRANS: This message contains Markdown links in the form [description](link).
// TRANS: %1$s is a profile nickname, %2$s is a hostname, %3$s is a URL.
_m('This remote profile is registered on another site; see [%1$s\'s original profile page on %2$s](%3$s).'),
$this->profile->nickname,
$host,
$url);
$html = common_markup_to_html($markdown);
$this->raw($html);
if ($this->profile->hasRole(Profile_role::SILENCED)) {
// TRANS: Message on blocked remote profile page.
$markdown = _m('Site moderators have silenced this profile, which prevents delivery of new messages to any users on this site.');
$this->raw(common_markup_to_html($markdown));
}
}
function getFeeds()
{
// none
}
/**
* Don't do various extra stuff, and also trim some things to avoid crawlers.
*/
function extraHead()
{
$this->element('meta', array('name' => 'robots',
'content' => 'noindex,nofollow'));
}
function showLocalNav()
{
$nav = new PublicGroupNav($this);
$nav->show();
}
function showSections()
{
ProfileAction::showSections();
// skip tag cloud
}
function showStatistics()
{
// skip
}
}