forked from GNUsocial/gnu-social
Merge remote branch 'statusnet/0.9.x' into 1.0.x
This commit is contained in:
@@ -46,7 +46,15 @@ class UserxrdAction extends XrdAction
|
||||
}
|
||||
} else {
|
||||
$this->user = User::staticGet('uri', $this->uri);
|
||||
if (empty($this->user)) {
|
||||
// try and get it by profile url
|
||||
$profile = Profile::staticGet('profileurl', $this->uri);
|
||||
if (!empty($profile)) {
|
||||
$this->user = User::staticGet('id', $profile->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->user) {
|
||||
$this->clientError(_m('No such user.'), 404);
|
||||
return false;
|
||||
|
@@ -1053,22 +1053,27 @@ class Ostatus_profile extends Memcached_DataObject
|
||||
// @fixme this should be better encapsulated
|
||||
// ripped from oauthstore.php (for old OMB client)
|
||||
$temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
|
||||
if (!copy($url, $temp_filename)) {
|
||||
throw new ServerException(sprintf(_m("Unable to fetch avatar from %s."), $url));
|
||||
}
|
||||
try {
|
||||
if (!copy($url, $temp_filename)) {
|
||||
throw new ServerException(sprintf(_m("Unable to fetch avatar from %s."), $url));
|
||||
}
|
||||
|
||||
if ($this->isGroup()) {
|
||||
$id = $this->group_id;
|
||||
} else {
|
||||
$id = $this->profile_id;
|
||||
if ($this->isGroup()) {
|
||||
$id = $this->group_id;
|
||||
} else {
|
||||
$id = $this->profile_id;
|
||||
}
|
||||
// @fixme should we be using different ids?
|
||||
$imagefile = new ImageFile($id, $temp_filename);
|
||||
$filename = Avatar::filename($id,
|
||||
image_type_to_extension($imagefile->type),
|
||||
null,
|
||||
common_timestamp());
|
||||
rename($temp_filename, Avatar::path($filename));
|
||||
} catch (Exception $e) {
|
||||
unlink($temp_filename);
|
||||
throw $e;
|
||||
}
|
||||
// @fixme should we be using different ids?
|
||||
$imagefile = new ImageFile($id, $temp_filename);
|
||||
$filename = Avatar::filename($id,
|
||||
image_type_to_extension($imagefile->type),
|
||||
null,
|
||||
common_timestamp());
|
||||
rename($temp_filename, Avatar::path($filename));
|
||||
// @fixme hardcoded chmod is lame, but seems to be necessary to
|
||||
// keep from accidentally saving images from command-line (queues)
|
||||
// that can't be read from web server, which causes hard-to-notice
|
||||
|
@@ -36,7 +36,8 @@ class XrdAction extends Action
|
||||
|
||||
function handle()
|
||||
{
|
||||
$nick = $this->user->nickname;
|
||||
$nick = $this->user->nickname;
|
||||
$profile = $this->user->getProfile();
|
||||
|
||||
if (empty($this->xrd)) {
|
||||
$xrd = new XRD();
|
||||
@@ -47,10 +48,28 @@ class XrdAction extends Action
|
||||
if (empty($xrd->subject)) {
|
||||
$xrd->subject = Discovery::normalize($this->uri);
|
||||
}
|
||||
$xrd->alias[] = $this->user->uri;
|
||||
|
||||
// Possible aliases for the user
|
||||
|
||||
$uris = array($this->user->uri, $profile->profileurl);
|
||||
|
||||
// FIXME: Webfinger generation code should live somewhere on its own
|
||||
|
||||
$path = common_config('site', 'path');
|
||||
|
||||
if (empty($path)) {
|
||||
$uris[] = sprintf('acct:%s@%s', $nick, common_config('site', 'server'));
|
||||
}
|
||||
|
||||
foreach ($uris as $uri) {
|
||||
if ($uri != $xrd->subject) {
|
||||
$xrd->alias[] = $uri;
|
||||
}
|
||||
}
|
||||
|
||||
$xrd->links[] = array('rel' => Discovery::PROFILEPAGE,
|
||||
'type' => 'text/html',
|
||||
'href' => $this->user->uri);
|
||||
'href' => $profile->profileurl);
|
||||
|
||||
$xrd->links[] = array('rel' => Discovery::UPDATESFROM,
|
||||
'href' => common_local_url('ApiTimelineUser',
|
||||
@@ -66,7 +85,7 @@ class XrdAction extends Action
|
||||
// XFN
|
||||
$xrd->links[] = array('rel' => 'http://gmpg.org/xfn/11',
|
||||
'type' => 'text/html',
|
||||
'href' => $this->user->uri);
|
||||
'href' => $profile->profileurl);
|
||||
// FOAF
|
||||
$xrd->links[] = array('rel' => 'describedby',
|
||||
'type' => 'application/rdf+xml',
|
||||
|
Reference in New Issue
Block a user