mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-05 09:22:21 +02:00
feature 2754: Add "Email" field for user comments + mandatory "Author"
git-svn-id: http://piwigo.org/svn/trunk@18164 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -1725,4 +1725,23 @@ function url_check_format($url)
|
||||
return (bool)preg_match('@^https?://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@iS', $url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check email format
|
||||
*/
|
||||
function email_check_format($mail_address)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.2.0') >= 0)
|
||||
{
|
||||
return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$atom = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]'; // before arobase
|
||||
$domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name
|
||||
$regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i';
|
||||
|
||||
return (bool)preg_match($regex, $mail_address);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user