Project

General

Profile

Download (4.17 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-2016 Electric Sheep Fencing, LLC
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']['igmpentry'])) {
36
	$config['igmpproxy']['igmpentry'] = array();
37
}
38

    
39
//igmpproxy_sort();
40
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
41

    
42
if ($_POST) {
43
	$pconfig = $_POST;
44

    
45
	$retval = 0;
46
	/* reload all components that use igmpproxy */
47
	$retval = services_igmpproxy_configure();
48

    
49
	if (stristr($retval, "error") <> true) {
50
		$savemsg = get_std_save_message($retval);
51
	} else {
52
		$savemsg = $retval;
53
	}
54

    
55
	clear_subsystem_dirty('igmpproxy');
56
}
57

    
58
if ($_GET['act'] == "del") {
59
	if ($a_igmpproxy[$_GET['id']]) {
60
		unset($a_igmpproxy[$_GET['id']]);
61
		write_config();
62
		mark_subsystem_dirty('igmpproxy');
63
		header("Location: services_igmpproxy.php");
64
		exit;
65
	}
66
}
67

    
68
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
69
include("head.inc");
70

    
71
if ($savemsg) {
72
	print_info_box($savemsg, 'success');
73
}
74

    
75
if (is_subsystem_dirty('igmpproxy')) {
76
	print_apply_box(gettext('The IGMP entry list has been changed.') . '<br />' . gettext('The changes must be applied for them to take effect.'));
77
}
78
?>
79

    
80
<form action="services_igmpproxy.php" method="post">
81
	<div class="panel panel-default">
82
		<div class="panel-heading"><h2 class="panel-title"><?=gettext('IGMP Proxy')?></h2></div>
83
		<div class="panel-body">
84
			<div class="table-responsive">
85
				<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
86
					<thead>
87
						<tr>
88
							<th><?=gettext("Name")?></th>
89
							<th><?=gettext("Type")?></th>
90
							<th><?=gettext("Values")?></th>
91
							<th><?=gettext("Description")?></th>
92
							<th><?=gettext("Actions")?></th>
93
						</tr>
94
					</thead>
95
					<tbody>
96
<?php
97
$i = 0;
98
foreach ($a_igmpproxy as $igmpentry):
99
?>
100
						<tr>
101
							<td>
102
								<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($igmpentry['ifname']))?>
103
							</td>
104
							<td>
105
								<?=htmlspecialchars($igmpentry['type'])?>
106
							</td>
107
							<td>
108
<?php
109
	$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
110
	print($addresses);
111

    
112
	if (count($addresses) < 10) {
113
		print(' ');
114
	} else {
115
		print('...');
116
	}
117
?>
118
							</td>
119
							<td>
120
								<?=htmlspecialchars($igmpentry['descr'])?>&nbsp;
121
							</td>
122
							<td>
123
								<a class="fa fa-pencil"	title="<?=gettext('Edit IGMP entry')?>" href="services_igmpproxy_edit.php?id=<?=$i?>"></a>
124
								<a class="fa fa-trash"	title="<?=gettext('Delete IGMP entry')?>" href="services_igmpproxy.php?act=del&amp;id=<?=$i?>"></a>
125
							</td>
126
						</tr>
127
<?php
128
	$i++;
129
endforeach;
130
?>
131
					</tbody>
132
				</table>
133
			</div>
134
		</div>
135
	</div>
136
</form>
137

    
138
<nav class="action-buttons">
139
	<button id="submit" name="submit" type="submit" class="btn btn-primary btn-sm" value="<?=gettext("Save")?>">
140
		<i class="fa fa-save icon-embed-btn"></i>
141
		<?=gettext("Save")?>
142
	</button>
143
	<a href="services_igmpproxy_edit.php" class="btn btn-success btn-sm">
144
		<i class="fa fa-plus icon-embed-btn"></i>
145
		<?=gettext('Add')?>
146
	</a>
147
</nav>
148

    
149
<div class="infoblock">
150
<?php print_info_box(gettext('Please add the interface for upstream, the allowed subnets, and the downstream interfaces for the proxy to allow. ' .
151
					   'Only one "upstream" interface can be configured.'), 'info', false); ?>
152
</div>
153
<?php
154
include("foot.inc");
(130-130/227)