summaryrefslogtreecommitdiff
path: root/plugins/OStatus/lib
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/OStatus/lib')
-rw-r--r--plugins/OStatus/lib/magicenvelope.php17
-rw-r--r--plugins/OStatus/lib/safecrypt_rsa.php18
-rw-r--r--plugins/OStatus/lib/safemath_biginteger.php20
-rw-r--r--plugins/OStatus/lib/xrd.php9
4 files changed, 21 insertions, 43 deletions
diff --git a/plugins/OStatus/lib/magicenvelope.php b/plugins/OStatus/lib/magicenvelope.php
index 9266cab5c..799b5e307 100644
--- a/plugins/OStatus/lib/magicenvelope.php
+++ b/plugins/OStatus/lib/magicenvelope.php
@@ -59,12 +59,21 @@ class MagicEnvelope
}
if ($xrd->links) {
if ($link = Discovery::getService($xrd->links, Magicsig::PUBLICKEYREL)) {
- list($type, $keypair) = explode(',', $link['href']);
- if (empty($keypair)) {
+ $keypair = false;
+ $parts = explode(',', $link['href']);
+ if (count($parts) == 2) {
+ $keypair = $parts[1];
+ } else {
// Backwards compatibility check for separator bug in 0.9.0
- list($type, $keypair) = explode(';', $link['href']);
+ $parts = explode(';', $link['href']);
+ if (count($parts) == 2) {
+ $keypair = $parts[1];
+ }
+ }
+
+ if ($keypair) {
+ return $keypair;
}
- return $keypair;
}
}
throw new Exception('Unable to locate signer public key');
diff --git a/plugins/OStatus/lib/safecrypt_rsa.php b/plugins/OStatus/lib/safecrypt_rsa.php
deleted file mode 100644
index f3aa2c928..000000000
--- a/plugins/OStatus/lib/safecrypt_rsa.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-require_once 'Crypt/RSA.php';
-
-/**
- * Crypt_RSA stores a Math_BigInteger with value 0, which triggers a bug
- * in Math_BigInteger's wakeup function which spews notices to log or output.
- * This wrapper replaces it with a version that survives serialization.
- */
-class SafeCrypt_RSA extends Crypt_RSA
-{
- function __construct()
- {
- parent::__construct();
- $this->zero = new SafeMath_BigInteger();
- }
-}
-
diff --git a/plugins/OStatus/lib/safemath_biginteger.php b/plugins/OStatus/lib/safemath_biginteger.php
deleted file mode 100644
index c05e24d1e..000000000
--- a/plugins/OStatus/lib/safemath_biginteger.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-require_once 'Math/BigInteger.php';
-
-/**
- * Crypt_RSA stores a Math_BigInteger with value 0, which triggers a bug
- * in Math_BigInteger's wakeup function which spews notices to log or output.
- * This wrapper replaces it with a version that survives serialization.
- */
-class SafeMath_BigInteger extends Math_BigInteger
-{
- function __wakeup()
- {
- if ($this->hex == '') {
- $this->hex = '0';
- }
- parent::__wakeup();
- }
-}
-
diff --git a/plugins/OStatus/lib/xrd.php b/plugins/OStatus/lib/xrd.php
index aa13ef024..34b28790b 100644
--- a/plugins/OStatus/lib/xrd.php
+++ b/plugins/OStatus/lib/xrd.php
@@ -53,7 +53,14 @@ class XRD
$xrd = new XRD();
$dom = new DOMDocument();
- if (!$dom->loadXML($xml)) {
+
+ // Don't spew XML warnings to output
+ $old = error_reporting();
+ error_reporting($old & ~E_WARNING);
+ $ok = $dom->loadXML($xml);
+ error_reporting($old);
+
+ if (!$ok) {
throw new Exception("Invalid XML");
}
$xrd_element = $dom->getElementsByTagName('XRD')->item(0);