Project

General

Profile

Download (5.64 KB) Statistics
| Branch: | Tag: | Revision:
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
##|+PRIV
30
##|*IDENT=page-interfaces-groups
31
##|*NAME=Interfaces: Groups page
32
##|*DESCR=Create interface groups
33
##|*MATCH=interfaces_groups.php*
34
##|-PRIV
35

    
36

    
37
require("guiconfig.inc");
38

    
39
if (!is_array($config['ifgroups']['ifgroupentry']))
40
	$config['ifgroups']['ifgroupentry'] = array();
41

    
42
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
43

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

    
59
$pgtitle = array("Interfaces","Groups");
60
include("head.inc");
61

    
62
?>
63

    
64
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
65
<?php include("fbegin.inc"); ?>
66

    
67
<table width="100%" border="0" cellpadding="0" cellspacing="0">
68
  <tr><td>
69
<?php
70
        $tab_array = array();
71
        $tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
72
	$tab_array[1] = array("Interface Groups", true, "interfaces_groups.php");
73
        $tab_array[2] = array("VLANs", false, "interfaces_vlan.php");
74
        $tab_array[3] = array("PPP", false, "interfaces_ppp.php");
75
        $tab_array[4] = array("GRE", false, "interfaces_gre.php");
76
        $tab_array[5] = array("GIF", false, "interfaces_gif.php");
77
        $tab_array[6] = array("Bridges", false, "interfaces_bridge.php");
78
        $tab_array[7] = array("LAGG", false, "interfaces_lagg.php");
79
        display_top_tabs($tab_array);
80
?>
81
  </td></tr>
82
<tr>
83
    <td>
84
        <div id="mainarea">
85
        <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
86

    
87
<tr>
88
  <td width="15%" class="listhdrr">Name</td>
89
  <td width="35%" class="listhdrr">Members</td>
90
  <td width="25%" class="listhdr">Description</td>
91
  <td width="5%" class="list"></td>
92
</tr>
93
	  <?php if (count ($a_ifgroups)):
94
		$i = 0; foreach ($a_ifgroups as $ifgroupentry): ?>
95
<tr>
96
  <td class="listlr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
97
	<a href="/firewall_rules.php?if=<?=htmlspecialchars($ifgroupentry['ifname']);?>"><?=htmlspecialchars($ifgroupentry['ifname']);?></a>
98
  </td>
99
  <td class="listr" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
100
      <?php
101
	$members_arr = explode(" ", $ifgroupentry['members']);
102
	$iflist = get_configured_interface_with_descr();
103
	$memberses_arr = array();
104
	foreach ($members_arr as $memb)
105
		$memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb;
106
	$memberses = implode(", ", $memberses_arr);
107
	echo $memberses;
108
	if(count($members_arr) < 10) {
109
		echo " ";
110
	} else {
111
		echo "...";
112
	}
113
    ?>
114
  </td>
115
  <td class="listbg" ondblclick="document.location='interfaces_groups_edit.php?id=<?=$i;?>';">
116
    <?=htmlspecialchars($ifgroupentry['descr']);?>&nbsp;
117
  </td>
118
  <td valign="middle" nowrap class="list">
119
    <table border="0" cellspacing="0" cellpadding="1">
120
      <tr>
121
        <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="edit group"></a></td>
122
        <td><a href="interfaces_groups.php?act=del&id=<?=$i;?>" onclick="return confirm('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="delete ifgroupentry"></a></td>
123
      </tr>
124
    </table>
125
  </td>
126
</tr>
127
	  <?php $i++; endforeach; endif;?>
128
<tr>
129
  <td class="list" colspan="3"></td>
130
  <td class="list">
131
    <table border="0" cellspacing="0" cellpadding="1">
132
      <tr>
133
	<td valign="middle" width="17">&nbsp;</td>
134
        <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="add a new group"></a></td>
135
        </td>
136
      </tr>
137
    </table>
138
  </td>
139
</tr>
140
<tr>
141
  <td class="tabcont" colspan="3">
142
	<p><span class="vexpl"><span class="red"><strong>Note:<br></strong></span>Interface Groups allow you to create rules that apply to multiple interface at once. If you remove members from an interface group the rules do not apply anymore to that interface.</span></p>
143
	</td>
144
</tr>
145
	</table>
146
	</div>
147
 </td>
148
</tr>
149
</table>
150
<?php include("fend.inc"); ?>
151
</body>
152
</html>
(80-80/203)