29 |
29 |
##|-PRIV
|
30 |
30 |
|
31 |
31 |
function allowedhostnamescmp($a, $b) {
|
32 |
|
return strcmp($a['hostname'], $b['hostname']);
|
|
32 |
return strcmp(idn_to_utf8($a['hostname']), idn_to_utf8($b['hostname']));
|
33 |
33 |
}
|
34 |
34 |
|
35 |
35 |
function allowedhostnames_sort() {
|
... | ... | |
68 |
68 |
|
69 |
69 |
if (isset($id) && $a_allowedhostnames[$id]) {
|
70 |
70 |
$pconfig['zone'] = $a_allowedhostnames[$id]['zone'];
|
71 |
|
$pconfig['hostname'] = $a_allowedhostnames[$id]['hostname'];
|
|
71 |
$pconfig['hostname'] = idn_to_utf8($a_allowedhostnames[$id]['hostname']);
|
72 |
72 |
$pconfig['sn'] = $a_allowedhostnames[$id]['sn'];
|
73 |
73 |
$pconfig['dir'] = $a_allowedhostnames[$id]['dir'];
|
74 |
74 |
$pconfig['bw_up'] = $a_allowedhostnames[$id]['bw_up'];
|
... | ... | |
79 |
79 |
if ($_POST['save']) {
|
80 |
80 |
unset($input_errors);
|
81 |
81 |
$pconfig = $_POST;
|
|
82 |
$_POST['hostname'] = idn_to_ascii($_POST['hostname']);
|
82 |
83 |
|
83 |
84 |
/* input validation */
|
84 |
85 |
$reqdfields = explode(" ", "hostname");
|
... | ... | |
87 |
88 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
88 |
89 |
|
89 |
90 |
if (($_POST['hostname'] && !is_hostname($_POST['hostname']))) {
|
90 |
|
$input_errors[] = sprintf(gettext("A valid Hostname must be specified. [%s]"), $_POST['hostname']);
|
|
91 |
$input_errors[] = sprintf(gettext("A valid Hostname must be specified. [%s]"), idn_to_utf8($_POST['hostname']));
|
91 |
92 |
}
|
92 |
93 |
|
93 |
94 |
if ($_POST['bw_up'] && !is_numeric($_POST['bw_up'])) {
|
... | ... | |
103 |
104 |
}
|
104 |
105 |
|
105 |
106 |
if ($ipent['hostname'] == $_POST['hostname']) {
|
106 |
|
$input_errors[] = sprintf(gettext("Hostname [%s] already allowed."), $_POST['hostname']) ;
|
|
107 |
$input_errors[] = sprintf(gettext("Hostname [%s] already allowed."), idn_to_utf8($_POST['hostname'])) ;
|
107 |
108 |
break ;
|
108 |
109 |
}
|
109 |
110 |
}
|
Captive Portal IDN hostname support. Implements #10747