Project

General

Profile

Download (4.61 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * services_igmpproxy.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
7
 * All rights reserved.
8
 *
9
 * originally based on m0n0wall (http://m0n0.ch/wall)
10
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
11
 * All rights reserved.
12
 *
13
 * 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
 *
17
 * http://www.apache.org/licenses/LICENSE-2.0
18
 *
19
 * 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
 */
25

    
26
##|+PRIV
27
##|*IDENT=page-services-igmpproxy
28
##|*NAME=Services: IGMP Proxy
29
##|*DESCR=Allow access to the 'Services: IGMP Proxy' page.
30
##|*MATCH=services_igmpproxy.php*
31
##|-PRIV
32

    
33
require_once("guiconfig.inc");
34

    
35
if(!is_array($config['igmpproxy'])){
36
	$config['igmpproxy'] = array();
37
}
38

    
39
if (!is_array($config['igmpproxy']['igmpentry'])) {
40
	$config['igmpproxy']['igmpentry'] = array();
41
}
42

    
43
//igmpproxy_sort();
44
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
45

    
46
if ($_POST['apply']) {
47
	$pconfig = $_POST;
48

    
49
	$changes_applied = true;
50
	$retval = 0;
51
	/* reload all components that use igmpproxy */
52
	$retval |= services_igmpproxy_configure();
53

    
54
	clear_subsystem_dirty('igmpproxy');
55
}
56

    
57
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
if ($_POST['act'] == "del") {
75
	if ($a_igmpproxy[$_POST['id']]) {
76
		unset($a_igmpproxy[$_POST['id']]);
77
		write_config();
78
		mark_subsystem_dirty('igmpproxy');
79
		header("Location: services_igmpproxy.php");
80
		exit;
81
	}
82
}
83

    
84
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
85
include("head.inc");
86

    
87
if ($changes_applied) {
88
	print_apply_result_box($retval);
89
}
90

    
91
if (is_subsystem_dirty('igmpproxy')) {
92
	print_apply_box(gettext('The IGMP entry list has been changed.') . '<br />' . gettext('The changes must be applied for them to take effect.'));
93
}
94
?>
95

    
96
<?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
?>
114
<form action="services_igmpproxy.php" method="post">
115
	<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
				<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
120
					<thead>
121
						<tr>
122
							<th><?=gettext("Name")?></th>
123
							<th><?=gettext("Type")?></th>
124
							<th><?=gettext("Values")?></th>
125
							<th><?=gettext("Description")?></th>
126
							<th><?=gettext("Actions")?></th>
127
						</tr>
128
					</thead>
129
					<tbody>
130
<?php
131
$i = 0;
132
foreach ($a_igmpproxy as $igmpentry):
133
?>
134
						<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
<?php
143
	$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
144
	print($addresses);
145

    
146
	if (!is_array($igmpentry['address']) || count($igmpentry['address']) < 10) {
147
		print(' ');
148
	} else {
149
		print('...');
150
	}
151
?>
152
							</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
								<a class="fa fa-trash"	title="<?=gettext('Delete IGMP entry')?>" href="services_igmpproxy.php?act=del&amp;id=<?=$i?>" usepost></a>
159
							</td>
160
						</tr>
161
<?php
162
	$i++;
163
endforeach;
164
?>
165
					</tbody>
166
				</table>
167
			</div>
168
		</div>
169
	</div>
170
</form>
171

    
172
<nav class="action-buttons">
173
	<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
174
		<i class="fa fa-plus icon-embed-btn"></i>
175
		<?=gettext('Add')?>
176
	</a>
177
</nav>
178

    
179
<div class="infoblock">
180
<?php print_info_box(gettext('Please add the interface for upstream, the allowed subnets, and the downstream interfaces for the proxy to allow. ' .
181
					   'Only one "upstream" interface can be configured.'), 'info', false); ?>
182
</div>
183
<?php
184
include("foot.inc");
(136-136/235)