summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2019-11-03 11:43:13 +0100
committermsquare <msquare@notrademark.de>2019-11-03 11:43:13 +0100
commitdc3de33a4b03cbbb17acb565ba6826ac42f2d189 (patch)
tree3298ae32182568685ecb78c8800d94548afcaebc
parenta514ba3adc76cb37ab6211640967aa164d56a9c5 (diff)
fix #287: handle IDN email addresses
-rw-r--r--includes/sys_page.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/includes/sys_page.php b/includes/sys_page.php
index e94a92cc..c7b3ec74 100644
--- a/includes/sys_page.php
+++ b/includes/sys_page.php
@@ -220,12 +220,18 @@ function strip_item($item)
}
/**
- * Überprüft eine E-Mail-Adresse.
+ * Validates an email address with support for IDN domain names.
*
* @param string $email
* @return bool
*/
function check_email($email)
{
+ // Convert the domain part from idn to ascii
+ if(substr_count($email, '@') == 1) {
+ list($name, $domain) = explode('@', $email);
+ $domain = idn_to_ascii($domain, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46);
+ $email = $name . '@' . $domain;
+ }
return (bool)filter_var($email, FILTER_VALIDATE_EMAIL);
}