Project

General

Profile

Download (4.61 KB) Statistics
| Branch: | Tag: | Revision:
1 ce9abebd Ermal Luci
<?php
2
/*
3 c5d81585 Renato Botelho
 * services_igmpproxy.php
4 b9043cdc Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 b8f91b7c Luiz Souza
 * Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
7 c5d81585 Renato Botelho
 * All rights reserved.
8 191cb31d Stephen Beaver
 *
9 c5d81585 Renato Botelho
 * originally based on m0n0wall (http://m0n0.ch/wall)
10
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
11
 * All rights reserved.
12 b9043cdc Stephen Beaver
 *
13 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
14
 * you may not use this file except in compliance with the License.
15
 * You may obtain a copy of the License at
16 b9043cdc Stephen Beaver
 *
17 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
18 b9043cdc Stephen Beaver
 *
19 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
20
 * distributed under the License is distributed on an "AS IS" BASIS,
21
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
 * See the License for the specific language governing permissions and
23
 * limitations under the License.
24 b9043cdc Stephen Beaver
 */
25 ce9abebd Ermal Luci
26
##|+PRIV
27
##|*IDENT=page-services-igmpproxy
28 5230f468 jim-p
##|*NAME=Services: IGMP Proxy
29 0b8328c5 jim-p
##|*DESCR=Allow access to the 'Services: IGMP Proxy' page.
30 ce9abebd Ermal Luci
##|*MATCH=services_igmpproxy.php*
31
##|-PRIV
32
33 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
34 ce9abebd Ermal Luci
35 6dde4c10 Stephen Jones
if(!is_array($config['igmpproxy'])){
36
	$config['igmpproxy'] = array();
37
}
38
39 c0bf7858 Phil Davis
if (!is_array($config['igmpproxy']['igmpentry'])) {
40 ce9abebd Ermal Luci
	$config['igmpproxy']['igmpentry'] = array();
41 c0bf7858 Phil Davis
}
42 ce9abebd Ermal Luci
43
//igmpproxy_sort();
44
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
45
46 1cd02ef7 PiBa-NL
if ($_POST['apply']) {
47 ce9abebd Ermal Luci
	$pconfig = $_POST;
48
49 44c42356 Phil Davis
	$changes_applied = true;
50 ce9abebd Ermal Luci
	$retval = 0;
51
	/* reload all components that use igmpproxy */
52 44c42356 Phil Davis
	$retval |= services_igmpproxy_configure();
53 6833c9cd Ermal Lu?i
54
	clear_subsystem_dirty('igmpproxy');
55 ce9abebd Ermal Luci
}
56
57 6b3e3bc5 PiBa-NL
if (isset($config['igmpproxy']['enable'])) {
58
	$pconfig['enable'] = true;
59
}
60
61
if ($_POST['save']) {
62
	$pconfig = $_POST;
63
	if (isset($pconfig['enable'])) {
64
		$config['igmpproxy']['enable'] = true;
65
	} else {
66
		unset($config['igmpproxy']['enable']);
67
	}
68
	write_config();
69
	mark_subsystem_dirty('igmpproxy');
70
	header("Location: services_igmpproxy.php");
71
	exit;
72
}
73
74 13541a81 Steve Beaver
if ($_POST['act'] == "del") {
75
	if ($a_igmpproxy[$_POST['id']]) {
76
		unset($a_igmpproxy[$_POST['id']]);
77 ce9abebd Ermal Luci
		write_config();
78 4bbfe029 Ermal Lu?i
		mark_subsystem_dirty('igmpproxy');
79 ce9abebd Ermal Luci
		header("Location: services_igmpproxy.php");
80
		exit;
81
	}
82
}
83
84 c0bf7858 Phil Davis
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
85 ce9abebd Ermal Luci
include("head.inc");
86
87 44c42356 Phil Davis
if ($changes_applied) {
88
	print_apply_result_box($retval);
89 20db3e1a Phil Davis
}
90 3d0f579f sbeaver
91 20db3e1a Phil Davis
if (is_subsystem_dirty('igmpproxy')) {
92 06ca4e2d NOYB
	print_apply_box(gettext('The IGMP entry list has been changed.') . '<br />' . gettext('The changes must be applied for them to take effect.'));
93 20db3e1a Phil Davis
}
94 ce9abebd Ermal Luci
?>
95
96 6b3e3bc5 PiBa-NL
<?php
97
98
$form = new Form();
99
100
$section = new Form_Section('General IGMP Options');
101
102
$section->addInput(new Form_Checkbox(
103
	'enable',
104
	'Enable',
105
	'Enable IGMP',
106
	$pconfig['enable']
107
));
108
109
$form->add($section);
110
111
print($form);
112
113 179377b0 robjarsen
?>
114 ce9abebd Ermal Luci
<form action="services_igmpproxy.php" method="post">
115 060ed238 Stephen Beaver
	<div class="panel panel-default">
116
		<div class="panel-heading"><h2 class="panel-title"><?=gettext('IGMP Proxy')?></h2></div>
117
		<div class="panel-body">
118
			<div class="table-responsive">
119 1c10ce97 PiBa-NL
				<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
120 060ed238 Stephen Beaver
					<thead>
121
						<tr>
122
							<th><?=gettext("Name")?></th>
123
							<th><?=gettext("Type")?></th>
124
							<th><?=gettext("Values")?></th>
125
							<th><?=gettext("Description")?></th>
126 70dc5cd6 Phil Davis
							<th><?=gettext("Actions")?></th>
127 060ed238 Stephen Beaver
						</tr>
128
					</thead>
129
					<tbody>
130 3d0f579f sbeaver
<?php
131
$i = 0;
132
foreach ($a_igmpproxy as $igmpentry):
133
?>
134 060ed238 Stephen Beaver
						<tr>
135
							<td>
136
								<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($igmpentry['ifname']))?>
137
							</td>
138
							<td>
139
								<?=htmlspecialchars($igmpentry['type'])?>
140
							</td>
141
							<td>
142 3d0f579f sbeaver
<?php
143 ce9abebd Ermal Luci
	$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
144 3d0f579f sbeaver
	print($addresses);
145
146 46631db4 Steve Beaver
	if (!is_array($igmpentry['address']) || count($igmpentry['address']) < 10) {
147 3d0f579f sbeaver
		print(' ');
148 ce9abebd Ermal Luci
	} else {
149 3d0f579f sbeaver
		print('...');
150 ce9abebd Ermal Luci
	}
151 3d0f579f sbeaver
?>
152 060ed238 Stephen Beaver
							</td>
153
							<td>
154
								<?=htmlspecialchars($igmpentry['descr'])?>&nbsp;
155
							</td>
156
							<td>
157
								<a class="fa fa-pencil"	title="<?=gettext('Edit IGMP entry')?>" href="services_igmpproxy_edit.php?id=<?=$i?>"></a>
158 13541a81 Steve Beaver
								<a class="fa fa-trash"	title="<?=gettext('Delete IGMP entry')?>" href="services_igmpproxy.php?act=del&amp;id=<?=$i?>" usepost></a>
159 060ed238 Stephen Beaver
							</td>
160
						</tr>
161 3d0f579f sbeaver
<?php
162
	$i++;
163
endforeach;
164
?>
165 060ed238 Stephen Beaver
					</tbody>
166
				</table>
167
			</div>
168
		</div>
169 ac950976 Colin Fleming
	</div>
170 ce9abebd Ermal Luci
</form>
171 3d0f579f sbeaver
172 c10cb196 Stephen Beaver
<nav class="action-buttons">
173 c9679d8c Stephen Beaver
	<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
174 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
175 c9679d8c Stephen Beaver
		<?=gettext('Add')?>
176
	</a>
177
</nav>
178
179 35681930 Stephen Beaver
<div class="infoblock">
180 06ca4e2d NOYB
<?php print_info_box(gettext('Please add the interface for upstream, the allowed subnets, and the downstream interfaces for the proxy to allow. ' .
181 f6aebbcc NewEraCracker
					   'Only one "upstream" interface can be configured.'), 'info', false); ?>
182 c9679d8c Stephen Beaver
</div>
183 3d0f579f sbeaver
<?php
184 5d3914a9 heper
include("foot.inc");