diff options
author | NOYB <Al_Stu@Frontier.com> | 2016-01-16 00:22:55 -0800 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-01-18 08:03:45 -0500 |
commit | deab4cdf88a373ced4297b2457145a2a1c416751 (patch) | |
tree | 78d8f94d53b65d83c9fc11b765c4b00e06cf99fc /src/usr/local | |
parent | a2c6f0731ec554ba61ecd8c0fd5ec60388ef3688 (diff) | |
download | pfsense-deab4cdf88a373ced4297b2457145a2a1c416751.zip pfsense-deab4cdf88a373ced4297b2457145a2a1c416751.tar.gz |
Firewall / Aliases / Edit - Pattern
Address field is used for a wide variety of input types. Including URLs which require a much greater character set acceptance.
Diffstat (limited to 'src/usr/local')
-rwxr-xr-x | src/usr/local/www/firewall_aliases_edit.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index 8f2ca24..c6d7372 100755 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -591,6 +591,19 @@ $help = array( "update frequency in days.</b>" ); +// Tab type specific patterns. +// Intentionally loose (valid character check only, no pattern recognition). +// Can be tightend up with pattern recognition as desired for each tab type. +$pattern_str = array( + 'network' => '[a-zA-Z0-9_:.-]+', // Alias Name, Host Name, IP Address, FQDN, Network or IP Address Range + 'host' => '[a-zA-Z0-9_:.-]+', // Alias Name, Host Name, IP Address, FQDN + 'port' => '[a-zA-Z0-9_:]+', // Alias Name, Port Number, or Port Number Range + 'url' => '.*', // Alias Name or URL + 'url_ports' => '.*', // Alias Name or URL + 'urltable' => '.*', // Alias Name or URL + 'urltable_ports' => '.*' // Alias Name or URL +); + $types = array( 'host' => 'Host(s)', 'network' => 'Network(s)', @@ -699,7 +712,7 @@ while ($counter < count($addresses)) { 'address' . $counter, 'Address', $address - ))->addMask('address_subnet' . $counter, $address_subnet)->setWidth(4)->setPattern('[a-zA-Z0-9\-\.\:]+'); + ))->addMask('address_subnet' . $counter, $address_subnet)->setWidth(4)->setPattern($pattern_str[$tab]); $group->add(new Form_Input( 'detail' . $counter, @@ -757,6 +770,12 @@ events.push(function() { var labelstr = <?=json_encode($label_str);?>; $('.repeatable:first').find('label').text(labelstr[tab]); + // Set the input field pattern by tab type + var patternstr = <?=json_encode($pattern_str);?>; + for (i = 0; i < <?=$counter;?>; i++) { + $('#address' + i).prop('pattern', patternstr[tab]); + } + // Hide and disable rows other than the first hideRowsAfter(1, (tab == 'urltable') || (tab == 'urltable_ports')); |