1
1
Fork 0

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

@ -35,6 +35,7 @@ use Friendica\Network\HTTPException\UnauthorizedException;
use Friendica\Network\HTTPException\TooManyRequestsException;
use Friendica\Object\Image;
use Friendica\Protocol\Diaspora;
use Friendica\Util\Network;
use Friendica\Util\XML;
require_once 'include/bbcode.php';
@ -5073,7 +5074,7 @@ function api_get_nick($profile)
if ($StatusnetHost != $profile) {
$StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile);
if ($StatusnetUser != $profile) {
$UserData = fetch_url("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
$UserData = Network::fetchURL("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
$user = json_decode($UserData);
if ($user) {
$nick = $user->screen_name;

View file

@ -13,6 +13,7 @@ use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Model\Contact;
use Friendica\Util\Map;
use Friendica\Util\Network;
require_once 'include/event.php';
require_once 'mod/proxy.php';
@ -688,7 +689,7 @@ function GetProfileUsername($profile, $username, $compact = false, $getnetwork =
$StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile);
if ($StatusnetUser != $profile) {
/// @TODO Some hosts run on https, not just http and sometimes http is disabled, let's support both here
$UserData = fetch_url("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
$UserData = Network::fetchURL("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
$user = json_decode($UserData);
if ($user) {
if ($getnetwork) {
@ -749,7 +750,7 @@ function bb_RemovePictureLinks($match) {
// if its not a picture then look if its a page that contains a picture link
require_once("include/network.php");
$body = fetch_url($match[1]);
$body = Network::fetchURL($match[1]);
$doc = new DOMDocument();
@$doc->loadHTML($body);
@ -806,7 +807,7 @@ function bb_CleanPictureLinksSub($match) {
// if its not a picture then look if its a page that contains a picture link
require_once("include/network.php");
$body = fetch_url($match[1]);
$body = Network::fetchURL($match[1]);
$doc = new DOMDocument();
@$doc->loadHTML($body);

View file

@ -57,7 +57,7 @@ function blocked_url($url)
return Network::blockedURL($url);
}
function allowedEmail($email)
function allowed_email($email)
{
return Network::allowedEmail($email);
}