Projet

Général

Profil

Télécharger (7,13 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / firewall_nat_npt.php @ fab1cd2f

1
<?php
2
/* $Id$ */
3
/*
4
	firewall_nat_npt.php
5
	part of pfSense (https://www.pfsense.org)
6

    
7
	Copyright (C) 2011 Seth Mos <seth.mos@dds.nl>.
8
	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
/*
32
	pfSense_MODULE:	nat
33
*/
34

    
35
##|+PRIV
36
##|*IDENT=page-firewall-nat-npt
37
##|*NAME=Firewall: NAT: NPT page
38
##|*DESCR=Allow access to the 'Firewall: NAT: NPT' page.
39
##|*MATCH=firewall_nat_npt.php*
40
##|-PRIV
41

    
42
require("guiconfig.inc");
43
require_once("functions.inc");
44
require_once("filter.inc");
45
require_once("shaper.inc");
46

    
47
if (!is_array($config['nat']['npt'])) {
48
	$config['nat']['npt'] = array();
49
}
50
$a_npt = &$config['nat']['npt'];
51

    
52
if ($_POST) {
53

    
54
	$pconfig = $_POST;
55

    
56
	if ($_POST['apply']) {
57
		$retval = 0;
58
		$retval |= filter_configure();
59
		$savemsg = get_std_save_message($retval);
60

    
61
		if ($retval == 0) {
62
			clear_subsystem_dirty('natconf');
63
			clear_subsystem_dirty('filter');
64
		}
65
	}
66
}
67

    
68
if ($_GET['act'] == "del") {
69
	if ($a_npt[$_GET['id']]) {
70
		unset($a_npt[$_GET['id']]);
71
		if (write_config())
72
			mark_subsystem_dirty('natconf');
73
		header("Location: firewall_nat_npt.php");
74
		exit;
75
	}
76
}
77

    
78
$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("NPt"));
79
include("head.inc");
80

    
81
?>
82
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
83
<?php include("fbegin.inc"); ?>
84
<form action="firewall_nat_npt.php" method="post">
85
<?php if ($savemsg) print_info_box($savemsg); ?>
86
<?php if (is_subsystem_dirty('natconf')): ?>
87
<?php print_info_box_np(gettext("The NAT configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
88
<?php endif; ?>
89
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall nat npt">  <tr><td>
90
<?php
91
	$tab_array = array();
92
	$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
93
	$tab_array[] = array(gettext("1:1"), false, "firewall_nat_1to1.php");
94
	$tab_array[] = array(gettext("Outbound"), false, "firewall_nat_out.php");
95
	$tab_array[] = array(gettext("NPt"), true, "firewall_nat_npt.php");
96
	display_top_tabs($tab_array);
97
?>
98
  </td></tr>
99
  <tr>
100
    <td>
101
	<div id="mainarea">
102
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
103
                <tr>
104
		  <td width="10%" class="listhdrr"><?=gettext("Interface"); ?></td>
105
                  <td width="20%" class="listhdrr"><?=gettext("External Prefix"); ?></td>
106
                  <td width="15%" class="listhdrr"><?=gettext("Internal prefix"); ?></td>
107
                  <td width="30%" class="listhdr"><?=gettext("Description"); ?></td>
108
                  <td width="10%" class="list">
109
                    <table border="0" cellspacing="0" cellpadding="1" summary="add">
110
                      <tr>
111
			<td width="17"></td>
112
                        <td valign="middle"><a href="firewall_nat_npt_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add rule"); ?>" alt="add" /></a></td>
113
                      </tr>
114
                    </table>
115
		  </td>
116
				</tr>
117
	  <?php 
118
			$textse = "</span>";
119

    
120
			$i = 0; foreach ($a_npt as $natent):
121

    
122
			if (isset($natent['disabled']))
123
				$textss = "<span class=\"gray\">";
124
			else
125
				$textss = "<span>"; ?>
126
                <tr>
127
		  <td class="listlr" ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
128
                  <?php
129
			echo $textss;
130
					if (!$natent['interface'])
131
						echo htmlspecialchars(convert_friendly_interface_to_friendly_descr("wan"));
132
					else
133
						echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface']));
134
			echo $textse;
135
				  ?>
136
                  </td>
137
                    <?php 
138
			$source_net = pprint_address($natent['source']);
139
			$source_cidr = strstr($source_net, '/');
140
			$destination_net = pprint_address($natent['destination']);
141
			$destination_cidr = strstr($destination_net, '/');
142
                    ?>
143
                  <td class="listr" ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
144
                    <?php 		echo $textss . $destination_net . $textse; ?>
145
                  </td>
146
                  <td class="listr" ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
147
                    <?php 		echo $textss . $source_net . $textse; ?>
148
                  </td>
149
                  <td class="listbg" ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
150
			<?=$textss;?>
151
                    <?=htmlspecialchars($natent['descr']);?>&nbsp;
152
			<?=$textse;?>
153
                  </td>
154
                  <td class="list nowrap">
155
                    <table border="0" cellspacing="0" cellpadding="1" summary="edit">
156
                      <tr>
157
                        <td valign="middle"><a href="firewall_nat_npt_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit rule"); ?>" alt="edit" /></a></td>
158
			<td valign="middle"><a href="firewall_nat_npt.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete rule"); ?>" alt="delete" /></a></td>
159
                      </tr>
160
                    </table>
161
                  </td>
162
                </tr>
163
		<?php $i++; endforeach; ?>
164
                <tr>
165
                  <td class="list" colspan="4"></td>
166
                  <td class="list">
167
                    <table border="0" cellspacing="0" cellpadding="1" summary="add">
168
                      <tr>
169
			<td width="17"></td>
170
                        <td valign="middle"><a href="firewall_nat_npt_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add rule"); ?>" alt="add" /></a></td>
171
                      </tr>
172
                    </table>
173
                  </td>
174
                </tr>
175
              </table>
176
	    </div>
177
	</td>
178
</tr>
179
</table>
180
</form>
181
<?php include("fend.inc"); ?>
182
</body>
183
</html>
(66-66/255)