Project

General

Profile

Download (4.49 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
//igmpproxy_sort();
36

    
37
init_config_arr(array('igmpproxy', 'igmpentry'));
38
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
39

    
40
if ($_POST['apply']) {
41
	$pconfig = $_POST;
42

    
43
	$changes_applied = true;
44
	$retval = 0;
45
	/* reload all components that use igmpproxy */
46
	$retval |= services_igmpproxy_configure();
47

    
48
	clear_subsystem_dirty('igmpproxy');
49
}
50

    
51
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
if ($_POST['act'] == "del") {
69
	if ($a_igmpproxy[$_POST['id']]) {
70
		unset($a_igmpproxy[$_POST['id']]);
71
		write_config();
72
		mark_subsystem_dirty('igmpproxy');
73
		header("Location: services_igmpproxy.php");
74
		exit;
75
	}
76
}
77

    
78
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
79
include("head.inc");
80

    
81
if ($changes_applied) {
82
	print_apply_result_box($retval);
83
}
84

    
85
if (is_subsystem_dirty('igmpproxy')) {
86
	print_apply_box(gettext('The IGMP entry list has been changed.') . '<br />' . gettext('The changes must be applied for them to take effect.'));
87
}
88
?>
89

    
90
<?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
?>
108
<form action="services_igmpproxy.php" method="post">
109
	<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
				<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
114
					<thead>
115
						<tr>
116
							<th><?=gettext("Name")?></th>
117
							<th><?=gettext("Type")?></th>
118
							<th><?=gettext("Values")?></th>
119
							<th><?=gettext("Description")?></th>
120
							<th><?=gettext("Actions")?></th>
121
						</tr>
122
					</thead>
123
					<tbody>
124
<?php
125
$i = 0;
126
foreach ($a_igmpproxy as $igmpentry):
127
?>
128
						<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
<?php
137
	$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
138
	print($addresses);
139

    
140
	if (!is_array($igmpentry['address']) || count($igmpentry['address']) < 10) {
141
		print(' ');
142
	} else {
143
		print('...');
144
	}
145
?>
146
							</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
								<a class="fa fa-trash"	title="<?=gettext('Delete IGMP entry')?>" href="services_igmpproxy.php?act=del&amp;id=<?=$i?>" usepost></a>
153
							</td>
154
						</tr>
155
<?php
156
	$i++;
157
endforeach;
158
?>
159
					</tbody>
160
				</table>
161
			</div>
162
		</div>
163
	</div>
164
</form>
165

    
166
<nav class="action-buttons">
167
	<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
168
		<i class="fa fa-plus icon-embed-btn"></i>
169
		<?=gettext('Add')?>
170
	</a>
171
</nav>
172

    
173
<div class="infoblock">
174
<?php print_info_box(gettext('Please add the interface for upstream, the allowed subnets, and the downstream interfaces for the proxy to allow. ' .
175
					   'Only one "upstream" interface can be configured.'), 'info', false); ?>
176
</div>
177
<?php
178
include("foot.inc");
(135-135/234)