use Friendica\Util\Network;
use Friendica\Util\XML;
-function validate_url($url)
-{
- return Network::validateURL($url);
-}
-
-function validate_email($addr)
-{
- return Network::validateEmail($addr);
-}
-
-function allowed_url($url)
-{
- return Network::allowedURL($url);
-}
-
-function blocked_url($url)
-{
- return Network::blockedURL($url);
-}
-
-function allowed_email($email)
-{
- return Network::allowedEmail($email);
-}
-
-function allowed_domain($domain, array $domain_list)
-{
- return Network::allowedDomain($domain, $domain_list);
-}
-
-function avatar_img($email)
-{
- return Network::avatarImg($email);
-}
-
-
function parse_xml_string($s, $strict = true)
{
return Network::parseXmlString($s, $strict);
intval($contact_record['id'])
);
} else {
- $url = validate_url($url);
+ $url = Network::validateURL($url);
if (!$url) {
notice(L10n::t('Invalid profile URL.') . EOL);
goaway(System::baseUrl() . '/' . $a->cmd);
return; // NOTREACHED
}
- if (!allowed_url($url)) {
+ if (!Network::allowedURL($url)) {
notice(L10n::t('Disallowed profile URL.') . EOL);
goaway(System::baseUrl() . '/' . $a->cmd);
return; // NOTREACHED
}
- if (blocked_url($url)) {
+ if (Network::blockedURL($url)) {
notice(L10n::t('Blocked domain') . EOL);
goaway(System::baseUrl() . '/' . $a->cmd);
return; // NOTREACHED
if (strpos($search,'@') === 0) {
$search = substr($search,1);
$header = L10n::t('People Search - %s', $search);
- if ((valid_email($search) && validate_email($search)) ||
+ if ((valid_email($search) && Network::validateEmail($search)) ||
(substr(normalise_link($search), 0, 7) == "http://")) {
$user_data = Probe::uri($search);
$discover_user = (in_array($user_data["network"], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA]));
use Friendica\Model\Group;
use Friendica\Model\User;
use Friendica\Protocol\Email;
+use Friendica\Util\Network;
function get_theme_config_file($theme)
{
// If openid has changed or if there's an openid but no openidserver, try and discover it.
if ($openid != $a->user['openid'] || (strlen($openid) && (!strlen($openidserver)))) {
- if (validate_url($openid)) {
+ if (Network::validateURL($openid)) {
logger('updating openidserver');
require_once 'library/openid.php';
$open_id_obj = new LightOpenID;
$allowed = explode(',', $str_allowed);
- return allowed_domain($domain, $allowed);
+ return Network::allowedDomain($domain, $allowed);
}
public static function getHTML($url, $title = null)
use Friendica\Protocol\OStatus;
use Friendica\Protocol\PortableContact;
use Friendica\Protocol\Salmon;
+use Friendica\Util\Network;
use dba;
require_once 'boot.php';
// remove ajax junk, e.g. Twitter
$url = str_replace('/#!/', '/', $url);
- if (!allowed_url($url)) {
+ if (!Network::allowedURL($url)) {
$result['message'] = L10n::t('Disallowed profile URL.');
return $result;
}
- if (blocked_url($url)) {
+ if (Network::blockedURL($url)) {
$result['message'] = L10n::t('Blocked domain');
return $result;
}
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Protocol\Diaspora;
+use Friendica\Util\Network;
use dba;
require_once 'include/dba.php';
public static function zrlInit(App $a)
{
$my_url = self::getMyURL();
- $my_url = validate_url($my_url);
+ $my_url = Network::validateURL($my_url);
if ($my_url) {
// Is it a DDoS attempt?
// The check fetches the cached value from gprobe to reduce the load for this system
if (!x($username) || !x($email) || !x($nickname)) {
if ($openid_url) {
- if (!validate_url($openid_url)) {
+ if (!Network::validateURL($openid_url)) {
throw new Exception(L10n::t('Invalid OpenID url'));
}
$_SESSION['register'] = 1;
throw new Exception(L10n::t('Please enter the required information.'));
}
- if (!validate_url($openid_url)) {
+ if (!Network::validateURL($openid_url)) {
$openid_url = '';
}
}
}
- if (!allowed_email($email)) {
+ if (!Network::allowedEmail($email)) {
throw new Exception(L10n::t('Your email domain is not among those allowed on this site.'));
}
- if (!valid_email($email) || !validate_email($email)) {
+ if (!valid_email($email) || !Network::validateEmail($email)) {
throw new Exception(L10n::t('Not a valid email address.'));
}
// if we have no OpenID photo try to look up an avatar
if (!strlen($photo)) {
- $photo = avatar_img($email);
+ $photo = Network::avatarImg($email);
}
// unless there is no avatar-addon loaded
use Friendica\Core\L10n;
use Friendica\Database\DBM;
use Friendica\Model\User;
+use Friendica\Util\Network;
use dba;
require_once 'boot.php';
$openid_url = trim($_POST['openid_url'] ? : $_POST['username']);
// if it's an email address or doesn't resolve to a URL, fail.
- if ($noid || strpos($openid_url, '@') || !validate_url($openid_url)) {
+ if ($noid || strpos($openid_url, '@') || !Network::validateURL($openid_url)) {
notice(L10n::t('Login failed.') . EOL);
goaway(self::getApp()->get_baseurl());
// NOTREACHED
*/
private static function mail($uri, $uid)
{
- if (!validate_email($uri)) {
+ if (!Network::validateEmail($uri)) {
return false;
}
$data["network"] = NETWORK_MAIL;
$data["name"] = substr($uri, 0, strpos($uri, '@'));
$data["nick"] = $data["name"];
- $data["photo"] = avatar_img($uri);
+ $data["photo"] = Network::avatarImg($uri);
$data["url"] = 'mailto:'.$uri;
$data["notify"] = 'smtp '.random_string();
$data["poll"] = 'email '.random_string();
$a = get_app();
- if (blocked_url($url)) {
+ if (self::blockedURL($url)) {
logger('z_fetch_url: domain of ' . $url . ' is blocked', LOGGER_DATA);
return $ret;
}
{
$stamp1 = microtime(true);
- if (blocked_url($url)) {
+ if (self::blockedURL($url)) {
logger('post_url: domain of ' . $url . ' is blocked', LOGGER_DATA);
return false;
}
$allowed = explode(',', $str_allowed);
- return allowed_domain($domain, $allowed);
+ return self::allowedDomain($domain, $allowed);
}
/**