mirror of
https://github.com/friendica/friendica
synced 2024-12-22 22:40:16 +00:00
Update and Remove isValidEmail
change function calls, and remove unneeded function.
This commit is contained in:
parent
11cec3229c
commit
e4354a0d7b
5 changed files with 4 additions and 16 deletions
|
@ -53,7 +53,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
if (strpos($search,'@') === 0) {
|
||||
$search = substr($search,1);
|
||||
$header = L10n::t('People Search - %s', $search);
|
||||
if ((Strings::isValidEmail($search) && Network::isEmailDomainValid($search)) ||
|
||||
if ((filter_var($search, FILTER_VALIDATE_EMAIL) && Network::isEmailDomainValid($search)) ||
|
||||
(substr(Strings::normaliseLink($search), 0, 7) == "http://")) {
|
||||
$user_data = Probe::uri($search);
|
||||
$discover_user = (in_array($user_data["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA]));
|
||||
|
|
|
@ -56,7 +56,7 @@ function invite_post(App $a)
|
|||
foreach ($recipients as $recipient) {
|
||||
$recipient = trim($recipient);
|
||||
|
||||
if (! Strings::isValidEmail($recipient)) {
|
||||
if (!filter_var($recipient, FILTER_VALIDATE_EMAIL)) {
|
||||
notice(L10n::t('%s : Not a valid email address.', $recipient) . EOL);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -517,7 +517,7 @@ function settings_post(App $a)
|
|||
$email = $a->user['email'];
|
||||
}
|
||||
// check the email is valid
|
||||
if (!Strings::isValidEmail($email)) {
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
$err .= L10n::t('Invalid email.');
|
||||
}
|
||||
// ensure new email is not the admin mail
|
||||
|
|
|
@ -499,7 +499,7 @@ class User
|
|||
throw new Exception(L10n::t('Your email domain is not among those allowed on this site.'));
|
||||
}
|
||||
|
||||
if (!Strings::isValidEmail($email) || !Network::isEmailDomainValid($email)) {
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL) || !Network::isEmailDomainValid($email)) {
|
||||
throw new Exception(L10n::t('Not a valid email address.'));
|
||||
}
|
||||
if (self::isNicknameBlocked($nickname)) {
|
||||
|
|
|
@ -353,18 +353,6 @@ class Strings
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check for a valid email string
|
||||
*
|
||||
* @param string $email_address Email address to be evaluated.
|
||||
*
|
||||
* @return boolean Value indicating whether or not the string is a valid email address.
|
||||
*/
|
||||
public static function isValidEmail($email_address)
|
||||
{
|
||||
return preg_match('/^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9\-\+]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/', $email_address);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Normalize url
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue