246 |
246 |
}
|
247 |
247 |
|
248 |
248 |
$pconfig['nbdd_server1'] = $a_server[$id]['nbdd_server1'];
|
249 |
|
if ($pconfig['nbdd_server1']) {
|
|
249 |
$pconfig['nbdd_server2'] = $a_server[$id]['nbdd_server2'];
|
|
250 |
|
|
251 |
if ($pconfig['nbdd_server1'] ||
|
|
252 |
$pconfig['nbdd_server2']) {
|
250 |
253 |
$pconfig['nbdd_server_enable'] = true;
|
251 |
254 |
}
|
252 |
255 |
|
... | ... | |
560 |
563 |
$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
|
561 |
564 |
}
|
562 |
565 |
}
|
|
566 |
|
563 |
567 |
if ($pconfig['nbdd_server_enable']) {
|
564 |
568 |
if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1']))) {
|
565 |
569 |
$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
|
566 |
570 |
}
|
|
571 |
if (!empty($pconfig['nbdd_server2']) && !is_ipaddr(trim($pconfig['nbdd_server2']))) {
|
|
572 |
$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #2' must contain a valid IP address");
|
567 |
573 |
}
|
|
574 |
}
|
568 |
575 |
|
569 |
576 |
if (!empty($pconfig['netbios_ntype']) &&
|
570 |
577 |
!array_key_exists($pconfig['netbios_ntype'], $netbios_nodetypes)) {
|
... | ... | |
819 |
826 |
}
|
820 |
827 |
|
821 |
828 |
$server['netbios_enable'] = $pconfig['netbios_enable'];
|
|
829 |
if ($pconfig['netbios_enable']) {
|
822 |
830 |
$server['netbios_ntype'] = $pconfig['netbios_ntype'];
|
823 |
831 |
$server['netbios_scope'] = $pconfig['netbios_scope'];
|
824 |
832 |
|
825 |
|
$server['create_gw'] = $pconfig['create_gw'];
|
826 |
|
$server['verbosity_level'] = $pconfig['verbosity_level'];
|
827 |
|
|
828 |
|
if ($pconfig['netbios_enable']) {
|
829 |
|
|
830 |
833 |
if ($pconfig['wins_server_enable']) {
|
831 |
834 |
$server['wins_server1'] = $pconfig['wins_server1'];
|
832 |
835 |
$server['wins_server2'] = $pconfig['wins_server2'];
|
833 |
836 |
}
|
834 |
837 |
|
835 |
|
if ($pconfig['dns_server_enable']) {
|
|
838 |
if ($pconfig['nbdd_server_enable']) {
|
836 |
839 |
$server['nbdd_server1'] = $pconfig['nbdd_server1'];
|
|
840 |
$server['nbdd_server2'] = $pconfig['nbdd_server2'];
|
837 |
841 |
}
|
838 |
842 |
}
|
839 |
843 |
|
|
844 |
$server['create_gw'] = $pconfig['create_gw'];
|
|
845 |
$server['verbosity_level'] = $pconfig['verbosity_level'];
|
|
846 |
|
840 |
847 |
if ($_POST['duplicate_cn'] == "yes") {
|
841 |
848 |
$server['duplicate_cn'] = true;
|
842 |
849 |
}
|
... | ... | |
1682 |
1689 |
|
1683 |
1690 |
$section->addInput(new Form_Checkbox(
|
1684 |
1691 |
'wins_server_enable',
|
1685 |
|
'WINS server enable',
|
|
1692 |
'WINS servers',
|
1686 |
1693 |
'Provide a WINS server list to clients',
|
1687 |
1694 |
$pconfig['wins_server_enable']
|
1688 |
1695 |
));
|
1689 |
1696 |
|
1690 |
|
$section->addInput(new Form_Input(
|
|
1697 |
$group = new Form_Group(null);
|
|
1698 |
|
|
1699 |
$group->add(new Form_Input(
|
1691 |
1700 |
'wins_server1',
|
1692 |
|
'WINS Server 1',
|
|
1701 |
null,
|
1693 |
1702 |
'text',
|
1694 |
1703 |
$pconfig['wins_server1']
|
1695 |
|
));
|
|
1704 |
))->setHelp('Server 1');
|
1696 |
1705 |
|
1697 |
|
$section->addInput(new Form_Input(
|
|
1706 |
$group->add(new Form_Input(
|
1698 |
1707 |
'wins_server2',
|
1699 |
|
'WINS Server 2',
|
|
1708 |
null,
|
1700 |
1709 |
'text',
|
1701 |
1710 |
$pconfig['wins_server2']
|
|
1711 |
))->setHelp('Server 2');
|
|
1712 |
|
|
1713 |
$group->addClass('winsservers');
|
|
1714 |
|
|
1715 |
$section->add($group);
|
|
1716 |
|
|
1717 |
$section->addInput(new Form_Checkbox(
|
|
1718 |
'nbdd_server_enable',
|
|
1719 |
'NBDD servers',
|
|
1720 |
'Provide a NetBIOS over TCP/IP Datagram Distribution Servers list to clients',
|
|
1721 |
$pconfig['nbdd_server_enable']
|
1702 |
1722 |
));
|
1703 |
1723 |
|
|
1724 |
$group = new Form_Group(null);
|
|
1725 |
|
|
1726 |
$group->add(new Form_Input(
|
|
1727 |
'nbdd_server1',
|
|
1728 |
null,
|
|
1729 |
'text',
|
|
1730 |
$pconfig['nbdd_server1']
|
|
1731 |
))->setHelp('Server 1');
|
|
1732 |
|
|
1733 |
$group->add(new Form_Input(
|
|
1734 |
'nbdd_server2',
|
|
1735 |
null,
|
|
1736 |
'text',
|
|
1737 |
$pconfig['nbdd_server2']
|
|
1738 |
))->setHelp('Server 2');
|
|
1739 |
|
|
1740 |
$group->addClass('nbddservers');
|
|
1741 |
|
|
1742 |
$section->add($group);
|
|
1743 |
|
1704 |
1744 |
$form->add($section);
|
1705 |
1745 |
|
1706 |
1746 |
$section = new Form_Section('Advanced Configuration');
|
... | ... | |
2151 |
2191 |
}
|
2152 |
2192 |
|
2153 |
2193 |
function wins_server_change() {
|
2154 |
|
var hide = ! $('#wins_server_enable').prop('checked')
|
|
2194 |
hideClass('winsservers', ! $('#wins_server_enable').prop('checked'));
|
|
2195 |
}
|
2155 |
2196 |
|
2156 |
|
hideInput('wins_server1', hide);
|
2157 |
|
hideInput('wins_server2', hide);
|
|
2197 |
function nbdd_server_change() {
|
|
2198 |
hideClass('nbddservers', ! $('#nbdd_server_enable').prop('checked'));
|
2158 |
2199 |
}
|
2159 |
2200 |
|
2160 |
|
|
2161 |
2201 |
function ntp_server_change() {
|
2162 |
2202 |
var hide = ! $('#ntp_server_enable').prop('checked')
|
2163 |
2203 |
|
... | ... | |
2166 |
2206 |
}
|
2167 |
2207 |
|
2168 |
2208 |
function netbios_change() {
|
2169 |
|
var hide = ! $('#netbios_enable').prop('checked')
|
2170 |
|
|
2171 |
|
hideInput('netbios_ntype', hide);
|
2172 |
|
hideInput('netbios_scope', hide);
|
2173 |
|
hideCheckbox('wins_server_enable', hide);
|
|
2209 |
if ($('#netbios_enable').prop('checked')) {
|
|
2210 |
hideInput('netbios_ntype', false);
|
|
2211 |
hideInput('netbios_scope', false);
|
|
2212 |
hideCheckbox('wins_server_enable', false);
|
2174 |
2213 |
wins_server_change();
|
|
2214 |
hideCheckbox('nbdd_server_enable', false);
|
|
2215 |
nbdd_server_change();
|
|
2216 |
} else {
|
|
2217 |
hideInput('netbios_ntype', true);
|
|
2218 |
hideInput('netbios_scope', true);
|
|
2219 |
hideCheckbox('wins_server_enable', true);
|
|
2220 |
hideClass('winsservers', true);
|
|
2221 |
hideCheckbox('nbdd_server_enable', true);
|
|
2222 |
hideClass('nbddservers', true);
|
2175 |
2223 |
}
|
|
2224 |
}
|
2176 |
2225 |
|
2177 |
2226 |
function tuntap_change() {
|
2178 |
2227 |
|
... | ... | |
2302 |
2351 |
wins_server_change();
|
2303 |
2352 |
});
|
2304 |
2353 |
|
|
2354 |
// NBDD server port
|
|
2355 |
$('#nbdd_server_enable').click(function () {
|
|
2356 |
nbdd_server_change();
|
|
2357 |
});
|
|
2358 |
|
2305 |
2359 |
// DNS server port
|
2306 |
2360 |
$('#dns_server_enable').click(function () {
|
2307 |
2361 |
dns_server_change();
|
... | ... | |
2438 |
2492 |
dns_domain_change();
|
2439 |
2493 |
dns_server_change();
|
2440 |
2494 |
wins_server_change();
|
|
2495 |
nbdd_server_change
|
2441 |
2496 |
ntp_server_change();
|
2442 |
2497 |
netbios_change();
|
2443 |
2498 |
tuntap_change();
|
2444 |
|
-- a/src/usr/local/www/vpn_openvpn_csc.php
|
|
2499 |
++ b/src/usr/local/www/vpn_openvpn_csc.php
|
... | ... | |
64 |
64 |
exit;
|
65 |
65 |
}
|
66 |
66 |
|
67 |
|
if (!$user_can_edit_advanced && !empty($a_csc[$id]['custom_options'])) {
|
|
67 |
if (!$user_can_edit_advanced && !empty_field($a_csc[$id]['custom_options'])) {
|
68 |
68 |
$input_errors[] = gettext("This user does not have sufficient privileges to delete an instance with Advanced options set.");
|
69 |
69 |
} else {
|
70 |
70 |
$wc_msg = sprintf(gettext('Deleted OpenVPN client specific override %1$s %2$s'), $a_csc[$id]['common_name'], $a_csc[$id]['description']);
|
... | ... | |
96 |
96 |
$pconfig['remove_route'] = $a_csc[$id]['remove_route'];
|
97 |
97 |
|
98 |
98 |
$pconfig['dns_domain'] = $a_csc[$id]['dns_domain'];
|
99 |
|
if ($pconfig['dns_domain']) {
|
|
99 |
if (!empty_field($pconfig['dns_domain'])) {
|
100 |
100 |
$pconfig['dns_domain_enable'] = true;
|
101 |
101 |
}
|
102 |
102 |
|
... | ... | |
105 |
105 |
$pconfig['dns_server3'] = $a_csc[$id]['dns_server3'];
|
106 |
106 |
$pconfig['dns_server4'] = $a_csc[$id]['dns_server4'];
|
107 |
107 |
|
108 |
|
if ($pconfig['dns_server1'] ||
|
109 |
|
$pconfig['dns_server2'] ||
|
110 |
|
$pconfig['dns_server3'] ||
|
111 |
|
$pconfig['dns_server4']) {
|
|
108 |
if (!empty_field($pconfig['dns_server1']) ||
|
|
109 |
!empty_field($pconfig['dns_server2']) ||
|
|
110 |
!empty_field($pconfig['dns_server3']) ||
|
|
111 |
!empty_field($pconfig['dns_server4'])) {
|
112 |
112 |
$pconfig['dns_server_enable'] = true;
|
113 |
113 |
}
|
114 |
114 |
|
115 |
115 |
$pconfig['ntp_server1'] = $a_csc[$id]['ntp_server1'];
|
116 |
116 |
$pconfig['ntp_server2'] = $a_csc[$id]['ntp_server2'];
|
117 |
117 |
|
118 |
|
if ($pconfig['ntp_server1'] ||
|
119 |
|
$pconfig['ntp_server2']) {
|
|
118 |
if (!empty_field($pconfig['ntp_server1']) ||
|
|
119 |
!empty_field($pconfig['ntp_server2'])) {
|
120 |
120 |
$pconfig['ntp_server_enable'] = true;
|
121 |
121 |
}
|
122 |
122 |
|
... | ... | |
127 |
127 |
$pconfig['wins_server1'] = $a_csc[$id]['wins_server1'];
|
128 |
128 |
$pconfig['wins_server2'] = $a_csc[$id]['wins_server2'];
|
129 |
129 |
|
130 |
|
if ($pconfig['wins_server1'] ||
|
131 |
|
$pconfig['wins_server2']) {
|
|
130 |
if (!empty_field($pconfig['wins_server1']) ||
|
|
131 |
!empty_field($pconfig['wins_server2'])) {
|
132 |
132 |
$pconfig['wins_server_enable'] = true;
|
133 |
133 |
}
|
134 |
134 |
|
135 |
135 |
$pconfig['nbdd_server1'] = $a_csc[$id]['nbdd_server1'];
|
136 |
|
if ($pconfig['nbdd_server1']) {
|
|
136 |
$pconfig['nbdd_server2'] = $a_csc[$id]['nbdd_server2'];
|
|
137 |
|
|
138 |
if (!empty_field($pconfig['nbdd_server1']) ||
|
|
139 |
!empty_field($pconfig['nbdd_server2'])) {
|
137 |
140 |
$pconfig['nbdd_server_enable'] = true;
|
138 |
141 |
}
|
139 |
142 |
}
|
... | ... | |
155 |
158 |
!$user_can_edit_advanced) {
|
156 |
159 |
$input_errors[] = gettext("This user does not have sufficient privileges to edit Advanced options on this instance.");
|
157 |
160 |
}
|
158 |
|
if (!$user_can_edit_advanced && !empty($a_csc[$id]['custom_options'])) {
|
|
161 |
if (!$user_can_edit_advanced && !empty_field($a_csc[$id]['custom_options'])) {
|
|
162 |
// restore custom options field to its original value
|
159 |
163 |
$pconfig['custom_options'] = $a_csc[$id]['custom_options'];
|
160 |
164 |
}
|
161 |
165 |
|
... | ... | |
171 |
175 |
}
|
172 |
176 |
}
|
173 |
177 |
|
174 |
|
if (!empty($pconfig['tunnel_network']) && !openvpn_validate_tunnel_network($pconfig['tunnel_network'], 'ipv4')) {
|
|
178 |
if (!empty_field($pconfig['tunnel_network']) && !openvpn_validate_tunnel_network($pconfig['tunnel_network'], 'ipv4')) {
|
175 |
179 |
$input_errors[] = gettext("The field 'IPv4 Tunnel Network' must contain a valid IPv4 subnet with CIDR mask or an alias with a single IPv4 subnet with CIDR mask.");
|
176 |
180 |
}
|
177 |
181 |
|
178 |
|
if (!empty($pconfig['tunnel_networkv6']) && !openvpn_validate_tunnel_network($pconfig['tunnel_networkv6'], 'ipv6')) {
|
|
182 |
if (!empty_field($pconfig['tunnel_networkv6']) && !openvpn_validate_tunnel_network($pconfig['tunnel_networkv6'], 'ipv6')) {
|
179 |
183 |
$input_errors[] = gettext("The field 'IPv6 Tunnel Network' must contain a valid IPv6 prefix or an alias with a single IPv6 prefix.");
|
180 |
184 |
}
|
181 |
185 |
|
... | ... | |
196 |
200 |
}
|
197 |
201 |
|
198 |
202 |
if ($pconfig['dns_server_enable']) {
|
199 |
|
if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1']))) {
|
|
203 |
if (!empty_field($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1']))) {
|
200 |
204 |
$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
|
201 |
205 |
}
|
202 |
|
if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2']))) {
|
|
206 |
if (!empty_field($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2']))) {
|
203 |
207 |
$input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address");
|
204 |
208 |
}
|
205 |
|
if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3']))) {
|
|
209 |
if (!empty_field($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3']))) {
|
206 |
210 |
$input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address");
|
207 |
211 |
}
|
208 |
|
if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4']))) {
|
|
212 |
if (!empty_field($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4']))) {
|
209 |
213 |
$input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address");
|
210 |
214 |
}
|
211 |
215 |
}
|
212 |
216 |
|
213 |
217 |
if ($pconfig['ntp_server_enable']) {
|
214 |
|
if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1']))) {
|
|
218 |
if (!empty_field($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1']))) {
|
215 |
219 |
$input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address");
|
216 |
220 |
}
|
217 |
|
if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2']))) {
|
|
221 |
if (!empty_field($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2']))) {
|
218 |
222 |
$input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address");
|
219 |
223 |
}
|
220 |
|
if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3']))) {
|
|
224 |
if (!empty_field($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3']))) {
|
221 |
225 |
$input_errors[] = gettext("The field 'NTP Server #3' must contain a valid IP address");
|
222 |
226 |
}
|
223 |
|
if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4']))) {
|
|
227 |
if (!empty_field($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4']))) {
|
224 |
228 |
$input_errors[] = gettext("The field 'NTP Server #4' must contain a valid IP address");
|
225 |
229 |
}
|
226 |
230 |
}
|
227 |
231 |
|
228 |
232 |
if ($pconfig['netbios_enable']) {
|
229 |
233 |
if ($pconfig['wins_server_enable']) {
|
230 |
|
if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1']))) {
|
|
234 |
if (!empty_field($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1']))) {
|
231 |
235 |
$input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address");
|
232 |
236 |
}
|
233 |
|
if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2']))) {
|
|
237 |
if (!empty_field($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2']))) {
|
234 |
238 |
$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
|
235 |
239 |
}
|
236 |
240 |
}
|
|
241 |
|
237 |
242 |
if ($pconfig['nbdd_server_enable']) {
|
238 |
|
if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1']))) {
|
|
243 |
if (!empty_field($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1']))) {
|
239 |
244 |
$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
|
240 |
245 |
}
|
|
246 |
if (!empty_field($pconfig['nbdd_server2']) && !is_ipaddr(trim($pconfig['nbdd_server2']))) {
|
|
247 |
$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #2' must contain a valid IP address");
|
241 |
248 |
}
|
|
249 |
}
|
242 |
250 |
|
243 |
251 |
if (!empty($pconfig['netbios_ntype']) &&
|
244 |
252 |
!array_key_exists($pconfig['netbios_ntype'], $netbios_nodetypes)) {
|
... | ... | |
294 |
302 |
}
|
295 |
303 |
|
296 |
304 |
$csc['netbios_enable'] = $pconfig['netbios_enable'];
|
|
305 |
|
|
306 |
if ($pconfig['netbios_enable']) {
|
297 |
307 |
$csc['netbios_ntype'] = $pconfig['netbios_ntype'];
|
298 |
308 |
$csc['netbios_scope'] = $pconfig['netbios_scope'];
|
299 |
309 |
|
300 |
|
if ($pconfig['netbios_enable']) {
|
301 |
310 |
if ($pconfig['wins_server_enable']) {
|
302 |
311 |
$csc['wins_server1'] = $pconfig['wins_server1'];
|
303 |
312 |
$csc['wins_server2'] = $pconfig['wins_server2'];
|
304 |
313 |
}
|
305 |
314 |
|
306 |
|
if ($pconfig['dns_server_enable']) {
|
|
315 |
if ($pconfig['nbdd_server_enable']) {
|
307 |
316 |
$csc['nbdd_server1'] = $pconfig['nbdd_server1'];
|
|
317 |
$csc['nbdd_server2'] = $pconfig['nbdd_server2'];
|
308 |
318 |
}
|
309 |
319 |
}
|
310 |
320 |
|
... | ... | |
323 |
333 |
$wc_msg = sprintf(gettext('Added OpenVPN client specific override %1$s %2$s'), $csc['common_name'], $csc['description']);
|
324 |
334 |
}
|
325 |
335 |
|
326 |
|
if (!empty($old_csc['common_name'])) {
|
|
336 |
if (!empty_field($old_csc['common_name'])) {
|
327 |
337 |
openvpn_delete_csc($old_csc);
|
328 |
338 |
}
|
329 |
339 |
openvpn_resync_csc($csc);
|
... | ... | |
499 |
509 |
'DNS Default Domain',
|
500 |
510 |
'Provide a default domain name to clients',
|
501 |
511 |
$pconfig['dns_domain_enable']
|
502 |
|
))->toggles('.dnsdomain');
|
|
512 |
));
|
503 |
513 |
|
504 |
514 |
$group = new Form_Group('DNS Domain');
|
505 |
515 |
$group->addClass('dnsdomain');
|
... | ... | |
519 |
529 |
'DNS Servers',
|
520 |
530 |
'Provide a DNS server list to clients',
|
521 |
531 |
$pconfig['dns_server_enable']
|
522 |
|
))->toggles('.dnsservers');
|
|
532 |
));
|
523 |
533 |
|
524 |
534 |
$group = new Form_Group(null);
|
525 |
535 |
$group->addClass('dnsservers');
|
... | ... | |
560 |
570 |
'NTP Servers',
|
561 |
571 |
'Provide an NTP server list to clients',
|
562 |
572 |
$pconfig['ntp_server_enable']
|
563 |
|
))->toggles('.ntpservers');
|
|
573 |
));
|
564 |
574 |
|
565 |
575 |
$group = new Form_Group(null);
|
566 |
576 |
$group->addClass('ntpservers');
|
... | ... | |
581 |
591 |
|
582 |
592 |
$section->add($group);
|
583 |
593 |
|
584 |
|
// NTP servers - For this section we need to use Javascript hiding since there
|
|
594 |
// Netbios - For this section we need to use Javascript hiding since there
|
585 |
595 |
// are nested toggles
|
586 |
596 |
$section->addInput(new Form_Checkbox(
|
587 |
597 |
'netbios_enable',
|
... | ... | |
633 |
643 |
|
634 |
644 |
$section->add($group);
|
635 |
645 |
|
|
646 |
$section->addInput(new Form_Checkbox(
|
|
647 |
'nbdd_server_enable',
|
|
648 |
'NBDD servers',
|
|
649 |
'Provide a NetBIOS over TCP/IP Datagram Distribution Servers list to clients',
|
|
650 |
$pconfig['nbdd_server_enable']
|
|
651 |
));
|
|
652 |
|
|
653 |
$group = new Form_Group(null);
|
|
654 |
|
|
655 |
$group->add(new Form_Input(
|
|
656 |
'nbdd_server1',
|
|
657 |
null,
|
|
658 |
'text',
|
|
659 |
$pconfig['nbdd_server1']
|
|
660 |
))->setHelp('Server 1');
|
|
661 |
|
|
662 |
$group->add(new Form_Input(
|
|
663 |
'nbdd_server2',
|
|
664 |
null,
|
|
665 |
'text',
|
|
666 |
$pconfig['nbdd_server2']
|
|
667 |
))->setHelp('Server 2');
|
|
668 |
|
|
669 |
$group->addClass('nbddservers');
|
|
670 |
|
|
671 |
$section->add($group);
|
|
672 |
|
636 |
673 |
$custops = new Form_Textarea(
|
637 |
674 |
'custom_options',
|
638 |
675 |
'Advanced',
|
... | ... | |
670 |
707 |
<script type="text/javascript">
|
671 |
708 |
//<![CDATA[
|
672 |
709 |
events.push(function() {
|
|
710 |
function dnsdomain_change() {
|
|
711 |
if ($('#dns_domain_enable').prop('checked')) {
|
|
712 |
hideClass('dnsdomain', false);
|
|
713 |
} else {
|
|
714 |
hideClass('dnsdomain', true);
|
|
715 |
}
|
|
716 |
}
|
673 |
717 |
|
674 |
|
// Hide/show that section, but have to also respect the wins_server_enable checkbox
|
|
718 |
function dnsservers_change() {
|
|
719 |
if ($('#dns_server_enable').prop('checked')) {
|
|
720 |
hideClass('dnsservers', false);
|
|
721 |
} else {
|
|
722 |
hideClass('dnsservers', true);
|
|
723 |
}
|
|
724 |
}
|
|
725 |
|
|
726 |
function ntpservers_change() {
|
|
727 |
if ($('#ntp_server_enable').prop('checked')) {
|
|
728 |
hideClass('ntpservers', false);
|
|
729 |
} else {
|
|
730 |
hideClass('ntpservers', true);
|
|
731 |
}
|
|
732 |
}
|
|
733 |
|
|
734 |
// Hide/show that section, but have to also respect the wins_server_enable and nbdd_server_enable checkboxes
|
675 |
735 |
function setNetbios() {
|
676 |
736 |
if ($('#netbios_enable').prop('checked')) {
|
677 |
737 |
hideInput('netbios_ntype', false);
|
678 |
738 |
hideInput('netbios_scope', false);
|
679 |
739 |
hideCheckbox('wins_server_enable', false);
|
680 |
740 |
setWins();
|
|
741 |
hideCheckbox('nbdd_server_enable', false);
|
|
742 |
setNbdds();
|
681 |
743 |
} else {
|
682 |
744 |
hideInput('netbios_ntype', true);
|
683 |
745 |
hideInput('netbios_scope', true);
|
684 |
746 |
hideCheckbox('wins_server_enable', true);
|
685 |
747 |
hideClass('winsservers', true);
|
|
748 |
hideCheckbox('nbdd_server_enable', true);
|
|
749 |
hideClass('nbddservers', true);
|
686 |
750 |
}
|
687 |
751 |
}
|
688 |
752 |
|
... | ... | |
690 |
754 |
hideClass('winsservers', ! $('#wins_server_enable').prop('checked'));
|
691 |
755 |
}
|
692 |
756 |
|
|
757 |
function setNbdds() {
|
|
758 |
hideClass('nbddservers', ! $('#nbdd_server_enable').prop('checked'));
|
|
759 |
}
|
|
760 |
|
693 |
761 |
// ---------- Click checkbox handlers ---------------------------------------------------------
|
694 |
762 |
|
|
763 |
// On clicking DNS Default Domain
|
|
764 |
$('#dns_domain_enable').click(function () {
|
|
765 |
dnsdomain_change();
|
|
766 |
});
|
|
767 |
|
|
768 |
// On clicking DNS Servers
|
|
769 |
$('#dns_server_enable').click(function () {
|
|
770 |
dnsservers_change();
|
|
771 |
});
|
|
772 |
|
|
773 |
// On clicking NTP Servers
|
|
774 |
$('#ntp_server_enable').click(function () {
|
|
775 |
ntpservers_change();
|
|
776 |
});
|
|
777 |
|
695 |
778 |
// On clicking the netbios_enable checkbox
|
696 |
779 |
$('#netbios_enable').click(function () {
|
697 |
780 |
setNetbios();
|
... | ... | |
702 |
785 |
setWins();
|
703 |
786 |
});
|
704 |
787 |
|
|
788 |
// On clicking the nbdd_server_enable checkbox
|
|
789 |
$('#nbdd_server_enable').click(function () {
|
|
790 |
setNbdds();
|
|
791 |
});
|
|
792 |
|
705 |
793 |
// ---------- On initial page load ------------------------------------------------------------
|
706 |
794 |
|
707 |
795 |
setNetbios();
|
|
796 |
dnsdomain_change();
|
|
797 |
dnsservers_change();
|
|
798 |
ntpservers_change();
|
|
799 |
|
708 |
800 |
});
|
709 |
801 |
//]]>
|
710 |
802 |
</script>
|
711 |
|
-- a/src/etc/inc/openvpn.inc
|
|
803 |
++ b/src/etc/inc/openvpn.inc
|
... | ... | |
197 |
197 |
$openvpn_exit_notify_client[$i] = sprintf(gettext("Retry %dx"), $i);
|
198 |
198 |
}
|
199 |
199 |
|
|
200 |
// check if submitted form field is not empty
|
|
201 |
function empty_field($str) {
|
|
202 |
$has_text = !is_bool($str) && strlen($str) > 0;
|
|
203 |
return !$has_text;
|
|
204 |
}
|
|
205 |
|
200 |
206 |
function openvpn_build_mode_list() {
|
201 |
207 |
global $openvpn_server_modes;
|
202 |
208 |
|
... | ... | |
772 |
778 |
|
773 |
779 |
if ($settings['netbios_enable']) {
|
774 |
780 |
|
775 |
|
if (!empty($settings['dhcp_nbttype']) && ($settings['dhcp_nbttype'] != 0)) {
|
776 |
|
$conf .= "push \"dhcp-option NBT {$settings['dhcp_nbttype']}\"\n";
|
|
781 |
if (!empty($settings['netbios_ntype']) && ($settings['netbios_ntype'] != 0)) {
|
|
782 |
$conf .= "push \"dhcp-option NBT {$settings['netbios_ntype']}\"\n";
|
777 |
783 |
}
|
778 |
|
if (!empty($settings['dhcp_nbtscope'])) {
|
779 |
|
$conf .= "push \"dhcp-option NBS {$settings['dhcp_nbtscope']}\"\n";
|
|
784 |
if (!empty($settings['netbios_scope'])) {
|
|
785 |
$conf .= "push \"dhcp-option NBS {$settings['netbios_scope']}\"\n";
|
780 |
786 |
}
|
781 |
787 |
|
782 |
788 |
if (!empty($settings['wins_server1'])) {
|
... | ... | |
788 |
794 |
|
789 |
795 |
if (!empty($settings['nbdd_server1'])) {
|
790 |
796 |
$conf .= "push \"dhcp-option NBDD {$settings['nbdd_server1']}\"\n";
|
|
797 |
}
|
|
798 |
if (!empty($settings['nbdd_server2'])) {
|
|
799 |
$conf .= "push \"dhcp-option NBDD {$settings['nbdd_server2']}\"\n";
|
791 |
800 |
}
|
792 |
801 |
}
|
793 |
802 |
|