Project

General

Profile

Download (6.14 KB) Statistics
| Branch: | Tag: | Revision:
1 ead45104 Ermal Luçi
<?php
2
/* $Id$ */
3
/*
4
	interfaces_gif.php
5
6
	Copyright (C) 2008 Ermal Lu?i
7
	All rights reserved.
8
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30 7ac5a4cb Scott Ullrich
/*
31
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
32
	pfSense_MODULE:	interfaces
33
*/
34 ead45104 Ermal Luçi
35 6b07c15a Matthew Grooms
##|+PRIV
36
##|*IDENT=page-interfaces-gif
37
##|*NAME=Interfaces: GIF page
38
##|*DESCR=Allow access to the 'Interfaces: GIF' page.
39
##|*MATCH=interfaces_gif.php*
40
##|-PRIV
41
42 ead45104 Ermal Luçi
require("guiconfig.inc");
43
44
if (!is_array($config['gifs']['gif']))
45
	$config['gifs']['gif'] = array();
46
47
$a_gifs = &$config['gifs']['gif'] ;
48
49
function gif_inuse($num) {
50 c059940b Erik Fonnesbeck
	global $config, $a_gifs;
51 ead45104 Ermal Luçi
52
	$iflist = get_configured_interface_list(false, true);
53
	foreach ($iflist as $if) {
54 2eedb548 Ermal Luçi
		if ($config['interfaces'][$if]['if'] == $a_gifs[$num]['gifif']) 
55 ead45104 Ermal Luçi
			return true;
56
	}
57
58
	return false;
59
}
60
61
if ($_GET['act'] == "del") {
62 0e22dda5 Ermal
	if (!isset($_GET['id']))
63
                $input_errors[] = getext("Wrong parameters supplied");
64
        else if (empty($a_gifs[$_GET['id']]))
65
                $input_errors[] = getext("Wrong index supplied");
66 ead45104 Ermal Luçi
	/* check if still in use */
67 0e22dda5 Ermal
	else if (gif_inuse($_GET['id'])) {
68 57d84321 Carlos Eduardo Ramos
		$input_errors[] = gettext("This gif TUNNEL cannot be deleted because it is still being used as an interface.");
69 ead45104 Ermal Luçi
	} else {
70
		mwexec("/sbin/ifconfig " . $a_gifs[$_GET['id']]['gifif'] . " destroy");
71
		unset($a_gifs[$_GET['id']]);
72
73
		write_config();
74
75
		header("Location: interfaces_gif.php");
76
		exit;
77
	}
78
}
79
80 57d84321 Carlos Eduardo Ramos
$pgtitle = array(gettext("Interfaces"),gettext("GIF"));
81 b32dd0a6 jim-p
$shortcut_section = "interfaces";
82 ead45104 Ermal Luçi
include("head.inc");
83
84
?>
85
86
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
87
<?php include("fbegin.inc"); ?>
88
<?php if ($input_errors) print_input_errors($input_errors); ?>
89 6c7fe3b7 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces gif">
90 ead45104 Ermal Luçi
  <tr><td>
91
<?php
92
	$tab_array = array();
93 57d84321 Carlos Eduardo Ramos
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
94
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
95
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
96
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
97
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
98
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
99
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
100
	$tab_array[7] = array(gettext("GIF"), true, "interfaces_gif.php");
101
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
102
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
103 ead45104 Ermal Luçi
	display_top_tabs($tab_array);
104
?>
105
  </td></tr>
106
  <tr>
107
    <td>
108
	<div id="mainarea">
109 6c7fe3b7 Colin Fleming
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
110 ead45104 Ermal Luçi
                <tr>
111 57d84321 Carlos Eduardo Ramos
                  <td width="20%" class="listhdrr"><?=gettext("Interface"); ?></td>
112 8cc2d7a6 Carlos Eduardo Ramos
                  <td width="20%" class="listhdrr"><?=gettext("Tunnel to..."); ?></td>
113 57d84321 Carlos Eduardo Ramos
                  <td width="50%" class="listhdr"><?=gettext("Description"); ?></td>
114 ead45104 Ermal Luçi
                  <td width="10%" class="list"></td>
115
				</tr>
116
			  <?php $i = 0; foreach ($a_gifs as $gif): ?>
117 fd22be34 Ermal Lu?i
                <tr  ondblclick="document.location='interfaces_gif_edit.php?id=<?=$i;?>'">
118 ead45104 Ermal Luçi
                  <td class="listlr">
119 d76f45b1 Ermal
					<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gif['if']));?>
120 ead45104 Ermal Luçi
                  </td>
121
                  <td class="listr">
122
					<?=htmlspecialchars($gif['remote-addr']);?>
123
                  </td>
124
                  <td class="listbg">
125
                    <?=htmlspecialchars($gif['descr']);?>&nbsp;
126
                  </td>
127 6c7fe3b7 Colin Fleming
                  <td valign="middle" class="list nowrap"> <a href="interfaces_gif_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
128
                     &nbsp;<a href="interfaces_gif.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this gif tunnel?"); ?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
129 ead45104 Ermal Luçi
				</tr>
130
			  <?php $i++; endforeach; ?>
131
                <tr>
132
                  <td class="list" colspan="3">&nbsp;</td>
133 6c7fe3b7 Colin Fleming
                  <td class="list"> <a href="interfaces_gif_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
134 ead45104 Ermal Luçi
				</tr>
135
				<tr>
136
				<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
137 6c7fe3b7 Colin Fleming
				  <?=gettext("Note:"); ?><br/>
138 ead45104 Ermal Luçi
				  </strong></span>
139 ef8b7960 Vinicius Coque
				  <?=gettext("GIF tunnels are configured here."); ?>
140 b835b1fa jim-p
				  <br/><br/>
141 6c7fe3b7 Colin Fleming
				  <?php echo gettext("If you are using a GIF tunnel to connect to a Hurricane Electric (he.net) Tunnel Broker on a WAN with a dynamic IP, you may want to add a"); ?> <a href="services_dyndns.php"><?php echo gettext("HE.net Tunnelbroker type DynDNS Entry"); ?></a> <?php echo gettext("to keep your tunnel functional when your IP changes."); ?></p>
142 ead45104 Ermal Luçi
				  </td>
143
				<td class="list">&nbsp;</td>
144
				</tr>
145
              </table>
146
	      </div>
147
	</td>
148
	</tr>
149
</table>
150
<?php include("fend.inc"); ?>
151
</body>
152
</html>