Project

General

Profile

Download (4.09 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * interfaces_gif.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2016 Electric Sheep Fencing, LLC
7
 * All rights reserved.
8
 *
9
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12
 *
13
 * http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20
 */
21

    
22
##|+PRIV
23
##|*IDENT=page-interfaces-gif
24
##|*NAME=Interfaces: GIF
25
##|*DESCR=Allow access to the 'Interfaces: GIF' page.
26
##|*MATCH=interfaces_gif.php*
27
##|-PRIV
28

    
29
require_once("guiconfig.inc");
30

    
31
if (!is_array($config['gifs']['gif'])) {
32
	$config['gifs']['gif'] = array();
33
}
34

    
35
$a_gifs = &$config['gifs']['gif'] ;
36

    
37
function gif_inuse($num) {
38
	global $config, $a_gifs;
39

    
40
	$iflist = get_configured_interface_list(false, true);
41
	foreach ($iflist as $if) {
42
		if ($config['interfaces'][$if]['if'] == $a_gifs[$num]['gifif']) {
43
			return true;
44
		}
45
	}
46

    
47
	return false;
48
}
49

    
50
if ($_GET['act'] == "del") {
51
	if (!isset($_GET['id'])) {
52
		$input_errors[] = gettext("Wrong parameters supplied");
53
	} else if (empty($a_gifs[$_GET['id']])) {
54
		$input_errors[] = gettext("Wrong index supplied");
55
	/* check if still in use */
56
	} else if (gif_inuse($_GET['id'])) {
57
		$input_errors[] = gettext("This gif TUNNEL cannot be deleted because it is still being used as an interface.");
58
	} else {
59
		mwexec("/sbin/ifconfig " . $a_gifs[$_GET['id']]['gifif'] . " destroy");
60
		unset($a_gifs[$_GET['id']]);
61

    
62
		write_config();
63

    
64
		header("Location: interfaces_gif.php");
65
		exit;
66
	}
67
}
68

    
69
$pgtitle = array(gettext("Interfaces"), gettext("GIFs"));
70
$shortcut_section = "interfaces";
71
include("head.inc");
72

    
73
if ($input_errors) {
74
	print_input_errors($input_errors);
75
}
76

    
77
$tab_array = array();
78
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
79
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
80
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
81
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
82
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
83
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
84
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
85
$tab_array[] = array(gettext("GIFs"), true, "interfaces_gif.php");
86
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
87
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
88
display_top_tabs($tab_array);
89
?>
90
<div class="panel panel-default">
91
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('GIF Interfaces')?></h2></div>
92
	<div class="panel-body">
93
		<div class="table-responsive">
94
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
95
				<thead>
96
					<tr>
97
						<th><?=gettext("Interface"); ?></th>
98
						<th><?=gettext("Tunnel to &hellip;"); ?></th>
99
						<th><?=gettext("Description"); ?></th>
100
						<th><?=gettext("Actions"); ?></th>
101
					</tr>
102
				</thead>
103
				<tbody>
104
<?php foreach ($a_gifs as $i => $gif): ?>
105
					<tr>
106
						<td>
107
							<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gif['if']))?>
108
						</td>
109
						<td>
110
							<?=htmlspecialchars($gif['remote-addr'])?>
111
						</td>
112
						<td>
113
							<?=htmlspecialchars($gif['descr'])?>
114
						</td>
115
						<td>
116
							<a class="fa fa-pencil"	title="<?=gettext('Edit GIF interface')?>"	href="interfaces_gif_edit.php?id=<?=$i?>"></a>
117
							<a class="fa fa-trash"	title="<?=gettext('Delete GIF interface')?>"	href="interfaces_gif.php?act=del&amp;id=<?=$i?>"></a>
118
						</td>
119
					</tr>
120
<?php endforeach; ?>
121
				</tbody>
122
			</table>
123
		</div>
124
	</div>
125
</div>
126

    
127
<nav class="action-buttons">
128
	<a href="interfaces_gif_edit.php" class="btn btn-success btn-sm">
129
		<i class="fa fa-plus icon-embed-btn"></i>
130
		<?=gettext("Add")?>
131
	</a>
132
</nav>
133

    
134
<?php include("foot.inc");
(72-72/227)