Move post_url
authorAdam Magness <adam.magness@gmail.com>
Sat, 27 Jan 2018 04:24:23 +0000 (23:24 -0500)
committerAdam Magness <adam.magness@gmail.com>
Sat, 27 Jan 2018 04:24:23 +0000 (23:24 -0500)
move post_url function

12 files changed:
include/items.php
include/network.php
mod/dfrn_confirm.php
mod/dfrn_poll.php
mod/match.php
spec/dfrn2_contact_confirmation.svg
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Protocol/Salmon.php
src/Util/Network.php
src/Worker/OnePoll.php
src/Worker/PubSubPublish.php

index edc757d..a1afbb3 100644 (file)
@@ -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);
 
index 7f1bbb6..875597f 100644 (file)
@@ -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);
index a712e43..d3c84c5 100644 (file)
@@ -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);
 
index 7b0785b..0392c2c 100644 (file)
@@ -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,
index 47b24e9..ad1e001 100644 (file)
@@ -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);
index bb506a2..53c2b6c 100644 (file)
@@ -69,7 +69,7 @@ text { font:12px Dialog; }
 <text x="29" y="1664" style="font:13px Open Sans">getting transmitted (if $aes_allow -&gt; encrypt the the public key)</text>
 <text x="29" y="1710" style="font:13px Open Sans">     -&gt; add duplex state and page-flags to the params</text>
 <text x="29" y="1756" style="font:13px Open Sans">  -&gt; send params to Bobs dfrn_confirm page ($res = </text>
-<text x="29" y="1779" style="font:13px Open Sans">post_url($dfrn_confirm,$params);</text>
+<text x="29" y="1779" style="font:13px Open Sans">Network::postURL($dfrn_confirm,$params);</text>
 <clipPath id="clip11"><path d="M1041,1319 L1619,1319 L1619,1913 L1041,1913 L1041,1319 Z" /></clipPath>
 <path d="M1050,1320 C1045.5820313,1320 1042,1323.5820313 1042,1328 L1042,1903 C1042,1907.4179688 1045.5820313,1911 1050,1911 L1609,1911 C1613.4179688,1911 1617,1907.4179688 1617,1903 L1617,1328 C1617,1323.5820313 1613.4179688,1320 1609,1320 Z" style="fill:rgb(255,255,3);stroke:none" clip-path="url(#clip11)" />
 <text x="1055" y="1342" style="font:13px Open Sans">dfrn_confirm_post()</text>
index 4289769..aed68e7 100644 (file)
@@ -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);
 
index 14bad8e..2ad4fad 100644 (file)
@@ -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");
index 3e8d368..f492250 100644 (file)
@@ -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();
                }
 
index ebe6abd..e0400c7 100644 (file)
@@ -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);
                        }
                }
 
index 98b5f77..b4e7bc2 100644 (file)
@@ -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)
index 2656cef..a287e89 100644 (file)
@@ -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) {