forked from GNUsocial/gnu-social
FOAF was missing OStatus remote subscriptions, now fixed.
This commit is contained in:
parent
7277b59734
commit
7dc24b4ca7
@ -162,40 +162,29 @@ class FoafAction extends Action
|
|||||||
|
|
||||||
if ($sub->find()) {
|
if ($sub->find()) {
|
||||||
while ($sub->fetch()) {
|
while ($sub->fetch()) {
|
||||||
if ($sub->token) {
|
$profile = Profile::staticGet('id', $sub->subscriber);
|
||||||
$other = Remote_profile::staticGet('id', $sub->subscriber);
|
if (empty($profile)) {
|
||||||
$profile = Profile::staticGet('id', $sub->subscriber);
|
|
||||||
} else {
|
|
||||||
$other = User::staticGet('id', $sub->subscriber);
|
|
||||||
$profile = Profile::staticGet('id', $sub->subscriber);
|
|
||||||
}
|
|
||||||
if (!$other) {
|
|
||||||
common_debug('Got a bad subscription: '.print_r($sub,true));
|
common_debug('Got a bad subscription: '.print_r($sub,true));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (array_key_exists($other->uri, $person)) {
|
$user = $profile->getUser();
|
||||||
$person[$other->uri][0] = BOTH;
|
$other_uri = $profile->getUri();
|
||||||
|
if (array_key_exists($other_uri, $person)) {
|
||||||
|
$person[$other_uri][0] = BOTH;
|
||||||
} else {
|
} else {
|
||||||
$person[$other->uri] = array(LISTENER,
|
$person[$other_uri] = array(LISTENER,
|
||||||
$other->id,
|
$profile->id,
|
||||||
$profile->nickname,
|
$profile->nickname,
|
||||||
(empty($sub->token)) ? 'User' : 'Remote_profile');
|
$user ? 'local' : 'remote');
|
||||||
}
|
}
|
||||||
$other->free();
|
|
||||||
$other = null;
|
|
||||||
unset($other);
|
|
||||||
$profile->free();
|
|
||||||
$profile = null;
|
|
||||||
unset($profile);
|
unset($profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sub->free();
|
|
||||||
$sub = null;
|
|
||||||
unset($sub);
|
unset($sub);
|
||||||
|
|
||||||
foreach ($person as $uri => $p) {
|
foreach ($person as $uri => $p) {
|
||||||
list($type, $id, $nickname, $cls) = $p;
|
list($type, $id, $nickname, $local) = $p;
|
||||||
if ($type == BOTH) {
|
if ($type == BOTH) {
|
||||||
$this->element('knows', array('rdf:resource' => $uri));
|
$this->element('knows', array('rdf:resource' => $uri));
|
||||||
}
|
}
|
||||||
@ -206,8 +195,8 @@ class FoafAction extends Action
|
|||||||
|
|
||||||
foreach ($person as $uri => $p) {
|
foreach ($person as $uri => $p) {
|
||||||
$foaf_url = null;
|
$foaf_url = null;
|
||||||
list($type, $id, $nickname, $cls) = $p;
|
list($type, $id, $nickname, $local) = $p;
|
||||||
if ($cls == 'User') {
|
if ($local == 'local') {
|
||||||
$foaf_url = common_local_url('foaf', array('nickname' => $nickname));
|
$foaf_url = common_local_url('foaf', array('nickname' => $nickname));
|
||||||
}
|
}
|
||||||
$profile = Profile::staticGet($id);
|
$profile = Profile::staticGet($id);
|
||||||
@ -216,7 +205,7 @@ class FoafAction extends Action
|
|||||||
$this->element('knows', array('rdf:resource' => $this->user->uri));
|
$this->element('knows', array('rdf:resource' => $this->user->uri));
|
||||||
}
|
}
|
||||||
$this->showMicrobloggingAccount($profile,
|
$this->showMicrobloggingAccount($profile,
|
||||||
($cls == 'User') ? common_root_url() : null,
|
($local == 'local') ? common_root_url() : null,
|
||||||
$uri,
|
$uri,
|
||||||
true);
|
true);
|
||||||
if ($foaf_url) {
|
if ($foaf_url) {
|
||||||
@ -275,33 +264,22 @@ class FoafAction extends Action
|
|||||||
|
|
||||||
if ($sub->find()) {
|
if ($sub->find()) {
|
||||||
while ($sub->fetch()) {
|
while ($sub->fetch()) {
|
||||||
if (!empty($sub->token)) {
|
$profile = Profile::staticGet('id', $sub->subscribed);
|
||||||
$other = Remote_profile::staticGet('id', $sub->subscribed);
|
if (empty($profile)) {
|
||||||
$profile = Profile::staticGet('id', $sub->subscribed);
|
|
||||||
} else {
|
|
||||||
$other = User::staticGet('id', $sub->subscribed);
|
|
||||||
$profile = Profile::staticGet('id', $sub->subscribed);
|
|
||||||
}
|
|
||||||
if (empty($other)) {
|
|
||||||
common_debug('Got a bad subscription: '.print_r($sub,true));
|
common_debug('Got a bad subscription: '.print_r($sub,true));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$this->element('sioc:follows', array('rdf:resource' => $other->uri.'#acct'));
|
$user = $profile->getUser();
|
||||||
$person[$other->uri] = array(LISTENEE,
|
$other_uri = $profile->getUri();
|
||||||
$other->id,
|
$this->element('sioc:follows', array('rdf:resource' => $other_uri.'#acct'));
|
||||||
$profile->nickname,
|
$person[$other_uri] = array(LISTENEE,
|
||||||
(empty($sub->token)) ? 'User' : 'Remote_profile');
|
$profile->id,
|
||||||
$other->free();
|
$profile->nickname,
|
||||||
$other = null;
|
$user ? 'local' : 'remote');
|
||||||
unset($other);
|
|
||||||
$profile->free();
|
|
||||||
$profile = null;
|
|
||||||
unset($profile);
|
unset($profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sub->free();
|
|
||||||
$sub = null;
|
|
||||||
unset($sub);
|
unset($sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user