Project

General

Profile

« Previous | Next » 

Revision 5e3ed2be

Added by Viktor Gurov about 5 years ago

Captive Portal IDN hostname support. Implements #10747

View differences:

src/usr/local/www/services_captiveportal_hostname.php
126 126
foreach ($a_cp[$cpzone]['allowedhostname'] as $ip): ?>
127 127
			<tr>
128 128
				<td>
129
					<?=$directionicons[$ip['dir']]?>&nbsp;<?=strtolower($ip['hostname'])?>
129
					<?=$directionicons[$ip['dir']]?>&nbsp;<?=strtolower(idn_to_utf8($ip['hostname']))?>
130 130
				</td>
131 131
				<td >
132 132
					<?=htmlspecialchars($ip['descr'])?>
src/usr/local/www/services_captiveportal_hostname_edit.php
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
	}

Also available in: Unified diff