From: Adam Magness Date: Sat, 27 Jan 2018 04:24:23 +0000 (-0500) Subject: Move post_url X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a32ba32ff468284641c55c4a08f8b6d949b33c0c;p=friendica.git Move post_url move post_url function --- diff --git a/include/items.php b/include/items.php index edc757dc2e..a1afbb3062 100644 --- a/include/items.php +++ b/include/items.php @@ -22,6 +22,7 @@ use Friendica\Object\Image; use Friendica\Protocol\DFRN; use Friendica\Protocol\OStatus; use Friendica\Protocol\Feed; +use Friendica\Util\Network; use Friendica\Util\ParseUrl; require_once 'include/bbcode.php'; @@ -1480,7 +1481,7 @@ function subscribe_to_hub($url, $importer, $contact, $hubmode = 'subscribe') { dba::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]); } - post_url($url, $params); + Network::postURL($url, $params); logger('subscribe_to_hub: returns: ' . $a->get_curl_code(), LOGGER_DEBUG); diff --git a/include/network.php b/include/network.php index 7f1bbb6d83..875597f764 100644 --- a/include/network.php +++ b/include/network.php @@ -12,11 +12,6 @@ use Friendica\Object\Image; use Friendica\Util\Network; use Friendica\Util\XML; -function post_url($url, $params, $headers = null, &$redirects = 0, $timeout = 0) -{ - return Network::postURL($url, $params, $headers, $redirects, $timeout); -} - function xml_status($st, $message = '') { Network::xmlStatus($st, $message); diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index a712e439f7..d3c84c54fa 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -30,6 +30,7 @@ use Friendica\Model\User; use Friendica\Network\Probe; use Friendica\Protocol\Diaspora; use Friendica\Util\Crypto; +use Friendica\Util\Network; require_once 'include/enotify.php'; require_once 'include/items.php'; @@ -220,7 +221,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) * */ - $res = post_url($dfrn_confirm, $params, null, $redirects, 120); + $res = Network::postURL($dfrn_confirm, $params, null, $redirects, 120); logger(' Confirm: received data: ' . $res, LOGGER_DATA); diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 7b0785b6f3..0392c2c920 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -490,7 +490,7 @@ function dfrn_poll_content(App $a) . '&sec=' . $sec ); } else { - $s = post_url($r[0]['poll'], [ + $s = Network::postURL($r[0]['poll'], [ 'dfrn_id' => $encrypted_id, 'type' => 'profile-check', 'dfrn_version' => DFRN_PROTOCOL_VERSION, diff --git a/mod/match.php b/mod/match.php index 47b24e9f7e..ad1e00101e 100644 --- a/mod/match.php +++ b/mod/match.php @@ -10,6 +10,7 @@ use Friendica\Core\System; use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\Profile; +use Friendica\Util\Network; require_once 'include/text.php'; require_once 'mod/proxy.php'; @@ -58,9 +59,9 @@ function match_content(App $a) } if (strlen(Config::get('system', 'directory'))) { - $x = post_url(get_server().'/msearch', $params); + $x = Network::postURL(get_server().'/msearch', $params); } else { - $x = post_url(System::baseUrl() . '/msearch', $params); + $x = Network::postURL(System::baseUrl() . '/msearch', $params); } $j = json_decode($x); diff --git a/spec/dfrn2_contact_confirmation.svg b/spec/dfrn2_contact_confirmation.svg index bb506a2328..53c2b6c19f 100644 --- a/spec/dfrn2_contact_confirmation.svg +++ b/spec/dfrn2_contact_confirmation.svg @@ -69,7 +69,7 @@ text { font:12px Dialog; } getting transmitted (if $aes_allow -> encrypt the the public key) -> add duplex state and page-flags to the params -> send params to Bobs dfrn_confirm page ($res = -post_url($dfrn_confirm,$params); +Network::postURL($dfrn_confirm,$params); dfrn_confirm_post() diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 4289769e41..aed68e704f 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -1333,7 +1333,7 @@ class DFRN logger('dfrn_deliver: ' . "SENDING: " . print_r($postvars, true), LOGGER_DATA); - $xml = post_url($contact['notify'], $postvars); + $xml = Network::postURL($contact['notify'], $postvars); logger('dfrn_deliver: ' . "RECEIVED: " . $xml, LOGGER_DATA); diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 14bad8e1d9..2ad4fadb11 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -3229,7 +3229,7 @@ class Diaspora if (!intval(Config::get("system", "diaspora_test"))) { $content_type = (($public_batch) ? "application/magic-envelope+xml" : "application/json"); - post_url($dest_url."/", $envelope, ["Content-Type: ".$content_type]); + Network::postURL($dest_url."/", $envelope, ["Content-Type: ".$content_type]); $return_code = $a->get_curl_code(); } else { logger("test_mode"); diff --git a/src/Protocol/Salmon.php b/src/Protocol/Salmon.php index 3e8d368169..f49225021e 100644 --- a/src/Protocol/Salmon.php +++ b/src/Protocol/Salmon.php @@ -133,7 +133,7 @@ class Salmon $salmon = XML::fromArray($xmldata, $xml, false, $namespaces); // slap them - post_url($url, $salmon, [ + Network::postURL($url, $salmon, [ 'Content-type: application/magic-envelope+xml', 'Content-length: ' . strlen($salmon) ]); @@ -159,7 +159,7 @@ class Salmon $salmon = XML::fromArray($xmldata, $xml, false, $namespaces); // slap them - post_url($url, $salmon, [ + Network::postURL($url, $salmon, [ 'Content-type: application/magic-envelope+xml', 'Content-length: ' . strlen($salmon) ]); @@ -182,10 +182,9 @@ class Salmon $salmon = XML::fromArray($xmldata, $xml, false, $namespaces); // slap them - post_url($url, $salmon, [ + Network::postURL($url, $salmon, [ 'Content-type: application/magic-envelope+xml', - 'Content-length: ' . strlen($salmon)] - ); + 'Content-length: ' . strlen($salmon)]); $return_code = $a->get_curl_code(); } diff --git a/src/Util/Network.php b/src/Util/Network.php index ebe6abda47..e0400c7f0a 100644 --- a/src/Util/Network.php +++ b/src/Util/Network.php @@ -380,7 +380,7 @@ class Network if (filter_var($newurl, FILTER_VALIDATE_URL)) { $redirects++; logger('post_url: redirect ' . $url . ' to ' . $newurl); - return post_url($newurl, $params, $headers, $redirects, $timeout); + return self::postURL($newurl, $params, $headers, $redirects, $timeout); } } diff --git a/src/Worker/OnePoll.php b/src/Worker/OnePoll.php index 98b5f77869..b4e7bc20c4 100644 --- a/src/Worker/OnePoll.php +++ b/src/Worker/OnePoll.php @@ -281,7 +281,7 @@ class OnePoll $postvars['dfrn_version'] = DFRN_PROTOCOL_VERSION; $postvars['perm'] = 'rw'; - $xml = post_url($contact['poll'], $postvars); + $xml = Network::postURL($contact['poll'], $postvars); } elseif (($contact['network'] === NETWORK_OSTATUS) || ($contact['network'] === NETWORK_DIASPORA) diff --git a/src/Worker/PubSubPublish.php b/src/Worker/PubSubPublish.php index 2656cef24b..a287e89d33 100644 --- a/src/Worker/PubSubPublish.php +++ b/src/Worker/PubSubPublish.php @@ -11,6 +11,7 @@ use Friendica\Core\Config; use Friendica\Core\Worker; use Friendica\Database\DBM; use Friendica\Protocol\OStatus; +use Friendica\Util\Network; require_once 'include/items.php'; @@ -68,7 +69,7 @@ class PubSubPublish { logger('POST '.print_r($headers, true)."\n".$params, LOGGER_DEBUG); - post_url($rr['callback_url'], $params, $headers); + Network::postURL($rr['callback_url'], $params, $headers); $ret = $a->get_curl_code(); if ($ret >= 200 && $ret <= 299) {