Project

General

Profile

Download (4.06 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-2019 Rubicon Communications, LLC (Netgate)
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
init_config_arr(array('gifs', 'gif'));
32
$a_gifs = &$config['gifs']['gif'] ;
33

    
34
function gif_inuse($num) {
35
	global $config, $a_gifs;
36

    
37
	$iflist = get_configured_interface_list(true);
38
	foreach ($iflist as $if) {
39
		if ($config['interfaces'][$if]['if'] == $a_gifs[$num]['gifif']) {
40
			return true;
41
		}
42
	}
43

    
44
	return false;
45
}
46

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

    
59
		write_config();
60

    
61
		header("Location: interfaces_gif.php");
62
		exit;
63
	}
64
}
65

    
66
$pgtitle = array(gettext("Interfaces"), gettext("GIFs"));
67
$shortcut_section = "interfaces";
68
include("head.inc");
69

    
70
if ($input_errors) {
71
	print_input_errors($input_errors);
72
}
73

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

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

    
131
<?php include("foot.inc");
(75-75/234)