Move post_url

move post_url function
This commit is contained in:
Adam Magness 2018-01-26 23:24:23 -05:00
parent 2f9642392d
commit a32ba32ff4
12 changed files with 19 additions and 21 deletions

View 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);

View 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);

View 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);

View 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,

View 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);

View 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>

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View 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);

View 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");

View 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();
}

View 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);
}
}

View 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)

View 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) {