aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_user.inc.php
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2012-09-23 09:34:30 +0000
committermistic100 <mistic@piwigo.org>2012-09-23 09:34:30 +0000
commit7e33b84e770ddab61ef1d5c67061cd41c189f20e (patch)
tree6ffa8d888072108bcf05d0901fa22434dacecdc6 /include/functions_user.inc.php
parentb6d2db8600871cd72094a0c3043865b75357ef9b (diff)
feature 2754: Add "Email" field for user comments + mandatory "Author"
git-svn-id: http://piwigo.org/svn/trunk@18164 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_user.inc.php')
-rw-r--r--include/functions_user.inc.php14
1 files changed, 5 insertions, 9 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index f0006a55e..e6bbe57f8 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -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)