Ignore:
Timestamp:
Sep 23, 2012, 11:34:30 AM (12 years ago)
Author:
mistic100
Message:

feature 2754: Add "Email" field for user comments + mandatory "Author"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r17748 r18164  
    17261726  }
    17271727}
     1728
     1729/**
     1730 * check email format
     1731 */
     1732function email_check_format($mail_address)
     1733{
     1734  if (version_compare(PHP_VERSION, '5.2.0') >= 0)
     1735  {
     1736    return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false;
     1737  }
     1738  else
     1739  {
     1740    $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase
     1741    $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name
     1742    $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i';
     1743
     1744    return (bool)preg_match($regex, $mail_address);
     1745  }
     1746}
    17281747?>
Note: See TracChangeset for help on using the changeset viewer.