diff options
Diffstat (limited to 'src/usr/local/www')
127 files changed, 1170 insertions, 885 deletions
diff --git a/src/usr/local/www/bandwidth_by_ip.php b/src/usr/local/www/bandwidth_by_ip.php index 9f8cc6c..39f9a01 100755 --- a/src/usr/local/www/bandwidth_by_ip.php +++ b/src/usr/local/www/bandwidth_by_ip.php @@ -1,8 +1,6 @@ <?php /* - * To change this template, choose Tools | Templates - * and open the template in the editor. - * + bandwidth_by_ip.php */ /* @@ -111,8 +109,8 @@ for ($x=2; $x<12; $x++) { if ($bandwidthinfo != "") { $infoarray = explode (":", $bandwidthinfo); if (($filter == "all") || - (($filter == "local") && (ip_in_subnet($infoarray[0], $intsubnet))) || - (($filter == "remote") && (!ip_in_subnet($infoarray[0], $intsubnet)))) { + (($filter == "local") && (ip_in_subnet($infoarray[0], $intsubnet))) || + (($filter == "remote") && (!ip_in_subnet($infoarray[0], $intsubnet)))) { if ($hostipformat == "") { // pass back just the raw IP address $addrdata = $infoarray[0]; @@ -146,7 +144,7 @@ unset($bandwidthinfo, $_grb); unset($listedIPs); //no bandwidth usage found -if ($someinfo == false) +if ($someinfo == false) { echo gettext("no info"); - -?>
\ No newline at end of file +} +?> diff --git a/src/usr/local/www/diag_authentication.php b/src/usr/local/www/diag_authentication.php index 503f5a3..1b3c366 100644 --- a/src/usr/local/www/diag_authentication.php +++ b/src/usr/local/www/diag_authentication.php @@ -110,7 +110,7 @@ if ($input_errors) if ($savemsg) print('<div class="alert alert-success" role="alert">'. $savemsg.'</div>'); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form('Test'); diff --git a/src/usr/local/www/diag_backup.php b/src/usr/local/www/diag_backup.php index 12e5ccc..943d57d 100644 --- a/src/usr/local/www/diag_backup.php +++ b/src/usr/local/www/diag_backup.php @@ -632,7 +632,7 @@ $tab_array[] = array(gettext("Config History"), false, "diag_confbak.php"); $tab_array[] = array(gettext("Backup/Restore"), true, "diag_backup.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(false); diff --git a/src/usr/local/www/diag_dns.php b/src/usr/local/www/diag_dns.php index 45c4a91..140bf4b 100755 --- a/src/usr/local/www/diag_dns.php +++ b/src/usr/local/www/diag_dns.php @@ -213,7 +213,7 @@ else if (!$resolved && $type) if ($createdalias) print('<div class="alert alert-success" role="alert">'.gettext("Alias was created/updated successfully").'</div>'); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form('Lookup'); $section = new Form_Section('DNS Lookup'); diff --git a/src/usr/local/www/diag_dump_states.php b/src/usr/local/www/diag_dump_states.php index 68c8bf6..aeb1679 100755 --- a/src/usr/local/www/diag_dump_states.php +++ b/src/usr/local/www/diag_dump_states.php @@ -132,7 +132,7 @@ display_top_tabs($tab_array); // Start of tab content $current_statecount=`pfctl -si | grep "current entries" | awk '{ print $3 }'`; -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(false); diff --git a/src/usr/local/www/diag_dump_states_sources.php b/src/usr/local/www/diag_dump_states_sources.php index 6a62aee..360ec58 100644 --- a/src/usr/local/www/diag_dump_states_sources.php +++ b/src/usr/local/www/diag_dump_states_sources.php @@ -125,7 +125,7 @@ events.push(function(){ <?php -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Filters'); diff --git a/src/usr/local/www/diag_ipsec.php b/src/usr/local/www/diag_ipsec.php index 6d4fd3f..5291e8a 100644 --- a/src/usr/local/www/diag_ipsec.php +++ b/src/usr/local/www/diag_ipsec.php @@ -225,7 +225,7 @@ if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_ print('<br/>' . $identity); } else { if (empty($identity)) - print(ettext("Unknown")); + print(gettext("Unknown")); else print($identity); } @@ -375,6 +375,7 @@ if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_ print(htmlspecialchars($childsa['dhgroup']) . '<br/>'); if (!empty($childsa['esn'])) + print(htmlspecialchars($childsa['esn']) . '<br/>'); print(gettext("IPComp: ") . htmlspecialchars($childsa['ipcomp'])); ?> diff --git a/src/usr/local/www/diag_logs.php b/src/usr/local/www/diag_logs.php index aca3873..ebd0c61 100755 --- a/src/usr/local/www/diag_logs.php +++ b/src/usr/local/www/diag_logs.php @@ -124,7 +124,7 @@ if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wirel display_top_tabs($tab_array, false, 'nav nav-tabs'); } -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(false); diff --git a/src/usr/local/www/diag_logs_filter.php b/src/usr/local/www/diag_logs_filter.php index 69fe622..8b3a92f 100644 --- a/src/usr/local/www/diag_logs_filter.php +++ b/src/usr/local/www/diag_logs_filter.php @@ -216,7 +216,7 @@ $Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act'])); if ($filterfieldsarray['interface'] == "All") $interface = ""; -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); if (!isset($config['syslog']['rawfilter'])) { // Advanced log filter form $form = new Form(new Form_Button( @@ -370,7 +370,7 @@ if (!isset($config['syslog']['rawfilter'])) { else print(count($filterlog). ' ' . gettext('matched log entries.') . ' '); - printf(gettext(" (Maximum %s)"),$nentries) + printf(gettext(" (Maximum %s)"), $nentries); ?> </h2> </div> @@ -420,7 +420,7 @@ if (!isset($config['syslog']['rawfilter'])) { <?=htmlspecialchars($filterent['interface'])?> </td> <?php - if ($config['syslog']['filterdescriptions'] === "1") { + if ($config['syslog']['filterdescriptions'] === "1") { ?> <td> <?=find_rule_by_number_buffer($filterent['rulenum'], $filterent['tracker'], $filterent['act'])?> diff --git a/src/usr/local/www/diag_logs_settings.php b/src/usr/local/www/diag_logs_settings.php index 94b1b6b..686df32 100644 --- a/src/usr/local/www/diag_logs_settings.php +++ b/src/usr/local/www/diag_logs_settings.php @@ -242,7 +242,7 @@ $tab_array[] = array(gettext("NTP"), false, "diag_logs.php?logfile=ntpd"); $tab_array[] = array(gettext("Settings"), true, "diag_logs_settings.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'Submit', diff --git a/src/usr/local/www/diag_nanobsd.php b/src/usr/local/www/diag_nanobsd.php index b7efa88..09532f1 100644 --- a/src/usr/local/www/diag_nanobsd.php +++ b/src/usr/local/www/diag_nanobsd.php @@ -146,7 +146,7 @@ print_info_box("The options on this page are intended for use by advanced users if ($savemsg) print_info_box($savemsg, $class); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(false); diff --git a/src/usr/local/www/diag_packet_capture.php b/src/usr/local/www/diag_packet_capture.php index d4adee8..39d230d 100644 --- a/src/usr/local/www/diag_packet_capture.php +++ b/src/usr/local/www/diag_packet_capture.php @@ -288,7 +288,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(false); // No button yet. We add those later depending on the required action diff --git a/src/usr/local/www/diag_patterns.php b/src/usr/local/www/diag_patterns.php index 2ca6f3a..87b6516 100644 --- a/src/usr/local/www/diag_patterns.php +++ b/src/usr/local/www/diag_patterns.php @@ -101,7 +101,7 @@ include("head.inc"); if ($ulmsg) print_info_box($ulmsg, $class); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form($buttonlabel); diff --git a/src/usr/local/www/diag_pf_info.php b/src/usr/local/www/diag_pf_info.php index 1d1cc89..8ede5c5 100644 --- a/src/usr/local/www/diag_pf_info.php +++ b/src/usr/local/www/diag_pf_info.php @@ -93,7 +93,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(false); $form->addGlobal(new Form_Input( 'getactivity', diff --git a/src/usr/local/www/diag_ping.php b/src/usr/local/www/diag_ping.php index f491b9a..125eebb 100644 --- a/src/usr/local/www/diag_ping.php +++ b/src/usr/local/www/diag_ping.php @@ -162,7 +162,7 @@ include('head.inc'); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form('Ping'); diff --git a/src/usr/local/www/diag_resetstate.php b/src/usr/local/www/diag_resetstate.php index 17f89bd..8630b59 100644 --- a/src/usr/local/www/diag_resetstate.php +++ b/src/usr/local/www/diag_resetstate.php @@ -122,7 +122,7 @@ if (isset($config['system']['lb_use_sticky'])) $tab_array[] = array(gettext("Reset States"), true, "diag_resetstate.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $resetbtn = new Form_Button( 'Submit', diff --git a/src/usr/local/www/diag_routes.php b/src/usr/local/www/diag_routes.php index a866b0b..711e6b7 100644 --- a/src/usr/local/www/diag_routes.php +++ b/src/usr/local/www/diag_routes.php @@ -105,7 +105,7 @@ $shortcut_section = "routing"; include('head.inc'); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form('Update'); $form->addGlobal(new Form_Input( diff --git a/src/usr/local/www/diag_smart.php b/src/usr/local/www/diag_smart.php index 4022e29..3defed1 100644 --- a/src/usr/local/www/diag_smart.php +++ b/src/usr/local/www/diag_smart.php @@ -111,7 +111,7 @@ if (!file_exists('/dev/' . $targetdev)) { return; } -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $tab_array = array(); $tab_array[0] = array(gettext("Information/Tests"), ($action != 'config'), $_SERVER['PHP_SELF'] . "?action=default"); diff --git a/src/usr/local/www/diag_system_pftop.php b/src/usr/local/www/diag_system_pftop.php index be2a493..fbd9df6 100644 --- a/src/usr/local/www/diag_system_pftop.php +++ b/src/usr/local/www/diag_system_pftop.php @@ -120,7 +120,7 @@ if ($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes) && if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(false); $form->addGlobal(new Form_Input( 'getactivity', diff --git a/src/usr/local/www/diag_tables.php b/src/usr/local/www/diag_tables.php index 5de3029..2dfd348 100644 --- a/src/usr/local/www/diag_tables.php +++ b/src/usr/local/www/diag_tables.php @@ -127,7 +127,7 @@ include("head.inc"); if ($savemsg) print_info_box($savemsg); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form('Show'); $section = new Form_Section('Table to display'); diff --git a/src/usr/local/www/diag_testport.php b/src/usr/local/www/diag_testport.php index e0515fa..3b7cf5a 100644 --- a/src/usr/local/www/diag_testport.php +++ b/src/usr/local/www/diag_testport.php @@ -235,7 +235,7 @@ else { print('<div class="alert alert-danger" role="alert">'.gettext('Connection failed.').'</div>'); } -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form('Test'); diff --git a/src/usr/local/www/diag_traceroute.php b/src/usr/local/www/diag_traceroute.php index 6792a9d..4c5b3c1 100644 --- a/src/usr/local/www/diag_traceroute.php +++ b/src/usr/local/www/diag_traceroute.php @@ -135,7 +135,7 @@ if (!isset($do_traceroute)) { if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form('Traceroute'); diff --git a/src/usr/local/www/exec.php b/src/usr/local/www/exec.php index 2ceef95..a8dcd99 100644 --- a/src/usr/local/www/exec.php +++ b/src/usr/local/www/exec.php @@ -142,8 +142,6 @@ if (isBlank($_POST['txtRecallBuffer'])) { puts(" );"); } ?> - // Set pointer to end of recall buffer. - var intRecallPtr = arrRecallBuffer.length-1; // Set pointer to end of recall buffer. var intRecallPtr = arrRecallBuffer.length-1; @@ -298,5 +296,5 @@ if (!isBlank($_POST['txtCommand'])):?> <?php include("foot.inc"); -if ($_POST) - conf_mount_ro();
\ No newline at end of file +if($_POST) + conf_mount_ro(); diff --git a/src/usr/local/www/firewall_aliases.php b/src/usr/local/www/firewall_aliases.php index 5ffb7e5..83d1c3c 100644 --- a/src/usr/local/www/firewall_aliases.php +++ b/src/usr/local/www/firewall_aliases.php @@ -127,7 +127,7 @@ if ($_GET['act'] == "del") { // Alias in an alias find_alias_reference(array('aliases', 'alias'), array('address'), $alias_name, $is_alias_referenced, $referenced_by); // Load Balancer - find_alias_reference(array('load_balancer', 'lbpool'), array('port'), $alias_name, $is_alias_referenced, $referenced_by); + find_alias_reference(array('load_balancer', 'lbpool'), array('port'), $alias_name, $is_alias_referenced, $referenced_by); find_alias_reference(array('load_balancer', 'virtual_server'), array('port'), $alias_name, $is_alias_referenced, $referenced_by); // Static routes find_alias_reference(array('staticroutes', 'route'), array('network'), $alias_name, $is_alias_referenced, $referenced_by); @@ -194,10 +194,10 @@ if (is_subsystem_dirty('aliases')) print_info_box_np(gettext("The alias list has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect.")); $tab_array = array(); -$tab_array[] = array(gettext("IP"),($tab=="ip" ? true : ($tab=="host" ? true : ($tab == "network" ? true : false))), "/firewall_aliases.php?tab=ip"); -$tab_array[] = array(gettext("Ports"), ($tab=="port"? true : false), "/firewall_aliases.php?tab=port"); -$tab_array[] = array(gettext("URLs"), ($tab=="url"? true : false), "/firewall_aliases.php?tab=url"); -$tab_array[] = array(gettext("All"), ($tab=="all"? true : false), "/firewall_aliases.php?tab=all"); +$tab_array[] = array(gettext("IP"), ($tab == "ip" ? true : ($tab == "host" ? true : ($tab == "network" ? true : false))), "/firewall_aliases.php?tab=ip"); +$tab_array[] = array(gettext("Ports"), ($tab == "port"? true : false), "/firewall_aliases.php?tab=port"); +$tab_array[] = array(gettext("URLs"), ($tab == "url"? true : false), "/firewall_aliases.php?tab=url"); +$tab_array[] = array(gettext("All"), ($tab == "all"? true : false), "/firewall_aliases.php?tab=all"); display_top_tabs($tab_array); ?> @@ -213,24 +213,24 @@ display_top_tabs($tab_array); <tbody> <?php asort($a_aliases); - foreach ($a_aliases as $i=> $alias): + foreach ($a_aliases as $i => $alias): unset ($show_alias); - switch ($tab){ + switch ($tab) { case "all": $show_alias= true; break; case "ip": case "host": case "network": - if (preg_match("/(host|network)/",$alias["type"])) + if (preg_match("/(host|network)/", $alias["type"])) $show_alias= true; break; case "url": - if (preg_match("/(url)/i",$alias["type"])) + if (preg_match("/(url)/i", $alias["type"])) $show_alias= true; break; case "port": - if($alias["type"] == "port") + if ($alias["type"] == "port") $show_alias= true; break; } @@ -245,10 +245,10 @@ display_top_tabs($tab_array); if ($alias["url"]) { echo $alias["url"] . "<br />"; } else { - if(is_array($alias["aliasurl"])) { + if (is_array($alias["aliasurl"])) { $aliasurls = implode(", ", array_slice($alias["aliasurl"], 0, 10)); echo $aliasurls; - if(count($aliasurls) > 10) { + if (count($aliasurls) > 10) { echo "…<br />"; } echo "<br />\n"; @@ -256,7 +256,7 @@ display_top_tabs($tab_array); $tmpaddr = explode(" ", $alias['address']); $addresses = implode(", ", array_slice($tmpaddr, 0, 10)); echo $addresses; - if(count($tmpaddr) > 10) { + if (count($tmpaddr) > 10) { echo '…'; } } diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index 84d9d96..90c00b9 100755 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -4,62 +4,62 @@ firewall_aliases_edit.php */ /* ==================================================================== - * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved. - * Copyright (c) 2004 Scott Ullrich + * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved. + * Copyright (c) 2004 Scott Ullrich * Copyright (c) 2009 Ermal Luçi * Copyright (c) 2010 Jim Pingle * originally part of m0n0wall (http://m0n0.ch/wall) * - * 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. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * "This product includes software developed by the pfSense Project - * for use in the pfSense software distribution. (http://www.pfsense.org/). + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * "This product includes software developed by the pfSense Project + * for use in the pfSense software distribution. (http://www.pfsense.org/). * - * 4. The names "pfSense" and "pfSense Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * coreteam@pfsense.org. + * 4. The names "pfSense" and "pfSense Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * coreteam@pfsense.org. * - * 5. Products derived from this software may not be called "pfSense" - * nor may "pfSense" appear in their names without prior written - * permission of the Electric Sheep Fencing, LLC. + * 5. Products derived from this software may not be called "pfSense" + * nor may "pfSense" appear in their names without prior written + * permission of the Electric Sheep Fencing, LLC. * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: * - * "This product includes software developed by the pfSense Project - * for use in the pfSense software distribution (http://www.pfsense.org/). + * "This product includes software developed by the pfSense Project + * for use in the pfSense software distribution (http://www.pfsense.org/). * - * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY - * EXPRESSED 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 pfSense PROJECT OR - * ITS CONTRIBUTORS 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 BY THE pfSense PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 pfSense PROJECT OR + * ITS CONTRIBUTORS 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. * - * ==================================================================== + * ==================================================================== * */ /* - pfSense_BUILDER_BINARIES: /bin/rm /bin/mkdir /usr/bin/fetch - pfSense_MODULE: aliases + pfSense_BUILDER_BINARIES: /bin/rm /bin/mkdir /usr/bin/fetch + pfSense_MODULE: aliases */ ##|+PRIV @@ -73,7 +73,6 @@ require("guiconfig.inc"); require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); -require_once("util.inc"); $pgtitle = array(gettext("Firewall"), gettext("Aliases"), gettext("Edit")); @@ -108,13 +107,6 @@ if ($_POST) { $origname = $_POST['origname']; } -$adrs = count($_POST['address']); - -for($idx=0; $idx<$adrs; $idx++) { - if($_POST['address'][$idx] == "") - unset($_POST['address'][$idx]); -} - // Debugging if ($debug) { unlink_if_exists("{$g['tmp_path']}/alias_rename_log.txt"); @@ -126,9 +118,10 @@ function alias_same_type($name, $type) { foreach ($config['aliases']['alias'] as $alias) { if ($name == $alias['name']) { if (in_array($type, array("host", "network")) && - in_array($alias['type'], array("host", "network"))) { + in_array($alias['type'], array("host", "network"))) { return true; } + if ($type == $alias['type']) { return true; } else { @@ -156,7 +149,6 @@ if (isset($id) && $a_aliases[$id]) { if (preg_match("/urltable/i", $a_aliases[$id]['type'])) { $pconfig['address'] = $a_aliases[$id]['url']; - $pconfig['updatefreq'] = $a_aliases[$id]['updatefreq']; } if ($a_aliases[$id]['aliasurl'] <> "") { @@ -223,24 +215,24 @@ if ($_POST) { $address = ""; /* item is a url table type */ - if ($_POST['address'][0]) { + if ($_POST['address0']) { /* fetch down and add in */ - $_POST['address'][0] = trim($_POST['address'][0]); - $address[] = $_POST['address'][0]; - $alias['url'] = $_POST['address'][0]; - $alias['updatefreq'] = $_POST['frequency'][0] ? $_POST['frequency'][0] : 7; + $_POST['address0'] = trim($_POST['address0']); + $address[] = $_POST['address0']; + $alias['url'] = $_POST['address0']; + $alias['updatefreq'] = $_POST['address_subnet0'] ? $_POST['address_subnet0'] : 7; if (!is_URL($alias['url']) || empty($alias['url'])) { $input_errors[] = gettext("You must provide a valid URL."); } elseif (!process_alias_urltable($alias['name'], $alias['url'], 0, true)) { $input_errors[] = gettext("Unable to fetch usable data."); } - if ($_POST["detail"][0] != "") { - if ((strpos($_POST["detail"][0], "||") === false) && (substr($_POST["detail"][0], 0, 1) != "|") && (substr($_POST["detail"][0], -1, 1) != "|")) { - $final_address_details[] = $_POST["detail"][0]; + if ($_POST["detail0"] <> "") { + if ((strpos($_POST["detail0"], "||") === false) && (substr($_POST["detail0"], 0, 1) != "|") && (substr($_POST["detail0"], -1, 1) != "|")) { + $final_address_details[] = $_POST["detail0"]; } else { /* Remove leading and trailing vertical bars and replace multiple vertical bars with single, */ /* and put in the output array so the text is at least redisplayed for the user. */ - $final_address_details[] = preg_replace('/\|\|+/', '|', trim($_POST["detail"][0], "|")); + $final_address_details[] = preg_replace('/\|\|+/', '|', trim($_POST["detail0"], "|")); $input_errors[] = $vertical_bar_err_text; } } else { @@ -251,32 +243,35 @@ if ($_POST) { $desc_fmt_err_found = false; /* item is a url type */ - foreach ($_POST['address'] as $idx => $post_address) { + for ($x = 0; $x < $max_alias_addresses - 1; $x++) { + $_POST['address' . $x] = trim($_POST['address' . $x]); + if ($_POST['address' . $x]) { /* fetch down and add in */ $temp_filename = tempnam("{$g['tmp_path']}/", "alias_import"); unlink_if_exists($temp_filename); $verify_ssl = isset($config['system']['checkaliasesurlcert']); mkdir($temp_filename); - download_file($post_address, $temp_filename . "/aliases", $verify_ssl); + download_file($_POST['address' . $x], $temp_filename . "/aliases", $verify_ssl); /* if the item is tar gzipped then extract */ - if(stristr($post_address, ".tgz")) + if (stristr($_POST['address' . $x], ".tgz")) { process_alias_tgz($temp_filename); - else if(stristr($post_address, ".zip")) + } else if (stristr($_POST['address' . $x], ".zip")) { process_alias_unzip($temp_filename); + } if (!isset($alias['aliasurl'])) { $alias['aliasurl'] = array(); } - $alias['aliasurl'][] = $post_address; - if ($_POST['detail'][$idx] != "") { - if ((strpos($_POST['detail'][$idx], "||") === false) && (substr($_POST['detail'][$idx], 0, 1) != "|") && (substr($_POST['detail'][$idx], -1, 1) != "|")) { - $final_address_details[] = $_POST['detail'][$idx]; + $alias['aliasurl'][] = $_POST['address' . $x]; + if ($_POST["detail{$x}"] <> "") { + if ((strpos($_POST["detail{$x}"], "||") === false) && (substr($_POST["detail{$x}"], 0, 1) != "|") && (substr($_POST["detail{$x}"], -1, 1) != "|")) { + $final_address_details[] = $_POST["detail{$x}"]; } else { /* Remove leading and trailing vertical bars and replace multiple vertical bars with single, */ /* and put in the output array so the text is at least redisplayed for the user. */ - $final_address_details[] = preg_replace('/\|\|+/', '|', trim($_POST['detail'][$idx], "|")); + $final_address_details[] = preg_replace('/\|\|+/', '|', trim($_POST["detail{$x}"], "|")); if (!$desc_fmt_err_found) { $input_errors[] = $vertical_bar_err_text; $desc_fmt_err_found = true; @@ -290,13 +285,14 @@ if ($_POST) { $address = parse_aliases_file("{$temp_filename}/aliases", $_POST['type'], 3000); if ($address == null) { /* nothing was found */ - $input_errors[] = sprintf(gettext("You must provide a valid URL. Could not fetch usable data from '%s'."), $post_address); + $input_errors[] = sprintf(gettext("You must provide a valid URL. Could not fetch usable data from '%s'."), $_POST['address' . $x]); } mwexec("/bin/rm -rf " . escapeshellarg($temp_filename)); } else { - $input_errors[] = sprintf(gettext("URL '%s' is not valid."), $post_address); + $input_errors[] = sprintf(gettext("URL '%s' is not valid."), $_POST['address' . $x]); } } + } unset($desc_fmt_err_found); if ($_POST['type'] == "url_ports") { $address = group_ports($address); @@ -312,15 +308,15 @@ if ($_POST) { // Users can paste strings like "10.1.2.0/24 10.3.0.0/16 9.10.11.0/24" into an address box. // They can also put an IP range. // This loop expands out that stuff so it can easily be validated. - foreach ($_POST['address'] as $idx => $post_address) { - if ($post_address != "") { - - if ((strpos($post_address, "||") === false) && (substr($post_address, 0, 1) != "|") && (substr($post_address, -1, 1) != "|")) { - $detail_text = $post_address; + for ($x = 0; $x < ($max_alias_addresses - 1); $x++) { + if ($_POST["address{$x}"] <> "") { + if ($_POST["detail{$x}"] <> "") { + if ((strpos($_POST["detail{$x}"], "||") === false) && (substr($_POST["detail{$x}"], 0, 1) != "|") && (substr($_POST["detail{$x}"], -1, 1) != "|")) { + $detail_text = $_POST["detail{$x}"]; } else { /* Remove leading and trailing vertical bars and replace multiple vertical bars with single, */ /* and put in the output array so the text is at least redisplayed for the user. */ - $detail_text = preg_replace('/\|\|+/', '|', trim($post_address, "|")); + $detail_text = preg_replace('/\|\|+/', '|', trim($_POST["detail{$x}"], "|")); if (!$desc_fmt_err_found) { $input_errors[] = $vertical_bar_err_text; $desc_fmt_err_found = true; @@ -329,11 +325,9 @@ if ($_POST) { } else { $detail_text = sprintf(gettext("Entry added %s"), date('r')); } - - $address_items = explode(" ", trim($post_address)); + $address_items = explode(" ", trim($_POST["address{$x}"])); foreach ($address_items as $address_item) { $iprange_type = is_iprange($address_item); - if ($iprange_type == 4) { list($startip, $endip) = explode('-', $address_item); if ($_POST['type'] == "network") { @@ -416,9 +410,8 @@ if ($_POST) { } } else { $input_addresses[] = $address_part; - $input_address_subnet[] = $_POST["address_subnet"][$idx]; + $input_address_subnet[] = $_POST["address_subnet{$x}"]; } - $final_address_details[] = $detail_text; $alias_address_count++; } @@ -429,6 +422,7 @@ if ($_POST) { } } } + } // Validate the input data expanded above. foreach ($input_addresses as $idx => $input_address) { @@ -436,7 +430,7 @@ if ($_POST) { if (!alias_same_type($input_address, $_POST['type'])) { // But alias type network can include alias type urltable. Feature#1603. if (!($_POST['type'] == 'network' && - preg_match("/urltable/i", alias_get_type($input_address)))) { + preg_match("/urltable/i", alias_get_type($input_address)))) { $wrongaliases .= " " . $input_address; } } @@ -446,7 +440,7 @@ if ($_POST) { } } else if ($_POST['type'] == "host" || $_POST['type'] == "network") { if (is_subnet($input_address) || - (!is_ipaddr($input_address) && !is_hostname($input_address))) { + (!is_ipaddr($input_address) && !is_hostname($input_address))) { $input_errors[] = sprintf(gettext('%1$s is not a valid %2$s address, FQDN or alias.'), $input_address, $_POST['type']); } } @@ -477,10 +471,10 @@ if ($_POST) { $alias['type'] = $_POST['type']; $alias['detail'] = implode("||", $final_address_details); - /* Check to see if alias name needs to be - * renamed on referenced rules and such + /* Check to see if alias name needs to be + * renamed on referenced rules and such */ - if ($_POST['name'] != $_POST['origname']) { + if ($_POST['name'] <> $_POST['origname']) { // Firewall rules update_alias_names_upon_change(array('filter', 'rule'), array('source', 'address'), $_POST['name'], $origname); update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'address'), $_POST['name'], $origname); @@ -498,11 +492,11 @@ if ($_POST) { //update_alias_names_upon_change(array('nat', 'onetoone'), array('source', 'address'), $_POST['name'], $origname); update_alias_names_upon_change(array('nat', 'onetoone'), array('destination', 'address'), $_POST['name'], $origname); // NAT Outbound Rules - update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('source', 'network'), $_POST['name'], $origname); - update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('sourceport'), $_POST['name'], $origname); - update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('destination', 'address'), $_POST['name'], $origname); - update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('dstport'), $_POST['name'], $origname); - update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('target'), $_POST['name'], $origname); + update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('source', 'network'), $_POST['name'], $origname); + update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('sourceport'), $_POST['name'], $origname); + update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('destination', 'address'), $_POST['name'], $origname); + update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('dstport'), $_POST['name'], $origname); + update_alias_names_upon_change(array('nat', 'outbound', 'rule'), array('target'), $_POST['name'], $origname); // Alias in an alias update_alias_names_upon_change(array('aliases', 'alias'), array('address'), $_POST['name'], $origname); } @@ -510,13 +504,11 @@ if ($_POST) { pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases_edit/pre_write_config"); if (isset($id) && $a_aliases[$id]) { - if ($a_aliases[$id]['name'] != $alias['name']) { + if ($a_aliases[$id]['name'] <> $alias['name']) { foreach ($a_aliases as $aliasid => $aliasd) { - - if ($aliasd['address'] != "") { + if ($aliasd['address'] <> "") { $tmpdirty = false; $tmpaddr = explode(" ", $aliasd['address']); - foreach ($tmpaddr as $tmpidx => $tmpalias) { if ($tmpalias == $a_aliases[$id]['name']) { $tmpaddr[$tmpidx] = $alias['name']; @@ -547,6 +539,7 @@ if ($_POST) { header("Location: firewall_aliases.php"); } exit; + } else { //we received input errors, copy data to prevent retype $pconfig['name'] = $_POST['name']; @@ -561,30 +554,39 @@ if ($_POST) { } } + include("head.inc"); -$network_str = gettext("Network or FQDN"); -$networks_str = gettext("Network(s)"); -$cidr_str = gettext("CIDR"); -$description_str = gettext("Description"); -$hosts_str = gettext("Host(s)"); -$ip_str = gettext("IP or FQDN"); -$ports_str = gettext("Port(s)"); -$port_str = gettext("Port"); -$url_str = gettext("URL (IPs)"); -$url_ports_str = gettext("URL (Ports)"); -$urltable_str = gettext("URL Table (IPs)"); -$urltable_ports_str = gettext("URL Table (Ports)"); -$update_freq_str = gettext("Update Freq. (days)"); +$section_str = array( + 'network' => gettext("Network(s)"), + 'host' => gettext("Host(s)"), + 'port' => gettext("Port(s)"), + 'url' => gettext("URL (IPs)"), + 'url_ports' => gettext("URL (Ports)"), + 'urltable' => gettext("URL Table (IPs)"), + 'urltable_ports' => gettext("URL Table (Ports)") + ); + +$label_str = array( + 'network' => gettext("Network or FQDN"), + 'host' => gettext("IP or FQDN"), + 'port' => gettext("Port"), + 'url' => gettext("URL (IPs)"), + 'url_ports' => gettext("URL (Ports)"), + 'urltable' => gettext("URL (IPs)"), + 'urltable_ports' => gettext("URL Table (Ports)") + ); $help = array( 'network' => "Networks are specified in CIDR format. Select the CIDR mask that pertains to each entry. /32 specifies a single IPv4 host, /128 specifies a single IPv6 host, /24 specifies 255.255.255.0, /64 specifies a normal IPv6 network, etc. Hostnames (FQDNs) may also be specified, using a /32 mask for IPv4 or /128 for IPv6. You may also enter an IP range such as 192.168.1.1-192.168.1.254 and a list of CIDR networks will be derived to fill the range.", 'host' => "Enter as many hosts as you would like. Hosts must be specified by their IP address or fully qualified domain name (FQDN). FQDN hostnames are periodically re-resolved and updated. If multiple IPs are returned by a DNS query, all are used. You may also enter an IP range such as 192.168.1.1-192.168.1.10 or a small subnet such as 192.168.1.16/28 and a list of individual IP addresses will be generated.", - 'port' => "Enter as many ports as you wish. Port ranges can be expressed by separating with a colon.", + 'port' => "Enter as many ports as you wish. Port ranges can be expressed by separating with a colon.", 'url' => "Enter as many URLs as you wish. After saving we will download the URL and import the items into the alias. Use only with small sets of IP addresses (less than 3000).", 'url_ports' => "Enter as many URLs as you wish. After saving we will download the URL and import the items into the alias. Use only with small sets of Ports (less than 3000).", - 'urltable' => "Enter a single URL containing a large number of IPs and/or Subnets. After saving we will download the URL and create a table file containing these addresses. This will work with large numbers of addresses (30,000+) or small numbers.", - 'urltable_ports' => "Enter a single URL containing a list of Port numbers and/or Port ranges. After saving we will download the URL.", + 'urltable' => "Enter a single URL containing a large number of IPs and/or Subnets. After saving we will download the URL and create a table file containing these addresses. This will work with large numbers of addresses (30,000+) or small numbers." . "<br /><b>The value after the \"/\" is the " . + "update frequency in days.</b>", + 'urltable_ports' => "Enter a single URL containing a list of Port numbers and/or Port ranges. After saving we will download the URL." . "<br /><b>The value after the \"/\" is the " . + "update frequency in days.</b>" ); $types = array( @@ -665,116 +667,258 @@ $section->addInput(new Form_Select( 'Type', isset($pconfig['type']) ? $pconfig['type'] : $tab, $types -))->toggles(); +)); $form->add($section); -foreach ($types as $type => $typeName) -{ - $section = new Form_Section('Details for '. $typeName); - $section->addClass('toggle-'.$type.' collapse'); +$section = new Form_Section($section_str[$tab]); +// Make somewhere to park the help text, and give it a class so we can update it later +$section->addInput(new Form_StaticText( + 'Hint', + '<span class="helptext">' . $help[$tab] . '</span>' +)); - // Texts are rather long; don't repeat for every input - $section->addInput(new Form_StaticText('', $help[$type])); +// If no addresses have been defined, we'll make up a blank set +if ($pconfig['address'] == "") { + $pconfig['address'] = ''; + $pconfig['address_subnet'] = ''; + $pconfig['detail'] = ''; +} - // Only include values for the correct type - if (isset($pconfig['type']) && $type == $pconfig['type']) { - $addresses = explode(' ', $pconfig['address']); - $details = explode('||', $pconfig['detail']); - } - else { - // When creating a new entry show at least one input - $addresses = array(''); - $details = array(); +$counter = 0; +$addresses = explode(" ", $pconfig['address']); +$details = explode("||", $pconfig['detail']); + +while ($counter < count($addresses)) { + if (($pconfig['type'] != "host") && is_subnet($addresses[$counter])) { + list($address, $address_subnet) = explode("/", $addresses[$counter]); + } else { + $address = $addresses[$counter]; + $address_subnet = ""; } - foreach ($addresses as $idx => $address) - { - $address_subnet = ''; - if (($pconfig['type'] != 'host') && is_subnet($address)) - list($address, $address_subnet) = explode('/', $address); - - if (substr($type, 0, 3) == 'url') { - $group = new Form_Group('URL to download'); - - $group->add(new Form_Input( - 'address', - 'URL to download', - 'url', - $address - )); - - if (in_array($type, ['urltable', 'urltable_ports'])) - { - $group->add(new Form_Input( - 'frequency', - 'Update frequency (days)', - 'number', - $address_subnet, - ['min' => 1] - )); - } - } - elseif ($type == 'port') { - $group = new Form_Group('Port(s)'); - $group->add(new Form_Input( - 'address', - 'Port', - $address - )); - - $group->add(new Form_Input( - 'detail', - 'Description (not parsed)', - 'text', - $details[$idx] - )); - } - else { - $group = new Form_Group('IP or FQDN'); - - $grpaddress = new Form_IpAddress( - 'address', - 'IP or FQDN', - $address - ); - - $grpaddress->addMask(address_subnet, $pconfig['address_subnet']); - - $group->add($grpaddress); - - $group->add(new Form_Input( - 'detail', - 'Description (not parsed)', - 'text', - $details[$idx] - )); - } + $group = new Form_Group($counter == 0 ? $label_str[$tab]:''); + $group->addClass('repeatable'); - $group->enableDuplication(); - $section->add($group); - } + $group->add(new Form_IpAddress( + 'address' . $counter, + null, + $address + ))->addMask('address_subnet' . $counter, $address_subnet)->setWidth(4); + + $group->add(new Form_Input( + 'detail' . $counter, + null, + 'text', + $details[$counter] + ))->setHelp('Description')->setWidth(4); - $form->add($section); + $group->add(new Form_Button( + 'deleterow' . $counter, + 'Delete' + ))->removeClass('btn-primary')->addClass('btn-warning'); + + $section->add($group); + $counter++; } +$section->addInput(new Form_Button( + 'addrow', + 'Add' +))->removeClass('btn-primary')->addClass('btn-success'); + +$form->add($section); + print $form; ?> <script> -//<![CDATA[ -events.push(function(){ - - // Disable address_subnet if type == 'host' - - $("[id^='address_subnet']").prop("disabled", ($('#type').val() == 'host')); - - $('#type').on('change', function() { - $("[id^='address_subnet']").prop("disabled", ($('#type').val() == 'host')); - }); +//<![CDATA[ +events.push(function(){ + + function setMasks() { + // Find all ipaddress masks and make dynamic based on address family of input + $('span.pfIpMask + select').each(function (idx, select){ + var input = $(select).prevAll('input[type=text]'); + + input.on('change', function(e){ + var isV6 = (input.val().indexOf(':') != -1), min = 0, max = 128; + if (!isV6) + max = 32; + + if (input.val() == "") + return; + + while (select.options.length > max) + select.remove(0); + + if (select.options.length < max) + { + for (var i=select.options.length; i<=max; i++) + select.options.add(new Option(i, i), 0); + } + }); + + // Fire immediately + input.change(); + }); + } + + // Complicated function to move all help text associated with this input id to the same id + // on the row above. That way if you delete the last row, you don't lose the help + function moveHelpText(id) { + $('#' + id).parent('div').parent('div').find('input').each(function() { // For each <span></span> + var fromId = this.id; + var toId = decrStringInt(fromId); + var helpSpan; + + if(!$(this).hasClass('pfIpMask') && !$(this).hasClass('btn')) { + + helpSpan = $('#' + fromId).parent('div').parent('div').find('span:last').clone(); + if($(helpSpan).hasClass('help-block')) { + if($('#' + decrStringInt(fromId)).parent('div').hasClass('input-group')) + $('#' + decrStringInt(fromId)).parent('div').after(helpSpan); + else + $('#' + decrStringInt(fromId)).after(helpSpan); + } + } + }); + } + + // Increment the number at the end of the string + function bumpStringInt( str ) { + var data = str.match(/(\D*)(\d+)(\D*)/), newStr = ""; + + if( data ) + newStr = data[ 1 ] + ( Number( data[ 2 ] ) + 1 ) + data[ 3 ]; + + return newStr || str; + } + + // Decrement the number at the end of the string + function decrStringInt( str ) { + var data = str.match(/(\D*)(\d+)(\D*)/), newStr = ""; + + if( data ) + newStr = data[ 1 ] + ( Number( data[ 2 ] ) - 1 ) + data[ 3 ]; + + return newStr || str; + } + + // Called after a delete so that there are no gaps in the numbering. Most of the time the config system doesn't care about + // gaps, but I do :) + function renumber() { + var idx = 0; + + $('.repeatable').each(function() { + + $(this).find('input').each(function() { + $(this).prop("id", this.id.replace(/\d+$/, "") + idx); + $(this).prop("name", this.name.replace(/\d+$/, "") + idx); + }); + + $(this).find('select').each(function() { + $(this).prop("id", this.id.replace(/\d+$/, "") + idx); + $(this).prop("name", this.name.replace(/\d+$/, "") + idx); + }); + + $(this).find('label').attr('for', $(this).find('label').attr('for').replace(/\d+$/, "") + idx); + + idx++; + }); + } + + function delete_row(row) { + $('#' + row).parent('div').parent('div').remove(); + renumber(); + } + + function add_row() { + // Find the lst repeatable group + var lastRepeatableGroup = $('.repeatable:last'); + + // Clone it + var newGroup = lastRepeatableGroup.clone(true); + + // Increment the suffix number for each input elemnt in the new group + $(newGroup).find('input').each(function() { + $(this).prop("id", bumpStringInt(this.id)); + $(this).prop("name", bumpStringInt(this.name)); + if(!$(this).is('[id^=delete]')) + $(this).val(''); + }); + + // Do the same for selectors + $(newGroup).find('select').each(function() { + $(this).prop("id", bumpStringInt(this.id)); + $(this).prop("name", bumpStringInt(this.name)); + // If this selector lists mask bits, we need it to be reset to all 128 options + // and no items selected, so that automatic v4/v6 selection still works + if($(this).is('[id^=address_subnet]')) { + $(this).empty(); + for(idx=128; idx>0; idx--) { + $(this).append($('<option>', { + value: idx, + text: idx + })); + } + } + }); + + // And for "for" tags + $(newGroup).find('label').attr('for', bumpStringInt($(newGroup).find('label').attr('for'))); + $(newGroup).find('label').text(""); // Clear the label. We only want it on the very first row + + // Insert the updated/cloned row + $(lastRepeatableGroup).after(newGroup); + + // Delete any help text from the group we have cloned + $(lastRepeatableGroup).find('.help-block').each(function() { + $(this).remove(); + }); + + setMasks(); + } + + // These are action buttons, not submit buttons + $('[id^=addrow]').prop('type','button'); + $('[id^=delete]').prop('type','button'); + + // on click . . + $('[id^=addrow]').click(function() { + add_row(); + }); + + $('[id^=delete]').click(function(event) { + if($('.repeatable').length > 1) { + moveHelpText(event.target.id); + delete_row(event.target.id); + } + else + alert('<?php echo gettext("You may not delet the last one!")?>'); + }); + + $('#type').on('change', function() { + var tab = $(this).find('option:selected').val(); + $("[id^='address_subnet']").prop("disabled", (tab == 'host') || (tab == 'port') || (tab == 'url') || (tab == 'url_ports')); + + // Set the help text to match the tab + var helparray = <?php echo json_encode($help); ?>; + $('.helptext').html(helparray[tab]); + + // Set the section heading by tab type + var sectionstr = <?php echo json_encode($section_str); ?>; + $('.panel-title:last').text(sectionstr[tab]); + + // Set the input field label by tab + var labelstr = <?php echo json_encode($label_str); ?>; + $('.repeatable:first').find('label').text(labelstr[tab]); + }); + // Disable address_subnet if type == 'host' + $("[id^='address_subnet']").prop("disabled", ($('#type').val() == 'host')); }); -//]]> +//]]> </script> <?php diff --git a/src/usr/local/www/firewall_aliases_import.php b/src/usr/local/www/firewall_aliases_import.php index 0199426..57378d8 100755 --- a/src/usr/local/www/firewall_aliases_import.php +++ b/src/usr/local/www/firewall_aliases_import.php @@ -93,7 +93,7 @@ if (!is_array($config['aliases']['alias'])) { } $a_aliases = &$config['aliases']['alias']; -if($_POST['aliasimport'] != "") { +if ($_POST['aliasimport'] != "") { $reqdfields = explode(" ", "name aliasimport"); $reqdfieldsn = array(gettext("Name"), gettext("Aliases")); @@ -196,7 +196,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Alias details'); diff --git a/src/usr/local/www/firewall_nat.php b/src/usr/local/www/firewall_nat.php index 651428d..82b5774 100644 --- a/src/usr/local/www/firewall_nat.php +++ b/src/usr/local/www/firewall_nat.php @@ -267,14 +267,14 @@ foreach ($a_nat as $natent): ); /* if user does not have access to edit an interface skip on to the next record */ - if(!have_natpfruleint_access($natent['interface'])) + if (!have_natpfruleint_access($natent['interface'])) continue; ?> <tr id="fr<?=$nnats?>"> <td> <?php - if($natent['associated-rule-id'] == "pass"): + if ($natent['associated-rule-id'] == "pass"): ?> <i class="icon-play" title="<?=gettext("All traffic matching this NAT entry is passed")?>"></i> <?php @@ -428,7 +428,7 @@ events.push(function() { </script> <?php -if(count($a_nat) > 0) { +if (count($a_nat) > 0) { ?> <!-- Legend --> <div> diff --git a/src/usr/local/www/firewall_nat_1to1_edit.php b/src/usr/local/www/firewall_nat_1to1_edit.php index ba92003..d5b432b 100644 --- a/src/usr/local/www/firewall_nat_1to1_edit.php +++ b/src/usr/local/www/firewall_nat_1to1_edit.php @@ -142,8 +142,8 @@ if ($_POST) { $temp = str_replace(">", "", $value); $newpost = htmlentities($temp); - if($newpost != $temp) - $input_errors[] = sprintf(gettext("Invalid characters detected (%s). Please remove invalid characters and save again."),$temp); + if ($newpost != $temp) + $input_errors[] = sprintf(gettext("Invalid characters detected (%s). Please remove invalid characters and save again."), $temp); } /* input validation */ @@ -282,17 +282,17 @@ function build_srctype_list() { $sel = is_specialnet($pconfig['src']); - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $list['pptp'] = 'PPTP clients'; - if(have_ruleint_access("pppoe")) + if (have_ruleint_access("pppoe")) $list['pppoe'] = 'PPPoE clients'; - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $list['l2tp'] = 'L2TP clients'; foreach ($ifdisp as $ifent => $ifdesc) { - if(have_ruleint_access($ifent)) { + if (have_ruleint_access($ifent)) { $list[$ifent] = $ifdesc . ' net'; $list[$ifent . 'ip'] = $ifdesc . ' address'; } @@ -306,8 +306,8 @@ function srctype_selected() { $sel = is_specialnet($pconfig['src']); - if(!$sel) { - if(($pconfig['srcmask'] == 32) || (!isset($pconfig['srcmask']))) + if (!$sel) { + if (($pconfig['srcmask'] == 32) || (!isset($pconfig['srcmask']))) return('single'); return('network'); @@ -322,17 +322,17 @@ function build_dsttype_list() { $sel = is_specialnet($pconfig['dst']); $list = array('any' => 'Any', 'single' => 'Single host or alias', 'network' => 'Network', '(self)' => 'This Firewall (self)'); - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $list['pptp'] = 'PPTP clients'; - if(have_ruleint_access("pppoe")) + if (have_ruleint_access("pppoe")) $list['pppoe'] = 'PPPoE clients'; - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $list['l2tp'] = 'L2TP clients'; foreach ($ifdisp as $if => $ifdesc) { - if(have_ruleint_access($if)) { + if (have_ruleint_access($if)) { $list[$if] = $ifdesc; $list[$if . 'ip'] = $ifdesc . ' address'; } @@ -367,11 +367,11 @@ function dsttype_selected() { $sel = is_specialnet($pconfig['dst']); - if(empty($pconfig['dst'] || $pconfig['dst'] == "any")) + if (empty($pconfig['dst'] || $pconfig['dst'] == "any")) return('any'); - if(!$sel) { - if($pconfig['dstmask'] == 32) + if (!$sel) { + if ($pconfig['dstmask'] == 32) return('single'); return('network'); @@ -383,7 +383,7 @@ function dsttype_selected() { if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'Submit', @@ -402,15 +402,15 @@ $section->addInput(new Form_Checkbox( $iflist = get_configured_interface_with_descr(false, true); foreach ($iflist as $if => $ifdesc) - if(have_ruleint_access($if)) + if (have_ruleint_access($if)) $interfaces[$if] = $ifdesc; if ($config['l2tp']['mode'] == "server") - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $interfaces['l2tp'] = "L2TP VPN"; if ($config['pptpd']['mode'] == "server") - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $interfaces['pptp'] = "PPTP VPN"; if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) @@ -418,7 +418,7 @@ if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) /* add ipsec interfaces */ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) - if(have_ruleint_access("enc0")) + if (have_ruleint_access("enc0")) $interfaces["enc0"] = "IPsec"; /* add openvpn/tun interfaces */ diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php index a75be46..ae76679 100644 --- a/src/usr/local/www/firewall_nat_edit.php +++ b/src/usr/local/www/firewall_nat_edit.php @@ -157,7 +157,7 @@ unset($input_errors); foreach ($_POST as $key => $value) { $temp = $value; $newpost = htmlentities($temp); - if($newpost != $temp) + if ($newpost != $temp) $input_errors[] = sprintf(gettext("Invalid characters detected %s. Please remove invalid characters and save again."), $temp); } @@ -534,17 +534,17 @@ function build_srctype_list() { $sel = is_specialnet($pconfig['src']); - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $list['pptp'] = 'PPTP clients'; - if(have_ruleint_access("pppoe")) + if (have_ruleint_access("pppoe")) $list['pppoe'] = 'PPPoE clients'; - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $list['l2tp'] = 'L2TP clients'; foreach ($ifdisp as $ifent => $ifdesc) { - if(have_ruleint_access($ifent)) { + if (have_ruleint_access($ifent)) { $list[$ifent] = $ifdesc . ' net'; $list[$ifent . 'ip'] = $ifdesc . ' address'; } @@ -559,17 +559,17 @@ function build_dsttype_list() { $sel = is_specialnet($pconfig['dst']); $list = array('any' => 'Any', 'single' => 'Single host or alias', 'network' => 'Network', '(self)' => 'This Firewall (self)'); - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $list['pptp'] = 'PPTP clients'; - if(have_ruleint_access("pppoe")) + if (have_ruleint_access("pppoe")) $list['pppoe'] = 'PPPoE clients'; - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $list['l2tp'] = 'L2TP clients'; foreach ($ifdisp as $if => $ifdesc) { - if(have_ruleint_access($if)) { + if (have_ruleint_access($if)) { $list[$if] = $ifdesc; $list[$if . 'ip'] = $ifdesc . ' address'; } @@ -604,8 +604,8 @@ function dsttype_selected() { $sel = is_specialnet($pconfig['dst']); - if(!$sel) { - if($pconfig['dstmask'] == 32) + if (!$sel) { + if ($pconfig['dstmask'] == 32) return('single'); return('network'); @@ -619,8 +619,8 @@ function srctype_selected() { $sel = is_specialnet($pconfig['src']); - if(!$sel) { - if($pconfig['srcmask'] == 32) + if (!$sel) { + if ($pconfig['srcmask'] == 32) return('single'); return('network'); @@ -636,7 +636,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'Submit', @@ -662,15 +662,15 @@ $section->addInput(new Form_Checkbox( $iflist = get_configured_interface_with_descr(false, true); foreach ($iflist as $if => $ifdesc) - if(have_ruleint_access($if)) + if (have_ruleint_access($if)) $interfaces[$if] = $ifdesc; if ($config['l2tp']['mode'] == "server") - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $interfaces['l2tp'] = "L2TP VPN"; if ($config['pptpd']['mode'] == "server") - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $interfaces['pptp'] = "PPTP VPN"; if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) @@ -678,11 +678,11 @@ if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) /* add ipsec interfaces */ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) - if(have_ruleint_access("enc0")) + if (have_ruleint_access("enc0")) $interfaces["enc0"] = "IPsec"; /* add openvpn/tun interfaces */ -if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) +if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) $interfaces["openvpn"] = "OpenVPN"; $section->addInput(new Form_Select( @@ -894,7 +894,7 @@ if (isset($id) && $a_nat[$id] && (!isset($_GET['dup']) || !is_numericint($_GET[' if (isset($filter_rule['associated-rule-id'])) { $rulelist[$filter_rule['associated-rule-id']] = 'Rule ' . $filter_rule['descr']; - if ($filter_rule['associated-rule-id']==$pconfig['associated-rule-id']) { + if ($filter_rule['associated-rule-id'] == $pconfig['associated-rule-id']) { $hlpstr = '<a href="firewall_rules_edit.php?id=' . $filter_id . '">' . gettext("View the filter rule") . '</a><br />'; } } @@ -902,7 +902,7 @@ if (isset($id) && $a_nat[$id] && (!isset($_GET['dup']) || !is_numericint($_GET[' } if (isset($pconfig['associated-rule-id'])) - $rulelist['new'] = 'Create new associated filter rule'; + $rulelist['new'] = 'Create new associated filter rule'; $section->addInput(new Form_Select( 'associated-rule-id', @@ -932,14 +932,14 @@ $has_updated_time = (isset($a_nat[$id]['updated']) && is_array($a_nat[$id]['upda if ($has_created_time || $has_updated_time) { $section = new Form_Section('Rule Information'); - if($has_created_time) { + if ($has_created_time) { $section->addInput(new Form_StaticText( 'Created', date(gettext("n/j/y H:i:s"), $a_nat[$id]['created']['time']) . gettext("by") . $a_nat[$id]['created']['username'] )); } - if($has_updated_time) { + if ($has_updated_time) { $section->addInput(new Form_StaticText( 'Updated', date(gettext("n/j/y H:i:s"), $a_nat[$id]['updated']['time']) . gettext("by") . $a_nat[$id]['updated']['username'] @@ -979,7 +979,7 @@ events.push(function(){ // ---------- "Library" functions --------------------------------------------------------------------------------- // Hides the <div> in which the specified input element lives so that the input, its label and help text are hidden function hideInput(id, hide) { - if(hide) + if (hide) $('#' + id).parent().parent('div').addClass('hidden'); else $('#' + id).parent().parent('div').removeClass('hidden'); @@ -992,7 +992,7 @@ events.push(function(){ // Hides all elements of the specified class. This will usually be a section function hideClass(s_class, hide) { - if(hide) + if (hide) $('.' + s_class).hide(); else $('.' + s_class).show(); @@ -1046,7 +1046,7 @@ events.push(function(){ disableInput('srcbeginport', false); disableInput('srcendport', false); disableInput('localbeginport_cust', false); - if( dstenabled ) { + if ( dstenabled ) { disableInput('dstbeginport', false); disableInput('dstendport', false); } @@ -1054,7 +1054,7 @@ events.push(function(){ } function nordr_change() { - if( $('#nordr').prop('checked') ) { + if ( $('#nordr').prop('checked') ) { hideInput('localip', true); hideClass('lclportrange', true); hideInput('associated-rule-id', true); @@ -1071,8 +1071,8 @@ events.push(function(){ // if External port range is an alias, then disallow // entry of Local port // - for(i=0; i<customarray.length; i++) { - if($('#dstbeginport_cust').val() == customarray[i]) { + for (i = 0; i < customarray.length; i++) { + if ($('#dstbeginport_cust').val() == customarray[i]) { $('#dstendport_cust').val(customarray[i]); $('#localbeginport_cust').val(customarray[i]); disableInput('dstendport_cust', true); @@ -1082,7 +1082,7 @@ events.push(function(){ disableInput('localbeginport', false); disableInput('localbeginport_cust', false); } - if($('#dstbeginport').val() == customarray[i]) { + if ($('#dstbeginport').val() == customarray[i]) { $('#dstendport_cust').val(customarray[i]); $('#localbeginport_cust').val(customarray[i]); disableInput('dstendport_cust', true); @@ -1092,7 +1092,7 @@ events.push(function(){ disableInput('localbeginport', false); disableInput('localbeginport_cust', false); } - if($('#dstendport_cust').val() == customarray[i]) { + if ($('#dstendport_cust').val() == customarray[i]) { $('#dstendport_cust').val(customarray[i]); $('#localbeginport_cust').val(customarray[i]); disableInput('dstendport_cust', true); @@ -1102,7 +1102,7 @@ events.push(function(){ disableInput('localbeginport', false); disableInput('localbeginport_cust', false); } - if($('#dstendport').val() == customarray[i]) { + if ($('#dstendport').val() == customarray[i]) { $('#dstendport_cust').val(customarray[i]); $('#localbeginport_cust').val(customarray[i]); disableInput('dstendport_cust', true); @@ -1159,7 +1159,7 @@ events.push(function(){ break; } - if(dstenabled) { + if (dstenabled) { switch ($('#dsttype').find(":selected").index()) { case 1: // single disableInput('dst', false); diff --git a/src/usr/local/www/firewall_nat_npt_edit.php b/src/usr/local/www/firewall_nat_npt_edit.php index 7e385e5..6fe0cea 100644 --- a/src/usr/local/www/firewall_nat_npt_edit.php +++ b/src/usr/local/www/firewall_nat_npt_edit.php @@ -180,42 +180,42 @@ function build_if_list() { global $ifdisp; foreach ($ifdisp as $if => $ifdesc) { - if(have_ruleint_access($if)) + if (have_ruleint_access($if)) $interfaces[$if] = $ifdesc; } if ($config['l2tp']['mode'] == "server") - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $interfaces['l2tp'] = "L2TP VPN"; if ($config['pptpd']['mode'] == "server") - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $interfaces['pptp'] = "PPTP VPN"; if ($config['pppoe']['mode'] == "server") - if(have_ruleint_access("pppoe")) + if (have_ruleint_access("pppoe")) $interfaces['pppoe'] = "PPPoE Server"; /* add ipsec interfaces */ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']['enable'])) { - if(have_ruleint_access("enc0")) + if (have_ruleint_access("enc0")) $interfaces["enc0"] = "IPsec"; } /* add openvpn/tun interfaces */ - if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) + if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) $interfaces["openvpn"] = "OpenVPN"; return($interfaces); } -$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("NPt"),gettext("Edit")); +$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("NPt"), gettext("Edit")); include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/firewall_nat_out.php b/src/usr/local/www/firewall_nat_out.php index 8f3d458..d1c97b5 100644 --- a/src/usr/local/www/firewall_nat_out.php +++ b/src/usr/local/www/firewall_nat_out.php @@ -152,10 +152,10 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") { $found = false; foreach ($a_out as $rule) { if ($rule['interface'] == $natent['interface'] && - $rule['source']['network'] == $natent['source']['network'] && - $rule['dstport'] == $natent['dstport'] && - $rule['target'] == $natent['target'] && - $rule['descr'] == $natent['descr']) { + $rule['source']['network'] == $natent['source']['network'] && + $rule['dstport'] == $natent['dstport'] && + $rule['target'] == $natent['target'] && + $rule['descr'] == $natent['descr']) { $found = true; break; } @@ -269,16 +269,16 @@ if (isset($_POST['del_x'])) { } } -function rule_popup($src,$srcport,$dst,$dstport){ - global $config,$g; +function rule_popup($src, $srcport, $dst, $dstport) { + global $config, $g; $aliases_array = array(); if ($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias'])) { $descriptions = array (); - foreach ($config['aliases']['alias'] as $alias_id=>$alias_name){ + foreach ($config['aliases']['alias'] as $alias_id => $alias_name) { $loading_image="<a><img src=\'/themes/{$g['theme']}/images/misc/loader.gif\' alt=\'loader\' /> " .gettext("loading...")."</a>"; - switch ($alias_name['type']){ + switch ($alias_name['type']) { case "port": $width="250"; break; @@ -303,7 +303,7 @@ function rule_popup($src,$srcport,$dst,$dstport){ $descriptions['srcport_end'] = $span_end; } - if ($alias_name['name'] == $dst ) { + if ($alias_name['name'] == $dst) { $descriptions['dst'] = $span_begin; $descriptions['dst_end'] = $span_end; } @@ -318,7 +318,7 @@ function rule_popup($src,$srcport,$dst,$dstport){ } } -$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("Outbound")); +$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Outbound")); include("head.inc"); if ($savemsg) @@ -334,7 +334,7 @@ $tab_array[] = array(gettext("Outbound"), true, "firewall_nat_out.php"); $tab_array[] = array(gettext("NPt"), false, "firewall_nat_npt.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); @@ -411,11 +411,11 @@ print($form); $alias = rule_columns_with_alias( - $natent['source']['address'], - pprint_port($natent['source']['port']), - $natent['destination']['address'], - pprint_port($natent['destination']['port']) - ); + $natent['source']['address'], + pprint_port($natent['source']['port']), + $natent['destination']['address'], + pprint_port($natent['destination']['port']) + ); ?> <tr id="fr<?=$i?>"> <td> @@ -464,9 +464,9 @@ print($form); <td> <?php echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ; - if (!$natent['sourceport']) + if (!$natent['sourceport']) { echo "*"; - else { + } else { if (isset($alias['srcport'])): ?> @@ -487,9 +487,9 @@ print($form); <td> <?php - if (isset($natent['destination']['any'])) + if (isset($natent['destination']['any'])) { echo "*"; - else { + } else { if (isset($natent['destination']['not'])) echo "! "; @@ -515,9 +515,9 @@ print($form); <?php echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ; - if (!$natent['dstport']) + if (!$natent['dstport']) { echo "*"; - else { + } else { if (isset($alias['dstport'])): ?> <a href="/firewall_aliases_edit.php?id=<?=$alias['dstport']?>" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="<?=alias_info_popup($alias['dstport'])?>" data-html="true"> @@ -560,7 +560,7 @@ print($form); <td> <?php - if(isset($natent['staticnatport'])) + if (isset($natent['staticnatport'])) echo gettext("YES"); else echo gettext("NO"); @@ -594,10 +594,10 @@ print($form); <?php if ($mode == "automatic" || $mode == "hybrid"): - if(empty($FilterIflist)) + if (empty($FilterIflist)) filter_generate_optcfg_array(); - if(empty($GatewaysList)) + if (empty($GatewaysList)) filter_generate_gateways(); $automatic_rules = filter_nat_rules_outbound_automatic(implode(" ", filter_nat_rules_automatic_tonathosts())); @@ -646,14 +646,14 @@ if ($mode == "automatic" || $mode == "hybrid"): </td> <td> <?php - if (isset($natent['destination']['any'])) + if (isset($natent['destination']['any'])) { echo "*"; - else { + } else { if (isset($natent['destination']['not'])) echo "! "; echo $natent['destination']['address']; - } + } ?> </td> <td> @@ -687,7 +687,7 @@ if ($mode == "automatic" || $mode == "hybrid"): </td> <td> <?php - if(isset($natent['staticnatport'])) + if (isset($natent['staticnatport'])) echo gettext("YES"); else echo gettext("NO"); @@ -709,8 +709,8 @@ endif; <div> <?php - print_info_box(gettext('If automatic outbound NAT selected, a mapping is automatically generated for each interface\'s subnet (except WAN-type connections) and the rules ' . - 'on "Mappings" section of this page are ignored.' . '<br />' . + print_info_box(gettext('If automatic outbound NAT is selected, a mapping is automatically generated for each interface\'s subnet (except WAN-type connections) and the rules ' . + 'on the "Mappings" section of this page are ignored.' . '<br />' . 'If manual outbound NAT is selected, outbound NAT rules will not be automatically generated and only the mappings you specify on this page ' . 'will be used.' . '<br />' . 'If hybrid outbound NAT is selected, mappings you specify on this page will be used, followed by the automatically generated ones.' . '<br />' . diff --git a/src/usr/local/www/firewall_nat_out_edit.php b/src/usr/local/www/firewall_nat_out_edit.php index 4d85609..222ad52 100644 --- a/src/usr/local/www/firewall_nat_out_edit.php +++ b/src/usr/local/www/firewall_nat_out_edit.php @@ -439,7 +439,7 @@ function build_target_list() { if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'Submit', @@ -465,15 +465,15 @@ $section->addInput(new Form_Checkbox( $iflist = get_configured_interface_with_descr(false, true); foreach ($iflist as $if => $ifdesc) - if(have_ruleint_access($if)) + if (have_ruleint_access($if)) $interfaces[$if] = $ifdesc; if ($config['l2tp']['mode'] == "server") - if(have_ruleint_access("l2tp")) + if (have_ruleint_access("l2tp")) $interfaces['l2tp'] = "L2TP VPN"; if ($config['pptpd']['mode'] == "server") - if(have_ruleint_access("pptp")) + if (have_ruleint_access("pptp")) $interfaces['pptp'] = "PPTP VPN"; if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) @@ -481,11 +481,11 @@ if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) /* add ipsec interfaces */ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) - if(have_ruleint_access("enc0")) + if (have_ruleint_access("enc0")) $interfaces["enc0"] = "IPsec"; /* add openvpn/tun interfaces */ -if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) +if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) $interfaces["openvpn"] = "OpenVPN"; $section->addInput(new Form_Select( @@ -669,14 +669,14 @@ $has_updated_time = (isset($a_out[$id]['updated']) && is_array($a_out[$id]['upda if ($has_created_time || $has_updated_time) { $section = new Form_Section('Rule Information'); - if($has_created_time) { + if ($has_created_time) { $section->addInput(new Form_StaticText( 'Created', date(gettext("n/j/y H:i:s"), $a_out[$id]['created']['time']) . gettext("by") . $a_out[$id]['created']['username'] )); } - if($has_updated_time) { + if ($has_updated_time) { $section->addInput(new Form_StaticText( 'Updated', date(gettext("n/j/y H:i:s"), $a_out[$id]['updated']['time']) . gettext("by") . $a_out[$id]['updated']['username'] @@ -697,7 +697,7 @@ events.push(function(){ // Hides the <div> in which the specified input element lives so that the input, its label and help text are hidden function hideInput(id, hide) { - if(hide) + if (hide) $('#' + id).parent().parent('div').addClass('hidden'); else $('#' + id).parent().parent('div').removeClass('hidden'); @@ -706,7 +706,7 @@ events.push(function(){ // Hides the <div> in which the specified group input element lives so that the input, // its label and help text are hidden function hideGroupInput(id, hide) { - if(hide) + if (hide) $('#' + id).parent('div').addClass('hidden'); else $('#' + id).parent('div').removeClass('hidden'); @@ -714,7 +714,7 @@ events.push(function(){ // Hides the <div> in which the specified checkbox lives so that the checkbox, its label and help text are hidden function hideCheckbox(id, hide) { - if(hide) + if (hide) $('#' + id).parent().parent().parent('div').addClass('hidden'); else $('#' + id).parent().parent().parent('div').removeClass('hidden'); @@ -727,7 +727,7 @@ events.push(function(){ // Hides all elements of the specified class. This will usually be a section function hideClass(s_class, hide) { - if(hide) + if (hide) $('.' + s_class).hide(); else $('.' + s_class).show(); @@ -735,14 +735,14 @@ events.push(function(){ // Hides all elements of the specified class assigned to a group. This will usually be a group function hideGroupClass(s_class, hide) { - if(hide) + if (hide) $('.' + s_class).parent().parent().parent().hide(); else $('.' + s_class).parent().parent().parent().show(); } function staticportchange() { - if($('#staticnatport').prop('checked')) { + if ($('#staticnatport').prop('checked')) { $('#natport').val(""); disableInput('natport' , true); } else { @@ -751,7 +751,7 @@ events.push(function(){ } function sourcesel_change() { - if($('#source_type').find(":selected").val() == "network") { + if ($('#source_type').find(":selected").val() == "network") { disableInput('source', false); disableInput('source_subnet', false); } @@ -764,7 +764,7 @@ events.push(function(){ } function typesel_change() { - if($('#destination_type').find(":selected").val() == "network") { + if ($('#destination_type').find(":selected").val() == "network") { disableInput('destination', false); disableInput('destination_subnet', false); } @@ -781,7 +781,7 @@ events.push(function(){ } function proto_change() { - if( ($('#protocol').find(":selected").index() > 0) && ($('#protocol').find(":selected").index() <= 3) ) { + if (($('#protocol').find(":selected").index() > 0) && ($('#protocol').find(":selected").index() <= 3)) { hideGroupInput('sourceport', false); hideGroupInput('dstport', false); hideClass('natportgrp', false); diff --git a/src/usr/local/www/firewall_rules.php b/src/usr/local/www/firewall_rules.php index cf5497b..f3b4b00 100644 --- a/src/usr/local/www/firewall_rules.php +++ b/src/usr/local/www/firewall_rules.php @@ -173,7 +173,7 @@ if ($_POST) { clear_subsystem_dirty('filter'); - $savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background.<br />You can also %s monitor %s the reload progress"),"<a href='status_filter_reload.php'>","</a>"); + $savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background.<br />You can also %s monitor %s the reload progress"), "<a href='status_filter_reload.php'>", "</a>"); } } @@ -268,8 +268,8 @@ display_top_tabs($tab_array); <?php // Show the anti-lockout rule if it's enabled, and we are on LAN with an if count > 1, or WAN with an if count of 1. if (!isset($config['system']['webgui']['noantilockout']) && - (((count($config['interfaces']) > 1) && ($if == 'lan')) - || ((count($config['interfaces']) == 1) && ($if == 'wan')))): + (((count($config['interfaces']) > 1) && ($if == 'lan')) || + ((count($config['interfaces']) == 1) && ($if == 'wan')))): $alports = implode('<br />', filter_get_antilockout_ports(true)); ?> <tr id="antilockout"> @@ -374,19 +374,19 @@ display_top_tabs($tab_array); $sched_caption_escaped = ""; $sched_content = ""; $schedstatus = false; - $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')); + $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')); if ($config['schedules']['schedule'] != "" && is_array($config['schedules']['schedule'])) { foreach ($a_schedules as $schedule) { - if ($schedule['name'] == $filterent['sched'] ){ + if ($schedule['name'] == $filterent['sched']) { $schedstatus = filter_get_time_based_rule_status($schedule); - foreach($schedule['timerange'] as $timerange) { + foreach ($schedule['timerange'] as $timerange) { $tempFriendlyTime = ""; $tempID = ""; $firstprint = false; - if ($timerange){ + if ($timerange) { $dayFriendly = ""; $tempFriendlyTime = ""; @@ -397,13 +397,13 @@ display_top_tabs($tab_array); $starttime = substr ($temptimerange, 0, $temptimeseparator); $stoptime = substr ($temptimerange, $temptimeseparator+1); - if ($timerange['month']){ + if ($timerange['month']) { $tempmontharray = explode(",", $timerange['month']); - $tempdayarray = explode(",",$timerange['day']); + $tempdayarray = explode(",", $timerange['day']); $arraycounter = 0; $firstDayFound = false; $firstPrint = false; - foreach ($tempmontharray as $monthtmp){ + foreach ($tempmontharray as $monthtmp) { $month = $tempmontharray[$arraycounter]; $day = $tempdayarray[$arraycounter]; @@ -417,7 +417,7 @@ display_top_tabs($tab_array); $currentDay = $day; $nextDay = $tempdayarray[$arraycounter+1]; $currentDay++; - if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){ + if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) { if ($firstPrint) $dayFriendly .= ", "; $currentDay--; @@ -440,8 +440,8 @@ display_top_tabs($tab_array); $firstDay = ""; $nextDay = ""; $counter = 0; - foreach ($tempFriendlyDayArray as $day){ - if ($day != ""){ + foreach ($tempFriendlyDayArray as $day) { + if ($day != "") { if (!$firstDayFound) { $firstDay = $tempFriendlyDayArray[$counter]; @@ -451,7 +451,7 @@ display_top_tabs($tab_array); //get next day $nextDay = $tempFriendlyDayArray[$counter+1]; $currentDay++; - if ($currentDay != $nextDay){ + if ($currentDay != $nextDay) { if ($firstprint) $dayFriendly .= ", "; $currentDay--; @@ -504,7 +504,7 @@ display_top_tabs($tab_array); <td> <?php if (isset($filterent['ipprotocol'])) { - switch($filterent['ipprotocol']) { + switch ($filterent['ipprotocol']) { case "inet": echo "IPv4 "; break; @@ -524,7 +524,7 @@ display_top_tabs($tab_array); if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) { echo ' <span style="cursor: help;" title="ICMP type: ' . - ( $filterent['ipprotocol'] == "inet6" ? $icmp6types[$filterent['icmptype']] : $icmptypes[$filterent['icmptype']] ) . + ($filterent['ipprotocol'] == "inet6" ? $icmp6types[$filterent['icmptype']] : $icmptypes[$filterent['icmptype']]) . '"><u>'; echo $filterent['icmptype']; echo '</u></span>'; diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php index 184cadb..4575364 100644 --- a/src/usr/local/www/firewall_rules_edit.php +++ b/src/usr/local/www/firewall_rules_edit.php @@ -86,16 +86,16 @@ function is_aoadv_used($rule_config) { // Note that the user could set "tag" or "tagged" to the string "0", which is valid but empty(). // And if the user enters "0" in other fields, we want to present an error message, and keep the Advanced Options section open. if ((isset($rule_config['allowopts'])) || - (isset($rule_config['disablereplyto'])) || - ($rule_config['tag'] != "") || - ($rule_config['tagged'] != "") || - ($rule_config['max'] != "") || - ($rule_config['max-src-nodes'] != "") || - ($rule_config['max-src-conn'] != "") || - ($rule_config['max-src-states'] != "") || - ($rule_config['max-src-conn-rate'] != "") || - ($rule_config['max-src-conn-rates'] != "") || - ($rule_config['statetimeout'] != "")) { + (isset($rule_config['disablereplyto'])) || + ($rule_config['tag'] != "") || + ($rule_config['tagged'] != "") || + ($rule_config['max'] != "") || + ($rule_config['max-src-nodes'] != "") || + ($rule_config['max-src-conn'] != "") || + ($rule_config['max-src-states'] != "") || + ($rule_config['max-src-conn-rate'] != "") || + ($rule_config['max-src-conn-rates'] != "") || + ($rule_config['statetimeout'] != "")) { return true; } return false; @@ -450,12 +450,12 @@ if ($_POST) { } if (isset($a_filter[$id]['associated-rule-id']) === false && - (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single")))) { + (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single")))) { $reqdfields[] = "srcmask"; $reqdfieldsn[] = "Source bit count"; } if (isset($a_filter[$id]['associated-rule-id']) === false && - (!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single")))) { + (!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single")))) { $reqdfields[] = "dstmask"; $reqdfieldsn[] = gettext("Destination bit count"); } @@ -493,7 +493,7 @@ if ($_POST) { $input_errors[] = 'The same port alias must be used in Source port range from: and to: fields'; } if ((is_alias($_POST['srcbeginport_cust']) && (!is_alias($_POST['srcendport_cust']) && $_POST['srcendport_cust'] != '')) || - ((!is_alias($_POST['srcbeginport_cust']) && $_POST['srcbeginport_cust'] != '') && is_alias($_POST['srcendport_cust']))) { + ((!is_alias($_POST['srcbeginport_cust']) && $_POST['srcbeginport_cust'] != '') && is_alias($_POST['srcendport_cust']))) { $input_errors[] = 'You cannot specify numbers and port aliases at the same time in Source port range from: and to: field'; } } @@ -507,7 +507,7 @@ if ($_POST) { $input_errors[] = 'The same port alias must be used in Destination port range from: and to: fields'; } if ((is_alias($_POST['dstbeginport_cust']) && (!is_alias($_POST['dstendport_cust']) && $_POST['dstendport_cust'] != '')) || - ((!is_alias($_POST['dstbeginport_cust']) && $_POST['dstbeginport_cust'] != '') && is_alias($_POST['dstendport_cust']))) { + ((!is_alias($_POST['dstbeginport_cust']) && $_POST['dstbeginport_cust'] != '') && is_alias($_POST['dstendport_cust']))) { $input_errors[] = 'You cannot specify numbers and port aliases at the same time in Destination port range from: and to: field'; } } @@ -702,7 +702,7 @@ if ($_POST) { } if ((($_POST['max-src-conn-rate'] <> "" and $_POST['max-src-conn-rates'] == "")) || - (($_POST['max-src-conn-rate'] == "" and $_POST['max-src-conn-rates'] <> ""))) { + (($_POST['max-src-conn-rate'] == "" and $_POST['max-src-conn-rates'] <> ""))) { $input_errors[] = gettext("Both maximum new connections per host and the interval (per second(s)) must be specified"); } @@ -1000,7 +1000,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Edit Firewall rule'); @@ -1085,9 +1085,9 @@ $edit_disabled = isset($pconfig['associated-rule-id']); if ($edit_disabled) { $extra = ''; - foreach( $config['nat']['rule'] as $index => $nat_rule ) + foreach ($config['nat']['rule'] as $index => $nat_rule) { - if ($nat_rule['associated-rule-id'] === $pconfig['associated-rule-id'] ) + if ($nat_rule['associated-rule-id'] === $pconfig['associated-rule-id']) $extra = '<br/><a href="firewall_nat_edit.php?id='. $index .'">'. gettext('View the NAT rule') .'</a>'; } @@ -1143,7 +1143,7 @@ if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enabl $interfaces["enc0"] = "IPsec"; /* add openvpn/tun interfaces */ -if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) +if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) $interfaces["openvpn"] = "OpenVPN"; $section->addInput($input = new Form_Select( @@ -1245,8 +1245,8 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) { if (is_specialnet($pconfig[$type])) $ruleType = 'network'; elseif ((is_ipaddrv6($pconfig[$type]) && $pconfig[$type.'mask'] == 128) || - (is_ipaddrv4($pconfig[$type]) && $pconfig[$type.'mask'] == 32) || - (is_alias($pconfig[$type]))) + (is_ipaddrv4($pconfig[$type]) && $pconfig[$type.'mask'] == 32) || + (is_alias($pconfig[$type]))) $ruleType = 'single'; $ruleValues = array( @@ -1287,7 +1287,7 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) { $section->add($group); - if($type == 'src') { + if ($type == 'src') { $section->addInput(new Form_Button( 'btnsrcadv', 'Show advanced' @@ -1336,14 +1336,14 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) { if ($type == 'src') $group->setHelp('Specify the source port or port range for this rule. This is '. 'usually random and almost never equal to the destination port range (and '. - 'should usually be <b>any.</b> You can leave the "To" field '. + 'should usually be <b>any</b>). You can leave the "To" field '. 'empty if you only want to filter a single port.'); else $group->setHelp('Specify the destination port or port range for this rule. ' . 'You can leave the "To" field empty if you only want to filter a '. 'single port.'); - $group->addClass( ($type == 'src') ? 'srcprtr':'dstprtr'); + $group->addClass(($type == 'src') ? 'srcprtr':'dstprtr'); $section->add($group); $form->add($section); } @@ -1662,7 +1662,7 @@ events.push(function(){ // Hides the <div> in which the specified input element lives so that the input, its label and help text are hidden function hideInput(id, hide) { - if(hide) + if (hide) $('#' + id).parent().parent('div').addClass('hidden'); else $('#' + id).parent().parent('div').removeClass('hidden'); @@ -1671,7 +1671,7 @@ events.push(function(){ // Hides the <div> in which the specified group input element lives so that the input, // its label and help text are hidden function hideGroupInput(id, hide) { - if(hide) + if (hide) $('#' + id).parent('div').addClass('hidden'); else $('#' + id).parent('div').removeClass('hidden'); @@ -1679,7 +1679,7 @@ events.push(function(){ // Hides the <div> in which the specified checkbox lives so that the checkbox, its label and help text are hidden function hideCheckbox(id, hide) { - if(hide) + if (hide) $('#' + id).parent().parent().parent('div').addClass('hidden'); else $('#' + id).parent().parent().parent('div').removeClass('hidden'); @@ -1692,7 +1692,7 @@ events.push(function(){ // Hides all elements of the specified class. This will usually be a section function hideClass(s_class, hide) { - if(hide) + if (hide) $('.' + s_class).hide(); else $('.' + s_class).show(); @@ -1700,7 +1700,7 @@ events.push(function(){ // Hides all elements of the specified class assigned to a group. This will usually be a group function hideGroupClass(s_class, hide) { - if(hide) + if (hide) $('.' + s_class).parent().parent().parent().hide(); else $('.' + s_class).parent().parent().parent().show(); @@ -1753,7 +1753,7 @@ events.push(function(){ disableInput('dstbeginport', true); disableInput('dstendport', true); } else { - if( editenabled ) { + if (editenabled) { disableInput('srcbeginport', false); disableInput('srcendport', false); disableInput('dstbeginport', false); @@ -1769,7 +1769,7 @@ events.push(function(){ } function typesel_change() { - if( editenabled ) { + if (editenabled) { switch ($('#srctype').find(":selected").index()) { case 1: // single disableInput('src', false); @@ -1833,11 +1833,11 @@ events.push(function(){ ext_change(); - if($('#proto').find(":selected").index() == 3 || $('#proto').find(":selected").index() == 4) { - if($('#ipprotocol').find(":selected").index() == 0) { // IPv4 + if ($('#proto').find(":selected").index() == 3 || $('#proto').find(":selected").index() == 4) { + if ($('#ipprotocol').find(":selected").index() == 0) { // IPv4 hideInput('icmptype', false); hideInput('icmp6type', true); - } else if($('#ipprotocol').find(":selected").index() == 1) { // IPv6 + } else if ($('#ipprotocol').find(":selected").index() == 1) { // IPv6 hideInput('icmptype', true); hideInput('icmp6type', false); } else { // IPv4 + IPv6 @@ -1849,7 +1849,7 @@ events.push(function(){ hideInput('icmp6type', true); } - if($('#proto').find(":selected").index() >= 0 && $('#proto').find(":selected").index() <= 2) { + if ($('#proto').find(":selected").index() >= 0 && $('#proto').find(":selected").index() <= 2) { hideClass('dstprtr', false); hideClass('srcprtr', false); } else { @@ -1925,12 +1925,12 @@ events.push(function(){ $('#toggle-advanced').click(function() { optionsvisible = 1; hideClass('advanced-options', false); - if($('#tcpflags_any').prop('checked')) + if ($('#tcpflags_any').prop('checked')) $('.table-flags').addClass('hidden'); }); $('#tcpflags_any').click(function () { - if(this.checked) + if (this.checked) $('.table-flags').addClass('hidden'); else $('.table-flags').removeClass('hidden'); @@ -1944,7 +1944,7 @@ events.push(function(){ function setOptText(target, val) { var dispstr = '<font color="green">'; - if(val == 'keep state') + if (val == 'keep state') dispstr += 'Keep: works with all IP protocols</font>'; else if (val == 'sloppy state') dispstr += 'Sloppy: works with all IP protocols'; diff --git a/src/usr/local/www/firewall_schedule.php b/src/usr/local/www/firewall_schedule.php index f3e2062..d52884f 100644 --- a/src/usr/local/www/firewall_schedule.php +++ b/src/usr/local/www/firewall_schedule.php @@ -101,7 +101,7 @@ if ($_GET['act'] == "del") { } if ($is_schedule_referenced == true) { - $savemsg = sprintf(gettext("Cannot delete Schedule. Currently in use by %s"), $referenced_by); + $savemsg = sprintf(gettext("Cannot delete Schedule. Currently in use by %s"), $referenced_by); } else { unset($a_schedules[$_GET['id']]); write_config(); @@ -146,7 +146,7 @@ foreach ($a_schedules as $schedule): <td> <?php $first = true; - foreach($schedule['timerange'] as $timerange) { + foreach ($schedule['timerange'] as $timerange) { $tempFriendlyTime = ""; $tempID = ""; $firstprint = false; @@ -164,11 +164,11 @@ foreach ($a_schedules as $schedule): if ($timerange['month']) { $tempmontharray = explode(",", $timerange['month']); - $tempdayarray = explode(",",$timerange['day']); + $tempdayarray = explode(",", $timerange['day']); $arraycounter = 0; $firstDayFound = false; $firstPrint = false; - foreach ($tempmontharray as $monthtmp){ + foreach ($tempmontharray as $monthtmp) { $month = $tempmontharray[$arraycounter]; $day = $tempdayarray[$arraycounter]; @@ -182,7 +182,7 @@ foreach ($a_schedules as $schedule): $nextDay = $tempdayarray[$arraycounter+1]; $currentDay++; - if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){ + if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) { if ($firstPrint) $dayFriendly .= "<br />"; @@ -208,8 +208,8 @@ foreach ($a_schedules as $schedule): $nextDay = ""; $counter = 0; - foreach ($tempFriendlyDayArray as $day){ - if ($day != ""){ + foreach ($tempFriendlyDayArray as $day) { + if ($day != "") { if (!$firstDayFound) { $firstDay = $tempFriendlyDayArray[$counter]; @@ -221,7 +221,7 @@ foreach ($a_schedules as $schedule): $nextDay = $tempFriendlyDayArray[$counter+1]; $currentDay++; - if ($currentDay != $nextDay){ + if ($currentDay != $nextDay) { if ($firstprint) $dayFriendly .= "<br />"; @@ -269,7 +269,7 @@ endforeach; </div> </div> -<?=($i > 0) ? gettext(CLOCK . ' Indicates that the scedule is currently active.'):''?> +<?=($i > 0) ? gettext(CLOCK . ' Indicates that the schedule is currently active.'):''?> <nav class="action-buttons"> <a href="firewall_schedule_edit.php" class="btn btn-sm btn-success"><?=gettext("Add new schedule")?></a> diff --git a/src/usr/local/www/firewall_schedule_edit.php b/src/usr/local/www/firewall_schedule_edit.php index bec4029..7be4f09 100644 --- a/src/usr/local/www/firewall_schedule_edit.php +++ b/src/usr/local/www/firewall_schedule_edit.php @@ -70,13 +70,13 @@ function schedulecmp($a, $b) { return strcmp($a['name'], $b['name']); } -function schedule_sort(){ - global $g, $config; +function schedule_sort() { + global $g, $config; - if (!is_array($config['schedules']['schedule'])) - return; + if (!is_array($config['schedules']['schedule'])) + return; - usort($config['schedules']['schedule'], "schedulecmp"); + usort($config['schedules']['schedule'], "schedulecmp"); } require("guiconfig.inc"); @@ -84,12 +84,12 @@ require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); -$pgtitle = array(gettext("Firewall"),gettext("Schedules"),gettext("Edit")); +$pgtitle = array(gettext("Firewall"), gettext("Schedules"), gettext("Edit")); $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')); +$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')); if (!is_array($config['schedules']['schedule'])) $config['schedules']['schedule'] = array(); @@ -112,13 +112,13 @@ if (isset($id) && $a_schedules[$id]) { if ($_POST) { - if(strtolower($_POST['name']) == "lan") + if (strtolower($_POST['name']) == "lan") $input_errors[] = gettext("Schedule may not be named LAN."); - if(strtolower($_POST['name']) == "wan") + if (strtolower($_POST['name']) == "wan") $input_errors[] = gettext("Schedule may not be named WAN."); - if(strtolower($_POST['name']) == "") + if (strtolower($_POST['name']) == "") $input_errors[] = gettext("Schedule name cannot be blank."); $x = is_validaliasname($_POST['name']); @@ -147,8 +147,8 @@ if ($_POST) { $timerangeFound = false; - for ($x=0; $x<99; $x++){ - if($_POST['schedule' . $x]) { + for ($x = 0; $x < 99; $x++) { + if ($_POST['schedule' . $x]) { if (!preg_match('/^[0-9]+:[0-9]+$/', $_POST['starttime' . $x])) { $input_errors[] = sprintf(gettext("Invalid start time - '%s'"), $_POST['starttime' . $x]); continue; @@ -181,7 +181,7 @@ if ($_POST) { $tempindarray = explode(",", $timestr); foreach ($tempindarray as $currentselection) { - if ($currentselection){ + if ($currentselection) { if ($firstprint) { $monthstr .= ","; @@ -216,10 +216,10 @@ if ($_POST) { else $schedule['schedlabel'] = uniqid(); - if (isset($id) && $a_schedules[$id]){ + if (isset($id) && $a_schedules[$id]) { $a_schedules[$id] = $schedule; } - else{ + else { $a_schedules[] = $schedule; } @@ -257,7 +257,7 @@ function build_date_table() { $monthcounter = date("n"); $yearcounter = date("Y"); - for ($k=0; $k<12; $k++){ + for ($k = 0; $k < 12; $k++) { $firstdayofmonth = date("w", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter))); if ($firstdayofmonth == 0) @@ -273,7 +273,7 @@ function build_date_table() { $mostr = '<div id="' . date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter))) ; $mostr .= '" style="position:relative; display:'; - if($firstmonth) + if ($firstmonth) $mostr .= "block"; else $mostr .= "none"; @@ -306,7 +306,7 @@ function build_date_table() { $mostr .= "<tr>"; } - if ($firstdayofmonth == $positioncounter){ + if ($firstdayofmonth == $positioncounter) { $mostr .= '<td class="text-center" style="cursor: pointer;" id="w' . $weekcounter . 'p' . $positioncounter . '" onclick="daytoggle(\'w' . $weekcounter . 'p' . $positioncounter . '-m' . $monthcounter . 'd' . $daycounter . '\');">' . $daycounter . "\r\n"; @@ -324,11 +324,11 @@ function build_date_table() { $mostr .= '<td class="text-center"></td>'; } - if ($positioncounter == 7 || $daycounter > $numberofdays){ + if ($positioncounter == 7 || $daycounter > $numberofdays) { $positioncounter = 1; $mostr .= "</tr>"; } - else{ + else { $positioncounter++; } @@ -362,7 +362,7 @@ function build_month_list() { $monthlimit = $monthcounter + 12; $yearcounter = date("Y"); - for ($k=0; $k<12; $k++){ + for ($k = 0; $k < 12; $k++) { $list[$monthcounter] = date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter))); if ($monthcounter == 12) { @@ -381,7 +381,7 @@ function build_month_list() { if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); @@ -397,7 +397,7 @@ $input = new Form_Input( $input->setHelp((is_schedule_inuse($pconfig['name']) != true) ? 'The name of the alias may only consist of the characters a-z, A-Z and 0-9': 'This schedule is in use so the name may not be modified!'); -if(is_schedule_inuse($pconfig['name']) == true) +if (is_schedule_inuse($pconfig['name']) == true) $input->setReadonly(); $section->addInput($input); @@ -490,179 +490,179 @@ $form->add($section); $section = new Form_Section('Configured ranges'); $counter = 0; -if ($getSchedule){ +if ($getSchedule) { $maxrows = count($pconfig['timerange']) -1; - foreach($pconfig['timerange'] as $timerange) { + foreach ($pconfig['timerange'] as $timerange) { $tempFriendlyTime = ""; $tempID = ""; - if ($timerange){ - $dayFriendly = ""; - $tempFriendlyTime = ""; - $timedescr = $timerange['rangedescr']; - - //get hours - $temptimerange = $timerange['hour']; - $temptimeseparator = strrpos($temptimerange, "-"); - - $starttime = substr ($temptimerange, 0, $temptimeseparator); - $stoptime = substr ($temptimerange, $temptimeseparator+1); - $currentDay = ""; - $firstDay = ""; - $nextDay = ""; - $foundEnd = false; - $firstDayFound = false; - $firstPrint = false; - $firstprint2 = false; - - if ($timerange['month']){ - $tempmontharray = explode(",", $timerange['month']); - $tempdayarray = explode(",",$timerange['day']); - $arraycounter = 0; - foreach ($tempmontharray as $monthtmp){ - $month = $tempmontharray[$arraycounter]; - $day = $tempdayarray[$arraycounter]; - $daypos = date("w", mktime(0, 0, 0, date($month), date($day), date("Y"))); - //if sunday, set position to 7 to get correct week number. This is due to php limitations on ISO-8601. When we move to php5.1 we can change this. - if ($daypos == 0){ - $daypos = 7; - } - - $weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y"))); - $weeknumber = ltrim($weeknumber, "0"); - - if ($firstPrint) - { - $tempID .= ","; - } - - $tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day; - $firstPrint = true; - - if (!$firstDayFound) - { - $firstDay = $day; - $firstmonth = $month; - $firstDayFound = true; - } - - $currentDay = $day; - $nextDay = $tempdayarray[$arraycounter+1]; - $currentDay++; - if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){ - if ($firstprint2) - $tempFriendlyTime .= ", "; - - $currentDay--; + if ($timerange) { + $dayFriendly = ""; + $tempFriendlyTime = ""; + $timedescr = $timerange['rangedescr']; + + //get hours + $temptimerange = $timerange['hour']; + $temptimeseparator = strrpos($temptimerange, "-"); + + $starttime = substr ($temptimerange, 0, $temptimeseparator); + $stoptime = substr ($temptimerange, $temptimeseparator+1); + $currentDay = ""; + $firstDay = ""; + $nextDay = ""; + $foundEnd = false; + $firstDayFound = false; + $firstPrint = false; + $firstprint2 = false; + + if ($timerange['month']) { + $tempmontharray = explode(",", $timerange['month']); + $tempdayarray = explode(",", $timerange['day']); + $arraycounter = 0; + foreach ($tempmontharray as $monthtmp) { + $month = $tempmontharray[$arraycounter]; + $day = $tempdayarray[$arraycounter]; + $daypos = date("w", mktime(0, 0, 0, date($month), date($day), date("Y"))); + //if sunday, set position to 7 to get correct week number. This is due to php limitations on ISO-8601. When we move to php5.1 we can change this. + if ($daypos == 0) { + $daypos = 7; + } - if ($currentDay != $firstDay) - $tempFriendlyTime .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ; - else - $tempFriendlyTime .= $monthArray[$month-1] . " " . $day; + $weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y"))); + $weeknumber = ltrim($weeknumber, "0"); - $firstDayFound = false; - $firstprint2 = true; - } - $arraycounter++; - } + if ($firstPrint) + { + $tempID .= ","; + } - } - else - { - $dayFriendly = $timerange['position']; - $tempID = $dayFriendly; - } + $tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day; + $firstPrint = true; - $tempTime = $tempID . "||" . $starttime . "-" . $stoptime . "||" . $timedescr; - - //following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed - $foundEnd = false; - $firstDayFound = false; - $firstprint = false; - $tempFriendlyDayArray = explode(",", $dayFriendly); - $currentDay = ""; - $firstDay = ""; - $nextDay = ""; - $i = 0; - - if (!$timerange['month']){ - foreach ($tempFriendlyDayArray as $day){ - if ($day != ""){ if (!$firstDayFound) { - $firstDay = $tempFriendlyDayArray[$i]; + $firstDay = $day; + $firstmonth = $month; $firstDayFound = true; } - $currentDay =$tempFriendlyDayArray[$i]; - //get next day - $nextDay = $tempFriendlyDayArray[$i+1]; + $currentDay = $day; + $nextDay = $tempdayarray[$arraycounter+1]; $currentDay++; - - if ($currentDay != $nextDay){ - if ($firstprint) + if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) { + if ($firstprint2) $tempFriendlyTime .= ", "; $currentDay--; if ($currentDay != $firstDay) - $tempFriendlyTime .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1]; + $tempFriendlyTime .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ; else - $tempFriendlyTime .= $dayArray[$firstDay-1]; + $tempFriendlyTime .= $monthArray[$month-1] . " " . $day; $firstDayFound = false; - $firstprint = true; + $firstprint2 = true; } - $i++; + $arraycounter++; } + } - } + else + { + $dayFriendly = $timerange['position']; + $tempID = $dayFriendly; + } + + $tempTime = $tempID . "||" . $starttime . "-" . $stoptime . "||" . $timedescr; - $group = new Form_Group(''); - $group->add(new Form_Input( - 'tempFriendlyTime', - null, - 'readonly', - $tempFriendlyTime - ))->setWidth(2)->setHelp($counter == $maxrows ? 'Day(s)':''); - - $group->add(new Form_Input( - 'starttime' . $counter, - null, - 'readonly', - $starttime - ))->setWidth(2)->setHelp($counter == $maxrows ? 'Start time':''); - - $group->add(new Form_Input( - 'stoptime' . $counter, - null, - 'readonly', - $stoptime - ))->setWidth(2)->setHelp($counter == $maxrows ? 'Stop time':''); - - $group->add(new Form_Input( - 'timedescr' . $counter, - null, - 'readonly', - $timedescr - ))->setWidth(2)->setHelp($counter == $maxrows ? 'Description':''); - - $group->add(new Form_Button( - 'Delete' . $counter, - 'Delete' - ))->removeClass('btn-primary')->addClass('btn-xs btn-warning'); - - $group->add(new Form_Input( - 'schedule' . $counter, - null, - 'hidden', - $tempID - )); - - $group->addClass('schedulegrp' . $counter); - - $counter++; - $section->add($group); + //following code makes the days friendly appearing, IE instead of Mon, Tues, Wed it will show Mon - Wed + $foundEnd = false; + $firstDayFound = false; + $firstprint = false; + $tempFriendlyDayArray = explode(",", $dayFriendly); + $currentDay = ""; + $firstDay = ""; + $nextDay = ""; + $i = 0; + + if (!$timerange['month']) { + foreach ($tempFriendlyDayArray as $day) { + if ($day != "") { + if (!$firstDayFound) + { + $firstDay = $tempFriendlyDayArray[$i]; + $firstDayFound = true; + } + + $currentDay =$tempFriendlyDayArray[$i]; + //get next day + $nextDay = $tempFriendlyDayArray[$i+1]; + $currentDay++; + + if ($currentDay != $nextDay) { + if ($firstprint) + $tempFriendlyTime .= ", "; + + $currentDay--; + + if ($currentDay != $firstDay) + $tempFriendlyTime .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1]; + else + $tempFriendlyTime .= $dayArray[$firstDay-1]; + + $firstDayFound = false; + $firstprint = true; + } + $i++; + } + } + } + + $group = new Form_Group(''); + $group->add(new Form_Input( + 'tempFriendlyTime', + null, + 'readonly', + $tempFriendlyTime + ))->setWidth(2)->setHelp($counter == $maxrows ? 'Day(s)':''); + + $group->add(new Form_Input( + 'starttime' . $counter, + null, + 'readonly', + $starttime + ))->setWidth(2)->setHelp($counter == $maxrows ? 'Start time':''); + + $group->add(new Form_Input( + 'stoptime' . $counter, + null, + 'readonly', + $stoptime + ))->setWidth(2)->setHelp($counter == $maxrows ? 'Stop time':''); + + $group->add(new Form_Input( + 'timedescr' . $counter, + null, + 'readonly', + $timedescr + ))->setWidth(2)->setHelp($counter == $maxrows ? 'Description':''); + + $group->add(new Form_Button( + 'Delete' . $counter, + 'Delete' + ))->removeClass('btn-primary')->addClass('btn-xs btn-warning'); + + $group->add(new Form_Input( + 'schedule' . $counter, + null, + 'hidden', + $tempID + )); + + $group->addClass('schedulegrp' . $counter); + + $counter++; + $section->add($group); } } } @@ -738,10 +738,10 @@ function repeatExistingDays(){ var dayarray = daysSelected.split(","); - for (i=0; i<=dayarray.length; i++){ + for (i=0; i<=dayarray.length; i++) { tempstr = dayarray[i]; tempstrdaypos = tempstr.search("p"); - week = tempstr.substring(1,tempstrdaypos); + week = tempstr.substring(1, tempstrdaypos); week = parseInt(week); dashpos = tempstr.search("-"); daypos = tempstr.substring(tempstrdaypos+1, dashpos); @@ -750,7 +750,7 @@ function repeatExistingDays(){ daydone = dayposdone.search(daypos); tempstr = 'w' + week + 'p' + daypos; daycell = eval('document.getElementById(tempstr)'); - if (daydone == "-1"){ + if (daydone == "-1") { if (rgb2hex(daycell.style.backgroundColor) == "#F08080") // lightcoral daytogglerepeating(week,daypos,true); else @@ -773,7 +773,7 @@ function daytogglerepeating(week,daypos,bExists){ //unselect it and remove original day from daysSelected string if (daycell != null) { - if (bExists){ + if (bExists) { daycell.style.backgroundColor = "#FFFFFF"; // white } else @@ -797,7 +797,7 @@ function daytoggle(id) { iddashpos = id.search("-"); var tempstrdaypos = id.search("p"); - var week = id.substring(1,tempstrdaypos); + var week = id.substring(1, tempstrdaypos); week = parseInt(week); @@ -808,17 +808,17 @@ function daytoggle(id) { } else { - idmod = id.substring(0,iddashpos); - var daypos = id.substring(tempstrdaypos+1,iddashpos); + idmod = id.substring(0, iddashpos); + var daypos = id.substring(tempstrdaypos+1, iddashpos); } daypos = parseInt(daypos); - while (!bFoundValid){ + while (!bFoundValid) { var daycell = document.getElementById(idmod); - if (daycell != null){ - if (rgb2hex(daycell.style.backgroundColor) == "#FF0000"){ // red + if (daycell != null) { + if (rgb2hex(daycell.style.backgroundColor) == "#FF0000") { // red daycell.style.backgroundColor = "#FFFFFF"; // white str = id + ","; daysSelected = daysSelected.replace(str, ""); @@ -852,22 +852,22 @@ function daytoggle(id) { } } -function update_month(){ +function update_month() { var indexNum = document.forms[0].monthsel.selectedIndex; var selected = document.forms[0].monthsel.options[indexNum].text; - for (i=0; i<=11; i++){ + for (i = 0; i <= 11; i++) { option = document.forms[0].monthsel.options[i].text; document.popupMonthLayer = eval('document.getElementById (option)'); - if(selected == option) + if (selected == option) document.popupMonthLayer.style.display="block"; else document.popupMonthLayer.style.display="none"; } } -function checkForRanges(){ +function checkForRanges() { if (daysSelected != "") { alert("You have not saved the specified time range. Please click 'Add Time' button to save the time range."); @@ -879,7 +879,7 @@ function checkForRanges(){ } } -function processEntries(){ +function processEntries() { var tempstr, starttimehour, starttimemin, stoptimehour, stoptimemin, errors = ""; var passedValidiation = true; @@ -898,13 +898,13 @@ function processEntries(){ } else if (starttimehour == stoptimehour) { - if (starttimemin > stoptimemin){ + if (starttimemin > stoptimemin) { errors = "Error: Start Minute cannot be greater than Stop Minute."; passedValidiation = false; } } - if (passedValidiation){ + if (passedValidiation) { addTimeRange(); } else { @@ -913,7 +913,7 @@ function processEntries(){ } } -function addTimeRange(){ +function addTimeRange() { var tempdayarray = daysSelected.split(","); var tempstr, tempFriendlyDay, starttimehour, starttimemin, stoptimehour, nrtempFriendlyTime, rtempFriendlyTime, nrtempID, rtempID = ""; var stoptimemin, timeRange, tempstrdaypos, week, daypos, day, month, dashpos, nrtempTime, rtempTime, monthstr, daystr = ""; @@ -931,7 +931,7 @@ function addTimeRange(){ //check for existing entries var findCurrentCounter; - for (u=0; u<99; u++){ + for (u = 0; u < 99; u++) { findCurrentCounter = document.getElementById("schedule" + u); if (!findCurrentCounter) { @@ -940,16 +940,16 @@ function addTimeRange(){ } } - if (daysSelected != ""){ + if (daysSelected != "") { //get days selected - for (i=0; i<tempdayarray.length; i++) + for (i = 0; i < tempdayarray.length; i++) { tempstr = tempdayarray[i]; if (tempstr != "") { tempstrdaypos = tempstr.search("p"); - week = tempstr.substring(1,tempstrdaypos); + week = tempstr.substring(1, tempstrdaypos); week = parseInt(week); dashpos = tempstr.search("-"); @@ -987,9 +987,9 @@ function addTimeRange(){ var tempFriendlyDayArray = daystr.split(","); var currentDay, firstDay, nextDay, currentMonth, nextMonth, firstDay, firstMonth = ""; - for (k=0; k<tempFriendlyMonthArray.length; k++){ + for (k = 0; k < tempFriendlyMonthArray.length; k++) { tempstr = tempFriendlyMonthArray[k]; - if (tempstr != ""){ + if (tempstr != "") { if (!firstDayFound) { firstDay = tempFriendlyDayArray[k]; @@ -1007,7 +1007,7 @@ function addTimeRange(){ //get next month currentDay++; - if ((currentDay != nextDay) || (tempFriendlyMonthArray[k] != tempFriendlyMonthArray[k+1])){ + if ((currentDay != nextDay) || (tempFriendlyMonthArray[k] != tempFriendlyMonthArray[k+1])) { if (firstprint) nrtempFriendlyTime += ", "; @@ -1032,9 +1032,9 @@ function addTimeRange(){ tempFriendlyDayArray.sort(); currentDay, firstDay, nextDay = ""; - for (k=0; k<tempFriendlyDayArray.length; k++){ + for (k = 0; k < tempFriendlyDayArray.length; k++) { tempstr = tempFriendlyDayArray[k]; - if (tempstr != ""){ + if (tempstr != "") { if (!firstDayFound) { firstDay = tempFriendlyDayArray[k]; @@ -1049,7 +1049,7 @@ function addTimeRange(){ nextDay = parseInt(nextDay); currentDay++; - if (currentDay != nextDay){ + if (currentDay != nextDay) { if (firstprint) rtempFriendlyTime += ", "; @@ -1074,10 +1074,10 @@ function addTimeRange(){ //clear tempID rtempID = ""; - for (t=0; t<tempsortArray.length; t++) + for (t = 0; t < tempsortArray.length; t++) { - if (tempsortArray[t] != ""){ - if (!isFirstdone){ + if (tempsortArray[t] != "") { + if (!isFirstdone) { rtempID += tempsortArray[t]; isFirstdone = true; } @@ -1100,7 +1100,7 @@ function addTimeRange(){ //get description for time range var tempdescr = document.getElementById("timerangedescr").value - if (nonrepeatingfound){ + if (nonrepeatingfound) { nrtempTime += nrtempID; //add time ranges nrtempTime += timeRange; @@ -1109,7 +1109,7 @@ function addTimeRange(){ insertElements(nrtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, nrtempTime, nrtempID); } - if (repeatingfound){ + if (repeatingfound) { rtempTime += rtempID; //add time ranges rtempTime += timeRange; @@ -1126,32 +1126,32 @@ function addTimeRange(){ } } -function clearCalendar(){ +function clearCalendar() { var tempstr, daycell = ""; //clear days selected daysSelected = ""; //loop through all 52 weeks - for (j=1; j<=53; j++) + for (j = 1; j <= 53; j++) { //loop through all 7 days - for (k=1; k<8; k++){ + for (k = 1; k < 8; k++) { tempstr = 'w' + j + 'p' + k; daycell = eval('document.getElementById(tempstr)'); - if (daycell != null){ + if (daycell != null) { daycell.style.backgroundColor = "#FFFFFF"; // white } } } } -function clearTime(){ +function clearTime() { document.getElementById("starttimehour").value = "0"; document.getElementById("starttimemin").value = "00"; document.getElementById("stoptimehour").value = "23"; document.getElementById("stoptimemin").value = "59"; } -function clearDescr(){ +function clearDescr() { document.getElementById("timerangedescr").value = ""; } @@ -1161,8 +1161,8 @@ var counter = -1; function insertElements(tempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, tempTime, tempID) { var rowhtml; - if(counter < 0) { - counter = <?php if(!isset($counter)) echo '0'; else echo $counter ?>; + if (counter < 0) { + counter = <?php if (!isset($counter)) echo '0'; else echo $counter ?>; rows_displayed = counter; } diff --git a/src/usr/local/www/firewall_shaper.php b/src/usr/local/www/firewall_shaper.php index 5050f9a..e83bd39 100644 --- a/src/usr/local/www/firewall_shaper.php +++ b/src/usr/local/www/firewall_shaper.php @@ -67,7 +67,7 @@ ##|*MATCH=firewall_shaper.php* ##|-PRIV -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); require("guiconfig.inc"); require_once("functions.inc"); @@ -75,7 +75,7 @@ require_once("filter.inc"); require_once("shaper.inc"); require_once("rrd.inc"); -if($_GET['reset'] != "") { +if ($_GET['reset'] != "") { /* XXX: Huh, why are we killing php? */ mwexec("killall -9 pfctl php"); exit; @@ -382,7 +382,7 @@ if ($_POST) { mwexec("killall qstats"); } -if(!$_POST && !$_GET){ +if (!$_POST && !$_GET) { $dfltmsg = true; $dontshow = true; } @@ -465,13 +465,13 @@ if (count($altq_list_queues) > 0) { <td> <?php -if($dfltmsg) +if ($dfltmsg) print_info_box($default_shaper_msg); else { // Add global buttons if (!$dontshow || $newqueue) { if ($can_add || $addnewaltq) { - if($queue) + if ($queue) $url = 'firewall_shaper.php?interface='. $interface . '&queue=' . $queue->GetQname() . '&action=add'; else $url = 'firewall_shaper.php?interface='. $interface . '&action=add'; @@ -483,7 +483,7 @@ else { ))->removeClass('btn-default')->addClass('btn-success'); } - if($queue) + if ($queue) $url = 'firewall_shaper.php?interface='. $interface . '&queue=' . $queue->GetQname() . '&action=delete'; else $url = 'firewall_shaper.php?interface='. $interface . '&action=delete'; diff --git a/src/usr/local/www/firewall_shaper_layer7.php b/src/usr/local/www/firewall_shaper_layer7.php index db350bd..0ee2287 100644 --- a/src/usr/local/www/firewall_shaper_layer7.php +++ b/src/usr/local/www/firewall_shaper_layer7.php @@ -67,7 +67,7 @@ ##|-PRIV require("guiconfig.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); @@ -98,7 +98,7 @@ read_layer7_config(); $sform = new Form(false); -if($_GET['reset'] != "") { +if ($_GET['reset'] != "") { // kill all ipfw-classifyd processes mwexec("killall -9 ipfw-classifyd"); exit; @@ -134,7 +134,7 @@ if ($_GET) { break; case "show": $show_proto_form = true; - if($container) { + if ($container) { $sform = $container->build_form(); } else { @@ -155,7 +155,7 @@ if ($_POST) { $show_proto_form = true; unset($input_errors); - if($_POST['Submit']) { + if ($_POST['Submit']) { if (isset($layer7_rules_list[$name])) { $l7r = $layer7_rules_list[$name]; @@ -225,7 +225,7 @@ if ($_POST) { clear_subsystem_dirty('shaper'); - if($container) { + if ($container) { $sform = $container->build_form(); } else { $show_proto_form = false; @@ -245,7 +245,7 @@ if ($_POST) { } } -if(!$_GET && !$_POST) { +if (!$_GET && !$_POST) { $show_proto_form = false; $dfltmsg = true; } @@ -325,12 +325,12 @@ function fillStructure() { var name; <?php foreach ($avail_structures as $key => $struct) { ?> name = "<?= $struct; ?>"; - if(name == "queue") { - if(js_behaviours_altq != "") { structure += "<option value=" + name + ">" + name + "<\/option>";} + if (name == "queue") { + if (js_behaviours_altq != "") { structure += "<option value=" + name + ">" + name + "<\/option>";} } else { - if(name == "limiter") { - if(js_behaviours_limiter != "") { structure += "<option value=" + name + ">" + name + "<\/option>";} + if (name == "limiter") { + if (js_behaviours_limiter != "") { structure += "<option value=" + name + ">" + name + "<\/option>";} } else structure += "<option value=" + name + ">" + name + "<\/option>"; //action } @@ -394,8 +394,8 @@ function addRow(table_id) { initial_count[table_id] = rows_count; } // determining real count of added fields - var tFielsNum = rows_count - initial_count[table_id]; - if (rows_limit!=0 && tFielsNum >= rows_limit) return false; + var tFielsNum = rows_count - initial_count[table_id]; + if (rows_limit != 0 && tFielsNum >= rows_limit) return false; var remove = '<a class="btn btn-default" onclick="removeRow(\''+table_id+'\',this.parentNode.parentNode)">Remove<\/a>'; @@ -441,13 +441,13 @@ function build_l7table() { $tbl .= '<thead><tr><th>Protocol</th><th>Structure</th><th>Behavior</th></tr></thead>'; $tbl .= '<tbody>'; - if($container) { - foreach($container->rsets as $l7rule) { + if ($container) { + foreach ($container->rsets as $l7rule) { $tbl .= '<tr><td>'; $tbl .= '<select name="protocol[]" class="form-control">'; - foreach($avail_protos as $proto): + foreach ($avail_protos as $proto): $tbl .= '<option value="' . $proto . '"'; if ($proto == $l7rule->GetRProtocol()) @@ -460,9 +460,9 @@ function build_l7table() { $tbl .= '</select></td><td>'; $tbl .= '<select name="structure[]" class="form-control" onchange="changeBehaviourValues(this.parentNode.parentNode);">'; - foreach($avail_structures as $struct) { - if($struct == "queue") { - if(!empty($avail_behaviours_altq)) { + foreach ($avail_structures as $struct) { + if ($struct == "queue") { + if (!empty($avail_behaviours_altq)) { $tbl .= '<option value="' . $struct . '"'; if ($struct == $l7rule->GetRStructure()) $tbl .= ' selected="selected"'; @@ -471,8 +471,8 @@ function build_l7table() { } } else { - if($struct == "limiter") { - if(!empty($avail_behaviours_limiter)) { + if ($struct == "limiter") { + if (!empty($avail_behaviours_limiter)) { $tbl .= '<option value="' . $struct . '"'; if ($struct == $l7rule->GetRStructure()) $tbl .= ' selected="selected"'; @@ -481,7 +481,7 @@ function build_l7table() { } } else { - if($struct == "action") { + if ($struct == "action") { $tbl .= '<option value="' . $struct . '"'; if ($struct == $l7rule->GetRStructure()) $tbl .= ' selected="selected"'; @@ -496,8 +496,8 @@ function build_l7table() { $tbl .= '<select name="behaviour[]" class="form-control">'; - if($l7rule->GetRStructure() == "action"): - foreach($avail_behaviours_action as $behaviour): + if ($l7rule->GetRStructure() == "action"): + foreach ($avail_behaviours_action as $behaviour): $tbl .= '<option value="' . $behaviour . '"'; if ($behaviour == $l7rule->GetRBehaviour()) $tbl .= ' selected="selected"'; @@ -510,8 +510,8 @@ function build_l7table() { endif; - if($l7rule->GetRStructure() == "queue"): - foreach($avail_behaviours_altq as $behaviour): + if ($l7rule->GetRStructure() == "queue"): + foreach ($avail_behaviours_altq as $behaviour): $tbl .= '<option value="' . $behaviour . '"'; if ($behaviour == $l7rule->GetRBehaviour()) @@ -525,8 +525,8 @@ function build_l7table() { endif; - if($l7rule->GetRStructure() == "limiter"): - foreach($avail_behaviours_limiter as $behaviour): + if ($l7rule->GetRStructure() == "limiter"): + foreach ($avail_behaviours_limiter as $behaviour): $tbl .= '<option value="' . $behaviour . '"'; if ($behaviour == $l7rule->GetRBehaviour()) $tbl .= ' selected="selected"'; @@ -574,7 +574,7 @@ $tab_array[] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php"); display_top_tabs($tab_array); // Create a StaticText control and populate it with the rules table -if(!$dfltmsg) { +if (!$dfltmsg) { $section = new Form_Section('Add one (or more) rules'); $section->addInput(new Form_StaticText( @@ -599,7 +599,7 @@ if(!$dfltmsg) { </div> <div class="col-sm-10"> <?php -if($dfltmsg) +if ($dfltmsg) print_info_box($output_form = $dn_default_shaper_msg . $default_layer7shaper_msg); else print($sform); diff --git a/src/usr/local/www/firewall_shaper_queues.php b/src/usr/local/www/firewall_shaper_queues.php index 5d1bbb7..190ca28 100644 --- a/src/usr/local/www/firewall_shaper_queues.php +++ b/src/usr/local/www/firewall_shaper_queues.php @@ -73,7 +73,7 @@ require_once("filter.inc"); require_once("shaper.inc"); require_once("rrd.inc"); -if($_GET['reset'] != "") { +if ($_GET['reset'] != "") { mwexec("killall -9 pfctl"); exit; } diff --git a/src/usr/local/www/firewall_shaper_vinterface.php b/src/usr/local/www/firewall_shaper_vinterface.php index da5ae24..8d942eb 100644 --- a/src/usr/local/www/firewall_shaper_vinterface.php +++ b/src/usr/local/www/firewall_shaper_vinterface.php @@ -67,13 +67,13 @@ ##|*MATCH=firewall_shaper_vinterface.php* ##|-PRIV -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); require("guiconfig.inc"); require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); -if($_GET['reset'] != "") { +if ($_GET['reset'] != "") { mwexec("/usr/bin/killall -9 pfctl"); exit; } @@ -293,40 +293,40 @@ if ($_POST) { } else $input_errors[] = gettext("Could not add new queue."); } else if ($_POST['apply']) { - write_config(); + write_config(); - $retval = 0; - $retval = filter_configure(); - $savemsg = get_std_save_message($retval); + $retval = 0; + $retval = filter_configure(); + $savemsg = get_std_save_message($retval); - if (stristr($retval, "error") != true) - $savemsg = get_std_save_message($retval); - else - $savemsg = $retval; + if (stristr($retval, "error") != true) + $savemsg = get_std_save_message($retval); + else + $savemsg = $retval; /* XXX: TODO Make dummynet pretty graphs */ // enable_rrd_graphing(); - clear_subsystem_dirty('shaper'); + clear_subsystem_dirty('shaper'); - if ($queue) { - $sform = $queue->build_form(); - $dontshow = false; - } - else { - $output_form .= $dn_default_shaper_message; - $dontshow = true; - } + if ($queue) { + $sform = $queue->build_form(); + $dontshow = false; + } + else { + $output_form .= $dn_default_shaper_message; + $dontshow = true; + } } else if ($queue) { - $queue->validate_input($_POST, $input_errors); - if (!$input_errors) { + $queue->validate_input($_POST, $input_errors); + if (!$input_errors) { $queue->update_dn_data($_POST); $queue->wconfig(); if (write_config()) mark_subsystem_dirty('shaper'); $dontshow = false; - } + } read_dummynet_config(); $sform = $queue->build_form(); } else { @@ -335,20 +335,20 @@ if ($_POST) { } } -if(!$_POST && !$_GET) { +if (!$_POST && !$_GET) { $dfltmsg = true; $dontshow = true; } if ($queue) { if ($queue->GetEnabled()) - $can_enable = true; + $can_enable = true; else - $can_enable = false; + $can_enable = false; if ($queue->CanHaveChildren()) { $can_add = true; } else - $can_add = false; + $can_add = false; } $tree = "<ul class=\"tree\" >"; @@ -418,13 +418,13 @@ display_top_tabs($tab_array); <td> <?php -if($dfltmsg) +if ($dfltmsg) print_info_box($dn_default_shaper_msg); else { // Add global buttons if (!$dontshow || $newqueue) { if ($can_add || $addnewaltq) { - if($queue) + if ($queue) $url = 'href="firewall_shaper_vinterface.php?pipe=' . $pipe . '&queue=' . $queue->GetQname() . '&action=add'; else $url = 'firewall_shaper.php?pipe='. $pipe . '&action=add'; @@ -436,7 +436,7 @@ else { ))->removeClass('btn-default')->addClass('btn-success'); } - if($queue) + if ($queue) $url = 'firewall_shaper_vinterface.php?pipe='. $pipe . '&queue=' . $queue->GetQname() . '&action=delete'; else $url = 'firewall_shaper_vinterface.php?pipe='. $pipe . '&action=delete'; diff --git a/src/usr/local/www/firewall_shaper_wizards.php b/src/usr/local/www/firewall_shaper_wizards.php index 18cc97e..7ea8e55 100644 --- a/src/usr/local/www/firewall_shaper_wizards.php +++ b/src/usr/local/www/firewall_shaper_wizards.php @@ -73,7 +73,7 @@ require_once("filter.inc"); require_once("shaper.inc"); require_once("util.inc"); -if($_GET['reset'] != "") { +if ($_GET['reset'] != "") { sigkillbyname('pfctl', SIGKILL); exit; } diff --git a/src/usr/local/www/firewall_virtual_ip.php b/src/usr/local/www/firewall_virtual_ip.php index e321603..ca80307 100644 --- a/src/usr/local/www/firewall_virtual_ip.php +++ b/src/usr/local/www/firewall_virtual_ip.php @@ -127,7 +127,7 @@ if ($_GET['act'] == "del") { /* make sure no inbound NAT mappings reference this entry */ if (is_array($config['nat']['rule'])) { foreach ($config['nat']['rule'] as $rule) { - if($rule['destination']['address'] != "") { + if ($rule['destination']['address'] != "") { if ($rule['destination']['address'] == $a_vip[$_GET['id']]['subnet']) { $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one NAT mapping."); break; @@ -272,7 +272,7 @@ $types = array('proxyarp' => 'Proxy ARP', 'ipalias' => 'IP Alias' ); -$pgtitle = array(gettext("Firewall"),gettext("Virtual IP Addresses")); +$pgtitle = array(gettext("Firewall"), gettext("Virtual IP Addresses")); include("head.inc"); if ($input_errors) @@ -314,20 +314,20 @@ $interfaces['lo0'] = "Localhost"; $i = 0; foreach ($a_vip as $vipent): - if( $vipent['subnet'] != "" or $vipent['range'] != "" or - $vipent['subnet_bits'] != "" or (isset($vipent['range']['from']) && $vipent['range']['from'] != "")): + if ($vipent['subnet'] != "" or $vipent['range'] != "" or + $vipent['subnet_bits'] != "" or (isset($vipent['range']['from']) && $vipent['range']['from'] != "")): ?> <tr> <td> <?php if (($vipent['type'] == "single") || ($vipent['type'] == "network")) - if($vipent['subnet_bits']) + if ($vipent['subnet_bits']) print("{$vipent['subnet']}/{$vipent['subnet_bits']}"); if ($vipent['type'] == "range") print("{$vipent['range']['from']}-{$vipent['range']['to']}"); - if($vipent['mode'] == "carp") + if ($vipent['mode'] == "carp") print(" (vhid: {$vipent['vhid']})"); ?> </td> diff --git a/src/usr/local/www/head.inc b/src/usr/local/www/head.inc index d3309d9..45168cd 100755 --- a/src/usr/local/www/head.inc +++ b/src/usr/local/www/head.inc @@ -335,6 +335,8 @@ if(! $g['disablehelpmenu']) { $modal_notices = new Modal('Notices', 'notices', 'large'); +/* +FIXME: addFooter does not exist $modal_notices->addFooter(new Form_Button( 'close', 'Close', @@ -346,7 +348,7 @@ if(! $g['disablehelpmenu']) { 'Mark all as read', '/?closenotice=all' ))->addClass('btn-primary')->removeClass('btn-default'); - +*/ $noticeCategories = $notice['category']; foreach($notices as $time => $notice) { if (!isset($noticeCategories[$notice['category']])) { @@ -369,7 +371,10 @@ if(! $g['disablehelpmenu']) { } $html .= '</ul>'; } +/* +FIXME: addHtml does not exist $modal_notices->addHtml($html); +*/ print $modal_notices; endif; diff --git a/src/usr/local/www/interfaces.php b/src/usr/local/www/interfaces.php index 51c3324..99c3d67 100644 --- a/src/usr/local/www/interfaces.php +++ b/src/usr/local/www/interfaces.php @@ -1719,7 +1719,7 @@ if ($savemsg) print_info_box($savemsg, 'success'); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'Submit', diff --git a/src/usr/local/www/interfaces_assign.php b/src/usr/local/www/interfaces_assign.php index 1e38812..88b8df1 100644 --- a/src/usr/local/www/interfaces_assign.php +++ b/src/usr/local/www/interfaces_assign.php @@ -206,7 +206,7 @@ if (is_array($config['openvpn'])) { } } -if (isset($_POST['if_add'])) { +if (isset($_POST['add']) && isset($_POST['if_add'])) { /* Be sure this port is not being used */ $portused = false; foreach ($config['interfaces'] as $ifname => $ifdata) { diff --git a/src/usr/local/www/interfaces_bridge_edit.php b/src/usr/local/www/interfaces_bridge_edit.php index c38afb6..4377555 100644 --- a/src/usr/local/www/interfaces_bridge_edit.php +++ b/src/usr/local/www/interfaces_bridge_edit.php @@ -329,7 +329,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/interfaces_gif_edit.php b/src/usr/local/www/interfaces_gif_edit.php index 7600717..fa5e1d2 100644 --- a/src/usr/local/www/interfaces_gif_edit.php +++ b/src/usr/local/www/interfaces_gif_edit.php @@ -148,7 +148,7 @@ function build_parent_list() { $pgtitle = array(gettext("Interfaces"),gettext("GIF"),gettext("Edit")); $shortcut_section = "interfaces"; include("head.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/interfaces_gre_edit.php b/src/usr/local/www/interfaces_gre_edit.php index 8a6497b..b0f06d8 100644 --- a/src/usr/local/www/interfaces_gre_edit.php +++ b/src/usr/local/www/interfaces_gre_edit.php @@ -143,7 +143,7 @@ function build_parent_list() { $pgtitle = array(gettext("Interfaces"),gettext("GRE"),gettext("Edit")); $shortcut_section = "interfaces"; include("head.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/interfaces_groups_edit.php b/src/usr/local/www/interfaces_groups_edit.php index 8e7b6da..f9fc399 100644 --- a/src/usr/local/www/interfaces_groups_edit.php +++ b/src/usr/local/www/interfaces_groups_edit.php @@ -206,7 +206,7 @@ $tab_array[9] = array(gettext("Bridges"), false, "interfaces_bridge.php"); $tab_array[10] = array(gettext("LAGG"), false, "interfaces_lagg.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Interface Group Edit'); diff --git a/src/usr/local/www/interfaces_lagg_edit.php b/src/usr/local/www/interfaces_lagg_edit.php index 3a03172..8590f01 100644 --- a/src/usr/local/www/interfaces_lagg_edit.php +++ b/src/usr/local/www/interfaces_lagg_edit.php @@ -217,7 +217,7 @@ function build_member_list() { $pgtitle = array(gettext("Interfaces"),gettext("LAGG"),gettext("Edit")); $shortcut_section = "interfaces"; include("head.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/interfaces_ppps_edit.php b/src/usr/local/www/interfaces_ppps_edit.php index 62363a7..729e9c4 100644 --- a/src/usr/local/www/interfaces_ppps_edit.php +++ b/src/usr/local/www/interfaces_ppps_edit.php @@ -582,7 +582,7 @@ $linkparamstr = gettext('Bandwidth is set only for MLLP conncetions and when lin 'MRU will be auto-negotiated by default' . '<br />' . 'Set only for MLLP conncetions. MRRU will be auto-negotiated by default.'); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/interfaces_qinq_edit.php b/src/usr/local/www/interfaces_qinq_edit.php index 9460884..dad4cf1 100644 --- a/src/usr/local/www/interfaces_qinq_edit.php +++ b/src/usr/local/www/interfaces_qinq_edit.php @@ -233,7 +233,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'Submit', diff --git a/src/usr/local/www/interfaces_vlan_edit.php b/src/usr/local/www/interfaces_vlan_edit.php index 0bf223a..3be34ca 100644 --- a/src/usr/local/www/interfaces_vlan_edit.php +++ b/src/usr/local/www/interfaces_vlan_edit.php @@ -162,7 +162,7 @@ if ($input_errors) { print_input_errors($input_errors); } -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Interface VLAN Edit'); diff --git a/src/usr/local/www/interfaces_wireless_edit.php b/src/usr/local/www/interfaces_wireless_edit.php index 52d26ff..7919424 100644 --- a/src/usr/local/www/interfaces_wireless_edit.php +++ b/src/usr/local/www/interfaces_wireless_edit.php @@ -179,7 +179,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/load_balancer_monitor_edit.php b/src/usr/local/www/load_balancer_monitor_edit.php index b7134db..6134b37 100644 --- a/src/usr/local/www/load_balancer_monitor_edit.php +++ b/src/usr/local/www/load_balancer_monitor_edit.php @@ -266,7 +266,7 @@ events.push(function(){ if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'Submit', diff --git a/src/usr/local/www/load_balancer_pool_edit.php b/src/usr/local/www/load_balancer_pool_edit.php index 876abe5..4d41b3b 100644 --- a/src/usr/local/www/load_balancer_pool_edit.php +++ b/src/usr/local/www/load_balancer_pool_edit.php @@ -292,7 +292,7 @@ events.push(function(){ if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'Submit', diff --git a/src/usr/local/www/load_balancer_setting.php b/src/usr/local/www/load_balancer_setting.php index 371c91f..ae18f6f 100644 --- a/src/usr/local/www/load_balancer_setting.php +++ b/src/usr/local/www/load_balancer_setting.php @@ -120,7 +120,7 @@ $tab_array[] = array(gettext("Monitors"), false, "load_balancer_monitor.php"); $tab_array[] = array(gettext("Settings"), true, "load_balancer_setting.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/pkg_mgr_settings.php b/src/usr/local/www/pkg_mgr_settings.php index da3c393..13a6b40 100644 --- a/src/usr/local/www/pkg_mgr_settings.php +++ b/src/usr/local/www/pkg_mgr_settings.php @@ -88,7 +88,7 @@ print_info_box(gettext('This page allows an alternate package repository to be c 'The package server settings should remain at their default values to ensure that verifiable and trusted packages are recevied.' . 'A warning is printed on the Dashboard and in the package manager when an unofficial package server is in use.'), 'default'); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_captiveportal.php b/src/usr/local/www/services_captiveportal.php index 04a9e20..9e46749 100644 --- a/src/usr/local/www/services_captiveportal.php +++ b/src/usr/local/www/services_captiveportal.php @@ -539,7 +539,7 @@ $tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_voucher $tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php?zone={$cpzone}"); display_top_tabs($tab_array, true); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_captiveportal_filemanager.php b/src/usr/local/www/services_captiveportal_filemanager.php index afd1610..1984cba 100644 --- a/src/usr/local/www/services_captiveportal_filemanager.php +++ b/src/usr/local/www/services_captiveportal_filemanager.php @@ -151,7 +151,7 @@ $tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_voucher $tab_array[] = array(gettext("File Manager"), true, "services_captiveportal_filemanager.php?zone={$cpzone}"); display_top_tabs($tab_array, true); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); if ($_GET['act'] == 'add') { diff --git a/src/usr/local/www/services_captiveportal_hostname_edit.php b/src/usr/local/www/services_captiveportal_hostname_edit.php index 2bd49ff..8f8bbd2 100644 --- a/src/usr/local/www/services_captiveportal_hostname_edit.php +++ b/src/usr/local/www/services_captiveportal_hostname_edit.php @@ -180,7 +180,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'Submit', diff --git a/src/usr/local/www/services_captiveportal_ip_edit.php b/src/usr/local/www/services_captiveportal_ip_edit.php index 0db6df5..93965fd 100644 --- a/src/usr/local/www/services_captiveportal_ip_edit.php +++ b/src/usr/local/www/services_captiveportal_ip_edit.php @@ -206,7 +206,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_captiveportal_mac_edit.php b/src/usr/local/www/services_captiveportal_mac_edit.php index 4f28531..baa4d9c 100644 --- a/src/usr/local/www/services_captiveportal_mac_edit.php +++ b/src/usr/local/www/services_captiveportal_mac_edit.php @@ -193,7 +193,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_captiveportal_vouchers.php b/src/usr/local/www/services_captiveportal_vouchers.php index b80d3a0..6b3065b 100644 --- a/src/usr/local/www/services_captiveportal_vouchers.php +++ b/src/usr/local/www/services_captiveportal_vouchers.php @@ -469,7 +469,7 @@ if ($pconfig['enable']) : ?> <?php endif; -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_captiveportal_vouchers_edit.php b/src/usr/local/www/services_captiveportal_vouchers_edit.php index cc05aee..fee3a4e 100644 --- a/src/usr/local/www/services_captiveportal_vouchers_edit.php +++ b/src/usr/local/www/services_captiveportal_vouchers_edit.php @@ -183,7 +183,7 @@ if ($input_errors) if ($savemsg) print_info_box($savemsg, 'success'); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_captiveportal_zones_edit.php b/src/usr/local/www/services_captiveportal_zones_edit.php index 340b684..ed0c36d 100644 --- a/src/usr/local/www/services_captiveportal_zones_edit.php +++ b/src/usr/local/www/services_captiveportal_zones_edit.php @@ -90,7 +90,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'submit', diff --git a/src/usr/local/www/services_dhcp_edit.php b/src/usr/local/www/services_dhcp_edit.php index 1ab0987..cfedb46 100644 --- a/src/usr/local/www/services_dhcp_edit.php +++ b/src/usr/local/www/services_dhcp_edit.php @@ -387,7 +387,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_dhcp_relay.php b/src/usr/local/www/services_dhcp_relay.php index 8559f4b..aaa9c2a 100644 --- a/src/usr/local/www/services_dhcp_relay.php +++ b/src/usr/local/www/services_dhcp_relay.php @@ -66,7 +66,7 @@ ##|-PRIV require("guiconfig.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $pconfig['enable'] = isset($config['dhcrelay']['enable']); diff --git a/src/usr/local/www/services_dhcpv6.php b/src/usr/local/www/services_dhcpv6.php index b8a4909..0dc8bd6 100644 --- a/src/usr/local/www/services_dhcpv6.php +++ b/src/usr/local/www/services_dhcpv6.php @@ -502,7 +502,7 @@ $tab_array[] = array(gettext("DHCPv6 Server"), true, "services_dhcpv6.php?if={ $tab_array[] = array(gettext("Router Advertisements"), false, "services_router_advertisements.php?if={$if}"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'Submit', diff --git a/src/usr/local/www/services_dhcpv6_edit.php b/src/usr/local/www/services_dhcpv6_edit.php index a6df8db..8a75ec8 100644 --- a/src/usr/local/www/services_dhcpv6_edit.php +++ b/src/usr/local/www/services_dhcpv6_edit.php @@ -200,7 +200,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_dhcpv6_relay.php b/src/usr/local/www/services_dhcpv6_relay.php index 2fdbcbc..fe7b8ed 100644 --- a/src/usr/local/www/services_dhcpv6_relay.php +++ b/src/usr/local/www/services_dhcpv6_relay.php @@ -41,7 +41,7 @@ ##|-PRIV require("guiconfig.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); function filterDestinationServers(array $destinationServers) { diff --git a/src/usr/local/www/services_dnsmasq.php b/src/usr/local/www/services_dnsmasq.php index ac6b44c..ad79b18 100644 --- a/src/usr/local/www/services_dnsmasq.php +++ b/src/usr/local/www/services_dnsmasq.php @@ -196,7 +196,7 @@ if ($savemsg) if (is_subsystem_dirty('hosts')) print_info_box_np(gettext("The DNS forwarder configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect.")); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_dnsmasq_domainoverride_edit.php b/src/usr/local/www/services_dnsmasq_domainoverride_edit.php index 3bc37fa..c7fdc67 100644 --- a/src/usr/local/www/services_dnsmasq_domainoverride_edit.php +++ b/src/usr/local/www/services_dnsmasq_domainoverride_edit.php @@ -132,7 +132,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_dnsmasq_edit.php b/src/usr/local/www/services_dnsmasq_edit.php index f9513d9..ec3e468 100644 --- a/src/usr/local/www/services_dnsmasq_edit.php +++ b/src/usr/local/www/services_dnsmasq_edit.php @@ -210,7 +210,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); @@ -220,7 +220,7 @@ $section->addInput(new Form_Input( 'host', 'Host', 'text', - $pconfig['domain'] + $pconfig['host'] ))->setHelp('Name of the host, without the domain part' . '<br />' . 'e.g.: "myhost"'); diff --git a/src/usr/local/www/services_dyndns_edit.php b/src/usr/local/www/services_dyndns_edit.php index 750cd9b..8e7c1e3 100644 --- a/src/usr/local/www/services_dyndns_edit.php +++ b/src/usr/local/www/services_dyndns_edit.php @@ -232,7 +232,7 @@ if ($input_errors) if ($savemsg) print_info_box($savemsg, 'success'); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; diff --git a/src/usr/local/www/services_igmpproxy_edit.php b/src/usr/local/www/services_igmpproxy_edit.php index cbe8307..7f3e6f0 100644 --- a/src/usr/local/www/services_igmpproxy_edit.php +++ b/src/usr/local/www/services_igmpproxy_edit.php @@ -151,7 +151,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); // These two inputs appear inthe original file. Don't know what they are for // but they are here just in case. diff --git a/src/usr/local/www/services_ntpd.php b/src/usr/local/www/services_ntpd.php index 412678b..518b568 100644 --- a/src/usr/local/www/services_ntpd.php +++ b/src/usr/local/www/services_ntpd.php @@ -260,7 +260,7 @@ $tab_array[] = array(gettext("Serial GPS"), false, "services_ntpd_gps.php"); $tab_array[] = array(gettext("PPS"), false, "services_ntpd_pps.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; diff --git a/src/usr/local/www/services_ntpd_gps.php b/src/usr/local/www/services_ntpd_gps.php index 9bf100d..f22a7cf 100644 --- a/src/usr/local/www/services_ntpd_gps.php +++ b/src/usr/local/www/services_ntpd_gps.php @@ -210,7 +210,7 @@ $tab_array[] = array(gettext("Serial GPS"), true, "services_ntpd_gps.php"); $tab_array[] = array(gettext("PPS"), false, "services_ntpd_pps.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; diff --git a/src/usr/local/www/services_ntpd_pps.php b/src/usr/local/www/services_ntpd_pps.php index c8d817b..8cd740d 100644 --- a/src/usr/local/www/services_ntpd_pps.php +++ b/src/usr/local/www/services_ntpd_pps.php @@ -127,7 +127,7 @@ $tab_array[] = array(gettext("Serial GPS"), false, "services_ntpd_gps.php"); $tab_array[] = array(gettext("PPS"), true, "services_ntpd_pps.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; diff --git a/src/usr/local/www/services_rfc2136_edit.php b/src/usr/local/www/services_rfc2136_edit.php index 53445bb..2949632 100644 --- a/src/usr/local/www/services_rfc2136_edit.php +++ b/src/usr/local/www/services_rfc2136_edit.php @@ -132,7 +132,7 @@ if ($_POST) { $pgtitle = array(gettext("Services"), gettext("RFC 2136 client"), gettext("Edit")); include("head.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); if ($input_errors) print_input_errors($input_errors); diff --git a/src/usr/local/www/services_snmp.php b/src/usr/local/www/services_snmp.php index ec94af7..3494add 100644 --- a/src/usr/local/www/services_snmp.php +++ b/src/usr/local/www/services_snmp.php @@ -199,7 +199,7 @@ if ($input_errors) if ($savemsg) print_info_box($savemsg); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_unbound.php b/src/usr/local/www/services_unbound.php index f1846a1..590a736 100644 --- a/src/usr/local/www/services_unbound.php +++ b/src/usr/local/www/services_unbound.php @@ -241,7 +241,7 @@ $tab_array[] = array(gettext("Advanced settings"), false, "services_unbound_adva $tab_array[] = array(gettext("Access Lists"), false, "/services_unbound_acls.php"); display_top_tabs($tab_array, true); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); @@ -436,7 +436,7 @@ foreach ($a_hosts as $hostent): <?=htmlspecialchars($hostent['descr'])?> </td> <td> - <a href="services_unbound.php?id=<?=$i?>" class="btn btn-xs btn-info"><?=gettext('Edit')?></a> + <a href="services_unbound_host_edit.php?id=<?=$i?>" class="btn btn-xs btn-info"><?=gettext('Edit')?></a> <a href="services_unbound.php?type=host&act=del&id=<?=$i?>" class="btn btn-xs btn-danger"><?=gettext('Delete')?></a> </td> </tr> diff --git a/src/usr/local/www/services_unbound_acls.php b/src/usr/local/www/services_unbound_acls.php index 82fd30e..478ccee 100644 --- a/src/usr/local/www/services_unbound_acls.php +++ b/src/usr/local/www/services_unbound_acls.php @@ -192,7 +192,7 @@ $tab_array[] = array(gettext("Advanced settings"), false, "services_unbound_adva $tab_array[] = array(gettext("Access Lists"), true, "/services_unbound_acls.php"); display_top_tabs($tab_array, true); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); if($act=="new" || $act=="edit") { diff --git a/src/usr/local/www/services_unbound_advanced.php b/src/usr/local/www/services_unbound_advanced.php index 26a9732..4afca92 100644 --- a/src/usr/local/www/services_unbound_advanced.php +++ b/src/usr/local/www/services_unbound_advanced.php @@ -233,7 +233,7 @@ $tab_array[] = array(gettext("Advanced settings"), true, "services_unbound_advan $tab_array[] = array(gettext("Access Lists"), false, "/services_unbound_acls.php"); display_top_tabs($tab_array, true); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_unbound_domainoverride_edit.php b/src/usr/local/www/services_unbound_domainoverride_edit.php index 5862b15..5c2bedd 100644 --- a/src/usr/local/www/services_unbound_domainoverride_edit.php +++ b/src/usr/local/www/services_unbound_domainoverride_edit.php @@ -121,7 +121,7 @@ $pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("Edit Dom $shortcut_section = "resolver"; include("head.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/services_unbound_host_edit.php b/src/usr/local/www/services_unbound_host_edit.php index ed3bbb2..42ce9ae 100644 --- a/src/usr/local/www/services_unbound_host_edit.php +++ b/src/usr/local/www/services_unbound_host_edit.php @@ -209,7 +209,7 @@ $pgtitle = array(gettext("Services"),gettext("DNS Resolver"),gettext("Edit host" $shortcut_section = "resolver"; include("head.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); @@ -219,7 +219,7 @@ $section->addInput(new Form_Input( 'host', 'Host', 'text', - $pconfig['domain'] + $pconfig['host'] ))->setHelp('Name of the host, without the domain part' . '<br />' . 'e.g.: "myhost"'); diff --git a/src/usr/local/www/services_wol.php b/src/usr/local/www/services_wol.php index 40917d9..8e3ed2d 100644 --- a/src/usr/local/www/services_wol.php +++ b/src/usr/local/www/services_wol.php @@ -42,7 +42,7 @@ ##|-PRIV require("guiconfig.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); if (!is_array($config['wol']['wolentry'])) { $config['wol']['wolentry'] = array(); diff --git a/src/usr/local/www/services_wol_edit.php b/src/usr/local/www/services_wol_edit.php index 2c750ed..97aff7f 100644 --- a/src/usr/local/www/services_wol_edit.php +++ b/src/usr/local/www/services_wol_edit.php @@ -51,7 +51,7 @@ function wol_sort() { } require("guiconfig.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); if (!is_array($config['wol']['wolentry'])) { $config['wol']['wolentry'] = array(); diff --git a/src/usr/local/www/shortcuts.inc b/src/usr/local/www/shortcuts.inc index c4bf48e..b21986e 100644 --- a/src/usr/local/www/shortcuts.inc +++ b/src/usr/local/www/shortcuts.inc @@ -102,7 +102,7 @@ function get_shortcut_main_link($shortcut_section, $addspace = true, $service = break; } if (!empty($link) && ($_SERVER['REQUEST_URI'] != "/{$link}")) { - return "{$space}<a href=\"{$link}\" title=\"" . gettext("Main page for this section") . "\"><img style=\"vertical-align:middle\" src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" border=\"0\" alt=\"plus\" /></a>"; + return "{$space}<a href=\"{$link}\" title=\"" . gettext("Main page for this section") . "\"><i class=\"icon-large icon-plus-sign\"></i></a>"; } } @@ -130,7 +130,7 @@ function get_shortcut_status_link($shortcut_section, $addspace = true, $service break; } if (!empty($link)) { - return "{$space}<a href=\"{$link}\" title=\"" . gettext("Status of items on this page") . "\"><img style=\"vertical-align:middle\" src=\"/themes/{$g['theme']}/images/icons/icon_service_status.gif\" border=\"0\" alt=\"status\" /></a>"; + return "{$space}<a href=\"{$link}\" title=\"" . gettext("Status of items on this page") . "\"><i class=\"icon-large icon-cog\"></i></a>"; } } @@ -138,7 +138,7 @@ function get_shortcut_log_link($shortcut_section, $addspace = true) { global $g, $shortcuts; $space = ($addspace) ? " " : "" ; if (!empty($shortcut_section) && !empty($shortcuts[$shortcut_section]['log'])) { - return "{$space}<a href=\"{$shortcuts[$shortcut_section]['log']}\" title=\"" . gettext("Log entries for items on this page") . "\"><img style=\"vertical-align:middle\" src=\"/themes/{$g['theme']}/images/icons/icon_logs.gif\" border=\"0\" alt=\"logs\" /></a>"; + return "{$space}<a href=\"{$shortcuts[$shortcut_section]['log']}\" title=\"" . gettext("Log entries for items on this page") . "\"><i class=\"icon-large icon-list-alt\"></i></a>"; } } diff --git a/src/usr/local/www/status_captiveportal.php b/src/usr/local/www/status_captiveportal.php index efe6851..4edeb64 100644 --- a/src/usr/local/www/status_captiveportal.php +++ b/src/usr/local/www/status_captiveportal.php @@ -120,7 +120,7 @@ endif; // Load MAC-Manufacturer table $mac_man = load_mac_manufacturer_table(); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); if (count($a_cp) > 1) { $form = new Form(); diff --git a/src/usr/local/www/status_captiveportal_expire.php b/src/usr/local/www/status_captiveportal_expire.php index 0e0631f..c9009fb 100644 --- a/src/usr/local/www/status_captiveportal_expire.php +++ b/src/usr/local/www/status_captiveportal_expire.php @@ -71,7 +71,7 @@ $tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test $tab_array[] = array(gettext("Expire Vouchers"), true, "status_captiveportal_expire.php?zone={$cpzone}"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; diff --git a/src/usr/local/www/status_captiveportal_test.php b/src/usr/local/www/status_captiveportal_test.php index 6a7993e..75e18dd 100644 --- a/src/usr/local/www/status_captiveportal_test.php +++ b/src/usr/local/www/status_captiveportal_test.php @@ -72,7 +72,7 @@ $tab_array[] = array(gettext("Test Vouchers"), true, "status_captiveportal_test. $tab_array[] = array(gettext("Expire Vouchers"), false, "status_captiveportal_expire.php?zone={$cpzone}"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; diff --git a/src/usr/local/www/status_graph.php b/src/usr/local/www/status_graph.php index 5f2dbbb..30fa6ad 100644 --- a/src/usr/local/www/status_graph.php +++ b/src/usr/local/www/status_graph.php @@ -129,7 +129,7 @@ $pgtitle = array(gettext("Status"),gettext("Traffic Graph")); include("head.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(false); $form->addClass('auto-submit'); diff --git a/src/usr/local/www/status_rrd_graph.php b/src/usr/local/www/status_rrd_graph.php index 037f521..c7b7eb1 100644 --- a/src/usr/local/www/status_rrd_graph.php +++ b/src/usr/local/www/status_rrd_graph.php @@ -492,7 +492,7 @@ display_top_tabs(make_tabs()); if ($input_errors && count($input_errors)) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(new Form_Button( 'submit', diff --git a/src/usr/local/www/status_rrd_graph_settings.php b/src/usr/local/www/status_rrd_graph_settings.php index 3ad7e8d..f43c3f5 100644 --- a/src/usr/local/www/status_rrd_graph_settings.php +++ b/src/usr/local/www/status_rrd_graph_settings.php @@ -180,7 +180,7 @@ if ($input_errors) if ($savemsg) print_info_box($savemsg, 'success'); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php index cd028a4..79be7a6 100644 --- a/src/usr/local/www/system.php +++ b/src/usr/local/www/system.php @@ -310,7 +310,7 @@ if ($savemsg) <div id="container"> <?php -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('System'); $section->addInput(new Form_Input( diff --git a/src/usr/local/www/system_advanced_admin.php b/src/usr/local/www/system_advanced_admin.php index db0bb44..d6cad3e 100644 --- a/src/usr/local/www/system_advanced_admin.php +++ b/src/usr/local/www/system_advanced_admin.php @@ -302,7 +302,7 @@ display_top_tabs($tab_array); ?><div id="container"><?php -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('WebConfigurator'); $group = new Form_Group('Protocol'); diff --git a/src/usr/local/www/system_advanced_firewall.php b/src/usr/local/www/system_advanced_firewall.php index 098b52a..dd21e54 100644 --- a/src/usr/local/www/system_advanced_firewall.php +++ b/src/usr/local/www/system_advanced_firewall.php @@ -397,7 +397,7 @@ display_top_tabs($tab_array); ?><div id="container"><?php -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Firewall Advanced'); diff --git a/src/usr/local/www/system_advanced_misc.php b/src/usr/local/www/system_advanced_misc.php index 5e87227..d998d59 100644 --- a/src/usr/local/www/system_advanced_misc.php +++ b/src/usr/local/www/system_advanced_misc.php @@ -2,36 +2,59 @@ /* $Id$ */ /* system_advanced_misc.php - part of pfSense - Copyright (C) 2005-2007 Scott Ullrich - Copyright (C) 2008 Shrew Soft Inc - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - - originally part of m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. - 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. */ +/* ==================================================================== + * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved. + * Copyright (c) 2004, 2005 Scott Ullrich + * Copyright (c) 2008 Shrew Soft Inc + * + * 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. + * + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * "This product includes software developed by the pfSense Project + * for use in the pfSense software distribution. (http://www.pfsense.org/). + * + * 4. The names "pfSense" and "pfSense Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * coreteam@pfsense.org. + * + * 5. Products derived from this software may not be called "pfSense" + * nor may "pfSense" appear in their names without prior written + * permission of the Electric Sheep Fencing, LLC. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * + * "This product includes software developed by the pfSense Project + * for use in the pfSense software distribution (http://www.pfsense.org/). + * + * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 pfSense PROJECT OR + * ITS CONTRIBUTORS 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. + * + * ==================================================================== + * + */ /* pfSense_MODULE: system */ @@ -260,12 +283,12 @@ if ($_POST) { $config['system']['use_mfs_tmp_size'] = $_POST['-tmp-ram-disk-size']; $config['system']['use_mfs_var_size'] = $_POST['-var-ram-disk-size']; - if (isset($_POST['periodic-rrd-backup'])) { - $config['system']['rrdbackup'] = $_POST['periodic-rrd-backup']; + if (isset($_POST['rrdbackup'])) { + $config['system']['rrdbackup'] = $_POST['rrdbackup']; install_cron_job("/etc/rc.backup_rrd.sh", ($config['system']['rrdbackup'] > 0), $minute="0", "*/{$config['system']['rrdbackup']}"); } - if (isset($_POST['periodic-dhcp-leases-backup'])) { - $config['system']['dhcpbackup'] = $_POST['periodic-dhcp-leases-backup']; + if (isset($_POST['dhcpbackup'])) { + $config['system']['dhcpbackup'] = $_POST['dhcpbackup']; install_cron_job("/etc/rc.backup_dhcpleases.sh", ($config['system']['dhcpbackup'] > 0), $minute="0", "*/{$config['system']['dhcpbackup']}"); } @@ -311,7 +334,7 @@ display_top_tabs($tab_array); ?><div id="container"><?php -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Proxy support'); @@ -339,9 +362,9 @@ $section->addInput(new Form_Input( 'leave blank to not use authentication.'); $section->addInput(new Form_Input( - 'password', + 'proxypass', 'Proxy Password', - 'text', + 'password', $pconfig['proxypass'] ))->setHelp('Password for authentication to proxy server.'); @@ -442,7 +465,7 @@ $section->addInput(new Form_Select( 'crypto_hardware', 'Cryptographic Hardware', $pconfig['crypto_hardware'], - $crypto_modules + ['' => gettext('None')] + $crypto_modules ))->setHelp('A cryptographic '. 'accelerator module will use hardware support to speed up some cryptographic '. 'functions on systems which have the chip. Do not enable this option if you have '. diff --git a/src/usr/local/www/system_advanced_network.php b/src/usr/local/www/system_advanced_network.php index 0a69be9..443241a 100644 --- a/src/usr/local/www/system_advanced_network.php +++ b/src/usr/local/www/system_advanced_network.php @@ -165,7 +165,7 @@ display_top_tabs($tab_array); ?><div id="container"><?php -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('IPv6 Options'); diff --git a/src/usr/local/www/system_advanced_notifications.php b/src/usr/local/www/system_advanced_notifications.php index 0a01cbc..bec0c4d 100644 --- a/src/usr/local/www/system_advanced_notifications.php +++ b/src/usr/local/www/system_advanced_notifications.php @@ -193,7 +193,7 @@ display_top_tabs($tab_array); ?><div id="container"><?php -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Growl'); diff --git a/src/usr/local/www/system_advanced_sysctl.php b/src/usr/local/www/system_advanced_sysctl.php index 00a2590..7ea1938 100644 --- a/src/usr/local/www/system_advanced_sysctl.php +++ b/src/usr/local/www/system_advanced_sysctl.php @@ -2,36 +2,59 @@ /* $Id$ */ /* system_advanced_sysctl.php - part of pfSense - Copyright (C) 2005-2007 Scott Ullrich - Copyright (C) 2008 Shrew Soft Inc - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - - originally part of m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. - 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. */ +/* ==================================================================== + * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved. + * Copyright (c) 2004, 2005 Scott Ullrich + * Copyright (c) 2008 Shrew Soft Inc + * + * 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. + * + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * "This product includes software developed by the pfSense Project + * for use in the pfSense software distribution. (http://www.pfsense.org/). + * + * 4. The names "pfSense" and "pfSense Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * coreteam@pfsense.org. + * + * 5. Products derived from this software may not be called "pfSense" + * nor may "pfSense" appear in their names without prior written + * permission of the Electric Sheep Fencing, LLC. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * + * "This product includes software developed by the pfSense Project + * for use in the pfSense software distribution (http://www.pfsense.org/). + * + * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 pfSense PROJECT OR + * ITS CONTRIBUTORS 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. + * + * ==================================================================== + * + */ /* pfSense_MODULE: system */ @@ -112,7 +135,8 @@ if ($_POST) { clear_subsystem_dirty('sysctl'); } - if ($_POST['Submit'] == gettext("Save")) { + if ($_POST['save'] == gettext("Save")) { + $tunableent = array(); $tunableent['tunable'] = $_POST['tunable']; @@ -137,10 +161,12 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); + if ($savemsg) - print_info_box($savemsg); + print_info_box($savemsg, 'success'); + if (is_subsystem_dirty('sysctl') && ($act != "edit" )) - print_info_box_np(gettext("The firewall tunables have changed. You must apply the configuration to take affect.")); + print_info_box_np(gettext("The firewall tunables have changed. You must apply the configuration for them to take affect.")); $tab_array = array(); $tab_array[] = array(gettext("Admin Access"), false, "system_advanced_admin.php"); @@ -195,7 +221,7 @@ if ($act != "edit" ): ?> </div> <?php else: - require('classes/Form.class.php'); + require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Edit Tunable'); diff --git a/src/usr/local/www/system_authservers.php b/src/usr/local/www/system_authservers.php index 52d57cc..4b6f7b9 100644 --- a/src/usr/local/www/system_authservers.php +++ b/src/usr/local/www/system_authservers.php @@ -358,8 +358,9 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); + if ($savemsg) - print_info_box($savemsg); + print_info_box($savemsg, 'success'); $tab_array = array(); $tab_array[] = array(gettext("Users"), false, "system_usermanager.php"); @@ -407,9 +408,10 @@ if (!($act == "new" || $act == "edit" || $input_errors)) exit; } -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $form->setAction('system_authservers.php?act=edit'); + $form->addGlobal(new Form_Input( 'userid', null, @@ -426,9 +428,6 @@ $section->addInput($input = new Form_Input( $pconfig['name'] )); -if ($act == 'edit') - $input->setReadonly(); - $section->addInput($input = new Form_Select( 'type', 'Type', @@ -436,10 +435,9 @@ $section->addInput($input = new Form_Select( $auth_server_types ))->toggles(); -if ($act == 'edit') - $input->setDisabled(); - $form->add($section); + +// ==== LDAP settings ========================================================= $section = new Form_Section('LDAP Server Settings'); $section->addClass('toggle-ldap collapse'); @@ -531,9 +529,10 @@ $group->add(new Form_Input( #FIXME $group->add(new Form_Button( 'Select', - 'Select a container', - '/system_usermanager_settings_ldapacpicker.php?port=389&host=192.168.1.1&scope=one&basedn=CN=pfsense&binddn=&bindpw=&urltype=TCP%20-%20Standard&proto=3&authcn=OU=Staff&cert=' -)); + 'Select a container' +// '/system_usermanager_settings_ldapacpicker.php?port=389&host=192.168.1.1&scope=one&basedn=CN=pfsense&binddn=&bindpw=&urltype=TCP%20-%20Standard&proto=3&authcn=OU=Staff&cert=' +))->removeClass('btn-primary')->addClass('btn-default'); + $section->add($group); $section->addInput(new Form_Checkbox( @@ -559,16 +558,18 @@ $section->addInput(new Form_Checkbox( 'Bind anonymous', 'Use anonymous binds to resolve distinguished names', $pconfig['ldap_anon'] -))->toggles('.toggle-anon'); +)); $group = new Form_Group('Bind credentials'); -$group->addClass('toggle-anon collapse'); +$group->addClass('ldapanon'); + $group->add(new Form_Input( 'ldap_binddn', 'User DN:', 'text', $pconfig['ldap_binddn'] )); + $group->add(new Form_Input( 'ldap_bindpw', 'Password', @@ -629,6 +630,8 @@ $section->addInput(new Form_Checkbox( ))->setHelp('e.g. user@host becomes user when unchecked.'); $form->add($section); + +// ==== RADIUS section ======================================================== $section = new Form_Section('Radius Server Settings'); $section->addClass('toggle-radius collapse'); @@ -694,6 +697,60 @@ print $form; <script> //<![CDATA[ events.push(function(){ + function select_clicked() { + if (document.getElementById("ldap_port").value == '' || + document.getElementById("ldap_host").value == '' || + document.getElementById("ldap_scope").value == '' || + document.getElementById("ldap_basedn").value == '' || + document.getElementById("ldapauthcontainers").value == '') { + alert("<?=gettext("Please fill the required values.");?>"); + return; + } + + if (!document.getElementById("ldap_anon").checked) { + if (document.getElementById("ldap_binddn").value == '' || + document.getElementById("ldap_bindpw").value == '') { + alert("<?=gettext("Please fill the bind username/password.");?>"); + return; + } + } + var url = 'system_usermanager_settings_ldapacpicker.php?'; + url += 'port=' + document.getElementById("ldap_port").value; + url += '&host=' + document.getElementById("ldap_host").value; + url += '&scope=' + document.getElementById("ldap_scope").value; + url += '&basedn=' + document.getElementById("ldap_basedn").value; + url += '&binddn=' + document.getElementById("ldap_binddn").value; + url += '&bindpw=' + document.getElementById("ldap_bindpw").value; + url += '&urltype=' + document.getElementById("ldap_urltype").value; + url += '&proto=' + document.getElementById("ldap_protver").value; + url += '&authcn=' + document.getElementById("ldapauthcontainers").value; + <?php if (count($a_ca) > 0): ?> + url += '&cert=' + document.getElementById("ldap_caref").value; + <?php else: ?> + url += '&cert='; + <?php endif; ?> + + var oWin = window.open(url, "pfSensePop", "width=620,height=400,top=150,left=150"); + if (oWin == null || typeof(oWin) == "undefined") { + alert("<?=gettext('Popup blocker detected. Action aborted.');?>"); + } + } + + function set_ldap_port() { + if($('#ldap_urltype').find(":selected").index() == 0) + $('#ldap_port').val('389'); + else + $('#ldap_port').val('636'); + } + + // Hides all elements of the specified class. This will usually be a section + function hideClass(s_class, hide) { + if(hide) + $('.' + s_class).hide(); + else + $('.' + s_class).show(); + } + function ldap_tmplchange() { switch ($('#ldap_tmpltype').find(":selected").index()) { <?php @@ -714,11 +771,44 @@ events.push(function(){ // On page load . . ldap_tmplchange(); + hideClass('ldapanon', $('#ldap_anon').prop('checked')); + $("#Select").prop('type','button'); + + if($('#ldap_port').val() == "") + set_ldap_port(); + +<?php + if($act == 'edit') { +?> + $('#type option:not(:selected)').each(function(){ + $(this).attr('disabled', 'disabled'); + }); + +<?php + if(!$input_errors) { +?> + $('#name').prop("readonly", true); +<?php + } + } +?> // On click . . $('#ldap_tmpltype').on('change', function() { ldap_tmplchange(); }); + + $('#ldap_anon').click(function () { + hideClass('ldapanon', this.checked); + }); + + $('#ldap_urltype').on('change', function() { + set_ldap_port(); + }); + + $('#Select').click(function () { + select_clicked(); + }); }); //]]> </script> diff --git a/src/usr/local/www/system_camanager.php b/src/usr/local/www/system_camanager.php index 83ace47..30f06c7 100644 --- a/src/usr/local/www/system_camanager.php +++ b/src/usr/local/www/system_camanager.php @@ -439,7 +439,7 @@ foreach ($a_ca as $i => $ca): exit; } -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; //$form->setAction('system_camanager.php?act=edit'); if (isset($id) && $a_ca[$id]) diff --git a/src/usr/local/www/system_certmanager.php b/src/usr/local/www/system_certmanager.php index 6ee5fbb..477efb7 100644 --- a/src/usr/local/www/system_certmanager.php +++ b/src/usr/local/www/system_certmanager.php @@ -671,7 +671,7 @@ foreach($a_cert as $i => $cert): exit; } -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; if ($act == "csr" || (($_POST['save'] == gettext("Update")) && $input_errors)) diff --git a/src/usr/local/www/system_crlmanager.php b/src/usr/local/www/system_crlmanager.php index 44e6190..4b19103 100644 --- a/src/usr/local/www/system_crlmanager.php +++ b/src/usr/local/www/system_crlmanager.php @@ -373,7 +373,7 @@ $tab_array[] = array(gettext("Certificates"), false, "system_certmanager.php"); $tab_array[] = array(gettext("Certificate Revocation"), true, "system_crlmanager.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); if ($act == "new" || $act == gettext("Save") || $input_errors) { if (!isset($id)) { @@ -526,7 +526,7 @@ if ($act == "new" || $act == gettext("Save") || $input_errors) { </td> <td class="list"> <a href="system_crlmanager.php?act=delcert&id=<?=$crl['refid']; ?>&certref=<?=$cert['refid']; ?>" onclick="return confirm('<?=gettext("Do you really want to delete this Certificate from the CRL?")?>')"> - <img src="/themes/<?= $g['theme']?>/images/icons/icon_x.gif" title="<?=gettext("Delete this certificate from the CRL ")?>" alt="<?=gettext("Delete this certificate from the CRL ")?>" /> + <i class="icon-large icon-remove-sign" title="<?=gettext("Delete this certificate from the CRL ")?>" alt="<?=gettext("Delete this certificate from the CRL ")?>"></i> </a> </td> </tr> diff --git a/src/usr/local/www/system_firmware.php b/src/usr/local/www/system_firmware.php index ccd2ab9..b211a5c 100644 --- a/src/usr/local/www/system_firmware.php +++ b/src/usr/local/www/system_firmware.php @@ -240,7 +240,7 @@ if ($sig_warning && !$input_errors) { } else { // This is where the work gets done so Forms.classes will be used from this point if (!is_subsystem_dirty('firmwarelock')) { - require('classes/Form.class.php'); + require_once('classes/Form.class.php'); if (!is_subsystem_dirty('rebootreq')) { // Provide a button to enable firmware upgrades. Upgrades should be disabled on initial page load diff --git a/src/usr/local/www/system_firmware_settings.php b/src/usr/local/www/system_firmware_settings.php index e43ca1c..aaf9089 100644 --- a/src/usr/local/www/system_firmware_settings.php +++ b/src/usr/local/www/system_firmware_settings.php @@ -113,7 +113,7 @@ if($g['hidedownloadbackup'] == false) display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/system_gateway_groups_edit.php b/src/usr/local/www/system_gateway_groups_edit.php index 70d46e8..87461e0 100644 --- a/src/usr/local/www/system_gateway_groups_edit.php +++ b/src/usr/local/www/system_gateway_groups_edit.php @@ -194,7 +194,7 @@ $protocol_array = array_values(array_unique($gateway_protocol)); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/system_gateways_edit.php b/src/usr/local/www/system_gateways_edit.php index bed023b..948ebe0 100644 --- a/src/usr/local/www/system_gateways_edit.php +++ b/src/usr/local/www/system_gateways_edit.php @@ -670,7 +670,7 @@ events.push(function(){ </script> <?php -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; /* If this is a system gateway we need this var */ diff --git a/src/usr/local/www/system_groupmanager.php b/src/usr/local/www/system_groupmanager.php index fa3140e..fbc0e43 100644 --- a/src/usr/local/www/system_groupmanager.php +++ b/src/usr/local/www/system_groupmanager.php @@ -307,7 +307,7 @@ if (!($_GET['act'] == "new" || $_GET['act'] == "edit")) exit; } -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $form->setAction('system_groupmanager.php?act=edit'); $form->addGlobal(new Form_Input( diff --git a/src/usr/local/www/system_groupmanager_addprivs.php b/src/usr/local/www/system_groupmanager_addprivs.php index d9134bf..1f45956 100644 --- a/src/usr/local/www/system_groupmanager_addprivs.php +++ b/src/usr/local/www/system_groupmanager_addprivs.php @@ -142,7 +142,7 @@ $tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.ph $tab_array[] = array(gettext("Servers"), false, "system_authservers.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; if (isset($groupid)) { diff --git a/src/usr/local/www/system_hasync.php b/src/usr/local/www/system_hasync.php index 47f6ea6..bbc258f 100755 --- a/src/usr/local/www/system_hasync.php +++ b/src/usr/local/www/system_hasync.php @@ -108,7 +108,7 @@ foreach ($ifaces as $ifname => $iface) { include("head.inc"); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; diff --git a/src/usr/local/www/system_routes_edit.php b/src/usr/local/www/system_routes_edit.php index 1a8974f..9c7b294 100644 --- a/src/usr/local/www/system_routes_edit.php +++ b/src/usr/local/www/system_routes_edit.php @@ -238,7 +238,7 @@ include("head.inc"); if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; if (isset($id) && $a_routes[$id]) { diff --git a/src/usr/local/www/system_usermanager.php b/src/usr/local/www/system_usermanager.php index 4493ff2..64defc7 100644 --- a/src/usr/local/www/system_usermanager.php +++ b/src/usr/local/www/system_usermanager.php @@ -528,7 +528,7 @@ foreach($a_user as $i => $userent): exit; } -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; if ($act == "new" || $act == "edit" || $input_errors): diff --git a/src/usr/local/www/system_usermanager_addprivs.php b/src/usr/local/www/system_usermanager_addprivs.php index 2e05769..ab70655 100644 --- a/src/usr/local/www/system_usermanager_addprivs.php +++ b/src/usr/local/www/system_usermanager_addprivs.php @@ -147,7 +147,7 @@ $tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.ph $tab_array[] = array(gettext("Servers"), false, "system_authservers.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/system_usermanager_passwordmg.php b/src/usr/local/www/system_usermanager_passwordmg.php index cb02942..43bd6eb 100644 --- a/src/usr/local/www/system_usermanager_passwordmg.php +++ b/src/usr/local/www/system_usermanager_passwordmg.php @@ -104,7 +104,7 @@ if ($islocal == false) { exit; } -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/system_usermanager_settings.php b/src/usr/local/www/system_usermanager_settings.php index a89970e..a844d78 100644 --- a/src/usr/local/www/system_usermanager_settings.php +++ b/src/usr/local/www/system_usermanager_settings.php @@ -118,7 +118,7 @@ display_top_tabs($tab_array); if(!$pconfig['backend']) $pconfig['backend'] = "pfsense"; -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Settings'); diff --git a/src/usr/local/www/vpn_ipsec_keys_edit.php b/src/usr/local/www/vpn_ipsec_keys_edit.php index d4037c4..7f7d733 100644 --- a/src/usr/local/www/vpn_ipsec_keys_edit.php +++ b/src/usr/local/www/vpn_ipsec_keys_edit.php @@ -137,7 +137,7 @@ include("head.inc"); <?php -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Edit pre-shared-secret'); diff --git a/src/usr/local/www/vpn_ipsec_mobile.php b/src/usr/local/www/vpn_ipsec_mobile.php index 503b2b2..6d674d5 100644 --- a/src/usr/local/www/vpn_ipsec_mobile.php +++ b/src/usr/local/www/vpn_ipsec_mobile.php @@ -373,7 +373,7 @@ $tab_array[2] = array(gettext("Pre-Shared Key"), false, "vpn_ipsec_keys.php"); $tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Enable IPsec Mobile Client Support'); diff --git a/src/usr/local/www/vpn_ipsec_phase1.php b/src/usr/local/www/vpn_ipsec_phase1.php index dfc5159..5a47a64 100644 --- a/src/usr/local/www/vpn_ipsec_phase1.php +++ b/src/usr/local/www/vpn_ipsec_phase1.php @@ -627,7 +627,7 @@ $tab_array[] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php"); $tab_array[] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/vpn_ipsec_phase2.php b/src/usr/local/www/vpn_ipsec_phase2.php index 4edecd4..a25aa7e 100644 --- a/src/usr/local/www/vpn_ipsec_phase2.php +++ b/src/usr/local/www/vpn_ipsec_phase2.php @@ -494,7 +494,7 @@ $tab_array[2] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php"); $tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/vpn_ipsec_settings.php b/src/usr/local/www/vpn_ipsec_settings.php index c6fe0ad..29c687b 100644 --- a/src/usr/local/www/vpn_ipsec_settings.php +++ b/src/usr/local/www/vpn_ipsec_settings.php @@ -275,7 +275,7 @@ $tab_array[2] = array(gettext("Pre-Shared Key"), false, "vpn_ipsec_keys.php"); $tab_array[3] = array(gettext("Advanced Settings"), true, "vpn_ipsec_settings.php"); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $section = new Form_Section('Start IPsec in debug mode based on sections selected'); diff --git a/src/usr/local/www/vpn_openvpn_client.php b/src/usr/local/www/vpn_openvpn_client.php index 19a1ca8..241e379 100644 --- a/src/usr/local/www/vpn_openvpn_client.php +++ b/src/usr/local/www/vpn_openvpn_client.php @@ -464,7 +464,7 @@ add_package_tabs("OpenVPN", $tab_array); display_top_tabs($tab_array); if($act=="new" || $act=="edit") : - require('classes/Form.class.php'); + require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/vpn_openvpn_csc.php b/src/usr/local/www/vpn_openvpn_csc.php index d3ffd22..9c8f739 100644 --- a/src/usr/local/www/vpn_openvpn_csc.php +++ b/src/usr/local/www/vpn_openvpn_csc.php @@ -295,7 +295,7 @@ add_package_tabs("OpenVPN", $tab_array); display_top_tabs($tab_array); if($act=="new" || $act=="edit"): - require('classes/Form.class.php'); + require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/vpn_openvpn_server.php b/src/usr/local/www/vpn_openvpn_server.php index bdbd08c..e125d65 100644 --- a/src/usr/local/www/vpn_openvpn_server.php +++ b/src/usr/local/www/vpn_openvpn_server.php @@ -692,7 +692,7 @@ $tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.x add_package_tabs("OpenVPN", $tab_array); display_top_tabs($tab_array); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); diff --git a/src/usr/local/www/vpn_pppoe_edit.php b/src/usr/local/www/vpn_pppoe_edit.php index e4617a8..958a318 100644 --- a/src/usr/local/www/vpn_pppoe_edit.php +++ b/src/usr/local/www/vpn_pppoe_edit.php @@ -290,7 +290,7 @@ if ($input_errors) if ($savemsg) print_info_box($savemsg, 'success'); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form(); |