summaryrefslogtreecommitdiff
path: root/plugins/OStatus
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2010-03-11 16:39:07 -0500
committerSarven Capadisli <csarven@status.net>2010-03-11 16:39:07 -0500
commit4c320872d92e4323c2566013034dbea45b309065 (patch)
treebc024cf3a925d84de58180af3d2c0c15dd35e166 /plugins/OStatus
parentc6f09306b1c72296db8b55500a5d6a2ea8cd5dd2 (diff)
parent512e51105372daf9c85af9284de1463084f03aa9 (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'plugins/OStatus')
-rw-r--r--plugins/OStatus/lib/magicenvelope.php21
-rw-r--r--plugins/OStatus/lib/xrdaction.php2
2 files changed, 14 insertions, 9 deletions
diff --git a/plugins/OStatus/lib/magicenvelope.php b/plugins/OStatus/lib/magicenvelope.php
index fb8c57c71..9266cab5c 100644
--- a/plugins/OStatus/lib/magicenvelope.php
+++ b/plugins/OStatus/lib/magicenvelope.php
@@ -59,7 +59,11 @@ class MagicEnvelope
}
if ($xrd->links) {
if ($link = Discovery::getService($xrd->links, Magicsig::PUBLICKEYREL)) {
- list($type, $keypair) = explode(';', $link['href']);
+ list($type, $keypair) = explode(',', $link['href']);
+ if (empty($keypair)) {
+ // Backwards compatibility check for separator bug in 0.9.0
+ list($type, $keypair) = explode(';', $link['href']);
+ }
return $keypair;
}
}
@@ -70,7 +74,7 @@ class MagicEnvelope
public function signMessage($text, $mimetype, $keypair)
{
$signature_alg = Magicsig::fromString($keypair);
- $armored_text = base64_encode($text);
+ $armored_text = base64_url_encode($text);
return array(
'data' => $armored_text,
@@ -108,7 +112,7 @@ class MagicEnvelope
public function unfold($env)
{
$dom = new DOMDocument();
- $dom->loadXML(base64_decode($env['data']));
+ $dom->loadXML(base64_url_decode($env['data']));
if ($dom->documentElement->tagName != 'entry') {
return false;
@@ -165,7 +169,7 @@ class MagicEnvelope
return false;
}
- $text = base64_decode($env['data']);
+ $text = base64_url_decode($env['data']);
$signer_uri = $this->getAuthor($text);
try {
@@ -193,11 +197,12 @@ class MagicEnvelope
public function fromDom($dom)
{
- if ($dom->documentElement->tagName == 'entry') {
+ $env_element = $dom->getElementsByTagNameNS(MagicEnvelope::NS, 'env')->item(0);
+ if (!$env_element) {
$env_element = $dom->getElementsByTagNameNS(MagicEnvelope::NS, 'provenance')->item(0);
- } else if ($dom->documentElement->tagName == 'me:env') {
- $env_element = $dom->documentElement;
- } else {
+ }
+
+ if (!$env_element) {
return false;
}
diff --git a/plugins/OStatus/lib/xrdaction.php b/plugins/OStatus/lib/xrdaction.php
index 6881292ad..b3c1d8453 100644
--- a/plugins/OStatus/lib/xrdaction.php
+++ b/plugins/OStatus/lib/xrdaction.php
@@ -91,7 +91,7 @@ class XrdAction extends Action
}
$xrd->links[] = array('rel' => Magicsig::PUBLICKEYREL,
- 'href' => 'data:application/magic-public-key;'. $magickey->toString(false));
+ 'href' => 'data:application/magic-public-key,'. $magickey->toString(false));
// TODO - finalize where the redirect should go on the publisher
$url = common_local_url('ostatussub') . '?profile={uri}';