Révision 81ca5f88
Ajouté par Renato Botelho il y a plus de 9 ans
usr/local/www/firewall_aliases_import.php | ||
---|---|---|
57 | 57 |
$reserved_keywords = array_merge($reserved_keywords, $reserved_ifs, $reserved_table_names); |
58 | 58 |
|
59 | 59 |
if (!is_array($config['aliases']['alias'])) |
60 |
$config['aliases']['alias'] = array();
|
|
60 |
$config['aliases']['alias'] = array();
|
|
61 | 61 |
$a_aliases = &$config['aliases']['alias']; |
62 | 62 |
|
63 | 63 |
if($_POST['aliasimport'] <> "") { |
... | ... | |
65 | 65 |
$reqdfieldsn = array(gettext("Name"),gettext("Aliases")); |
66 | 66 |
|
67 | 67 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); |
68 |
|
|
68 |
|
|
69 | 69 |
if (is_validaliasname($_POST['name']) == false) |
70 | 70 |
$input_errors[] = gettext("The alias name may only consist of the characters") . " a-z, A-Z, 0-9, _."; |
71 | 71 |
|
... | ... | |
75 | 75 |
|
76 | 76 |
|
77 | 77 |
/* Check for reserved keyword names */ |
78 |
foreach($reserved_keywords as $rk)
|
|
79 |
if ($rk == $_POST['name'])
|
|
80 |
$input_errors[] = sprintf(gettext("Cannot use a reserved keyword as alias name %s"), $rk);
|
|
81 |
|
|
82 |
/* check for name interface description conflicts */
|
|
83 |
foreach($config['interfaces'] as $interface) {
|
|
84 |
if($interface['descr'] == $_POST['name']) {
|
|
85 |
$input_errors[] = gettext("An interface description with this name already exists.");
|
|
86 |
break;
|
|
87 |
}
|
|
88 |
}
|
|
78 |
foreach($reserved_keywords as $rk)
|
|
79 |
if ($rk == $_POST['name'])
|
|
80 |
$input_errors[] = sprintf(gettext("Cannot use a reserved keyword as alias name %s"), $rk);
|
|
81 |
|
|
82 |
/* check for name interface description conflicts */
|
|
83 |
foreach($config['interfaces'] as $interface) {
|
|
84 |
if($interface['descr'] == $_POST['name']) {
|
|
85 |
$input_errors[] = gettext("An interface description with this name already exists.");
|
|
86 |
break;
|
|
87 |
}
|
|
88 |
}
|
|
89 | 89 |
|
90 | 90 |
if ($_POST['aliasimport']) { |
91 | 91 |
$tocheck = explode("\n", $_POST['aliasimport']); |
... | ... | |
147 | 147 |
if (write_config()) |
148 | 148 |
mark_subsystem_dirty('aliases'); |
149 | 149 |
pfSenseHeader("firewall_aliases.php"); |
150 |
|
|
150 |
|
|
151 | 151 |
exit; |
152 | 152 |
} |
153 | 153 |
} |
... | ... | |
163 | 163 |
<div id="inputerrors"></div> |
164 | 164 |
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="firewall alias import"> |
165 | 165 |
<tr> |
166 |
<td colspan="2" valign="top" class="listtopic"><?=gettext("Alias Import"); ?></td>
|
|
166 |
<td colspan="2" valign="top" class="listtopic"><?=gettext("Alias Import"); ?></td>
|
|
167 | 167 |
</tr> |
168 | 168 |
<tr> |
169 |
<td valign="top" class="vncellreq"><?=gettext("Alias Name"); ?></td> |
|
170 |
<td class="vtable"> <input name="name" type="text" class="formfld unknown" id="name" size="40" value="<?=htmlspecialchars($_POST['name']);?>" /> |
|
171 |
<br /> <span class="vexpl"> |
|
172 |
<?=gettext("The name of the alias may only consist of the characters \"a-z, A-Z and 0-9\"."); ?></span></td> |
|
169 |
<td valign="top" class="vncellreq"><?=gettext("Alias Name"); ?></td> |
|
170 |
<td class="vtable"> |
|
171 |
<input name="name" type="text" class="formfld unknown" id="name" size="40" maxlength="31" value="<?=htmlspecialchars($_POST['name']);?>" /> |
|
172 |
<br /> |
|
173 |
<span class="vexpl"> |
|
174 |
<?=gettext("The name of the alias may only consist of the characters \"a-z, A-Z and 0-9\"."); ?> |
|
175 |
</span> |
|
176 |
</td> |
|
173 | 177 |
</tr> |
174 | 178 |
<tr> |
175 |
<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td> |
|
176 |
<td width="78%" class="vtable"> <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($_POST['descr']);?>" /> |
|
177 |
<br /> <span class="vexpl"><?=gettext("You may enter a description here " . |
|
178 |
"for your reference (not parsed)"); ?>.</span></td> |
|
179 |
<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td> |
|
180 |
<td width="78%" class="vtable"> |
|
181 |
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($_POST['descr']);?>" /> |
|
182 |
<br /> |
|
183 |
<span class="vexpl"> |
|
184 |
<?=gettext("You may enter a description here for your reference (not parsed)"); ?>. |
|
185 |
</span> |
|
186 |
</td> |
|
179 | 187 |
</tr> |
180 | 188 |
<tr> |
181 |
<td valign="top" class="vncellreq"><?=gettext("Aliases to import"); ?></td> |
|
182 |
<td class="vtable"><textarea name="aliasimport" rows="15" cols="40"><?php echo $_POST['aliasimport']; ?></textarea> |
|
183 |
<br /> <span class="vexpl"><?=gettext("Paste in the aliases to import separated by a carriage return. Common examples are lists of IPs, networks, blacklists, etc."); ?> |
|
184 |
<br /> <?=gettext("The list may contain IP addresses, with or without CIDR prefix, IP ranges, blank lines (ignored) and an optional description after each IP. e.g.:"); ?> |
|
185 |
<br />172.16.1.2 |
|
186 |
<br />172.16.0.0/24 |
|
187 |
<br />10.11.12.100-10.11.12.200 |
|
188 |
<br />192.168.1.254 Home router |
|
189 |
<br />10.20.0.0/16 Office network |
|
190 |
<br />10.40.1.10-10.40.1.19 Managed switches</span></td> |
|
189 |
<td valign="top" class="vncellreq"><?=gettext("Aliases to import"); ?></td> |
|
190 |
<td class="vtable"> |
|
191 |
<textarea name="aliasimport" rows="15" cols="40"><?php echo $_POST['aliasimport']; ?></textarea> |
|
192 |
<br /> |
|
193 |
<span class="vexpl"> |
|
194 |
<?=gettext("Paste in the aliases to import separated by a carriage return. Common examples are lists of IPs, networks, blacklists, etc."); ?> |
|
195 |
<br /> |
|
196 |
<?=gettext("The list may contain IP addresses, with or without CIDR prefix, IP ranges, blank lines (ignored) and an optional description after each IP. e.g.:"); ?> |
|
197 |
<br />172.16.1.2 |
|
198 |
<br />172.16.0.0/24 |
|
199 |
<br />10.11.12.100-10.11.12.200 |
|
200 |
<br />192.168.1.254 Home router |
|
201 |
<br />10.20.0.0/16 Office network |
|
202 |
<br />10.40.1.10-10.40.1.19 Managed switches |
|
203 |
</span> |
|
204 |
</td> |
|
191 | 205 |
</tr> |
192 | 206 |
<tr> |
193 |
<td width="22%" valign="top"> </td> |
|
194 |
<td width="78%"> |
|
195 |
<input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> |
|
196 |
<input class="formbtn" type="button" value="<?=gettext("Cancel"); ?>" onclick="history.back()" /> |
|
197 |
</td></tr> |
|
207 |
<td width="22%" valign="top"> </td> |
|
208 |
<td width="78%"> |
|
209 |
<input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> |
|
210 |
<input class="formbtn" type="button" value="<?=gettext("Cancel"); ?>" onclick="history.back()" /> |
|
211 |
</td> |
|
212 |
</tr> |
|
198 | 213 |
</table> |
199 | 214 |
|
200 | 215 |
|
... | ... | |
202 | 217 |
</div> |
203 | 218 |
|
204 | 219 |
<?php include("fend.inc"); ?> |
205 |
|
|
220 |
|
|
206 | 221 |
<script type="text/javascript"> |
207 | 222 |
//<![CDATA[ |
208 | 223 |
NiftyCheck(); |
Formats disponibles : Unified diff
Fix indent whitespaces