Fixes foaf notices, use Profile for information that's missing in Remote_profile

This commit is contained in:
Carlos Perilla 2009-09-01 09:19:10 -05:00 committed by Craig Andrews
parent e0e30552cf
commit aa7bda4677

View File

@ -146,8 +146,10 @@ class FoafAction extends Action
while ($sub->fetch()) { while ($sub->fetch()) {
if ($sub->token) { if ($sub->token) {
$other = Remote_profile::staticGet('id', $sub->subscriber); $other = Remote_profile::staticGet('id', $sub->subscriber);
$profile = Profile::staticGet('id', $sub->subscriber);
} else { } else {
$other = User::staticGet('id', $sub->subscriber); $other = User::staticGet('id', $sub->subscriber);
$profile = Profile::staticGet('id', $sub->subscriber);
} }
if (!$other) { if (!$other) {
common_debug('Got a bad subscription: '.print_r($sub,true)); common_debug('Got a bad subscription: '.print_r($sub,true));
@ -158,12 +160,15 @@ class FoafAction extends Action
} else { } else {
$person[$other->uri] = array(LISTENER, $person[$other->uri] = array(LISTENER,
$other->id, $other->id,
$other->nickname, $profile->nickname,
(empty($sub->token)) ? 'User' : 'Remote_profile'); (empty($sub->token)) ? 'User' : 'Remote_profile');
} }
$other->free(); $other->free();
$other = null; $other = null;
unset($other); unset($other);
$profile->free();
$profile = null;
unset($profile);
} }
} }
@ -254,8 +259,10 @@ class FoafAction extends Action
while ($sub->fetch()) { while ($sub->fetch()) {
if (!empty($sub->token)) { if (!empty($sub->token)) {
$other = Remote_profile::staticGet('id', $sub->subscribed); $other = Remote_profile::staticGet('id', $sub->subscribed);
$profile = Profile::staticGet('id', $sub->subscribed);
} else { } else {
$other = User::staticGet('id', $sub->subscribed); $other = User::staticGet('id', $sub->subscribed);
$profile = Profile::staticGet('id', $sub->subscribed);
} }
if (empty($other)) { if (empty($other)) {
common_debug('Got a bad subscription: '.print_r($sub,true)); common_debug('Got a bad subscription: '.print_r($sub,true));
@ -264,11 +271,14 @@ class FoafAction extends Action
$this->element('sioc:follows', array('rdf:resource' => $other->uri.'#acct')); $this->element('sioc:follows', array('rdf:resource' => $other->uri.'#acct'));
$person[$other->uri] = array(LISTENEE, $person[$other->uri] = array(LISTENEE,
$other->id, $other->id,
$other->nickname, $profile->nickname,
(empty($sub->token)) ? 'User' : 'Remote_profile'); (empty($sub->token)) ? 'User' : 'Remote_profile');
$other->free(); $other->free();
$other = null; $other = null;
unset($other); unset($other);
$profile->free();
$profile = null;
unset($profile);
} }
} }