Project

General

Profile

Download (17 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
<?php
2
/*
3
	services_dnsmasq.php
4
*/
5 191cb31d Stephen Beaver
/* ====================================================================
6
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7 cb41dd63 Renato Botelho
 *	Copyright (c)  2003-2004 Bob Zoller <bob@kludgebox.com> and Manuel Kasper <mk@neon1.net
8 191cb31d Stephen Beaver
 *
9 cb41dd63 Renato Botelho
 *	Some or all of this file is based on the m0n0wall project which is
10
 *	Copyright (c)  2004 Manuel Kasper (BSD 2 clause)
11 191cb31d Stephen Beaver
 *
12
 *	Redistribution and use in source and binary forms, with or without modification,
13
 *	are permitted provided that the following conditions are met:
14
 *
15
 *	1. Redistributions of source code must retain the above copyright notice,
16
 *		this list of conditions and the following disclaimer.
17
 *
18
 *	2. Redistributions in binary form must reproduce the above copyright
19
 *		notice, this list of conditions and the following disclaimer in
20
 *		the documentation and/or other materials provided with the
21
 *		distribution.
22
 *
23
 *	3. All advertising materials mentioning features or use of this software
24
 *		must display the following acknowledgment:
25
 *		"This product includes software developed by the pfSense Project
26
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
27
 *
28
 *	4. The names "pfSense" and "pfSense Project" must not be used to
29
 *		 endorse or promote products derived from this software without
30
 *		 prior written permission. For written permission, please contact
31
 *		 coreteam@pfsense.org.
32
 *
33
 *	5. Products derived from this software may not be called "pfSense"
34
 *		nor may "pfSense" appear in their names without prior written
35
 *		permission of the Electric Sheep Fencing, LLC.
36
 *
37
 *	6. Redistributions of any form whatsoever must retain the following
38
 *		acknowledgment:
39
 *
40
 *	"This product includes software developed by the pfSense Project
41
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
42
 *
43
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
44
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
46
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
47
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
49
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
50
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
52
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
54
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
55
 *
56
 *	====================================================================
57
 *
58
 */
59 70edf50d jim-p
/*
60 e6363160 sbeaver
	pfSense_MODULE: dnsforwarder
61 1d333258 Scott Ullrich
*/
62 5b237745 Scott Ullrich
63 6b07c15a Matthew Grooms
##|+PRIV
64
##|*IDENT=page-services-dnsforwarder
65 5230f468 jim-p
##|*NAME=Services: DNS Forwarder
66 6b07c15a Matthew Grooms
##|*DESCR=Allow access to the 'Services: DNS Forwarder' page.
67
##|*MATCH=services_dnsmasq.php*
68
##|-PRIV
69
70 5b237745 Scott Ullrich
require("guiconfig.inc");
71 7a927e67 Scott Ullrich
require_once("functions.inc");
72
require_once("filter.inc");
73
require_once("shaper.inc");
74 4dbcf2fb Renato Botelho
require_once("system.inc");
75 5b237745 Scott Ullrich
76 70edf50d jim-p
$pconfig['enable'] = isset($config['dnsmasq']['enable']);
77 5b237745 Scott Ullrich
$pconfig['regdhcp'] = isset($config['dnsmasq']['regdhcp']);
78 6a01ea44 Bill Marquette
$pconfig['regdhcpstatic'] = isset($config['dnsmasq']['regdhcpstatic']);
79 aa994814 Andrew Thompson
$pconfig['dhcpfirst'] = isset($config['dnsmasq']['dhcpfirst']);
80 96ea7162 N0YB
$pconfig['strict_order'] = isset($config['dnsmasq']['strict_order']);
81
$pconfig['domain_needed'] = isset($config['dnsmasq']['domain_needed']);
82 7bdd28fb Phil Davis
$pconfig['no_private_reverse'] = isset($config['dnsmasq']['no_private_reverse']);
83 e6c49e3d jim-p
$pconfig['port'] = $config['dnsmasq']['port'];
84 8f9bffbc Andrew Thompson
$pconfig['custom_options'] = $config['dnsmasq']['custom_options'];
85 5b237745 Scott Ullrich
86 b4323f39 jim-p
$pconfig['strictbind'] = isset($config['dnsmasq']['strictbind']);
87 966ed611 Phil Davis
if (!empty($config['dnsmasq']['interface'])) {
88 79d03c40 jim-p
	$pconfig['interface'] = explode(",", $config['dnsmasq']['interface']);
89 966ed611 Phil Davis
} else {
90 79d03c40 jim-p
	$pconfig['interface'] = array();
91 966ed611 Phil Davis
}
92 b4323f39 jim-p
93 966ed611 Phil Davis
if (!is_array($config['dnsmasq']['hosts'])) {
94 5b237745 Scott Ullrich
	$config['dnsmasq']['hosts'] = array();
95 966ed611 Phil Davis
}
96 0c2b5df7 Scott Ullrich
97 966ed611 Phil Davis
if (!is_array($config['dnsmasq']['domainoverrides'])) {
98 70edf50d jim-p
	$config['dnsmasq']['domainoverrides'] = array();
99 966ed611 Phil Davis
}
100 0c2b5df7 Scott Ullrich
101 70edf50d jim-p
$a_hosts = &$config['dnsmasq']['hosts'];
102 0c2b5df7 Scott Ullrich
$a_domainOverrides = &$config['dnsmasq']['domainoverrides'];
103 5b237745 Scott Ullrich
104
if ($_POST) {
105 98d39683 jim-p
	if ($_POST['apply']) {
106
		$retval = 0;
107
		$retval = services_dnsmasq_configure();
108
		$savemsg = get_std_save_message($retval);
109
110
		// Reload filter (we might need to sync to CARP hosts)
111
		filter_configure();
112
		/* Update resolv.conf in case the interface bindings exclude localhost. */
113
		system_resolvconf_generate();
114
		/* Start or restart dhcpleases when it's necessary */
115
		system_dhcpleases_configure();
116
117
		if ($retval == 0) {
118
			clear_subsystem_dirty('hosts');
119
		}
120 33ed4d60 Stephen Beaver
	} else {
121
		$pconfig = $_POST;
122
		unset($input_errors);
123
	
124
		$config['dnsmasq']['enable'] = ($_POST['enable']) ? true : false;
125
		$config['dnsmasq']['regdhcp'] = ($_POST['regdhcp']) ? true : false;
126
		$config['dnsmasq']['regdhcpstatic'] = ($_POST['regdhcpstatic']) ? true : false;
127
		$config['dnsmasq']['dhcpfirst'] = ($_POST['dhcpfirst']) ? true : false;
128
		$config['dnsmasq']['strict_order'] = ($_POST['strict_order']) ? true : false;
129
		$config['dnsmasq']['domain_needed'] = ($_POST['domain_needed']) ? true : false;
130
		$config['dnsmasq']['no_private_reverse'] = ($_POST['no_private_reverse']) ? true : false;
131
		$config['dnsmasq']['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']);
132
		$config['dnsmasq']['strictbind'] = ($_POST['strictbind']) ? true : false;
133
	
134
		if (isset($_POST['enable']) && isset($config['unbound']['enable'])) {
135
			if ($_POST['port'] == $config['unbound']['port']) {
136
				$input_errors[] = "The DNS Resolver is enabled using this port. Choose a non-conflicting port, or disable DNS Resolver.";
137
			}
138 966ed611 Phil Davis
		}
139 33ed4d60 Stephen Beaver
	
140
		if ($_POST['port']) {
141
			if (is_port($_POST['port'])) {
142
				$config['dnsmasq']['port'] = $_POST['port'];
143
			} else {
144
				$input_errors[] = gettext("You must specify a valid port number");
145
			}
146
		} else if (isset($config['dnsmasq']['port'])) {
147
			unset($config['dnsmasq']['port']);
148 966ed611 Phil Davis
		}
149 33ed4d60 Stephen Beaver
	
150
		if (is_array($_POST['interface'])) {
151
			$config['dnsmasq']['interface'] = implode(",", $_POST['interface']);
152
		} elseif (isset($config['dnsmasq']['interface'])) {
153
			unset($config['dnsmasq']['interface']);
154 966ed611 Phil Davis
		}
155 33ed4d60 Stephen Beaver
	
156
		if ($config['dnsmasq']['custom_options']) {
157
			$args = '';
158
			foreach (preg_split('/\s+/', $config['dnsmasq']['custom_options']) as $c) {
159
				$args .= escapeshellarg("--{$c}") . " ";
160
			}
161
			exec("/usr/local/sbin/dnsmasq --test $args", $output, $rc);
162
			if ($rc != 0) {
163
				$input_errors[] = gettext("Invalid custom options");
164
			}
165 c85b1242 Stephen Beaver
		}
166 33ed4d60 Stephen Beaver
	
167
		if (!$input_errors) {
168
			write_config();
169 98d39683 jim-p
			mark_subsystem_dirty('hosts');
170 966ed611 Phil Davis
		}
171 8f9bffbc Andrew Thompson
	}
172 5b237745 Scott Ullrich
}
173
174
if ($_GET['act'] == "del") {
175 70edf50d jim-p
	if ($_GET['type'] == 'host') {
176
		if ($a_hosts[$_GET['id']]) {
177
			unset($a_hosts[$_GET['id']]);
178
			write_config();
179 a368a026 Ermal Lu?i
			mark_subsystem_dirty('hosts');
180 70edf50d jim-p
			header("Location: services_dnsmasq.php");
181
			exit;
182
		}
183
	}
184
	elseif ($_GET['type'] == 'doverride') {
185
		if ($a_domainOverrides[$_GET['id']]) {
186
			unset($a_domainOverrides[$_GET['id']]);
187
			write_config();
188 a368a026 Ermal Lu?i
			mark_subsystem_dirty('hosts');
189 70edf50d jim-p
			header("Location: services_dnsmasq.php");
190
			exit;
191
		}
192
	}
193 5b237745 Scott Ullrich
}
194 0c2b5df7 Scott Ullrich
195 e6363160 sbeaver
function build_if_list() {
196
	$interface_addresses = get_possible_listen_ips(true);
197
	$iflist = array('options' => array(), 'selected' => array());
198
199
	$iflist['options'][""]	= "All";
200
	if (empty($pconfig['interface']) || empty($pconfig['interface'][0]))
201
		array_push($iflist['selected'], "");
202
203
	foreach ($interface_addresses as $laddr => $ldescr) {
204
		$iflist['options'][$laddr] = htmlspecialchars($ldescr);
205
206
		if ($pconfig['interface'] && in_array($laddr, $pconfig['interface']))
207
			array_push($iflist['selected'], $laddr);
208
	}
209
210
	unset($interface_addresses);
211
212
	return($iflist);
213
}
214
215 7bd5b320 Colin Fleming
$closehead = false;
216 9f5aa90f Phil Davis
$pgtitle = array(gettext("Services"), gettext("DNS Forwarder"));
217 db88a3a2 Phil Davis
$shortcut_section = "forwarder";
218 b63695db Scott Ullrich
include("head.inc");
219 0c2b5df7 Scott Ullrich
220 e6363160 sbeaver
if ($input_errors)
221
	print_input_errors($input_errors);
222 5b237745 Scott Ullrich
223 e6363160 sbeaver
if ($savemsg)
224
	print_info_box($savemsg, 'success');
225
226
if (is_subsystem_dirty('hosts'))
227
	print_info_box_np(gettext("The DNS forwarder configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
228
229 fae9a73c sbeaver
$form = new Form();
230 e6363160 sbeaver
231
$section = new Form_Section('General DNS Forwarder Options');
232
233
$section->addInput(new Form_Checkbox(
234
	'enable',
235
	'Enable',
236
	'Enable DNS forwarder',
237
	$pconfig['enable']
238 08d1762e Sjon Hortensius
))->toggles('.toggle-dhcp', 'disable');
239 e6363160 sbeaver
240
$section->addInput(new Form_Checkbox(
241
	'regdhcp',
242
	'DHCP Registration',
243
	'Register DHCP leases in DNS forwarder',
244
	$pconfig['regdhcp']
245 fae9a73c sbeaver
))->setHelp(sprintf("If this option is set, then machines that specify".
246 70edf50d jim-p
			" their hostname when requesting a DHCP lease will be registered".
247
			" in the DNS forwarder, so that their name can be resolved.".
248
			" You should also set the domain in %sSystem:".
249 08d1762e Sjon Hortensius
			" General setup%s to the proper value.",'<a href="system.php">','</a>'))
250
	->addClass('toggle-dhcp');
251 e6363160 sbeaver
252
$section->addInput(new Form_Checkbox(
253
	'regdhcpstatic',
254
	'Static DHCP',
255
	'Register DHCP static mappings in DNS forwarder',
256
	$pconfig['regdhcpstatic']
257 fae9a73c sbeaver
))->setHelp(sprintf("If this option is set, then DHCP static mappings will ".
258 70edf50d jim-p
					"be registered in the DNS forwarder, so that their name can be ".
259
					"resolved. You should also set the domain in %s".
260 08d1762e Sjon Hortensius
					"System: General setup%s to the proper value.",'<a href="system.php">','</a>'))
261
	->addClass('toggle-dhcp');
262 e6363160 sbeaver
263
$section->addInput(new Form_Checkbox(
264
	'dhcpfirst',
265
	'Prefer DHCP',
266
	'Resolve DHCP mappings first',
267
	$pconfig['dhcpfirst']
268 fae9a73c sbeaver
))->setHelp(sprintf("If this option is set, then DHCP mappings will ".
269 aa994814 Andrew Thompson
					"be resolved before the manual list of names below. This only ".
270 08d1762e Sjon Hortensius
					"affects the name given for a reverse lookup (PTR)."))
271
	->addClass('toggle-dhcp');
272 e6363160 sbeaver
273 08d1762e Sjon Hortensius
$group = new Form_Group('DNS Query Forwarding');
274
275
$group->add(new Form_Checkbox(
276 e6363160 sbeaver
	'strict_order',
277
	'DNS Query Forwarding',
278
	'Query DNS servers sequentially',
279
	$pconfig['strict_order']
280 fae9a73c sbeaver
))->setHelp(sprintf("If this option is set, %s DNS Forwarder (dnsmasq) will ".
281 96ea7162 N0YB
					"query the DNS servers sequentially in the order specified (<i>System - General Setup - DNS Servers</i>), ".
282 fae9a73c sbeaver
					"rather than all at once in parallel. ", $g['product_name']));
283 e6363160 sbeaver
284 08d1762e Sjon Hortensius
$group->add(new Form_Checkbox(
285 e6363160 sbeaver
	'domain_needed',
286
	null,
287
	'Require domain',
288
	$pconfig['domain_needed']
289 fae9a73c sbeaver
))->setHelp(sprintf("If this option is set, %s DNS Forwarder (dnsmasq) will ".
290 e6363160 sbeaver
					"not forward A or AAAA queries for plain names, without dots or domain parts, to upstream name servers.	 ".
291 fae9a73c sbeaver
					"If the name is not known from /etc/hosts or DHCP then a \"not found\" answer is returned. ", $g['product_name']));
292 e6363160 sbeaver
293 08d1762e Sjon Hortensius
$group->add(new Form_Checkbox(
294 e6363160 sbeaver
	'no_private_reverse',
295
	null,
296
	'Do not forward private reverse lookups',
297
	$pconfig['no_private_reverse']
298 fae9a73c sbeaver
))->setHelp(sprintf("If this option is set, %s DNS Forwarder (dnsmasq) will ".
299 7bdd28fb Phil Davis
					"not forward reverse DNS lookups (PTR) for private addresses (RFC 1918) to upstream name servers.  ".
300
					"Any entries in the Domain Overrides section forwarding private \"n.n.n.in-addr.arpa\" names to a specific server are still forwarded. ".
301 fae9a73c sbeaver
					"If the IP to name is not known from /etc/hosts, DHCP or a specific domain override then a \"not found\" answer is immediately returned. ", $g['product_name']));
302 e6363160 sbeaver
303 08d1762e Sjon Hortensius
$section->add($group);
304
305 e6363160 sbeaver
$section->addInput(new Form_Input(
306
	'port',
307
	'Listen Port',
308 08d1762e Sjon Hortensius
	'number',
309
	$pconfig['port'],
310
	['placeholder' => '53']
311 e6363160 sbeaver
))->setHelp('The port used for responding to DNS queries. It should normally be left blank unless another service needs to bind to TCP/UDP port 53.');
312
313
$iflist = build_if_list();
314
315
$section->addInput(new Form_Select(
316
	'interface',
317
	'Interfaces',
318
	$iflist['selected'],
319
	$iflist['options'],
320
	true
321
))->setHelp('Interface IPs used by the DNS Forwarder for responding to queries from clients. If an interface has both IPv4 and IPv6 IPs, both are used. Queries to other interface IPs not selected below are discarded. ' .
322
			'The default behavior is to respond to queries on every available IPv4 and IPv6 address.');
323
324
$section->addInput(new Form_Checkbox(
325
	'strictbind',
326 08d1762e Sjon Hortensius
	'Strict binding',
327 e6363160 sbeaver
	'Strict interface binding',
328
	$pconfig['strictbind']
329 fae9a73c sbeaver
))->setHelp('If this option is set, the DNS forwarder will only bind to the interfaces containing the IP addresses selected above, ' .
330 e6363160 sbeaver
					'rather than binding to all interfaces and discarding queries to other addresses.' . '<br /><br />' .
331 fae9a73c sbeaver
					'This option does NOT work with IPv6. If set, dnsmasq will not bind to IPv6 addresses.');
332 e6363160 sbeaver
333 33ed4d60 Stephen Beaver
$section->addInput(new Form_Textarea(
334 e6363160 sbeaver
	'custom_options',
335
	'Custom options',
336
	$pconfig['custom_options']
337 08d1762e Sjon Hortensius
))->setHelp('Enter any additional options you would like to add to the dnsmasq configuration here, separated by a space or newline')
338
	->addClass('advanced');
339 e6363160 sbeaver
340
$form->add($section);
341
print($form);
342
343 fae9a73c sbeaver
print_info_box(sprintf("If the DNS forwarder is enabled, the DHCP".
344 e6363160 sbeaver
	" service (if enabled) will automatically serve the LAN IP".
345
	" address as a DNS server to DHCP clients so they will use".
346
	" the forwarder. The DNS forwarder will use the DNS servers".
347
	" entered in %sSystem: General setup%s".
348
	" or those obtained via DHCP or PPP on WAN if the &quot;Allow".
349
	" DNS server list to be overridden by DHCP/PPP on WAN&quot;".
350
	" is checked. If you don't use that option (or if you use".
351
	" a static IP address on WAN), you must manually specify at".
352
	" least one DNS server on the %sSystem:".
353 c9679d8c Stephen Beaver
	"General setup%s page.",'<a href="system.php">','</a>','<a href="system.php">','</a>'), info);
354 e6363160 sbeaver
?>
355
356
<div class="panel panel-default">
357 c9679d8c Stephen Beaver
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Host Overrides")?></h2></div>
358 e6363160 sbeaver
	<div class="panel-body table-responsive">
359 10fe1eb5 Stephen Beaver
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
360 e6363160 sbeaver
			<thead>
361 70edf50d jim-p
				<tr>
362 e6363160 sbeaver
					<th><?=gettext("Host")?></th>
363
					<th><?=gettext("Domain")?></th>
364
					<th><?=gettext("IP")?></th>
365
					<th><?=gettext("Description")?></th>
366
					<th></th>
367 70edf50d jim-p
				</tr>
368 e6363160 sbeaver
			</thead>
369
			<tbody>
370
<?php
371 08d1762e Sjon Hortensius
foreach ($a_hosts as $i => $hostent):
372 e6363160 sbeaver
?>
373
				<tr>
374
					<td>
375 a15714cc NOYB
						<?=$hostent['host']?>
376 e6363160 sbeaver
					</td>
377
					<td>
378 a15714cc NOYB
						<?=$hostent['domain']?>
379 e6363160 sbeaver
					</td>
380
					<td>
381 08d1762e Sjon Hortensius
						<?=$hostent['ip']?>
382 e6363160 sbeaver
					</td>
383
					<td>
384
						<?=htmlspecialchars($hostent['descr'])?>
385
					</td>
386
					<td>
387 c84a6977 heper
						<a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" 	href="services_dnsmasq_edit.php?id=<?=$i?>"></a>
388 33f0b0d5 Stephen Beaver
						<a class="fa fa-trash"	title="<?=gettext('Delete host override')?>"	href="services_dnsmasq.php?type=host&amp;act=del&amp;id=<?=$i?>"></a>
389 e6363160 sbeaver
					</td>
390
				</tr>
391
392
<?php
393
	if ($hostent['aliases']['item'] && is_array($hostent['aliases']['item'])):
394 08d1762e Sjon Hortensius
		foreach ($hostent['aliases']['item'] as $i => $alias):
395 e6363160 sbeaver
?>
396 7bd5b320 Colin Fleming
				<tr>
397 e6363160 sbeaver
					<td>
398 a15714cc NOYB
						<?=$alias['host']?>
399 e6363160 sbeaver
					</td>
400
					<td>
401 a15714cc NOYB
						<?=$alias['domain']?>
402 e6363160 sbeaver
					</td>
403
					<td>
404
						Alias for <?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?>
405
					</td>
406
					<td>
407 39609bf9 Stephen Beaver
						<i class="fa fa-angle-double-right text-info"></i>
408 e6363160 sbeaver
						<?=htmlspecialchars($alias['description'])?>
409
					</td>
410
					<td>
411 c84a6977 heper
						<a class="fa fa-pencil"	title="<?=gettext('Edit host override')?>" 	href="services_dnsmasq_edit.php?id=<?=$i?>"></a>
412 e6363160 sbeaver
					</td>
413 7bd5b320 Colin Fleming
				</tr>
414 e6363160 sbeaver
<?php
415
		endforeach;
416
	endif;
417
endforeach;
418
?>
419
			</tbody>
420
		</table>
421
	</div>
422
</div>
423
424 c10cb196 Stephen Beaver
<nav class="action-buttons">
425 c9679d8c Stephen Beaver
	<a href="services_dnsmasq_edit.php" class="btn btn-sm btn-success btn-sm">
426 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
427 c9679d8c Stephen Beaver
		<?=gettext('Add')?>
428
	</a>
429 e6363160 sbeaver
</nav>
430
431
<?php
432 08d1762e Sjon Hortensius
print_info_box(gettext("Entries in this section override individual results from the forwarders.") .
433 c9679d8c Stephen Beaver
				gettext("Use these for changing DNS results or for adding custom DNS records."), info);
434 e6363160 sbeaver
?>
435
436
<div class="panel panel-default">
437 c9679d8c Stephen Beaver
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Domain Overrides")?></h2></div>
438 e6363160 sbeaver
	<div class="panel-body table-responsive">
439 10fe1eb5 Stephen Beaver
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
440 e6363160 sbeaver
			<thead>
441 70edf50d jim-p
				<tr>
442 e6363160 sbeaver
					<th><?=gettext("Domain")?></th>
443
					<th><?=gettext("IP")?></th>
444
					<th><?=gettext("Description")?></th>
445
					<th></th>
446 70edf50d jim-p
				</tr>
447 e6363160 sbeaver
			</thead>
448
449
			<tbody>
450
<?php
451 08d1762e Sjon Hortensius
foreach ($a_domainOverrides as $i => $doment):
452 e6363160 sbeaver
?>
453 70edf50d jim-p
				<tr>
454 e6363160 sbeaver
					<td>
455 a15714cc NOYB
						<?=$doment['domain']?>
456 e6363160 sbeaver
					</td>
457
					<td>
458 08d1762e Sjon Hortensius
						<?=$doment['ip']?>
459 e6363160 sbeaver
					</td>
460
					<td>
461 08d1762e Sjon Hortensius
						<?=htmlspecialchars($doment['descr'])?>
462 e6363160 sbeaver
					</td>
463
					<td>
464 33f0b0d5 Stephen Beaver
						<a class="fa fa-pencil"	title="<?=gettext('Edit domain override')?>" href="services_dnsmasq_domainoverride_edit.php?id=<?=$i?>"></a>
465
						<a class="fa fa-trash"	title="<?=gettext('Delete domain override')?>" href="services_dnsmasq.php?act=del&amp;type=doverride&amp;id=<?=$i?>"></a>
466 e6363160 sbeaver
					</td>
467 70edf50d jim-p
				</tr>
468 e6363160 sbeaver
<?php
469
endforeach;
470
?>
471
			</tbody>
472 7bd5b320 Colin Fleming
		</table>
473 e6363160 sbeaver
	</div>
474
</div>
475
476 c10cb196 Stephen Beaver
<nav class="action-buttons">
477 c9679d8c Stephen Beaver
	<a href="services_dnsmasq_domainoverride_edit.php" class="btn btn-sm btn-success btn-sm">
478 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
479 c9679d8c Stephen Beaver
		<?=gettext('Add')?>
480
	</a>
481 e6363160 sbeaver
</nav>
482
483 8fd9052f Colin Fleming
<script type="text/javascript">
484 c85b1242 Stephen Beaver
//<![CDATA[
485
events.push(function(){
486
	// On clicking the "Apply" button, submit the main form, not the little form the button lives in
487 33ed4d60 Stephen Beaver
//	$('[name=apply]').prop('type', 'button');
488 c85b1242 Stephen Beaver
489 33ed4d60 Stephen Beaver
//    $('[name=apply]').click(function() {
490
//        $('form:last').submit();
491
//    });
492
// });
493 c85b1242 Stephen Beaver
//]]>
494
</script>
495 e6363160 sbeaver
<?php
496
print_info_box(gettext("Entries in this area override an entire domain, and subdomains, by specifying an".
497 c9679d8c Stephen Beaver
						" authoritative DNS server to be queried for that domain."), info);
498 e6363160 sbeaver
499 c84a6977 heper
include("foot.inc");