Commit cc20b293 authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Fixes: #1859 Changed email validation system

Showing with 9 additions and 9 deletions
+9 -9
...@@ -271,18 +271,18 @@ class tests { ...@@ -271,18 +271,18 @@ class tests {
* *
* \param boolean $template FALSE * \param boolean $template FALSE
*/ */
public static function is_email($address, $template= FALSE) public static function is_email($address, $deprecated = FALSE)
{ {
if ($address == ""){ if ($address == "") {
return (TRUE); return TRUE;
} }
if ($template){ if (filter_var($address, FILTER_VALIDATE_EMAIL) !== FALSE) {
return preg_match ("/^[._a-z0-9%\+-]+@[_a-z0-9-]+(\.[a-z0-9-]+)(\.[a-z0-9-]+)*$/i", return TRUE;
$address); } elseif (filter_var($address.'.com', FILTER_VALIDATE_EMAIL) !== FALSE) {
} else { /* this is to allow addresses like example@localhost, which are refused by some PHP version */
return preg_match ("/^[._a-z0-9\+-]+@[_a-z0-9-]+(\.[a-z0-9i-]+)(\.[a-z0-9-]+)*$/i", return TRUE;
$address);
} }
return FALSE;
} }
......
  • bmortier @bmortier

    mentioned in issue #661 (closed)

    By agallavardin on 2017-09-02T14:54:38 (imported from GitLab)

    ·

    mentioned in issue #661 (closed)

    By agallavardin on 2017-09-02T14:54:38 (imported from GitLab)

    Toggle commit list
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment