diff options
51 files changed, 383 insertions, 248 deletions
diff --git a/conf.default/config.xml b/conf.default/config.xml index 817031c..e16800e 100644 --- a/conf.default/config.xml +++ b/conf.default/config.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <pfsense> - <version>11.8</version> + <version>11.9</version> <lastchange/> <theme>pfsense_ng</theme> <system> diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index 5eb3d5c..222d9d8 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -81,6 +81,7 @@ function encrypted_configxml() { exec("/bin/mv {$g['conf_path']}/config.xml.tmp {$g['conf_path']}/config.xml"); echo "\n" . gettext("Config.xml unlocked.") . "\n"; fclose($fp); + pfSense_fsync("{$g['conf_path']}/config.xml"); } else { echo "\n" . gettext("Invalid password entered. Please try again.") . "\n"; } @@ -187,12 +188,15 @@ function generate_config_cache($config) { $configcache = fopen($g['tmp_path'] . '/config.cache', "w"); fwrite($configcache, serialize($config)); fclose($configcache); + pfSense_fsync("{$g['tmp_path']}/config.cache"); + unset($configcache); /* Used for config.extra.xml */ if (file_exists($g['tmp_path'] . '/config.extra.cache') && $config_extra) { $configcacheextra = fopen($g['tmp_path'] . '/config.extra.cache', "w"); fwrite($configcacheextra, serialize($config_extra)); fclose($configcacheextra); + pfSense_fsync("{$g['tmp_path']}/config.extra.cache"); unset($configcacheextra); } } @@ -218,6 +222,8 @@ function restore_backup($file) { conf_mount_rw(); unlink_if_exists("{$g['tmp_path']}/config.cache"); copy("$file", "/cf/conf/config.xml"); + pfSense_fsync("/cf/conf/config.xml"); + pfSense_fsync($g['conf_path']); disable_security_checks(); log_error(sprintf(gettext('%1$s is restoring the configuration %2$s'), $g['product_name'], $file)); file_notice("config.xml", sprintf(gettext('%1$s is restoring the configuration %2$s'), $g['product_name'], $file), "pfSenseConfigurator", ""); @@ -379,7 +385,7 @@ function conf_mount_ro() { clear_subsystem_dirty('mount'); /* sync data, then force a remount of /cf */ - pfSense_sync(); + pfSense_fsync($g['cf_path']); mwexec("/sbin/mount -u -r -f -o sync,noatime {$g['cf_path']}"); mwexec("/sbin/mount -u -r -f -o sync,noatime /"); } @@ -486,16 +492,14 @@ function safe_write_file($file, $content, $force_binary) { fflush($fd); fclose($fd); - if (!rename($tmp_file, $file)) { + if (!pfSense_fsync($tmp_file) || !rename($tmp_file, $file)) { // Unable to move temporary file to original @unlink($tmp_file); return false; } // Sync file before returning - pfSense_sync(); - - return true; + return pfSense_fsync($file); } /****f* config/write_config @@ -545,7 +549,7 @@ function write_config($desc="Unknown", $backup = true) { /* write new configuration */ if (!safe_write_file("{$g['cf_conf_path']}/config.xml", $xmlconfig, false)) { - log_error(gettext("WARNING: Config contents could not be save. Could not open file!")); + log_error(gettext("WARNING: Config contents could not be saved. Could not open file!")); unlock($lockkey); file_notice("config.xml", sprintf(gettext("Unable to open %s/config.xml for writing in write_config()%s"), $g['cf_conf_path'], "\n")); return -1; @@ -830,6 +834,7 @@ function cleanup_backupcache($lock = false) { $bakout = fopen($g['cf_conf_path'] . '/backup/backup.cache', "w"); fwrite($bakout, serialize($tocache)); fclose($bakout); + pfSense_fsync("{$g['cf_conf_path']}/backup/backup.cache"); conf_mount_ro(); if (!$lock) { @@ -866,12 +871,12 @@ function backup_config() { /* Create backup directory if needed */ safe_mkdir("{$g['cf_conf_path']}/backup"); - if ($config['revision']['time'] == "") { $baktime = 0; } else { $baktime = $config['revision']['time']; } + if ($config['revision']['description'] == "") { $bakdesc = "Unknown"; } else { @@ -881,6 +886,7 @@ function backup_config() { $bakver = ($config['version'] == "") ? "?" : $config['version']; $bakfilename = $g['cf_conf_path'] . '/backup/config-' . $baktime . '.xml'; copy($g['cf_conf_path'] . '/config.xml', $bakfilename); + if (file_exists($g['cf_conf_path'] . '/backup/backup.cache')) { $backupcache = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache')); } else { @@ -890,6 +896,7 @@ function backup_config() { $bakout = fopen($g['cf_conf_path'] . '/backup/backup.cache', "w"); fwrite($bakout, serialize($backupcache)); fclose($bakout); + pfSense_fsync("{$g['cf_conf_path']}/backup/backup.cache"); conf_mount_ro(); diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class index 29b5689..cb21fb5 100644 --- a/etc/inc/dyndns.class +++ b/etc/inc/dyndns.class @@ -690,13 +690,13 @@ curl_setopt($ch, CURLOPT_URL, $server .$port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP); break; case 'gratisdns': - $needsIP = FALSE; + $needsIP = TRUE; if ($this->_dnsVerboseLog) { log_error("GratisDNS.dk ({$this->_dnsHost}): DNS update() starting."); } $server = "https://ssl.gratisdns.dk/ddns.phtml"; list($hostname, $domain) = explode(".", $this->_dnsHost, 2); - curl_setopt($ch, CURLOPT_URL, $server . '?u=' . $this->_dnsUser . '&p=' . $this->_dnsPass . '&h=' . $this->_dnsHost . '&d=' . $domain); + curl_setopt($ch, CURLOPT_URL, $server . '?u=' . $this->_dnsUser . '&p=' . $this->_dnsPass . '&h=' . $this->_dnsHost . '&d=' . $domain . '&i=' . $this->_dnsIP); break; case 'ovh-dynhost': $needsIP = FALSE; diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index ec65bad..657888c 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -612,6 +612,7 @@ function filter_generate_nested_alias($name, $alias, &$aliasnesting, &$aliasaddr $builtlist = ""; $urltable_nesting = ""; $aliasnesting[$name] = $name; + $alias_type = alias_get_type($name); foreach ($addresses as $address) { if (empty($address)) { continue; @@ -639,7 +640,7 @@ function filter_generate_nested_alias($name, $alias, &$aliasnesting, &$aliasaddr $tmpline = filter_generate_nested_alias($name, $aliastable[$address], $aliasnesting, $aliasaddrnesting); } } else if (!isset($aliasaddrnesting[$address])) { - if (!is_ipaddr($address) && !is_subnet($address) && !is_port($address) && !is_portrange($address) && is_hostname($address)) { + if (!is_ipaddr($address) && !is_subnet($address) && !(($alias_type == 'port') && (is_port($address) || is_portrange($address))) && is_hostname($address)) { if (!isset($filterdns["{$address}{$name}"])) { $use_filterdns = true; $filterdns["{$address}{$name}"] = "pf {$address} {$name}\n"; @@ -3155,10 +3156,10 @@ pass in {$log['pass']} quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 i pass in {$log['pass']} quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {128,133,134,135,136} tracker {$increment_tracker($tracker)} keep state # We use the mighty pf, we cannot be fooled. -block {$log['block']} quick inet proto { tcp, udp } from any port = 0 to any tracker {$increment_tracker($tracker)} -block {$log['block']} quick inet proto { tcp, udp } from any to any port = 0 tracker {$increment_tracker($tracker)} -block {$log['block']} quick inet6 proto { tcp, udp } from any port = 0 to any tracker {$increment_tracker($tracker)} -block {$log['block']} quick inet6 proto { tcp, udp } from any to any port = 0 tracker {$increment_tracker($tracker)} +block {$log['block']} quick inet proto { tcp, udp } from any port = 0 to any tracker {$increment_tracker($tracker)} label "Block traffic from port 0" +block {$log['block']} quick inet proto { tcp, udp } from any to any port = 0 tracker {$increment_tracker($tracker)} label "Block traffic to port 0" +block {$log['block']} quick inet6 proto { tcp, udp } from any port = 0 to any tracker {$increment_tracker($tracker)} label "Block traffic from port 0" +block {$log['block']} quick inet6 proto { tcp, udp } from any to any port = 0 tracker {$increment_tracker($tracker)} label "Block traffic to port 0" # Snort package block {$log['block']} quick from <snort2c> to any tracker {$increment_tracker($tracker)} label "Block snort2c hosts" diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc index 619a9ea..3c5880b 100644 --- a/etc/inc/globals.inc +++ b/etc/inc/globals.inc @@ -74,7 +74,7 @@ $g = array( "disablecrashreporter" => false, "crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php", "debug" => false, - "latest_config" => "11.8", + "latest_config" => "11.9", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "101", "minimum_ram_warning_text" => "128 MB", @@ -161,7 +161,6 @@ $sysctls = array("net.inet.ip.portrange.first" => "1024", "net.inet.udp.checksum" => 1, "net.bpf.zerocopy_enable" => 1, "net.inet.icmp.reply_from_interface" => 1, - "vfs.forcesync" => "1", "net.inet6.ip6.rfc6204w3" => 1, "net.enc.out.ipsec_bpf_mask" => "0x0001", "net.enc.out.ipsec_filter_mask" => "0x0001", diff --git a/etc/inc/ipsec.inc b/etc/inc/ipsec.inc index 5c7d15d..d3a6fe8 100644 --- a/etc/inc/ipsec.inc +++ b/etc/inc/ipsec.inc @@ -727,9 +727,6 @@ function ipsec_find_id(& $ph1ent, $side = "local", $rgmap = array()) { break; case 'asn1dn': $thisid_data = $id_data; - if ($thisid_data && $thisid_data[0] != '"') { - $thisid_data = "\"{$id_data}\""; - } break; } return array($thisid_type, $thisid_data); diff --git a/etc/inc/unbound.inc b/etc/inc/unbound.inc index dcf2e01..043ced2 100644 --- a/etc/inc/unbound.inc +++ b/etc/inc/unbound.inc @@ -171,11 +171,11 @@ EOF; $outgoing_interfaces = explode(",", $config['unbound']['outgoing_interface']); foreach ($outgoing_interfaces as $outif) { $outip = get_interface_ip($outif); - if (!is_null($outip)) { + if (is_ipaddr($outip)) { $outgoingints .= "outgoing-interface: $outip\n"; } $outip = get_interface_ipv6($outif); - if (!is_null($outip)) { + if (is_ipaddrv6($outip)) { $outgoingints .= "outgoing-interface: $outip\n"; } } diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index c3ce9e5..188c08f 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -3752,6 +3752,27 @@ function upgrade_116_to_117() { function upgrade_117_to_118() { global $config; + if (!isset($config['ipsec']['phase1'])) { + return; + } + + $a_phase1 =& $config['ipsec']['phase1']; + + foreach ($a_phase1 as &$ph1_entry) { + if (isset($ph1_entry['myid_type']) && $ph1_entry['myid_type'] == 'asn1dn') { + $ph1_entry['myid_data'] = + preg_replace('/\/\s*emailAddress\s*=\s*/', ', E=', $ph1_entry['myid_data']); + } + if (isset($ph1_entry['peerid_type']) && $ph1_entry['peerid_type'] == 'asn1dn') { + $ph1_entry['peerid_data'] = + preg_replace('/\/\s*emailAddress\s*=\s*/', ', E=', $ph1_entry['peerid_data']); + } + } +} + +function upgrade_118_to_119() { + global $config; + if (!isset($config['installedpackages']['miniupnpd']['config'][0])) { return; } @@ -3767,5 +3788,5 @@ function upgrade_117_to_118() { unset($miniupnpd["permuser{$i}"]); } } -?> +?> diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 9ca4df2..aaf7c09 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -823,16 +823,34 @@ EOD; } list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, 'local'); - if ($myid_type != 'address' && $myid_type != 'keyid') { + if ($myid_type != 'address' && $myid_type != 'keyid' && $myid_type != 'asn1dn') { $myid_data = "{$myid_type}:{$myid_data}"; + } elseif ($myid_type == "asn1dn" && !empty($myid_data)) { + if ($myid_data[0] == '#') { + /* asn1dn needs double quotes */ + $myid_data = "\"{$myid_type}:{$myid_data}\""; + } else { + $myid_data = "\"{$myid_data}\""; + } + } + $leftid = ''; + if (!empty($myid_data)) { + $leftid = "leftid = {$myid_data}"; } /* Only specify peer ID if we are not dealing with a mobile PSK-only tunnel */ $peerid_spec = ''; if (!isset($ph1ent['mobile'])) { list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, 'peer', $rgmap); - if ($peerid_type != 'address' && $peerid_type != 'keyid') { + if ($peerid_type != 'address' && $peerid_type != 'keyid' && $peerid_type != 'asn1dn') { $peerid_spec = "{$peerid_type}:{$peerid_data}"; + } elseif ($peerid_type == "asn1dn") { + /* asn1dn needs double quotes */ + if ($peerid_data[0] == '#') { + $peerid_spec = "\"{$peerid_type}:{$peerid_data}\""; + } elseif (!empty($peerid_data)) { + $peerid_spec = "\"{$peerid_data}\""; + } } else { $peerid_spec = $peerid_data; } @@ -1153,7 +1171,7 @@ EOD; auto = {$passive} left = {$left_spec} right = {$right_spec} - leftid = {$myid_data} + {$leftid} EOD; @@ -1650,16 +1668,16 @@ function vpn_pppoe_configure(&$pppoecfg) { $clientip = long2ip32(ip2long($pppoecfg['remoteip']) + $i); if (isset($pppoecfg['radius']['radiusissueips']) && isset($pppoecfg['radius']['server']['enable'])) { - $isssue_ip_type = "set ipcp ranges {$pppoecfg['localip']}/32 0.0.0.0/0"; + $issue_ip_type = "set ipcp ranges {$pppoecfg['localip']}/32 0.0.0.0/0"; } else { - $isssue_ip_type = "set ipcp ranges {$pppoecfg['localip']}/32 {$clientip}/32"; + $issue_ip_type = "set ipcp ranges {$pppoecfg['localip']}/32 {$clientip}/32"; } $mpdconf .=<<<EOD poes{$pppoecfg['pppoeid']}{$i}: new -i poes{$pppoecfg['pppoeid']}{$i} poes{$pppoecfg['pppoeid']}{$i} poes{$pppoecfg['pppoeid']}{$i} - {$isssue_ip_type} + {$issue_ip_type} load pppoe_standard EOD; @@ -1877,16 +1895,16 @@ EOD; $clientip = long2ip32(ip2long($l2tpcfg['remoteip']) + $i); if (isset ($l2tpcfg['radius']['radiusissueips']) && isset ($l2tpcfg['radius']['enable'])) { - $isssue_ip_type = "set ipcp ranges {$l2tpcfg['localip']}/32 0.0.0.0/0"; + $issue_ip_type = "set ipcp ranges {$l2tpcfg['localip']}/32 0.0.0.0/0"; } else { - $isssue_ip_type = "set ipcp ranges {$l2tpcfg['localip']}/32 {$clientip}/32"; + $issue_ip_type = "set ipcp ranges {$l2tpcfg['localip']}/32 {$clientip}/32"; } $mpdconf .=<<<EOD l2tp{$i}: new -i l2tp{$i} l2tp{$i} l2tp{$i} - {$isssue_ip_type} + {$issue_ip_type} load l2tp_standard EOD; diff --git a/etc/pfSense.obsoletedfiles b/etc/pfSense.obsoletedfiles index 7949530..a5fc2c6 100644 --- a/etc/pfSense.obsoletedfiles +++ b/etc/pfSense.obsoletedfiles @@ -923,6 +923,7 @@ /usr/local/www/javascript/jquery.js /usr/local/www/javascript/jquery/jquery-ui.custom.css /usr/local/www/javascript/jquery/jquery-ui.custom.min.js +/usr/local/www/javascript/NetUtils.js /usr/local/www/javascript/scriptaculous/CHANGELOG /usr/local/www/javascript/scriptaculous/MIT-LICENSE /usr/local/www/javascript/system_advanced diff --git a/etc/phpshellsessions/restartipsec b/etc/phpshellsessions/restartipsec index cadff25..ebbe9b3 100644 --- a/etc/phpshellsessions/restartipsec +++ b/etc/phpshellsessions/restartipsec @@ -1,5 +1,7 @@ ! echo "Restarting ipsec..." require_once("config.inc"); +require_once("filter.inc"); +require_once("auth.inc"); require_once("ipsec.inc"); require_once("vpn.inc"); vpn_ipsec_configure(true); diff --git a/etc/rc.carpmaster b/etc/rc.carpmaster index cde290d..be00dde 100755 --- a/etc/rc.carpmaster +++ b/etc/rc.carpmaster @@ -2,31 +2,32 @@ <?php /* $Id$ */ /* - rc.carpmaster - part of pfSense (https://www.pfsense.org) - Copyright (C) 2004 Scott Ullrich - All rights reserved. + rc.carpmaster + part of pfSense (https://www.pfsense.org) + Copyright (C) 2004-2015 Electric Sheep Fencing LLC + Copyright (C) 2004 Scott Ullrich + All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ require_once("functions.inc"); @@ -47,23 +48,27 @@ if (!strstr($argument, "@")) { list($vhid, $iface) = explode("@", $argument); $friendly = convert_real_interface_to_friendly_interface_name($iface); -$friendly_descr = convert_friendly_interface_to_friendly_descr($friendly); -$vips = link_interface_to_vips($friendly, '', $vhid); -$carp_iface = "{$friendly}_vip{$vhid}"; -foreach ($vips as $vip) { - $notificationmsg = sprintf('Carp cluster member "{$friendly_descr)(%2$s): {$vip['subnet']} (%1$s)" has resumed the state "MASTER" for vhid %s', $argument, $vip['descr'], $vhid); +$carp_iface = "{$friendly}_vip${vhid}"; +$friendly_descr = convert_friendly_interface_to_friendly_descr($carp_iface); +$notificationmsg = sprintf('Carp cluster member "%2$s (%1$s)" has resumed the state "MASTER" for vhid %s', $argument, $friendly_descr, $vhid); - notify_via_smtp($notificationmsg); - notify_via_growl($notificationmsg); - log_error($notificationmsg); -} +notify_via_smtp($notificationmsg); +notify_via_growl($notificationmsg); +log_error($notificationmsg); /* Start OpenVPN clients running on this VIP, since they should be in the stopped state while the VIP is CARP Backup. */ global $config; if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-client'])) { foreach ($config['openvpn']['openvpn-client'] as $settings) { - foreach ($vips as $vip) { - if ($settings['interface'] == "_vip{$vip['uniqid']}") { + if ($settings['interface'] == $carp_iface) { + log_error("Starting OpenVPN client instance on {$friendly_descr} because of transition to CARP master."); + openvpn_restart('client', $settings); + } + // check for gateway groups specifying CARP IPs + $a_groups = return_gateway_groups_array(); + if (is_array($a_groups[$settings['interface']])) { + // interface of this instance is a gateway group, check for CARP VIP + if (strstr($a_groups[$settings['interface']][0]['vip'], "_vip")) { log_error("Starting OpenVPN client instance on {$friendly_descr} because of transition to CARP master."); openvpn_restart('client', $settings); } @@ -76,6 +81,15 @@ if (is_array($config['openvpn']) && is_array($config['openvpn']['openvpn-server' log_error("Starting OpenVPN instance on {$friendly_descr} because of transition to CARP master."); openvpn_restart('server', $settings); } + // check for gateway groups specifying CARP IPs + $a_groups = return_gateway_groups_array(); + if (is_array($a_groups[$settings['interface']])) { + // interface of this instance is a gateway group, check for CARP VIP + if (strstr($a_groups[$settings['interface']][0]['vip'], "_vip")) { + log_error("Starting OpenVPN instance on {$friendly_descr} because of transition to CARP master."); + openvpn_restart('server', $settings); + } + } } } @@ -102,4 +116,4 @@ $pluginparams['event'] = 'rc.carpmaster'; $pluginparams['interface'] = $argument; pkg_call_plugins('plugin_carp', $pluginparams); -?> +?>
\ No newline at end of file diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php index d78c500..638d1f1 100755 --- a/usr/local/www/firewall_aliases_edit.php +++ b/usr/local/www/firewall_aliases_edit.php @@ -52,7 +52,11 @@ require_once("shaper.inc"); $pgtitle = array(gettext("Firewall"), gettext("Aliases"), gettext("Edit")); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_aliases.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_aliases.php'); +} // Keywords not allowed in names $reserved_keywords = array("all", "pass", "block", "out", "queue", "max", "min", "pptp", "pppoe", "L2TP", "OpenVPN", "IPsec"); @@ -273,6 +277,7 @@ if ($_POST) { $wrongaliases = ""; $desc_fmt_err_found = false; $alias_address_count = 0; + $input_addresses = array(); // First trim and expand the input data. // Users can paste strings like "10.1.2.0/24 10.3.0.0/16 9.10.11.0/24" into an address box. @@ -663,8 +668,8 @@ function update_box_type() { typesel_change(); add_alias_control(this); } - document.getElementById ("addressnetworkport").firstChild.data = "{$url_str}"; - document.getElementById ("onecolumn").firstChild.data = "{$url_str}"; + document.getElementById ("addressnetworkport").firstChild.data = "{$urltable_str}"; + document.getElementById ("onecolumn").firstChild.data = "{$urltable_str}"; document.getElementById ("twocolumn").firstChild.data = "{$update_freq_str}"; document.getElementById ("threecolumn").firstChild.data = ""; document.getElementById ("threecolumn").style.display = 'none'; @@ -676,8 +681,8 @@ function update_box_type() { typesel_change(); add_alias_control(this); } - document.getElementById ("addressnetworkport").firstChild.data = "{$url_str}"; - document.getElementById ("onecolumn").firstChild.data = "{$url_str}"; + document.getElementById ("addressnetworkport").firstChild.data = "{$urltable_ports_str}"; + document.getElementById ("onecolumn").firstChild.data = "{$urltable_ports_str}"; document.getElementById ("twocolumn").firstChild.data = "{$update_freq_str}"; document.getElementById ("threecolumn").firstChild.data = ""; document.getElementById ("threecolumn").style.display = 'none'; @@ -851,6 +856,7 @@ if (empty($tab)) { <td width="78%"> <input id="submit" name="submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> </td> </tr> </table> diff --git a/usr/local/www/firewall_aliases_import.php b/usr/local/www/firewall_aliases_import.php index 09a2b79..868f5eb 100755 --- a/usr/local/www/firewall_aliases_import.php +++ b/usr/local/www/firewall_aliases_import.php @@ -49,7 +49,11 @@ require("shaper.inc"); $pgtitle = array(gettext("Firewall"), gettext("Aliases"), gettext("Bulk import")); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_aliases.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_aliases.php'); +} // Add all Load balance names to reserved_keywords if (is_array($config['load_balancer']['lbpool'])) { @@ -66,7 +70,7 @@ if (!is_array($config['aliases']['alias'])) { } $a_aliases = &$config['aliases']['alias']; -if ($_POST['aliasimport'] <> "") { +if ($_POST) { $reqdfields = explode(" ", "name aliasimport"); $reqdfieldsn = array(gettext("Name"), gettext("Aliases")); @@ -220,6 +224,7 @@ include("head.inc"); <td width="78%"> <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> </td> </tr> </table> diff --git a/usr/local/www/firewall_nat_1to1_edit.php b/usr/local/www/firewall_nat_1to1_edit.php index 37c25ca..e415015 100644 --- a/usr/local/www/firewall_nat_1to1_edit.php +++ b/usr/local/www/firewall_nat_1to1_edit.php @@ -46,7 +46,11 @@ require_once("interfaces.inc"); require_once("filter.inc"); require("shaper.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_nat_1to1.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_nat_1to1.php'); +} $specialsrcdst = explode(" ", "any pptp pppoe l2tp openvpn"); $ifdisp = get_configured_interface_with_descr(); @@ -564,6 +568,7 @@ if ($input_errors) { <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_1to1[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/firewall_nat_edit.php b/usr/local/www/firewall_nat_edit.php index 7015f65..db8a174 100644 --- a/usr/local/www/firewall_nat_edit.php +++ b/usr/local/www/firewall_nat_edit.php @@ -46,7 +46,11 @@ require_once("itemid.inc"); require_once("filter.inc"); require("shaper.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_nat.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_nat.php'); +} $specialsrcdst = explode(" ", "any (self) pptp pppoe l2tp openvpn"); $ifdisp = get_configured_interface_with_descr(); @@ -970,6 +974,7 @@ include("fbegin.inc"); ?> <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_nat[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/firewall_nat_npt_edit.php b/usr/local/www/firewall_nat_npt_edit.php index e4b5818..addddd2 100644 --- a/usr/local/www/firewall_nat_npt_edit.php +++ b/usr/local/www/firewall_nat_npt_edit.php @@ -59,7 +59,11 @@ require_once("interfaces.inc"); require_once("filter.inc"); require("shaper.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_nat_npt.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_nat_npt.php'); +} $ifdisp = get_configured_interface_with_descr(); foreach ($ifdisp as $kif => $kdescr) { @@ -294,6 +298,7 @@ include("head.inc"); <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_npt[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php index 6471516..e99cebb 100644 --- a/usr/local/www/firewall_nat_out_edit.php +++ b/usr/local/www/firewall_nat_out_edit.php @@ -46,7 +46,11 @@ require("guiconfig.inc"); require_once("filter.inc"); require("shaper.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_nat_out.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_nat_out.php'); +} if (!is_array($config['nat']['outbound'])) { $config['nat']['outbound'] = array(); @@ -865,6 +869,7 @@ function poolopts_change() { <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_out[$id]): ?> diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index fa4a8eb..b0af4cc 100644 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -46,7 +46,11 @@ require("guiconfig.inc"); require_once("filter.inc"); require("shaper.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_rules.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_rules.php'); +} function is_posnumericint($arg) { // Note that to be safe we do not allow any leading zero - "01", "007" @@ -1907,6 +1911,7 @@ $has_updated_time = (isset($a_filter[$id]['updated']) && is_array($a_filter[$id] <br /> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_filter[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <input name="tracker" type="hidden" value="<?=htmlspecialchars($pconfig['tracker']);?>"> diff --git a/usr/local/www/firewall_schedule_edit.php b/usr/local/www/firewall_schedule_edit.php index c0b46c0..e7c4bca 100644 --- a/usr/local/www/firewall_schedule_edit.php +++ b/usr/local/www/firewall_schedule_edit.php @@ -62,7 +62,11 @@ require_once("shaper.inc"); $pgtitle = array(gettext("Firewall"), gettext("Schedules"), gettext("Edit")); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_schedule.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_schedule.php'); +} $dayArray = array (gettext('Mon'), gettext('Tues'), gettext('Wed'), gettext('Thur'), gettext('Fri'), gettext('Sat'), gettext('Sun')); $monthArray = array (gettext('January'), gettext('February'), gettext('March'), gettext('April'), gettext('May'), gettext('June'), gettext('July'), gettext('August'), gettext('September'), gettext('October'), gettext('November'), gettext('December')); @@ -1131,6 +1135,7 @@ EOD; <td width="85%"> <input id="submit" name="submit" type="submit" onclick="return checkForRanges();" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_schedules[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index 709f10c..6021115 100644 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -55,7 +55,11 @@ require("guiconfig.inc"); require_once("filter.inc"); require("shaper.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_virtual_ip.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_virtual_ip.php'); +} if (!is_array($config['virtualip']['vip'])) { $config['virtualip']['vip'] = array(); @@ -538,6 +542,7 @@ function typesel_change() { <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_vip[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/index.php b/usr/local/www/index.php index 4de2852..ba39623 100644 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -170,13 +170,15 @@ if (file_exists('/conf/needs_package_sync')) { ## If it is the first time webConfigurator has been ## accessed since initial install show this stuff. if (file_exists('/conf/trigger_initial_wizard')) { + $lang_code = system_get_language_code(); + $lang_codeset = system_get_language_codeset(); echo <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" lang="<?=system_get_language_code();?>" xml:lang="<?=system_get_language_code();?>"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="$lang_code" xml:lang="$lang_code"> <head> <title>{$g['product_name']}.localdomain - {$g['product_name']} first time setup</title> - <meta http-equiv="Content-Type" content="text/html; charset=<?=system_get_language_codeset();?>" /> + <meta http-equiv="Content-Type" content="text/html; charset=$lang_codeset" /> <link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print" /> <script type="text/javascript">var theme = "{$g['theme']}"</script> <script type="text/javascript" src="/themes/{$g['theme']}/loader.js"></script> @@ -223,7 +225,7 @@ if ($fd) { preg_match("/^ubsec.: (.*?),/", $dmesgl, $matches) or preg_match("/^padlock.: <(.*?)>,/", $dmesgl, $matches) or preg_match("/^glxsb.: (.*?),/", $dmesgl, $matches) or - preg_match("/^aesni.: (.*?),/", $dmesgl, $matches)) { + preg_match("/^aesni.: <(.*?)>/", $dmesgl, $matches)) { $hwcrypto = $matches[1]; break; } diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 73f23d1..760d386 100644 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -55,7 +55,11 @@ require_once("rrd.inc"); require_once("vpn.inc"); require_once("xmlparse_attr.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces.php'); +} // Get configured interface list $ifdescrs = get_configured_interface_with_descr(false, true); @@ -3696,6 +3700,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), <br /> <input id="save" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input id="cancel" type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <input name="if" type="hidden" id="if" value="<?=htmlspecialchars($if);?>" /> <?php if ($wancfg['if'] == $a_ppps[$pppid]['if']) : ?> <input name="ppp_port" type="hidden" value="<?=htmlspecialchars($pconfig['port']);?>" /> diff --git a/usr/local/www/interfaces_bridge_edit.php b/usr/local/www/interfaces_bridge_edit.php index cef2493..1787ca1 100644 --- a/usr/local/www/interfaces_bridge_edit.php +++ b/usr/local/www/interfaces_bridge_edit.php @@ -41,7 +41,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_bridge.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_bridge.php'); +} if (!is_array($config['bridges']['bridged'])) { $config['bridges']['bridged'] = array(); @@ -691,6 +695,7 @@ function show_source_port_range() { <input type="hidden" name="bridgeif" value="<?=htmlspecialchars($pconfig['bridgeif']); ?>" /> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_bridges[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/interfaces_gif_edit.php b/usr/local/www/interfaces_gif_edit.php index 76a24ed..2870c79 100644 --- a/usr/local/www/interfaces_gif_edit.php +++ b/usr/local/www/interfaces_gif_edit.php @@ -41,7 +41,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_gif.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_gif.php'); +} if (!is_array($config['gifs']['gif'])) { $config['gifs']['gif'] = array(); @@ -77,8 +81,8 @@ if ($_POST) { $pconfig = $_POST; /* input validation */ - $reqdfields = explode(" ", "if tunnel-remote-addr tunnel-remote-net tunnel-local-addr"); - $reqdfieldsn = array(gettext("Parent interface,Local address, Remote tunnel address, Remote tunnel network, Local tunnel address")); + $reqdfields = explode(" ", "if remote-addr tunnel-local-addr tunnel-remote-addr tunnel-remote-net"); + $reqdfieldsn = array(gettext("Parent interface"), gettext("gif remote address"), gettext("gif tunnel local address"), gettext("gif tunnel remote address"), gettext("gif tunnel remote netmask")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); @@ -255,6 +259,7 @@ include("head.inc"); <input type="hidden" name="gifif" value="<?=htmlspecialchars($pconfig['gifif']); ?>" /> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_gifs[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/interfaces_gre_edit.php b/usr/local/www/interfaces_gre_edit.php index 474e57b..a6cde04 100644 --- a/usr/local/www/interfaces_gre_edit.php +++ b/usr/local/www/interfaces_gre_edit.php @@ -42,7 +42,11 @@ require("guiconfig.inc"); require_once("functions.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_gre.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_gre.php'); +} if (!is_array($config['gres']['gre'])) { $config['gres']['gre'] = array(); @@ -76,8 +80,8 @@ if ($_POST) { $pconfig = $_POST; /* input validation */ - $reqdfields = explode(" ", "if tunnel-remote-addr tunnel-remote-net tunnel-local-addr"); - $reqdfieldsn = array(gettext("Parent interface"), gettext("Local address"), gettext("Remote tunnel address"), gettext("Remote tunnel network"), gettext("Local tunnel address")); + $reqdfields = explode(" ", "if remote-addr tunnel-local-addr tunnel-remote-addr tunnel-remote-net"); + $reqdfieldsn = array(gettext("Parent interface"), gettext("Remote tunnel endpoint IP address"), gettext("Local tunnel IP address"), gettext("Remote tunnel IP address"), gettext("Remote tunnel network")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); @@ -245,6 +249,7 @@ include("head.inc"); <input type="hidden" name="greif" value="<?=htmlspecialchars($pconfig['greif']); ?>" /> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_gres[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/interfaces_lagg_edit.php b/usr/local/www/interfaces_lagg_edit.php index c7894a6..d548160 100644 --- a/usr/local/www/interfaces_lagg_edit.php +++ b/usr/local/www/interfaces_lagg_edit.php @@ -41,7 +41,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_lagg.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_lagg.php'); +} if (!is_array($config['laggs']['lagg'])) { $config['laggs']['lagg'] = array(); @@ -261,6 +265,7 @@ include("head.inc"); <input type="hidden" name="laggif" value="<?=htmlspecialchars($pconfig['laggif']); ?>" /> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_laggs[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/interfaces_ppps_edit.php b/usr/local/www/interfaces_ppps_edit.php index 035f915..2a7eaf9 100644 --- a/usr/local/www/interfaces_ppps_edit.php +++ b/usr/local/www/interfaces_ppps_edit.php @@ -46,7 +46,11 @@ require("guiconfig.inc"); require("functions.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_ppps.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_ppps.php'); +} define("CRON_MONTHLY_PATTERN", "0 0 1 * *"); define("CRON_WEEKLY_PATTERN", "0 0 * * 0"); @@ -266,21 +270,23 @@ if ($_POST) { } } - foreach ($_POST['interfaces'] as $iface) { - if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface])) { - $input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."), $iface); - } - if ($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]) && !is_hostname($_POST['gateway'][$iface])) { - $input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."), $iface); - } - if ($_POST['bandwidth'][$iface] && !is_numericint($_POST['bandwidth'][$iface])) { - $input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."), $iface); - } - if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576)) { - $input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."), $iface); - } - if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576)) { - $input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."), $iface); + if (is_array($_POST['interfaces'])) { + foreach ($_POST['interfaces'] as $iface) { + if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface])) { + $input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."), $iface); + } + if ($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]) && !is_hostname($_POST['gateway'][$iface])) { + $input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."), $iface); + } + if ($_POST['bandwidth'][$iface] && !is_numericint($_POST['bandwidth'][$iface])) { + $input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."), $iface); + } + if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576)) { + $input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."), $iface); + } + if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576)) { + $input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."), $iface); + } } } @@ -484,7 +490,12 @@ $types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE" mwexec("/bin/mkdir -p /var/spool/lock"); } // $serialports = pfSense_get_modem_devices(); - $serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE); + // Match files in /dev starting with "cua" then: + // [a-zA-Z] = any single alpha character e.g. like "cuau" + // [0-9] = a digit from 0 to 9 + // stuff in {} = the various possible digit and dot combinations to allow an optional 2nd digit, dot, followed by 1 or 2 optional digits + // This supports up to 100 device numbers (0 to 99), e.g. cuau0 cuau1 ... cuau10 cuau11 ... cuau99 and also possibilities like cuau1.1 cuau1.11 cuau11.1 cuau11.11 + $serialports = glob("/dev/cua[a-zA-Z][0-9]{,.[0-9],.[0-9][0-9],[0-9],[0-9].[0-9],[0-9].[0-9][0-9]}", GLOB_BRACE); $serport_count = 0; foreach ($serialports as $port) { $serport_count++; @@ -878,6 +889,7 @@ $types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE" <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <input name="ptpid" type="hidden" value="<?=htmlspecialchars($pconfig['ptpid']);?>" /> <?php if (isset($id) && $a_ppps[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> diff --git a/usr/local/www/interfaces_qinq.php b/usr/local/www/interfaces_qinq.php index f088862..dac5801 100644 --- a/usr/local/www/interfaces_qinq.php +++ b/usr/local/www/interfaces_qinq.php @@ -67,8 +67,6 @@ if ($_GET['act'] == "del") { /* check if still in use */ if (qinq_inuse($id)) { $input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface."); - } elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) { - $input_errors[] = gettext("QinQ interface does not exist"); } else { $qinq =& $a_qinqs[$id]; diff --git a/usr/local/www/interfaces_vlan_edit.php b/usr/local/www/interfaces_vlan_edit.php index 05940ad..dd9f1a7 100644 --- a/usr/local/www/interfaces_vlan_edit.php +++ b/usr/local/www/interfaces_vlan_edit.php @@ -42,7 +42,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_vlan.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_vlan.php'); +} if (!is_array($config['vlans']['vlan'])) { $config['vlans']['vlan'] = array(); @@ -219,6 +223,7 @@ include("head.inc"); <input type="hidden" name="vlanif" value="<?=htmlspecialchars($pconfig['vlanif']); ?>" /> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_vlans[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/interfaces_wireless_edit.php b/usr/local/www/interfaces_wireless_edit.php index ab206f0..6ccce5c 100644 --- a/usr/local/www/interfaces_wireless_edit.php +++ b/usr/local/www/interfaces_wireless_edit.php @@ -41,7 +41,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_wireless.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_wireless.php'); +} if (!is_array($config['wireless'])) { $config['wireless'] = array(); @@ -213,6 +217,7 @@ include("head.inc"); <input type="hidden" name="cloneif" value="<?=htmlspecialchars($pconfig['cloneif']); ?>" /> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_clones[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/javascript/NetUtils.js b/usr/local/www/javascript/NetUtils.js deleted file mode 100644 index b1c9ffb..0000000 --- a/usr/local/www/javascript/NetUtils.js +++ /dev/null @@ -1,114 +0,0 @@ -/* - NetUtils.js - part of pfSense (https://www.pfsense.org) - Various helper functions for IPv6 support. - - Copyright (C) 2007 Simon Cornelius P. Umacob <simoncpu@gmail.com> - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - -*/ - -function NetUtils_changeIPVersionMask(field, version) { - switch(version){ - case 'IPv4': - NetUtils_clearOptions(document.getElementById(field)); - NetUtils_loadMaskIPv4(document.getElementById(field), 32); - - break; - case 'IPv6': - NetUtils_clearOptions(document.getElementById(field)); - NetUtils_loadMaskIPv6(document.getElementById(field), 64); - - break; - case 'IPv4_net': - NetUtils_clearOptions(document.getElementById(field)); - NetUtils_loadMaskIPv4(document.getElementById(field), 32, 1, 31); - - break; - case 'IPv6_net': - NetUtils_clearOptions(document.getElementById(field)); - NetUtils_loadMaskIPv6(document.getElementById(field), 64, 1, 63); - - break; - } -} - -function NetUtils_clearOptions(obj) { - var len = obj.length; - - for (var i = 0; i < len; i++) { - obj[0] = null; - } -} - -function NetUtils_loadMaskIPv4(obj, sel, min, max) { - var min, - max, - j = 0; - - min = min == undefined ? 1 : min; - max = max == undefined ? 32 : max; - - for (var i = max; i >= min; i--) { - obj[j] = new Option(i, i); - if (sel == i) { - obj[j].selected = true; - } - j++; - } -} - -function NetUtils_loadMaskIPv6(obj, sel, min, max) { - var min, - max, - j = 0; - - min = min == undefined ? 1 : min; - max = max == undefined ? 64 : max; - - if ((max % 4) != 0) { - obj[j++] = new Option(max, max); - - /** - * NOTE: This solution is a kludge. - * If you have a better way, don't hesitate - * to change this. Please send patches. :) - */ - for (var i = 1; i <= 3; i++) { - if (((max - i) % 4) == 0) { - max = max - i; - break; - } - } - } - - for (var i = max; i >= min; i -= 4) { - obj[j] = new Option(i, i); - if (sel == i) { - obj[j].selected = true; - } - j++; - } -} - diff --git a/usr/local/www/load_balancer_monitor_edit.php b/usr/local/www/load_balancer_monitor_edit.php index 45a5dab..532136b 100644 --- a/usr/local/www/load_balancer_monitor_edit.php +++ b/usr/local/www/load_balancer_monitor_edit.php @@ -42,7 +42,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_monitor.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_monitor.php'); +} if (!is_array($config['load_balancer']['monitor_type'])) { $config['load_balancer']['monitor_type'] = array(); @@ -372,6 +376,7 @@ function updateType(t) { <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_monitor[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/load_balancer_pool_edit.php b/usr/local/www/load_balancer_pool_edit.php index 91aef71..cf5c72f 100644 --- a/usr/local/www/load_balancer_pool_edit.php +++ b/usr/local/www/load_balancer_pool_edit.php @@ -44,7 +44,11 @@ require("guiconfig.inc"); require_once("filter.inc"); require_once("util.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_pool.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_pool.php'); +} if (!is_array($config['load_balancer']['lbpool'])) { $config['load_balancer']['lbpool'] = array(); @@ -350,6 +354,7 @@ function clearcombo() { <br /> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="AllServers('serversSelect', true); AllServers('serversDisabledSelect', true);" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_pool[$id] && $_GET['act'] != 'dup'): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/load_balancer_virtual_server_edit.php b/usr/local/www/load_balancer_virtual_server_edit.php index 5326b99..39bc6c9 100644 --- a/usr/local/www/load_balancer_virtual_server_edit.php +++ b/usr/local/www/load_balancer_virtual_server_edit.php @@ -43,7 +43,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_virtual_server.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_virtual_server.php'); +} if (!is_array($config['load_balancer']['virtual_server'])) { $config['load_balancer']['virtual_server'] = array(); @@ -61,7 +65,7 @@ if (isset($id) && $a_vs[$id]) { $pconfig = $a_vs[$id]; } else { // Sane defaults - $pconfig['mode'] = 'redirect'; + $pconfig['mode'] = 'redirect_mode'; } $changedesc = gettext("Load Balancer: Virtual Server:") . " "; @@ -73,14 +77,14 @@ if ($_POST) { /* input validation */ switch ($pconfig['mode']) { - case "redirect": { + case "redirect_mode": { $reqdfields = explode(" ", "ipaddr name mode"); $reqdfieldsn = array(gettext("IP Address"), gettext("Name"), gettext("Mode")); break; } - case "relay": { + case "relay_mode": { $reqdfields = explode(" ", "ipaddr name mode relay_protocol"); - $reqdfieldsn = array(gettext("IP Address"), gettext("Name"), gettext("Relay Protocol")); + $reqdfieldsn = array(gettext("IP Address"), gettext("Name"), gettext("Mode"), gettext("Relay Protocol")); break; } } @@ -296,6 +300,7 @@ include("head.inc"); <td align="left" valign="bottom" width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Submit"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_vs[$id] && $_GET['act'] != 'dup'): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/services_captiveportal_vouchers.php b/usr/local/www/services_captiveportal_vouchers.php index decea80..0bc7dae 100644 --- a/usr/local/www/services_captiveportal_vouchers.php +++ b/usr/local/www/services_captiveportal_vouchers.php @@ -50,7 +50,11 @@ require("shaper.inc"); require("captiveportal.inc"); require_once("voucher.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_captiveportal_vouchers.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_captiveportal_vouchers.php'); +} $cpzone = $_GET['zone']; if (isset($_POST['zone'])) { @@ -683,6 +687,7 @@ function enable_change(enable_change) { <input type="hidden" name="exponent" id="exponent" value="<?=$pconfig['exponent'];?>" /> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true); before_save();" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> </td> </tr> <tr> diff --git a/usr/local/www/services_dhcp_edit.php b/usr/local/www/services_dhcp_edit.php index 4cdb2e0..1fc947b 100644 --- a/usr/local/www/services_dhcp_edit.php +++ b/usr/local/www/services_dhcp_edit.php @@ -60,7 +60,11 @@ if (!$g['services_dhcp_server_enable']) { require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_dhcp.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_dhcp.php'); +} $if = $_GET['if']; if ($_POST['if']) { @@ -607,6 +611,7 @@ include("head.inc"); <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_maps[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/services_dhcpv6_edit.php b/usr/local/www/services_dhcpv6_edit.php index e581f20..2034049 100644 --- a/usr/local/www/services_dhcpv6_edit.php +++ b/usr/local/www/services_dhcpv6_edit.php @@ -54,7 +54,11 @@ function staticmaps_sort($ifgui) { require_once('globals.inc'); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_dhcpv6.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_dhcpv6.php'); +} if (!$g['services_dhcp_server_enable']) { header("Location: /"); @@ -267,6 +271,7 @@ include("head.inc"); <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_maps[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/services_dnsmasq_domainoverride_edit.php b/usr/local/www/services_dnsmasq_domainoverride_edit.php index b992019..ca66b49 100644 --- a/usr/local/www/services_dnsmasq_domainoverride_edit.php +++ b/usr/local/www/services_dnsmasq_domainoverride_edit.php @@ -41,7 +41,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_dnsmasq.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_dnsmasq.php'); +} if (!is_array($config['dnsmasq']['domainoverrides'])) { $config['dnsmasq']['domainoverrides'] = array(); @@ -180,6 +184,7 @@ include("head.inc"); <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_domainOverrides[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/services_dnsmasq_edit.php b/usr/local/www/services_dnsmasq_edit.php index 879675f..4b4c1c4 100644 --- a/usr/local/www/services_dnsmasq_edit.php +++ b/usr/local/www/services_dnsmasq_edit.php @@ -56,7 +56,11 @@ function hosts_sort() { require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_dnsmasq.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_dnsmasq.php'); +} if (!is_array($config['dnsmasq']['hosts'])) { $config['dnsmasq']['hosts'] = array(); @@ -328,6 +332,7 @@ include("head.inc"); <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_hosts[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/services_unbound_acls.php b/usr/local/www/services_unbound_acls.php index 092d641..3a51b3e 100644 --- a/usr/local/www/services_unbound_acls.php +++ b/usr/local/www/services_unbound_acls.php @@ -33,7 +33,11 @@ require("guiconfig.inc"); require("unbound.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_unbound_acls.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_unbound_acls.php'); +} if (!is_array($config['unbound']['acls'])) { $config['unbound']['acls'] = array(); @@ -323,6 +327,7 @@ include("head.inc"); <br /> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> </td> </tr> </table> diff --git a/usr/local/www/services_unbound_domainoverride_edit.php b/usr/local/www/services_unbound_domainoverride_edit.php index 05b5812..28a8424 100644 --- a/usr/local/www/services_unbound_domainoverride_edit.php +++ b/usr/local/www/services_unbound_domainoverride_edit.php @@ -43,7 +43,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_unbound.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_unbound.php'); +} if (!is_array($config['unbound']['domainoverrides'])) { $config['unbound']['domainoverrides'] = array(); @@ -166,6 +170,7 @@ include("head.inc"); <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_domainOverrides[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/services_unbound_host_edit.php b/usr/local/www/services_unbound_host_edit.php index 522feb3..6b365f2 100644 --- a/usr/local/www/services_unbound_host_edit.php +++ b/usr/local/www/services_unbound_host_edit.php @@ -42,7 +42,11 @@ ##|*MATCH=services_unbound_host_edit.php* ##|-PRIV -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_unbound.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_unbound.php'); +} function hostcmp($a, $b) { return strcasecmp($a['host'], $b['host']); @@ -320,6 +324,7 @@ include("head.inc"); <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_hosts[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/services_wol_edit.php b/usr/local/www/services_wol_edit.php index 66481bf..031ba83 100644 --- a/usr/local/www/services_wol_edit.php +++ b/usr/local/www/services_wol_edit.php @@ -52,7 +52,11 @@ function wol_sort() { require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_wol.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_wol.php'); +} if (!is_array($config['wol']['wolentry'])) { $config['wol']['wolentry'] = array(); @@ -163,6 +167,7 @@ include("head.inc"); <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_wol[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/system_advanced_sysctl.php b/usr/local/www/system_advanced_sysctl.php index be12322..1992cc1 100644 --- a/usr/local/www/system_advanced_sysctl.php +++ b/usr/local/www/system_advanced_sysctl.php @@ -45,7 +45,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_advanced_sysctl.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_advanced_sysctl.php'); +} if (!is_array($config['sysctl'])) { $config['sysctl'] = array(); @@ -283,6 +287,7 @@ include("head.inc"); <td width="78%"> <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_tunable[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/system_gateway_groups_edit.php b/usr/local/www/system_gateway_groups_edit.php index 81b6dfa..c5fcc3b 100644 --- a/usr/local/www/system_gateway_groups_edit.php +++ b/usr/local/www/system_gateway_groups_edit.php @@ -44,7 +44,11 @@ require("guiconfig.inc"); require_once("ipsec.inc"); require_once("vpn.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_gateway_groups.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_gateway_groups.php'); +} if (!is_array($config['gateways']['gateway_group'])) { $config['gateways']['gateway_group'] = array(); @@ -361,6 +365,7 @@ jQuery(function ($) { <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_gateway_groups[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 3d0bc78..af5e7cb 100644 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -43,7 +43,11 @@ require("guiconfig.inc"); require("pkg-utils.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_gateways.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_gateways.php'); +} $a_gateways = return_gateways_array(true, false, true); $a_gateways_arr = array(); @@ -927,6 +931,7 @@ function enable_change() { <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change()" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_gateways[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/system_hasync.php b/usr/local/www/system_hasync.php index 1ce81e6..8ebde1f 100755 --- a/usr/local/www/system_hasync.php +++ b/usr/local/www/system_hasync.php @@ -42,7 +42,11 @@ require("guiconfig.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_hasync.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_hasync.php'); +} if (!is_array($config['hasync'])) { $config['hasync'] = array(); @@ -347,6 +351,7 @@ include("head.inc"); <input name="id" type="hidden" value="0" /> <input name="Submit" type="submit" class="formbtn" value="Save" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> </td> </tr> </table> diff --git a/usr/local/www/system_routes_edit.php b/usr/local/www/system_routes_edit.php index 5d57622..a64580b 100644 --- a/usr/local/www/system_routes_edit.php +++ b/usr/local/www/system_routes_edit.php @@ -45,7 +45,11 @@ require_once("filter.inc"); require_once("util.inc"); require_once("gwlb.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_routes.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_routes.php'); +} if (!is_array($config['staticroutes']['route'])) { $config['staticroutes']['route'] = array(); @@ -358,6 +362,7 @@ include("head.inc"); <?php if (isset($id) && $a_routes[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> + <input name="referer" type="hidden" value="<?=$referer;?>" /> </td> </tr> </table> diff --git a/usr/local/www/vpn_l2tp_users_edit.php b/usr/local/www/vpn_l2tp_users_edit.php index e132606..6cedc02 100644 --- a/usr/local/www/vpn_l2tp_users_edit.php +++ b/usr/local/www/vpn_l2tp_users_edit.php @@ -56,7 +56,11 @@ function l2tp_users_sort() { require("guiconfig.inc"); require_once("vpn.inc"); -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/vpn_l2tp_users.php'); +if (isset($_POST['referer'])) { + $referer = $_POST['referer']; +} else { + $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/vpn_l2tp_users.php'); +} if (!is_array($config['l2tp']['user'])) { $config['l2tp']['user'] = array(); @@ -193,6 +197,7 @@ include("head.inc"); <td width="78%"> <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext('Save');?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" /> + <input name="referer" type="hidden" value="<?=$referer;?>" /> <?php if (isset($id) && $a_secret[$id]): ?> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <?php endif; ?> diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc index 5bb3ca5..3f68869 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc @@ -607,6 +607,12 @@ function step3_stepsubmitphpaction() { $config['ezshaper']['step3']['address'] = $_POST['upstream_sip_server']; if ($_POST['enable'] == 'on') $config['ezshaper']['step3']['enable'] = 'on'; + if (!empty($_POST['provider'])) { + $VoIPproviders = array("Generic", "VoicePulse", "Asterisk", "Panasonic"); + if (in_array($_POST['provider'], $VoIPproviders)) { + $config['ezshaper']['step3']['provider'] = $_POST['provider']; + } + } for ($i = 0; $i < $localint; $i++) { $config['ezshaper']['step3']["local{$i}download"] = $_POST["local{$i}download"]; $config['ezshaper']['step3']["local{$i}downloadspeed"] = $_POST["local{$i}downloadspeed"]; |