From a7e748479c273ddecfe9fdbd72670fe1abe766bf Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 30 Sep 2013 23:12:35 +0200 Subject: [PATCH] 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. --- plugins/OStatus/actions/ostatusinit.php | 6 +++++- plugins/OStatus/actions/ostatustag.php | 6 +++++- plugins/OStatus/lib/discoveryhints.php | 2 +- plugins/OStatus/lib/magicenvelope.php | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/plugins/OStatus/actions/ostatusinit.php b/plugins/OStatus/actions/ostatusinit.php index d8b3fdec51..b31320b444 100644 --- a/plugins/OStatus/actions/ostatusinit.php +++ b/plugins/OStatus/actions/ostatusinit.php @@ -180,7 +180,11 @@ class OStatusInitAction extends Action $link = $xrd->get('http://ostatus.org/schema/1.0/subscribe'); if (!is_null($link)) { // 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_redirect($url, 303); } diff --git a/plugins/OStatus/actions/ostatustag.php b/plugins/OStatus/actions/ostatustag.php index 7a3be739c7..e81c97b5ab 100644 --- a/plugins/OStatus/actions/ostatustag.php +++ b/plugins/OStatus/actions/ostatustag.php @@ -92,7 +92,11 @@ class OStatusTagAction extends OStatusInitAction $link = $xrd->get('http://ostatus.org/schema/1.0/tag'); if (!is_null($link)) { // 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_redirect($url, 303); } diff --git a/plugins/OStatus/lib/discoveryhints.php b/plugins/OStatus/lib/discoveryhints.php index ab0586dac0..a868e73922 100644 --- a/plugins/OStatus/lib/discoveryhints.php +++ b/plugins/OStatus/lib/discoveryhints.php @@ -24,7 +24,7 @@ class DiscoveryHints { { $hints = array(); - foreach ($xrd->getAll() as $link) { + foreach ($xrd->links as $link) { switch ($link->rel) { case WebFinger::PROFILEPAGE: $hints['profileurl'] = $link->href; diff --git a/plugins/OStatus/lib/magicenvelope.php b/plugins/OStatus/lib/magicenvelope.php index a6a60bfa37..e97eb2be2c 100644 --- a/plugins/OStatus/lib/magicenvelope.php +++ b/plugins/OStatus/lib/magicenvelope.php @@ -59,12 +59,12 @@ class MagicEnvelope $link = $xrd->get(Magicsig::PUBLICKEYREL); if (!is_null($link)) { $keypair = false; - $parts = explode(',', $link['href']); + $parts = explode(',', $link->href); if (count($parts) == 2) { $keypair = $parts[1]; } else { // Backwards compatibility check for separator bug in 0.9.0 - $parts = explode(';', $link['href']); + $parts = explode(';', $link->href); if (count($parts) == 2) { $keypair = $parts[1]; }