Move multiple functions

move multiple smaller functions
This commit is contained in:
Adam Magness 2018-01-26 23:51:41 -05:00
parent cd3643d174
commit 1eb7c19c1e
11 changed files with 24 additions and 56 deletions

View file

@ -20,6 +20,7 @@ use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
use Friendica\Protocol\PortableContact;
use Friendica\Protocol\Salmon;
use Friendica\Util\Network;
use dba;
require_once 'boot.php';
@ -1131,12 +1132,12 @@ class Contact extends BaseObject
// 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;
}

View file

@ -17,6 +17,7 @@ use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Protocol\Diaspora;
use Friendica\Util\Network;
use dba;
require_once 'include/dba.php';
@ -963,7 +964,7 @@ class Profile
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

View file

@ -282,7 +282,7 @@ class User
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;
@ -305,7 +305,7 @@ class User
throw new Exception(L10n::t('Please enter the required information.'));
}
if (!validate_url($openid_url)) {
if (!Network::validateURL($openid_url)) {
$openid_url = '';
}
@ -330,11 +330,11 @@ class User
}
}
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.'));
}
@ -461,7 +461,7 @@ class User
// 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