Project

General

Profile

Download (6.34 KB) Statistics
| Branch: | Tag: | Revision:
1 0ec2fdf0 Ermal Lu?i
<?php
2
/*
3 dd447bde Jim Thompson
        Copyright (C) 2013-2014 Electric Sheep Fencing, LP
4 1d7ba683 ayvis
	Copyright (C) 2009 Ermal Luçi
5 0ec2fdf0 Ermal Lu?i
	Copyright (C) 2004 Scott Ullrich
6
	All rights reserved.
7
8
	Redistribution and use in source and binary forms, with or without
9
	modification, are permitted provided that the following conditions are met:
10
11
	1. Redistributions of source code must retain the above copyright notice,
12
	   this list of conditions and the following disclaimer.
13
14
	2. Redistributions in binary form must reproduce the above copyright
15
	   notice, this list of conditions and the following disclaimer in the
16
	   documentation and/or other materials provided with the distribution.
17
18
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
	POSSIBILITY OF SUCH DAMAGE.
28
*/
29 7ac5a4cb Scott Ullrich
/*
30
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
31
	pfSense_MODULE:	interfaces
32
*/
33 0ec2fdf0 Ermal Lu?i
34
##|+PRIV
35
##|*IDENT=page-interfaces-groups
36
##|*NAME=Interfaces: Groups page
37
##|*DESCR=Create interface groups
38
##|*MATCH=interfaces_groups.php*
39
##|-PRIV
40
41
require("guiconfig.inc");
42 654998ee Carlos Eduardo Ramos
require_once("functions.inc");
43 0ec2fdf0 Ermal Lu?i
44
if (!is_array($config['ifgroups']['ifgroupentry']))
45
	$config['ifgroups']['ifgroupentry'] = array();
46
47
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
48
49
if ($_GET['act'] == "del") {
50
	if ($a_ifgroups[$_GET['id']]) {
51 073cd52e Ermal
		$members = explode(" ", $a_ifgroups[$_GET['id']]['members']);
52 42753d25 Ermal Lu?i
		foreach ($members as $ifs) {
53
			$realif = get_real_interface($ifs);
54
			if ($realif)
55 073cd52e Ermal
				mwexec("/sbin/ifconfig  {$realif} -group " . $a_ifgroups[$_GET['id']]['ifname']);
56 42753d25 Ermal Lu?i
		}
57 0ec2fdf0 Ermal Lu?i
		unset($a_ifgroups[$_GET['id']]);
58
		write_config();
59
		header("Location: interfaces_groups.php");
60
		exit;
61
	}
62
}
63
64 bd33744d Rafael Lucas
$pgtitle = array(gettext("Interfaces"),gettext("Groups"));
65 b32dd0a6 jim-p
$shortcut_section = "interfaces";
66 0ec2fdf0 Ermal Lu?i
include("head.inc");
67
68
?>
69
70
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
71
<?php include("fbegin.inc"); ?>
72
73 0f83dd7b Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces groups">
74 0ec2fdf0 Ermal Lu?i
  <tr><td>
75
<?php
76 d02951e9 gnhb
	$tab_array = array();
77 bd33744d Rafael Lucas
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
78
	$tab_array[1] = array(gettext("Interface Groups"), true, "interfaces_groups.php");
79
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
80
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
81
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
82
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
83
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
84
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
85
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
86
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
87 d02951e9 gnhb
	display_top_tabs($tab_array);
88 0ec2fdf0 Ermal Lu?i
?>
89
  </td></tr>
90
<tr>
91
    <td>
92
        <div id="mainarea">
93 0f83dd7b Colin Fleming
        <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
94 0ec2fdf0 Ermal Lu?i
95
<tr>
96 bd33744d Rafael Lucas
  <td width="15%" class="listhdrr"><?=gettext("Name");?></td>
97
  <td width="35%" class="listhdrr"><?=gettext("Members");?></td>
98
  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
99 0ec2fdf0 Ermal Lu?i
  <td width="5%" class="list"></td>
100
</tr>
101
	  <?php if (count ($a_ifgroups)):
102
		$i = 0; foreach ($a_ifgroups as $ifgroupentry): ?>
103
<tr>
104
  <td class="listlr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
105 22e6d572 Ermal Lu?i
	<a href="/firewall_rules.php?if=<?=htmlspecialchars($ifgroupentry['ifname']);?>"><?=htmlspecialchars($ifgroupentry['ifname']);?></a>
106 0ec2fdf0 Ermal Lu?i
  </td>
107
  <td class="listr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
108
      <?php
109 42753d25 Ermal Lu?i
	$members_arr = explode(" ", $ifgroupentry['members']);
110 6e73977b Renato Botelho
	$iflist = get_configured_interface_with_descr(false, true);
111 22e6d572 Ermal Lu?i
	$memberses_arr = array();
112 0ec2fdf0 Ermal Lu?i
	foreach ($members_arr as $memb)
113
		$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
114 36b9bb28 Renato Botelho
	unset($iflist);
115 0ec2fdf0 Ermal Lu?i
	$memberses = implode(", ", $memberses_arr);
116
	echo $memberses;
117
	if(count($members_arr) < 10) {
118
		echo " ";
119
	} else {
120
		echo "...";
121
	}
122
    ?>
123
  </td>
124
  <td class="listbg" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
125
    <?=htmlspecialchars($ifgroupentry['descr']);?>&nbsp;
126
  </td>
127 0f83dd7b Colin Fleming
  <td valign="middle" class="list nowrap">
128
    <table border="0" cellspacing="0" cellpadding="1" summary="icons">
129 0ec2fdf0 Ermal Lu?i
      <tr>
130 0f83dd7b Colin Fleming
        <td valign="middle"><a href="interfaces_groups_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit group");?>" alt="edit" /></a></td>
131
        <td><a href="interfaces_groups.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this group? All elements that still use it will become invalid (e.g. filter rules)!");?>')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete ifgroupentry");?>" alt="delete" /></a></td>
132 0ec2fdf0 Ermal Lu?i
      </tr>
133
    </table>
134
  </td>
135
</tr>
136
	  <?php $i++; endforeach; endif;?>
137
<tr>
138
  <td class="list" colspan="3"></td>
139
  <td class="list">
140 0f83dd7b Colin Fleming
    <table border="0" cellspacing="0" cellpadding="1" summary="add">
141 0ec2fdf0 Ermal Lu?i
      <tr>
142
	<td valign="middle" width="17">&nbsp;</td>
143 0f83dd7b Colin Fleming
        <td valign="middle"><a href="interfaces_groups_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add a new group");?>" alt="add" /></a></td>
144 0ec2fdf0 Ermal Lu?i
      </tr>
145
    </table>
146
  </td>
147
</tr>
148
<tr>
149
  <td class="tabcont" colspan="3">
150 1d7ba683 ayvis
	<p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br /></strong></span><?=gettext("Interface Groups allow you to create rules that apply to multiple interfaces without duplicating the rules. If you remove members from an interface group, the group rules no longer apply to that interface.");?></span></p>
151 0ec2fdf0 Ermal Lu?i
	</td>
152
</tr>
153
	</table>
154
	</div>
155
 </td>
156
</tr>
157
</table>
158
<?php include("fend.inc"); ?>
159
</body>
160
</html>