X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FSalmon.php;h=f30488ce140eeef304b7dd99eb8258707c11c014;hb=d0dfe2aa64439eb1fe74be2cfb102303307eca67;hp=2bf86f0e36317714ccfbc110de9efc0d0809207e;hpb=390d5706f46ce58cbed24b292d5c1f1b9789a8a8;p=friendica.git diff --git a/src/Protocol/Salmon.php b/src/Protocol/Salmon.php index 2bf86f0e36..f30488ce14 100644 --- a/src/Protocol/Salmon.php +++ b/src/Protocol/Salmon.php @@ -6,6 +6,7 @@ namespace Friendica\Protocol; use Friendica\Network\Probe; use Friendica\Util\Crypto; +use Friendica\Util\Network; use Friendica\Util\XML; /** @@ -22,7 +23,7 @@ class Salmon */ public static function getKey($uri, $keyhash) { - $ret = array(); + $ret = []; logger('Fetching salmon key for '.$uri); @@ -50,7 +51,7 @@ class Salmon $ret[$x] = substr($ret[$x], 5); } } elseif (normalise_link($ret[$x]) == 'http://') { - $ret[$x] = fetch_url($ret[$x]); + $ret[$x] = Network::fetchUrl($ret[$x]); } } } @@ -120,22 +121,22 @@ class Salmon $signature3 = base64url_encode(Crypto::rsaSign($data, $owner['sprvkey'])); // At first try the non compliant method that works for GNU Social - $xmldata = array("me:env" => array("me:data" => $data, - "@attributes" => array("type" => $data_type), + $xmldata = ["me:env" => ["me:data" => $data, + "@attributes" => ["type" => $data_type], "me:encoding" => $encoding, "me:alg" => $algorithm, "me:sig" => $signature, - "@attributes2" => array("key_id" => $keyhash))); + "@attributes2" => ["key_id" => $keyhash]]]; - $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env"); + $namespaces = ["me" => "http://salmon-protocol.org/ns/magic-env"]; $salmon = XML::fromArray($xmldata, $xml, false, $namespaces); // slap them - post_url($url, $salmon, array( + Network::post($url, $salmon, [ 'Content-type: application/magic-envelope+xml', 'Content-length: ' . strlen($salmon) - )); + ]); $a = get_app(); $return_code = $a->get_curl_code(); @@ -146,22 +147,22 @@ class Salmon logger('GNU Social salmon failed. Falling back to compliant mode'); // Now try the compliant mode that normally isn't used for GNU Social - $xmldata = array("me:env" => array("me:data" => $data, - "@attributes" => array("type" => $data_type), + $xmldata = ["me:env" => ["me:data" => $data, + "@attributes" => ["type" => $data_type], "me:encoding" => $encoding, "me:alg" => $algorithm, "me:sig" => $signature2, - "@attributes2" => array("key_id" => $keyhash))); + "@attributes2" => ["key_id" => $keyhash]]]; - $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env"); + $namespaces = ["me" => "http://salmon-protocol.org/ns/magic-env"]; $salmon = XML::fromArray($xmldata, $xml, false, $namespaces); // slap them - post_url($url, $salmon, array( + Network::post($url, $salmon, [ 'Content-type: application/magic-envelope+xml', 'Content-length: ' . strlen($salmon) - )); + ]); $return_code = $a->get_curl_code(); } @@ -169,22 +170,21 @@ class Salmon logger('compliant salmon failed. Falling back to old status.net'); // Last try. This will most likely fail as well. - $xmldata = array("me:env" => array("me:data" => $data, - "@attributes" => array("type" => $data_type), + $xmldata = ["me:env" => ["me:data" => $data, + "@attributes" => ["type" => $data_type], "me:encoding" => $encoding, "me:alg" => $algorithm, "me:sig" => $signature3, - "@attributes2" => array("key_id" => $keyhash))); + "@attributes2" => ["key_id" => $keyhash]]]; - $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env"); + $namespaces = ["me" => "http://salmon-protocol.org/ns/magic-env"]; $salmon = XML::fromArray($xmldata, $xml, false, $namespaces); // slap them - post_url($url, $salmon, array( + Network::post($url, $salmon, [ 'Content-type: application/magic-envelope+xml', - 'Content-length: ' . strlen($salmon)) - ); + 'Content-length: ' . strlen($salmon)]); $return_code = $a->get_curl_code(); }