Project

General

Profile

Download (6.28 KB) Statistics
| Branch: | Tag: | Revision:

univnautes / usr / local / www / interfaces_groups.php @ a1b66bec

1
<?php
2
/*
3
	Copyright (C) 2009 Ermal Luçi
4
	Copyright (C) 2004 Scott Ullrich
5
	All rights reserved.
6

    
7
	Redistribution and use in source and binary forms, with or without
8
	modification, are permitted provided that the following conditions are met:
9

    
10
	1. Redistributions of source code must retain the above copyright notice,
11
	   this list of conditions and the following disclaimer.
12

    
13
	2. Redistributions in binary form must reproduce the above copyright
14
	   notice, this list of conditions and the following disclaimer in the
15
	   documentation and/or other materials provided with the distribution.
16

    
17
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
	POSSIBILITY OF SUCH DAMAGE.
27
*/
28
/*
29
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
30
	pfSense_MODULE:	interfaces
31
*/
32

    
33
##|+PRIV
34
##|*IDENT=page-interfaces-groups
35
##|*NAME=Interfaces: Groups page
36
##|*DESCR=Create interface groups
37
##|*MATCH=interfaces_groups.php*
38
##|-PRIV
39

    
40
require("guiconfig.inc");
41
require_once("functions.inc");
42

    
43
if (!is_array($config['ifgroups']['ifgroupentry']))
44
	$config['ifgroups']['ifgroupentry'] = array();
45

    
46
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
47

    
48
if ($_GET['act'] == "del") {
49
	if ($a_ifgroups[$_GET['id']]) {
50
		$members = explode(" ", $a_ifgroups[$_GET['id']]['members']);
51
		foreach ($members as $ifs) {
52
			$realif = get_real_interface($ifs);
53
			if ($realif)
54
				mwexec("/sbin/ifconfig  {$realif} -group " . $a_ifgroups[$_GET['id']]['ifname']);
55
		}
56
		unset($a_ifgroups[$_GET['id']]);
57
		write_config();
58
		header("Location: interfaces_groups.php");
59
		exit;
60
	}
61
}
62

    
63
$pgtitle = array(gettext("Interfaces"),gettext("Groups"));
64
$shortcut_section = "interfaces";
65
include("head.inc");
66

    
67
?>
68

    
69
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
70
<?php include("fbegin.inc"); ?>
71

    
72
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces groups">
73
  <tr><td>
74
<?php
75
	$tab_array = array();
76
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
77
	$tab_array[1] = array(gettext("Interface Groups"), true, "interfaces_groups.php");
78
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
79
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
80
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
81
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
82
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
83
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
84
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
85
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
86
	display_top_tabs($tab_array);
87
?>
88
  </td></tr>
89
<tr>
90
    <td>
91
        <div id="mainarea">
92
        <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
93

    
94
<tr>
95
  <td width="15%" class="listhdrr"><?=gettext("Name");?></td>
96
  <td width="35%" class="listhdrr"><?=gettext("Members");?></td>
97
  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
98
  <td width="5%" class="list"></td>
99
</tr>
100
	  <?php if (count ($a_ifgroups)):
101
		$i = 0; foreach ($a_ifgroups as $ifgroupentry): ?>
102
<tr>
103
  <td class="listlr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
104
	<a href="/firewall_rules.php?if=<?=htmlspecialchars($ifgroupentry['ifname']);?>"><?=htmlspecialchars($ifgroupentry['ifname']);?></a>
105
  </td>
106
  <td class="listr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
107
      <?php
108
	$members_arr = explode(" ", $ifgroupentry['members']);
109
	$iflist = get_configured_interface_with_descr(false, true);
110
	$memberses_arr = array();
111
	foreach ($members_arr as $memb)
112
		$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
113
	unset($iflist);
114
	$memberses = implode(", ", $memberses_arr);
115
	echo $memberses;
116
	if(count($members_arr) < 10) {
117
		echo " ";
118
	} else {
119
		echo "...";
120
	}
121
    ?>
122
  </td>
123
  <td class="listbg" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
124
    <?=htmlspecialchars($ifgroupentry['descr']);?>&nbsp;
125
  </td>
126
  <td valign="middle" class="list nowrap">
127
    <table border="0" cellspacing="0" cellpadding="1" summary="icons">
128
      <tr>
129
        <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>
130
        <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>
131
      </tr>
132
    </table>
133
  </td>
134
</tr>
135
	  <?php $i++; endforeach; endif;?>
136
<tr>
137
  <td class="list" colspan="3"></td>
138
  <td class="list">
139
    <table border="0" cellspacing="0" cellpadding="1" summary="add">
140
      <tr>
141
	<td valign="middle" width="17">&nbsp;</td>
142
        <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>
143
      </tr>
144
    </table>
145
  </td>
146
</tr>
147
<tr>
148
  <td class="tabcont" colspan="3">
149
	<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>
150
	</td>
151
</tr>
152
	</table>
153
	</div>
154
 </td>
155
</tr>
156
</table>
157
<?php include("fend.inc"); ?>
158
</body>
159
</html>
(103-103/256)