2011-08-01 19:51:01 -04:00
|
|
|
<?php
|
2016-04-27 10:31:03 -04:00
|
|
|
/**
|
|
|
|
* @file include/network.php
|
|
|
|
*/
|
2017-04-30 00:07:00 -04:00
|
|
|
use Friendica\App;
|
2018-01-17 13:42:40 -05:00
|
|
|
use Friendica\Core\Addon;
|
2018-01-21 13:33:59 -05:00
|
|
|
use Friendica\Core\L10n;
|
2017-08-26 02:04:21 -04:00
|
|
|
use Friendica\Core\System;
|
2017-04-30 00:01:26 -04:00
|
|
|
use Friendica\Core\Config;
|
2017-05-07 14:44:30 -04:00
|
|
|
use Friendica\Network\Probe;
|
2017-12-07 08:56:11 -05:00
|
|
|
use Friendica\Object\Image;
|
2018-01-26 22:51:07 -05:00
|
|
|
use Friendica\Util\Network;
|
2017-11-10 07:45:33 -05:00
|
|
|
use Friendica\Util\XML;
|
2011-08-01 19:51:01 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function fetch_url($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = 0)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::fetchURL($url, $binary, $redirects, $timeout, $accept_content, $cookiejar);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2015-05-15 14:41:10 -04:00
|
|
|
|
2018-01-15 08:05:12 -05:00
|
|
|
function z_fetch_url($url, $binary = false, &$redirects = 0, $opts = [])
|
2017-11-10 00:00:50 -05:00
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::zFetchURL($url, $binary, $redirects, $opts);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2011-08-01 19:51:01 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function post_url($url, $params, $headers = null, &$redirects = 0, $timeout = 0)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::postURL($url, $params, $headers, $redirects, $timeout);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2011-08-01 19:51:01 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function xml_status($st, $message = '')
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
Network::xmlStatus($st, $message);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2011-08-01 19:51:01 -04:00
|
|
|
|
2018-01-15 08:05:12 -05:00
|
|
|
function http_status_exit($val, $description = [])
|
2017-11-10 00:00:50 -05:00
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
Network::httpStatusExit($val, $description);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2011-08-01 19:51:01 -04:00
|
|
|
|
2017-12-16 19:23:22 -05:00
|
|
|
function validate_url($url)
|
2017-11-10 00:00:50 -05:00
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::validateURL($url);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2011-08-01 19:51:01 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function validate_email($addr)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::validateEmail($addr);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2011-08-01 19:51:01 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function allowed_url($url)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::allowedURL($url);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2011-08-01 19:51:01 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function blocked_url($url)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::blockedURL($url);
|
2017-04-25 22:45:56 -04:00
|
|
|
}
|
|
|
|
|
2018-01-26 23:09:48 -05:00
|
|
|
function allowed_email($email)
|
2017-11-10 00:00:50 -05:00
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::allowedEmail($email);
|
2018-01-04 11:57:41 -05:00
|
|
|
}
|
2011-08-01 19:51:01 -04:00
|
|
|
|
2018-01-07 19:10:09 -05:00
|
|
|
function allowed_domain($domain, array $domain_list)
|
2018-01-04 11:57:41 -05:00
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::allowedDomain($domain, $domain_list);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2011-08-01 19:51:01 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function avatar_img($email)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::avatarImg($email);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2011-08-01 19:51:01 -04:00
|
|
|
|
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function parse_xml_string($s, $strict = true)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::parseXmlString($s, $strict);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2011-08-18 07:20:30 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function scale_external_images($srctext, $include_link = true, $scale_replace = false)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::scaleExternalImages($srctext, $include_link, $scale_replace);
|
2012-02-25 17:22:51 -05:00
|
|
|
}
|
2012-04-03 02:07:26 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function fix_contact_ssl_policy(&$contact, $new_policy)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
Network::fixContactSslPolicy($contact, $new_policy);
|
2012-04-03 02:07:26 -04:00
|
|
|
}
|
|
|
|
|
2017-02-17 22:35:46 -05:00
|
|
|
function strip_tracking_query_params($url)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::stripTrackingQueryParams($url);
|
2017-02-17 22:35:46 -05:00
|
|
|
}
|
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function original_url($url, $depth = 1, $fetchbody = false)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::originalURL($url, $depth, $fetchbody);
|
2014-04-04 04:55:30 -04:00
|
|
|
}
|
2014-05-03 06:07:34 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function short_link($url)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::shortLink($url);
|
2016-04-27 10:31:03 -04:00
|
|
|
}
|
2016-02-01 11:43:12 -05:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function json_return_and_die($x)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
Network::jsonReturnAndDie($x);
|
2016-02-01 11:43:12 -05:00
|
|
|
}
|
2016-07-04 02:05:30 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function matching_url($url1, $url2)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::matchingURL($url1, $url2);
|
2016-07-04 02:05:30 -04:00
|
|
|
}
|
2017-10-16 16:31:13 -04:00
|
|
|
|
2017-11-10 00:00:50 -05:00
|
|
|
function unParseUrl($parsed)
|
|
|
|
{
|
2018-01-26 22:51:07 -05:00
|
|
|
return Network::unParseURL($parsed);
|
2017-10-16 16:31:13 -04:00
|
|
|
}
|