Fixed regression in OStatus sub from WebFinger/XML_XRD update

XML_XRD::getAll requires arguments (at least relation). If one really
want all links, just get the 'links' array. It's public!

Also, not all XML_XRD_Element_Link were migrated from the previous
array style.
This commit is contained in:
Mikael Nordfeldth 2013-09-30 23:12:35 +02:00
parent cced063e47
commit a7e748479c
4 changed files with 13 additions and 5 deletions

View File

@ -180,7 +180,11 @@ class OStatusInitAction extends Action
$link = $xrd->get('http://ostatus.org/schema/1.0/subscribe'); $link = $xrd->get('http://ostatus.org/schema/1.0/subscribe');
if (!is_null($link)) { if (!is_null($link)) {
// We found a URL - let's redirect! // We found a URL - let's redirect!
$url = Discovery::applyTemplate($link['template'], $target_profile); if (!empty($link->template)) {
$url = Discovery::applyTemplate($link->template, $target_profile);
} else {
$url = $link->href;
}
common_log(LOG_INFO, "Sending remote subscriber $acct to $url"); common_log(LOG_INFO, "Sending remote subscriber $acct to $url");
common_redirect($url, 303); common_redirect($url, 303);
} }

View File

@ -92,7 +92,11 @@ class OStatusTagAction extends OStatusInitAction
$link = $xrd->get('http://ostatus.org/schema/1.0/tag'); $link = $xrd->get('http://ostatus.org/schema/1.0/tag');
if (!is_null($link)) { if (!is_null($link)) {
// We found a URL - let's redirect! // We found a URL - let's redirect!
if (!empty($link->template)) {
$url = Discovery::applyTemplate($link->template, $target_profile); $url = Discovery::applyTemplate($link->template, $target_profile);
} else {
$url = $link->href;
}
common_log(LOG_INFO, "Sending remote subscriber $acct to $url"); common_log(LOG_INFO, "Sending remote subscriber $acct to $url");
common_redirect($url, 303); common_redirect($url, 303);
} }

View File

@ -24,7 +24,7 @@ class DiscoveryHints {
{ {
$hints = array(); $hints = array();
foreach ($xrd->getAll() as $link) { foreach ($xrd->links as $link) {
switch ($link->rel) { switch ($link->rel) {
case WebFinger::PROFILEPAGE: case WebFinger::PROFILEPAGE:
$hints['profileurl'] = $link->href; $hints['profileurl'] = $link->href;

View File

@ -59,12 +59,12 @@ class MagicEnvelope
$link = $xrd->get(Magicsig::PUBLICKEYREL); $link = $xrd->get(Magicsig::PUBLICKEYREL);
if (!is_null($link)) { if (!is_null($link)) {
$keypair = false; $keypair = false;
$parts = explode(',', $link['href']); $parts = explode(',', $link->href);
if (count($parts) == 2) { if (count($parts) == 2) {
$keypair = $parts[1]; $keypair = $parts[1];
} else { } else {
// Backwards compatibility check for separator bug in 0.9.0 // Backwards compatibility check for separator bug in 0.9.0
$parts = explode(';', $link['href']); $parts = explode(';', $link->href);
if (count($parts) == 2) { if (count($parts) == 2) {
$keypair = $parts[1]; $keypair = $parts[1];
} }