Project

General

Profile

Download (4.37 KB) Statistics
| Branch: | Tag: | Revision:
1 ce9abebd Ermal Luci
<?php
2
/* $Id$ */
3
/*
4
	services_igmpproxy.php
5 3d0f579f sbeaver
6 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7 1d7ba683 ayvis
	Copyright (C) 2009 Ermal Luçi
8 ce9abebd Ermal Luci
	Copyright (C) 2004 Scott Ullrich
9
	All rights reserved.
10
11 8913533d Phil Davis
	originally part of m0n0wall (http://m0n0.ch/wall)
12 ce9abebd Ermal Luci
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
13
	All rights reserved.
14
15
	Redistribution and use in source and binary forms, with or without
16
	modification, are permitted provided that the following conditions are met:
17
18
	1. Redistributions of source code must retain the above copyright notice,
19
	   this list of conditions and the following disclaimer.
20
21
	2. Redistributions in binary form must reproduce the above copyright
22
	   notice, this list of conditions and the following disclaimer in the
23
	   documentation and/or other materials provided with the distribution.
24
25
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
26
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
29
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
	POSSIBILITY OF SUCH DAMAGE.
35
*/
36 1d333258 Scott Ullrich
/*
37 c0bf7858 Phil Davis
	pfSense_MODULE:	igmpproxy
38 1d333258 Scott Ullrich
*/
39 ce9abebd Ermal Luci
40
##|+PRIV
41
##|*IDENT=page-services-igmpproxy
42
##|*NAME=Services: Igmpproxy page
43
##|*DESCR=Allow access to the 'Services: Igmpproxy' page.
44
##|*MATCH=services_igmpproxy.php*
45
##|-PRIV
46
47
require("guiconfig.inc");
48
49 c0bf7858 Phil Davis
if (!is_array($config['igmpproxy']['igmpentry'])) {
50 ce9abebd Ermal Luci
	$config['igmpproxy']['igmpentry'] = array();
51 c0bf7858 Phil Davis
}
52 ce9abebd Ermal Luci
53
//igmpproxy_sort();
54
$a_igmpproxy = &$config['igmpproxy']['igmpentry'];
55
56
if ($_POST) {
57
	$pconfig = $_POST;
58
59
	$retval = 0;
60
	/* reload all components that use igmpproxy */
61
	$retval = services_igmpproxy_configure();
62
63 c0bf7858 Phil Davis
	if (stristr($retval, "error") <> true) {
64 3d0f579f sbeaver
		$savemsg = get_std_save_message($retval);
65 c0bf7858 Phil Davis
	} else {
66 3d0f579f sbeaver
		$savemsg = $retval;
67 c0bf7858 Phil Davis
	}
68 6833c9cd Ermal Lu?i
69
	clear_subsystem_dirty('igmpproxy');
70 ce9abebd Ermal Luci
}
71
72
if ($_GET['act'] == "del") {
73
	if ($a_igmpproxy[$_GET['id']]) {
74
		unset($a_igmpproxy[$_GET['id']]);
75
		write_config();
76 4bbfe029 Ermal Lu?i
		mark_subsystem_dirty('igmpproxy');
77 ce9abebd Ermal Luci
		header("Location: services_igmpproxy.php");
78
		exit;
79
	}
80
}
81
82 c0bf7858 Phil Davis
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
83 ce9abebd Ermal Luci
include("head.inc");
84
85 3d0f579f sbeaver
if ($savemsg)
86
	print_info_box($savemsg, 'success');
87
88
if (is_subsystem_dirty('igmpproxy'))
89 f6fe9035 sbeaver
	print_info_box_np(gettext('The IGMP entry list has been changed.' . '<br />' . 'You must apply the changes in order for them to take effect.'));
90 ce9abebd Ermal Luci
?>
91
92
<form action="services_igmpproxy.php" method="post">
93 3d0f579f sbeaver
	<div class="table-responsive">
94
		<table class="table table-striped table-hover table-condensed">
95
			<thead>
96
				<tr>
97
					<th><?=gettext("Name")?></th>
98
					<th><?=gettext("Type")?></th>
99
					<th><?=gettext("Values")?></th>
100
					<th><?=gettext("Description")?></th>
101
					<th</th>
102
				</tr>
103
			</thead>
104
			<tbody>
105
<?php
106
$i = 0;
107
foreach ($a_igmpproxy as $igmpentry):
108
?>
109
				<tr>
110
					<td>
111
						<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($igmpentry['ifname']))?>
112
					</td>
113
					<td>
114
						<?=htmlspecialchars($igmpentry['type'])?>
115
					</td>
116
					<td>
117
<?php
118 ce9abebd Ermal Luci
	$addresses = implode(", ", array_slice(explode(" ", $igmpentry['address']), 0, 10));
119 3d0f579f sbeaver
	print($addresses);
120
121 ce9abebd Ermal Luci
	if(count($addresses) < 10) {
122 3d0f579f sbeaver
		print(' ');
123 ce9abebd Ermal Luci
	} else {
124 3d0f579f sbeaver
		print('...');
125 ce9abebd Ermal Luci
	}
126 3d0f579f sbeaver
?>
127
					</td>
128
					<td>
129
						<?=htmlspecialchars($igmpentry['descr'])?>&nbsp;
130
					</td>
131
					<td>
132
						<a href="services_igmpproxy_edit.php?id=<?=$i?>" class="btn btn-info btn-xs"><?=gettext('Edit')?></a>
133
						<a href="services_igmpproxy.php?act=del&amp;id=<?=$i?>" class="btn btn-danger btn-xs"><?=gettext('Delete')?></a>
134
					</td>
135
				</tr>
136
<?php
137
	$i++;
138
endforeach;
139
?>
140
			</tbody>
141
		</table>
142
	</div>
143
144
	<nav class="action-buttons">
145
		<input id="submit" name="submit" type="submit" class="btn btn-primary" value="<?=gettext("Save")?>" />
146
		<a href="services_igmpproxy_edit.php" class="btn btn-success"><?=gettext('Add')?></a>
147
	</nav>
148
149 ce9abebd Ermal Luci
</form>
150 3d0f579f sbeaver
151
<?php
152
153
print_info_box(gettext('Please add the interface for upstream, the allowed subnets, and the downstream interfaces you would like the proxy to allow. ' .
154
					   'Only one "upstream" interface can be configured.'));
155
156
include("foot.inc");