0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00

support unicode domain names - see #47

This commit is contained in:
David Goodwin 2017-06-02 12:54:29 +01:00
parent 3b481082c4
commit a09a3fa3b0
2 changed files with 16 additions and 0 deletions

View File

@ -199,6 +199,13 @@ function language_selector() {
* TODO: skip DNS check if the domain exists in PostfixAdmin?
*/
function check_domain ($domain) {
$orig = $domain;
if(function_exists('idn_to_ascii')) {
$domain = idn_to_ascii($domain, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);
}
if (!preg_match ('/^([-0-9A-Z]+\.)+' . '([-0-9A-Z]){2,13}$/i', ($domain))) {
return sprintf(Config::lang('pInvalidDomainRegex'), htmlentities($domain));
}

View File

@ -52,6 +52,7 @@ $f_session_start = function_exists ("session_start");
$f_preg_match = function_exists ("preg_match");
$f_mb_encode_mimeheader = function_exists ("mb_encode_mimeheader");
$f_imap_open = function_exists ("imap_open");
$f_intl_exists = function_exists('idn_to_ascii');
$file_config = file_exists (realpath ("./config.inc.php"));
@ -221,6 +222,7 @@ if ($f_sqlite_open == 1)
print "</li>";
}
//
// Database connection
//
@ -303,6 +305,13 @@ else
}
if($f_intl_exists == 1) {
print "<li>Optional: Unicode domain name support - OK</li>";
}
else {
// see inc.functions.php -> check_domain()
print "<li><b>Notice: php intl module - NOT FOUND</b><br/>Optional, to support unicode domain names, install php$phpversion-intl </li>";
}