Project

General

Profile

Download (4.43 KB) Statistics
| Branch: | Tag: | Revision:
1 ead45104 Ermal Luçi
<?php
2
/* $Id$ */
3
/*
4
	interfaces_gif.php
5
6 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7 1d7ba683 ayvis
	Copyright (C) 2008 Ermal Luçi
8 ead45104 Ermal Luçi
	All rights reserved.
9
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31 7ac5a4cb Scott Ullrich
/*
32
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
33 6a2a3416 sbeaver
	pfSense_MODULE: interfaces
34 7ac5a4cb Scott Ullrich
*/
35 ead45104 Ermal Luçi
36 6b07c15a Matthew Grooms
##|+PRIV
37
##|*IDENT=page-interfaces-gif
38
##|*NAME=Interfaces: GIF page
39
##|*DESCR=Allow access to the 'Interfaces: GIF' page.
40
##|*MATCH=interfaces_gif.php*
41
##|-PRIV
42
43 ead45104 Ermal Luçi
require("guiconfig.inc");
44
45 2af86dda Phil Davis
if (!is_array($config['gifs']['gif'])) {
46 ead45104 Ermal Luçi
	$config['gifs']['gif'] = array();
47 2af86dda Phil Davis
}
48 ead45104 Ermal Luçi
49
$a_gifs = &$config['gifs']['gif'] ;
50
51
function gif_inuse($num) {
52 c059940b Erik Fonnesbeck
	global $config, $a_gifs;
53 ead45104 Ermal Luçi
54
	$iflist = get_configured_interface_list(false, true);
55
	foreach ($iflist as $if) {
56 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $a_gifs[$num]['gifif']) {
57 ead45104 Ermal Luçi
			return true;
58 2af86dda Phil Davis
		}
59 ead45104 Ermal Luçi
	}
60
61
	return false;
62
}
63
64
if ($_GET['act'] == "del") {
65 2af86dda Phil Davis
	if (!isset($_GET['id'])) {
66
		$input_errors[] = gettext("Wrong parameters supplied");
67
	} else if (empty($a_gifs[$_GET['id']])) {
68
		$input_errors[] = gettext("Wrong index supplied");
69 ead45104 Ermal Luçi
	/* check if still in use */
70 2af86dda Phil Davis
	} else if (gif_inuse($_GET['id'])) {
71 57d84321 Carlos Eduardo Ramos
		$input_errors[] = gettext("This gif TUNNEL cannot be deleted because it is still being used as an interface.");
72 ead45104 Ermal Luçi
	} else {
73
		mwexec("/sbin/ifconfig " . $a_gifs[$_GET['id']]['gifif'] . " destroy");
74
		unset($a_gifs[$_GET['id']]);
75
76
		write_config();
77
78
		header("Location: interfaces_gif.php");
79
		exit;
80
	}
81
}
82
83 6c07db48 Phil Davis
$pgtitle = array(gettext("Interfaces"), gettext("GIF"));
84 b32dd0a6 jim-p
$shortcut_section = "interfaces";
85 ead45104 Ermal Luçi
include("head.inc");
86 814b5184 sbeaver
87 6a2a3416 sbeaver
if ($input_errors)
88
	print_input_errors($input_errors);
89
90
$tab_array = array();
91 c8610c74 Sjon Hortensius
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
92
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
93
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
94
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
95
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
96
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
97
$tab_array[] = array(gettext("GRE"), false, "interfaces_gre.php");
98
$tab_array[] = array(gettext("GIF"), true, "interfaces_gif.php");
99
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
100
$tab_array[] = array(gettext("LAGG"), false, "interfaces_lagg.php");
101 6a2a3416 sbeaver
display_top_tabs($tab_array);
102 ead45104 Ermal Luçi
?>
103
104 6a2a3416 sbeaver
<div class="table-responsive">
105
	<table class="table table-striped table-hover table-condensed">
106
		<thead>
107
			<tr>
108 c8610c74 Sjon Hortensius
				<th><?=gettext("Interface"); ?></th>
109 256f418c Sjon Hortensius
				<th><?=gettext("Tunnel to &hellip;"); ?></th>
110 c8610c74 Sjon Hortensius
				<th><?=gettext("Description"); ?></th>
111
				<th></th>
112 6a2a3416 sbeaver
			</tr>
113
		</thead>
114
		<tbody>
115 c8610c74 Sjon Hortensius
<?php foreach ($a_gifs as $i => $gif): ?>
116
			<tr>
117 6a2a3416 sbeaver
				<td>
118
					<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gif['if']))?>
119
				</td>
120
				<td>
121
					<?=htmlspecialchars($gif['remote-addr'])?>
122
				</td>
123
				<td>
124
					<?=htmlspecialchars($gif['descr'])?>
125
				</td>
126
				<td>
127 814b5184 sbeaver
					<a href="interfaces_gif_edit.php?id=<?=$i?>" class="btn btn-default btn-xs"><?=gettext("Edit")?></a>
128
					<a href="interfaces_gif.php?act=del&amp;id=<?=$i?>" class="btn btn-danger btn-xs"><?=gettext("Delete")?></a>
129 6a2a3416 sbeaver
				</td>
130
			</tr>
131 c8610c74 Sjon Hortensius
<?php endforeach; ?>
132 6a2a3416 sbeaver
		</tbody>
133
	</table>
134
</div>
135
136 c8610c74 Sjon Hortensius
<nav class="action-buttons">
137
	<a href="interfaces_gif_edit.php" class="btn btn-success">
138
		<?=gettext("Add")?>
139
	</a>
140
</nav>
141
142 6a2a3416 sbeaver
<?php include("foot.inc");