mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-08 09:43:01 +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:
@@ -41,11 +41,7 @@ function validate_mail_address($user_id, $mail_address)
|
||||
return '';
|
||||
}
|
||||
|
||||
$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';
|
||||
|
||||
if ( !preg_match( $regex, $mail_address ) )
|
||||
if ( !email_check_format($mail_address) )
|
||||
{
|
||||
return l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)');
|
||||
}
|
||||
@@ -53,10 +49,10 @@ function validate_mail_address($user_id, $mail_address)
|
||||
if (defined("PHPWG_INSTALLED") and !empty($mail_address))
|
||||
{
|
||||
$query = '
|
||||
select count(*)
|
||||
from '.USERS_TABLE.'
|
||||
where upper('.$conf['user_fields']['email'].') = upper(\''.$mail_address.'\')
|
||||
'.(is_numeric($user_id) ? 'and '.$conf['user_fields']['id'].' != \''.$user_id.'\'' : '').'
|
||||
SELECT count(*)
|
||||
FROM '.USERS_TABLE.'
|
||||
WHERE upper('.$conf['user_fields']['email'].') = upper(\''.$mail_address.'\')
|
||||
'.(is_numeric($user_id) ? 'AND '.$conf['user_fields']['id'].' != \''.$user_id.'\'' : '').'
|
||||
;';
|
||||
list($count) = pwg_db_fetch_row(pwg_query($query));
|
||||
if ($count != 0)
|
||||
|
||||
Reference in New Issue
Block a user