Move fetch_url

move fetch_url function
This commit is contained in:
Adam Magness 2018-01-26 23:09:48 -05:00
commit c67452f72e
25 changed files with 55 additions and 35 deletions

View file

@ -11,6 +11,7 @@ use Friendica\Database\DBM;
use Friendica\Module\Login;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
use Friendica\Util\Network;
require_once 'include/items.php';
@ -98,7 +99,7 @@ function dfrn_poll_init(App $a)
);
if (DBM::is_result($r)) {
$s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
$s = Network::fetchURL($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
logger("dfrn_poll: old profile returns " . $s, LOGGER_DATA);
@ -481,7 +482,7 @@ function dfrn_poll_content(App $a)
if (($type === 'profile') && (strlen($sec))) {
// URL reply
if ($dfrn_version < 2.2) {
$s = fetch_url($r[0]['poll']
$s = Network::fetchURL($r[0]['poll']
. '?dfrn_id=' . $encrypted_id
. '&type=profile-check'
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION

View file

@ -23,6 +23,7 @@ use Friendica\Model\User;
use Friendica\Model\Profile;
use Friendica\Module\Login;
use Friendica\Network\Probe;
use Friendica\Util\Network;
require_once 'include/enotify.php';
@ -182,7 +183,7 @@ function dfrn_request_post(App $a)
}
if (strlen($dfrn_request) && strlen($confirm_key)) {
$s = fetch_url($dfrn_request . '?confirm_key=' . $confirm_key);
$s = Network::fetchURL($dfrn_request . '?confirm_key=' . $confirm_key);
}
// (ignore reply, nothing we can do it failed)

View file

@ -14,6 +14,7 @@ use Friendica\Model\GContact;
use Friendica\Model\Profile;
use Friendica\Network\Probe;
use Friendica\Protocol\PortableContact;
use Friendica\Util\Network;
require_once 'mod/contacts.php';
@ -177,7 +178,7 @@ function dirfind_content(App $a, $prefix = "") {
$p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
if(strlen(Config::get('system','directory')))
$x = fetch_url(get_server().'/lsearch?f=' . $p . '&search=' . urlencode($search));
$x = Network::fetchURL(get_server().'/lsearch?f=' . $p . '&search=' . urlencode($search));
$j = json_decode($x);
}

View file

@ -8,6 +8,7 @@ use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Database\DBStructure;
use Friendica\Object\Image;
use Friendica\Util\Network;
$install_wizard_pass = 1;
@ -482,10 +483,10 @@ function check_htaccess(&$checks) {
$status = true;
$help = "";
if (function_exists('curl_init')) {
$test = fetch_url(System::baseUrl()."/install/testrewrite");
$test = Network::fetchURL(System::baseUrl()."/install/testrewrite");
if ($test != "ok") {
$test = fetch_url(normalise_link(System::baseUrl()."/install/testrewrite"));
$test = Network::fetchURL(normalise_link(System::baseUrl()."/install/testrewrite"));
}
if ($test != "ok") {

View file

@ -9,6 +9,7 @@ use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Util\Network;
function nodeinfo_wellknown(App $a) {
$nodeinfo = ['links' => [['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
@ -246,7 +247,7 @@ function nodeinfo_cron() {
// Now trying to register
$url = 'http://the-federation.info/register/'.$a->get_hostname();
logger('registering url: '.$url, LOGGER_DEBUG);
$ret = fetch_url($url);
$ret = Network::fetchURL($url);
logger('registering answer: '.$ret, LOGGER_DEBUG);
logger('cron_end');

View file

@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Module\Login;
use Friendica\Util\Network;
function oexchange_init(App $a) {
@ -39,7 +40,7 @@ function oexchange_content(App $a) {
$tags = (((x($_REQUEST,'tags')) && strlen($_REQUEST['tags']))
? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : '');
$s = fetch_url(System::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
$s = Network::fetchURL(System::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
if (! strlen($s)) {
return;

View file

@ -10,6 +10,7 @@ use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Photo;
use Friendica\Object\Image;
use Friendica\Util\Network;
define('PROXY_DEFAULT_TIME', 86400); // 1 Day
@ -161,7 +162,7 @@ function proxy_init(App $a) {
// It shouldn't happen but it does - spaces in URL
$_REQUEST['url'] = str_replace(' ', '+', $_REQUEST['url']);
$redirects = 0;
$img_str = fetch_url($_REQUEST['url'], true, $redirects, 10);
$img_str = Network::fetchURL($_REQUEST['url'], true, $redirects, 10);
$tempfile = tempnam(get_temppath(), 'cache');
file_put_contents($tempfile, $img_str);

View file

@ -3,6 +3,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Database\DBM;
use Friendica\Util\Network;
function post_var($name) {
return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
@ -109,7 +110,7 @@ function pubsubhubbub_init(App $a) {
// we don't actually enforce the lease time because GNU
// Social/StatusNet doesn't honour it (yet)
$body = fetch_url($hub_callback . "?" . $params);
$body = Network::fetchURL($hub_callback . "?" . $params);
$ret = $a->get_curl_code();
// give up if the HTTP return code wasn't a success (2xx)