change function calls, and remove unneeded function.
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]));
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;
}
$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
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)) {
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
*