Project

General

Profile

Download (4.51 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 0b4c14a4 Steve Beaver
 * Copyright (c) 2004-2019 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
//igmpproxy_sort();
36 c6c398c6 jim-p
37
init_config_arr(array('igmpproxy', 'igmpentry'));
38 ce9abebd Ermal Luci
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
39
40 1cd02ef7 PiBa-NL
if ($_POST['apply']) {
41 ce9abebd Ermal Luci
	$pconfig = $_POST;
42
43 44c42356 Phil Davis
	$changes_applied = true;
44 ce9abebd Ermal Luci
	$retval = 0;
45
	/* reload all components that use igmpproxy */
46 44c42356 Phil Davis
	$retval |= services_igmpproxy_configure();
47 6833c9cd Ermal Lu?i
48
	clear_subsystem_dirty('igmpproxy');
49 ce9abebd Ermal Luci
}
50
51 6b3e3bc5 PiBa-NL
if (isset($config['igmpproxy']['enable'])) {
52
	$pconfig['enable'] = true;
53
}
54
55
if ($_POST['save']) {
56
	$pconfig = $_POST;
57
	if (isset($pconfig['enable'])) {
58
		$config['igmpproxy']['enable'] = true;
59
	} else {
60
		unset($config['igmpproxy']['enable']);
61
	}
62
	write_config();
63
	mark_subsystem_dirty('igmpproxy');
64
	header("Location: services_igmpproxy.php");
65
	exit;
66
}
67
68 13541a81 Steve Beaver
if ($_POST['act'] == "del") {
69
	if ($a_igmpproxy[$_POST['id']]) {
70
		unset($a_igmpproxy[$_POST['id']]);
71 ce9abebd Ermal Luci
		write_config();
72 4bbfe029 Ermal Lu?i
		mark_subsystem_dirty('igmpproxy');
73 ce9abebd Ermal Luci
		header("Location: services_igmpproxy.php");
74
		exit;
75
	}
76
}
77
78 c0bf7858 Phil Davis
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
79 ce9abebd Ermal Luci
include("head.inc");
80
81 44c42356 Phil Davis
if ($changes_applied) {
82
	print_apply_result_box($retval);
83 20db3e1a Phil Davis
}
84 3d0f579f sbeaver
85 20db3e1a Phil Davis
if (is_subsystem_dirty('igmpproxy')) {
86 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.'));
87 20db3e1a Phil Davis
}
88 ce9abebd Ermal Luci
?>
89
90 6b3e3bc5 PiBa-NL
<?php
91
92
$form = new Form();
93
94
$section = new Form_Section('General IGMP Options');
95
96
$section->addInput(new Form_Checkbox(
97
	'enable',
98
	'Enable',
99
	'Enable IGMP',
100
	$pconfig['enable']
101
));
102
103
$form->add($section);
104
105
print($form);
106
107 179377b0 robjarsen
?>
108 ce9abebd Ermal Luci
<form action="services_igmpproxy.php" method="post">
109 060ed238 Stephen Beaver
	<div class="panel panel-default">
110
		<div class="panel-heading"><h2 class="panel-title"><?=gettext('IGMP Proxy')?></h2></div>
111
		<div class="panel-body">
112
			<div class="table-responsive">
113 1c10ce97 PiBa-NL
				<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
114 060ed238 Stephen Beaver
					<thead>
115
						<tr>
116
							<th><?=gettext("Name")?></th>
117
							<th><?=gettext("Type")?></th>
118
							<th><?=gettext("Values")?></th>
119
							<th><?=gettext("Description")?></th>
120 70dc5cd6 Phil Davis
							<th><?=gettext("Actions")?></th>
121 060ed238 Stephen Beaver
						</tr>
122
					</thead>
123
					<tbody>
124 3d0f579f sbeaver
<?php
125
$i = 0;
126
foreach ($a_igmpproxy as $igmpentry):
127
?>
128 060ed238 Stephen Beaver
						<tr>
129
							<td>
130
								<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($igmpentry['ifname']))?>
131
							</td>
132
							<td>
133
								<?=htmlspecialchars($igmpentry['type'])?>
134
							</td>
135
							<td>
136 3d0f579f sbeaver
<?php
137 ce9abebd Ermal Luci
	$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
138 261916e5 jim-p
	print(htmlspecialchars($addresses));
139 3d0f579f sbeaver
140 46631db4 Steve Beaver
	if (!is_array($igmpentry['address']) || count($igmpentry['address']) < 10) {
141 3d0f579f sbeaver
		print(' ');
142 ce9abebd Ermal Luci
	} else {
143 3d0f579f sbeaver
		print('...');
144 ce9abebd Ermal Luci
	}
145 3d0f579f sbeaver
?>
146 060ed238 Stephen Beaver
							</td>
147
							<td>
148
								<?=htmlspecialchars($igmpentry['descr'])?>&nbsp;
149
							</td>
150
							<td>
151
								<a class="fa fa-pencil"	title="<?=gettext('Edit IGMP entry')?>" href="services_igmpproxy_edit.php?id=<?=$i?>"></a>
152 13541a81 Steve Beaver
								<a class="fa fa-trash"	title="<?=gettext('Delete IGMP entry')?>" href="services_igmpproxy.php?act=del&amp;id=<?=$i?>" usepost></a>
153 060ed238 Stephen Beaver
							</td>
154
						</tr>
155 3d0f579f sbeaver
<?php
156
	$i++;
157
endforeach;
158
?>
159 060ed238 Stephen Beaver
					</tbody>
160
				</table>
161
			</div>
162
		</div>
163 ac950976 Colin Fleming
	</div>
164 ce9abebd Ermal Luci
</form>
165 3d0f579f sbeaver
166 c10cb196 Stephen Beaver
<nav class="action-buttons">
167 c9679d8c Stephen Beaver
	<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
168 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
169 c9679d8c Stephen Beaver
		<?=gettext('Add')?>
170
	</a>
171
</nav>
172
173 35681930 Stephen Beaver
<div class="infoblock">
174 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. ' .
175 f6aebbcc NewEraCracker
					   'Only one "upstream" interface can be configured.'), 'info', false); ?>
176 c9679d8c Stephen Beaver
</div>
177 3d0f579f sbeaver
<?php
178 5d3914a9 heper
include("foot.inc");