From 4de8f7baac61c06da7c0719db020eedfb936acbd Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sun, 30 Aug 2015 22:17:24 +0545 Subject: Integrate bootstrap etc/inc with master This applies the little changes in etc/inc master to the bootstrap branch so that etc/inc in bootstrap will now just have the real differences that are due to real bootstrap changes. --- src/etc/inc/auth.inc | 40 ++++++------- src/etc/inc/authgui.inc | 2 +- src/etc/inc/filter_log.inc | 24 ++++---- src/etc/inc/openvpn.inc | 36 ++++++------ src/etc/inc/pfsense-utils.inc | 130 ++++++++++++++++++++--------------------- src/etc/inc/services.inc | 58 +++++++++--------- src/etc/inc/shaper.inc | 64 ++++++++++---------- src/etc/inc/upgrade_config.inc | 26 ++++----- 8 files changed, 193 insertions(+), 187 deletions(-) (limited to 'src') diff --git a/src/etc/inc/auth.inc b/src/etc/inc/auth.inc index 2e585bf..8f4c281 100644 --- a/src/etc/inc/auth.inc +++ b/src/etc/inc/auth.inc @@ -309,7 +309,7 @@ function get_user_privileges(& $user) { foreach ($names as $name) { $group = getGroupEntry($name); if (is_array($group['priv'])) { - $privs = array_merge( $privs, $group['priv']); + $privs = array_merge($privs, $group['priv']); } } @@ -369,7 +369,7 @@ function local_sync_accounts() { $fd = popen("/usr/sbin/pw usershow -a", "r"); if ($fd) { while (!feof($fd)) { - $line = explode(":",fgets($fd)); + $line = explode(":", fgets($fd)); if (((!strncmp($line[0], "_", 1)) || ($line[2] < 2000) || ($line[2] > 65000)) && ($line[0] != "admin")) { continue; } @@ -392,7 +392,7 @@ function local_sync_accounts() { $fd = popen("/usr/sbin/pw groupshow -a", "r"); if ($fd) { while (!feof($fd)) { - $line = explode(":",fgets($fd)); + $line = explode(":", fgets($fd)); if (!strncmp($line[0], "_", 1)) { continue; } @@ -587,7 +587,7 @@ function local_user_set_password(&$user, $password) { $ustr = ''; for ($i = 0; $i < strlen($astr); $i++) { $a = ord($astr{$i}) << 8; - $ustr.= sprintf("%X", $a); + $ustr .= sprintf("%X", $a); } } @@ -601,7 +601,7 @@ function local_user_get_groups($user, $all = false) { } foreach ($config['system']['group'] as $group) { - if ( $all || ( !$all && ($group['name'] != "all"))) { + if ($all || (!$all && ($group['name'] != "all"))) { if (is_array($group['member'])) { if (in_array($user['uid'], $group['member'])) { $groups[] = $group['name']; @@ -620,9 +620,9 @@ function local_user_get_groups($user, $all = false) { } -function local_user_set_groups($user, $new_groups = NULL ) { +function local_user_set_groups($user, $new_groups = NULL) { global $debug, $config, $groupindex; - + if (!is_array($config['system']['group'])) { return; } @@ -640,7 +640,7 @@ function local_user_set_groups($user, $new_groups = NULL ) { /* determine which memberships to add */ foreach ($new_groups as $groupname) { - if ($groupname == '' || in_array($groupname,$cur_groups)) { + if ($groupname == '' || in_array($groupname, $cur_groups)) { continue; } $group = & $config['system']['group'][$groupindex[$groupname]]; @@ -651,7 +651,7 @@ function local_user_set_groups($user, $new_groups = NULL ) { /* determine which memberships to remove */ foreach ($cur_groups as $groupname) { - if (in_array($groupname,$new_groups)) { + if (in_array($groupname, $new_groups)) { continue; } if (!isset($config['system']['group'][$groupindex[$groupname]])) { @@ -697,7 +697,7 @@ function local_group_set($group, $reset = false) { $group_gid = $group['gid']; $group_members = ''; if (!$reset && !empty($group['member']) && count($group['member']) > 0) { - $group_members = implode(",",$group['member']); + $group_members = implode(",", $group['member']); } if (empty($group_name)) { @@ -760,7 +760,7 @@ function ldap_test_connection($authcfg) { } /* first check if there is even an LDAP server populated */ - if ( !$ldapserver) { + if (!$ldapserver) { return false; } @@ -969,8 +969,8 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) { if (!$show_complete_ou) { $inf_split = explode(",", $inf['dn']); $ou = $inf_split[0]; - $ou = str_replace("OU=","", $ou); - $ou = str_replace("CN=","", $ou); + $ou = str_replace("OU=", "", $ou); + $ou = str_replace("CN=", "", $ou); } else { if ($inf['dn']) { $ou = $inf['dn']; @@ -1108,7 +1108,7 @@ function ldap_get_groups($username, $authcfg) { /* Time to close LDAP connection */ @ldap_unbind($ldap); - $groups = print_r($memberof,true); + $groups = print_r($memberof, true); //log_error("Returning groups ".$groups." for user $username"); @@ -1228,7 +1228,7 @@ function ldap_backed($username, $passwd, $authcfg) { $ldac_splits = explode(";", $ldapauthcont); /* setup the usercount so we think we haven't found anyone yet */ - $usercount = 0; + $usercount = 0; /*****************************************************************/ /* We First find the user based on username and filter */ @@ -1256,15 +1256,15 @@ function ldap_backed($username, $passwd, $authcfg) { } /* Support legacy auth container specification. */ if (stristr($ldac_split, "DC=") || empty($ldapbasedn)) { - $search = @$ldapfunc($ldap,$ldac_split,$ldapfilter); + $search = @$ldapfunc($ldap,$ldac_split,$ldapfilter); } else { - $search = @$ldapfunc($ldap,$ldapsearchbasedn,$ldapfilter); + $search = @$ldapfunc($ldap,$ldapsearchbasedn,$ldapfilter); } if (!$search) { log_error(sprintf(gettext("Search resulted in error: %s"), ldap_error($ldap))); continue; } - $info = ldap_get_entries($ldap,$search); + $info = ldap_get_entries($ldap, $search); $matches = $info['count']; if ($matches == 1) { $userdn = $_SESSION['ldapdn'] = $info[0]['dn']; @@ -1391,7 +1391,7 @@ function get_user_expiration_date($username) { function is_account_expired($username) { $expirydate = get_user_expiration_date($username); if ($expirydate) { - if (strtotime("-1 day") > strtotime(date("m/d/Y",strtotime($expirydate)))) { + if (strtotime("-1 day") > strtotime(date("m/d/Y", strtotime($expirydate)))) { return true; } } @@ -1435,7 +1435,7 @@ function auth_get_authserver_list() { } } - $list["Local Database"] = array( "name" => gettext("Local Database"), "type" => "Local Auth", "host" => $config['system']['hostname']); + $list["Local Database"] = array("name" => gettext("Local Database"), "type" => "Local Auth", "host" => $config['system']['hostname']); return $list; } diff --git a/src/etc/inc/authgui.inc b/src/etc/inc/authgui.inc index 721be47..d3b701d 100644 --- a/src/etc/inc/authgui.inc +++ b/src/etc/inc/authgui.inc @@ -219,7 +219,7 @@ if ($local_ip == false) {

If you did not setup this forwarding, you may be the target of a man-in-the-middle attack.")); } diff --git a/src/etc/inc/filter_log.inc b/src/etc/inc/filter_log.inc index 11ee6de..44c1673 100644 --- a/src/etc/inc/filter_log.inc +++ b/src/etc/inc/filter_log.inc @@ -74,7 +74,7 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil $flent = parse_filter_line($logent); if (!$filterinterface || ($filterinterface == $flent['interface'])) { if ((($flent != "") && (!is_array($filtertext)) && (match_filter_line ($flent, $filtertext))) || - (($flent != "") && ( is_array($filtertext)) && (match_filter_field($flent, $filtertext)))) { + (($flent != "") && (is_array($filtertext)) && (match_filter_field($flent, $filtertext)))) { $counter++; $filterlog[] = $flent; } @@ -86,7 +86,7 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil function escape_filter_regex($filtertext) { /* If the caller (user) has not already put a backslash before a slash, to escape it in the regex, */ - /* then this will do it. Take out any "\/" already there, then turn all ordinary "/" into "\/". */ + /* then this will do it. Take out any "\/" already there, then turn all ordinary "/" into "\/". */ return str_replace('/', '\/', str_replace('\/', '/', $filtertext)); } @@ -156,7 +156,7 @@ function parse_filter_line($line) { $flent['anchor'] = $rule_data[$field++]; $flent['tracker'] = $rule_data[$field++]; $flent['realint'] = $rule_data[$field++]; - $flent['interface'] = convert_real_interface_to_friendly_descr($flent['realint']); + $flent['interface'] = convert_real_interface_to_friendly_descr($flent['realint']); $flent['reason'] = $rule_data[$field++]; $flent['act'] = $rule_data[$field++]; $flent['direction'] = $rule_data[$field++]; @@ -198,7 +198,7 @@ function parse_filter_line($line) { $flent['ack'] = $rule_data[$field++]; $flent['window'] = $rule_data[$field++]; $flent['urg'] = $rule_data[$field++]; - $flent['options'] = explode(";",$rule_data[$field++]); + $flent['options'] = explode(";", $rule_data[$field++]); } } else if ($flent['protoid'] == '1') { // ICMP $flent['src'] = $flent['srcip']; @@ -261,7 +261,7 @@ function parse_filter_line($line) { } } else { if ($g['debug']) { - log_error(sprintf(gettext("There was a error parsing rule number: %s. Please report to mailing list or forum."), $flent['rulenum'])); + log_error(sprintf(gettext("There was a error parsing rule number: %s. Please report to mailing list or forum."), $flent['rulenum'])); } return ""; } @@ -271,7 +271,7 @@ function parse_filter_line($line) { return $flent; } else { if ($g['debug']) { - log_error(sprintf(gettext("There was a error parsing rule: %s. Please report to mailing list or forum."), $errline)); + log_error(sprintf(gettext("There was a error parsing rule: %s. Please report to mailing list or forum."), $errline)); } return ""; } @@ -382,11 +382,11 @@ function find_rule_by_number_buffer($rulenum, $trackernum, $type) { if ($type == "rdr") { $ruleString = $buffer_rules_rdr[$lookup_key]; //TODO: get the correct 'description' part of a RDR log line. currently just first 30 characters.. - $rulename = substr($ruleString,0,30); + $rulename = substr($ruleString, 0, 30); } else { $ruleString = $buffer_rules_normal[$lookup_key]; - list(,$rulename,) = explode("\"",$ruleString); - $rulename = str_replace("USER_RULE: ",'USER_RULE ',$rulename); + list(,$rulename,) = explode("\"", $ruleString); + $rulename = str_replace("USER_RULE: ", 'USER_RULE ', $rulename); } return "{$rulename} ({$lookup_key})"; } @@ -413,9 +413,9 @@ function handle_ajax($nentries, $tail = 50) { if ($_POST['lastsawtime']) { $lastsawtime = $_POST['lastsawtime']; } - /* compare lastsawrule's time stamp to filter logs. - * afterwards return the newer records so that client - * can update AJAX interface screen. + /* compare lastsawrule's time stamp to filter logs. + * afterwards return the newer records so that client + * can update AJAX interface screen. */ $new_rules = ""; $filterlog = conv_log_filter($filter_logfile, $nentries, $tail); diff --git a/src/etc/inc/openvpn.inc b/src/etc/inc/openvpn.inc index 945e7ff..c163294 100644 --- a/src/etc/inc/openvpn.inc +++ b/src/etc/inc/openvpn.inc @@ -526,7 +526,7 @@ function openvpn_reconfigure($mode, $settings) { // Otherwise, if a specific interface is requested, use it // If "any" interface was selected, local directive will be omitted. if (is_ipaddrv4($ipaddr)) { - $iface_ip=$ipaddr; + $iface_ip = $ipaddr; } else { if ((!empty($interface)) && (strcmp($interface, "any"))) { $iface_ip=get_interface_ip($interface); @@ -793,12 +793,12 @@ function openvpn_reconfigure($mode, $settings) { $up_file = "{$g['varetc_path']}/openvpn/{$mode_id}.up"; $conf .= "auth-user-pass {$up_file}\n"; if ($settings['auth_user']) { - $userpass = "{$settings['auth_user']}\n"; + $userpass = "{$settings['auth_user']}\n"; } else { $userpass = ""; } if ($settings['auth_pass']) { - $userpass .= "{$settings['auth_pass']}\n"; + $userpass .= "{$settings['auth_pass']}\n"; } // If only auth_pass is given, then it acts like a user name and we put a blank line where pass would normally go. if (!($settings['auth_user'] && $settings['auth_pass'])) { @@ -1351,29 +1351,29 @@ function openvpn_get_client_status($client, $socket) { } /* Get the client state */ - if (strstr($line,"CONNECTED")) { - $client['status']="up"; + if (strstr($line, "CONNECTED")) { + $client['status'] = "up"; $list = explode(",", $line); - $client['connect_time'] = date("D M j G:i:s Y", $list[0]); - $client['virtual_addr'] = $list[3]; + $client['connect_time'] = date("D M j G:i:s Y", $list[0]); + $client['virtual_addr'] = $list[3]; $client['remote_host'] = $list[4]; } - if (strstr($line,"CONNECTING")) { - $client['status']="connecting"; + if (strstr($line, "CONNECTING")) { + $client['status'] = "connecting"; } - if (strstr($line,"ASSIGN_IP")) { - $client['status']="waiting"; + if (strstr($line, "ASSIGN_IP")) { + $client['status'] = "waiting"; $list = explode(",", $line); - $client['connect_time'] = date("D M j G:i:s Y", $list[0]); - $client['virtual_addr'] = $list[3]; + $client['connect_time'] = date("D M j G:i:s Y", $list[0]); + $client['virtual_addr'] = $list[3]; } - if (strstr($line,"RECONNECTING")) { - $client['status']="reconnecting"; + if (strstr($line, "RECONNECTING")) { + $client['status'] = "reconnecting"; $list = explode(",", $line); - $client['connect_time'] = date("D M j G:i:s Y", $list[0]); + $client['connect_time'] = date("D M j G:i:s Y", $list[0]); $client['status'] .= "; " . $list[2]; } /* parse end of output line */ @@ -1395,12 +1395,12 @@ function openvpn_get_client_status($client, $socket) { break; } - if (strstr($line,"TCP/UDP read bytes")) { + if (strstr($line, "TCP/UDP read bytes")) { $list = explode(",", $line); $client['bytes_recv'] = $list[1]; } - if (strstr($line,"TCP/UDP write bytes")) { + if (strstr($line, "TCP/UDP write bytes")) { $list = explode(",", $line); $client['bytes_sent'] = $list[1]; } diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index be66e8b..dc44036 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -79,7 +79,7 @@ function have_ruleint_access($if) { * returns true if a url is available ******/ function does_url_exist($url) { - $fd = fopen("$url","r"); + $fd = fopen("$url", "r"); if ($fd) { fclose($fd); return true; @@ -98,14 +98,14 @@ function does_url_exist($url) { ******/ function is_private_ip($iptocheck) { $isprivate = false; - $ip_private_list=array( + $ip_private_list = array( "10.0.0.0/8", "100.64.0.0/10", "172.16.0.0/12", "192.168.0.0/16", ); foreach ($ip_private_list as $private) { - if (ip_in_subnet($iptocheck,$private)==true) { + if (ip_in_subnet($iptocheck, $private) == true) { $isprivate = true; } } @@ -136,16 +136,16 @@ function get_tmp_file() { function get_dns_servers() { $dns_servers = array(); if (file_exists("/etc/resolv.conf")) { - $dns_s = file("/etc/resolv.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + $dns_s = file("/etc/resolv.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); } if (is_array($dns_s)) { - foreach ($dns_s as $dns) { - $matches = ""; - if (preg_match("/nameserver (.*)/", $dns, $matches)) { - $dns_servers[] = $matches[1]; + foreach ($dns_s as $dns) { + $matches = ""; + if (preg_match("/nameserver (.*)/", $dns, $matches)) { + $dns_servers[] = $matches[1]; + } } } - } return array_unique($dns_servers); } @@ -502,7 +502,7 @@ function WakeOnLan($addr, $mac) { $addr_byte = explode(':', $mac); $hw_addr = ''; - for ($a=0; $a < 6; $a++) { + for ($a = 0; $a < 6; $a++) { $hw_addr .= chr(hexdec($addr_byte[$a])); } @@ -519,7 +519,7 @@ function WakeOnLan($addr, $mac) { log_error(sprintf(gettext("Error code is '%1\$s' - %2\$s"), socket_last_error($s), socket_strerror(socket_last_error($s)))); } else { // setting a broadcast option to socket: - $opt_ret = socket_set_option($s, 1, 6, TRUE); + $opt_ret = socket_set_option($s, 1, 6, TRUE); if ($opt_ret < 0) { log_error(sprintf(gettext("setsockopt() failed, error: %s"), strerror($opt_ret))); } @@ -564,7 +564,7 @@ function backup_config_section($section_name) { function restore_config_section($section_name, $new_contents) { global $config, $g; conf_mount_rw(); - $fout = fopen("{$g['tmp_path']}/tmpxml","w"); + $fout = fopen("{$g['tmp_path']}/tmpxml", "w"); fwrite($fout, $new_contents); fclose($fout); @@ -625,10 +625,10 @@ function merge_config_section($section_name, $new_contents) { function http_post($server, $port, $url, $vars) { $user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)"; $urlencoded = ""; - while (list($key,$value) = each($vars)) { - $urlencoded.= urlencode($key) . "=" . urlencode($value) . "&"; + while (list($key, $value) = each($vars)) { + $urlencoded .= urlencode($key) . "=" . urlencode($value) . "&"; } - $urlencoded = substr($urlencoded,0,-1); + $urlencoded = substr($urlencoded, 0, -1); $content_length = strlen($urlencoded); $headers = "POST $url HTTP/1.1 Accept: */* @@ -654,7 +654,7 @@ Content-Length: $content_length $ret = ""; while (!feof($fp)) { - $ret.= fgets($fp, 1024); + $ret .= fgets($fp, 1024); } fclose($fp); @@ -668,7 +668,7 @@ if (!function_exists('php_check_syntax')) { global $g; function php_check_syntax($code_to_check, &$errormessage) { return false; - $fout = fopen("{$g['tmp_path']}/codetocheck.php","w"); + $fout = fopen("{$g['tmp_path']}/codetocheck.php", "w"); $code = $_POST['content']; $code = str_replace("", "", $code); @@ -709,11 +709,11 @@ if (!function_exists('php_check_syntax')) { } /* - * rmdir_recursive($path,$follow_links=false) + * rmdir_recursive($path, $follow_links=false) * Recursively remove a directory tree (rm -rf path) * This is for directories _only_ */ -function rmdir_recursive($path,$follow_links=false) { +function rmdir_recursive($path, $follow_links=false) { $to_do = glob($path); if (!is_array($to_do)) { $to_do = array($to_do); @@ -725,7 +725,7 @@ function rmdir_recursive($path,$follow_links=false) { while ($entry = readdir($dir)) { if (is_file("$workingdir/$entry") || ((!$follow_links) && is_link("$workingdir/$entry"))) { unlink("$workingdir/$entry"); - } elseif (is_dir("$workingdir/$entry") && $entry!='.' && $entry!='..') { + } elseif (is_dir("$workingdir/$entry") && $entry != '.' && $entry != '..') { rmdir_recursive("$workingdir/$entry"); } } @@ -985,7 +985,7 @@ function reload_all_sync() { send_event("service restart webgui"); } -function setup_serial_port($when="save", $path="") { +function setup_serial_port($when = "save", $path = "") { global $g, $config; conf_mount_rw(); $ttys_file = "{$path}/etc/ttys"; @@ -1013,7 +1013,7 @@ function setup_serial_port($when="save", $path="") { } $boot_config_split = explode("\n", $boot_config); - $fd = fopen($boot_config_file,"w"); + $fd = fopen($boot_config_file, "w"); if ($fd) { foreach ($boot_config_split as $bcs) { if (stristr($bcs, "-D") || stristr($bcs, "-h")) { @@ -1047,9 +1047,9 @@ function setup_serial_port($when="save", $path="") { (stripos($bcs, "console") === false) && (stripos($bcs, "boot_multicons") === false) && (stripos($bcs, "boot_serial") === false) && - (stripos($bcs, "hw.usb.no_pf") === false) && - (stripos($bcs, "hint.uart.0.flags") === false) && - (stripos($bcs, "hint.uart.1.flags") === false)) { + (stripos($bcs, "hw.usb.no_pf") === false) && + (stripos($bcs, "hint.uart.0.flags") === false) && + (stripos($bcs, "hint.uart.1.flags") === false)) { $new_boot_config[] = $bcs; } } @@ -1266,7 +1266,7 @@ function is_pppoe_server_enabled() { } function convert_seconds_to_hms($sec) { - $min=$hrs=0; + $min = $hrs = 0; if ($sec != 0) { $min = floor($sec/60); $sec %= 60; @@ -1293,8 +1293,8 @@ function convert_seconds_to_hms($sec) { function get_ppp_uptime($port) { if (file_exists("/conf/{$port}.log")) { $saved_time = file_get_contents("/conf/{$port}.log"); - $uptime_data = explode("\n",$saved_time); - $sec=0; + $uptime_data = explode("\n", $saved_time); + $sec = 0; foreach ($uptime_data as $upt) { $sec += substr($upt, 1 + strpos($upt, " ")); } @@ -1803,7 +1803,7 @@ function download_file($url, $destination, $verify_ssl = true, $connect_timeout function download_file_with_progress_bar($url_file, $destination_file, $readbody = 'read_body', $connect_timeout = 5, $timeout = 0) { global $config, $g; global $ch, $fout, $file_size, $downloaded, $config, $first_progress_update; - $file_size = 1; + $file_size = 1; $downloaded = 1; $first_progress_update = TRUE; /* open destination file */ @@ -2355,21 +2355,21 @@ function nanobsd_switch_boot_slice() { } ob_implicit_flush(1); if (strstr($slice, "s2")) { - $ASLICE="2"; - $AOLDSLICE="1"; - $AGLABEL_SLICE="pfsense1"; - $AUFS_ID="1"; - $AOLD_UFS_ID="0"; + $ASLICE = "2"; + $AOLDSLICE = "1"; + $AGLABEL_SLICE = "pfsense1"; + $AUFS_ID = "1"; + $AOLD_UFS_ID = "0"; } else { - $ASLICE="1"; - $AOLDSLICE="2"; - $AGLABEL_SLICE="pfsense0"; - $AUFS_ID="0"; - $AOLD_UFS_ID="1"; - } - $ATOFLASH="{$BOOT_DRIVE}s{$ASLICE}"; - $ACOMPLETE_PATH="{$BOOT_DRIVE}s{$ASLICE}a"; - $ABOOTFLASH="{$BOOT_DRIVE}s{$AOLDSLICE}"; + $ASLICE = "1"; + $AOLDSLICE = "2"; + $AGLABEL_SLICE = "pfsense0"; + $AUFS_ID = "0"; + $AOLD_UFS_ID = "1"; + } + $ATOFLASH = "{$BOOT_DRIVE}s{$ASLICE}"; + $ACOMPLETE_PATH = "{$BOOT_DRIVE}s{$ASLICE}a"; + $ABOOTFLASH = "{$BOOT_DRIVE}s{$AOLDSLICE}"; conf_mount_rw(); set_single_sysctl("kern.geom.debugflags", "16"); exec("gpart set -a active -i {$ASLICE} {$BOOT_DRIVE}"); @@ -2443,23 +2443,23 @@ function nanobsd_detect_slice_info() { // Detect which slice is active and set information. if (strstr($REAL_BOOT_DEVICE, "s1")) { - $SLICE="2"; - $OLDSLICE="1"; - $GLABEL_SLICE="pfsense1"; - $UFS_ID="1"; - $OLD_UFS_ID="0"; + $SLICE = "2"; + $OLDSLICE = "1"; + $GLABEL_SLICE = "pfsense1"; + $UFS_ID = "1"; + $OLD_UFS_ID = "0"; } else { - $SLICE="1"; - $OLDSLICE="2"; - $GLABEL_SLICE="pfsense0"; - $UFS_ID="0"; - $OLD_UFS_ID="1"; + $SLICE = "1"; + $OLDSLICE = "2"; + $GLABEL_SLICE = "pfsense0"; + $UFS_ID = "0"; + $OLD_UFS_ID = "1"; } - $TOFLASH="{$BOOT_DRIVE}s{$SLICE}"; - $COMPLETE_PATH="{$BOOT_DRIVE}s{$SLICE}a"; - $COMPLETE_BOOT_PATH="{$BOOT_DRIVE}s{$OLDSLICE}"; - $BOOTFLASH="{$BOOT_DRIVE}s{$OLDSLICE}"; + $TOFLASH = "{$BOOT_DRIVE}s{$SLICE}"; + $COMPLETE_PATH = "{$BOOT_DRIVE}s{$SLICE}a"; + $COMPLETE_BOOT_PATH = "{$BOOT_DRIVE}s{$OLDSLICE}"; + $BOOTFLASH = "{$BOOT_DRIVE}s{$OLDSLICE}"; } function nanobsd_friendly_slice_name($slicename) { @@ -2658,10 +2658,10 @@ function generate_ipv6_from_mac($mac) { $ipv6 = "fe80::"; foreach ($elements as $byte) { if ($i == 0) { - $hexadecimal = substr($byte, 1, 2); + $hexadecimal = substr($byte, 1, 2); $bitmap = base_convert($hexadecimal, 16, 2); $bitmap = str_pad($bitmap, 4, "0", STR_PAD_LEFT); - $bitmap = substr($bitmap, 0, 2) ."1". substr($bitmap, 3,4); + $bitmap = substr($bitmap, 0, 2) ."1". substr($bitmap, 3, 4); $byte = substr($byte, 0, 1) . base_convert($bitmap, 2, 16); } $ipv6 .= $byte; @@ -2698,7 +2698,7 @@ function load_mac_manufacturer_table() { foreach ($macs as $line) { if (preg_match('/([0-9A-Fa-f]{6}) (.*)$/', $line, $matches)) { /* store values like this $mac_man['000C29']='VMware' */ - $mac_man["$matches[1]"]=$matches[2]; + $mac_man["$matches[1]"] = $matches[2]; } } return $mac_man; @@ -2794,7 +2794,7 @@ function where_is_ipaddr_configured($ipaddr, $ignore_if = "", $check_localip = f $where_entry['if'] = $if; $where_entry['ip_or_subnet'] = get_interface_ip($if) . "/" . get_interface_subnet($if); $where_configured[] = $where_entry; - } + } } } } else { @@ -2820,7 +2820,7 @@ function where_is_ipaddr_configured($ipaddr, $ignore_if = "", $check_localip = f $interface_list_vips = get_configured_vips_list(true); foreach ($interface_list_vips as $id => $vip) { /* Skip CARP interfaces here since they were already checked above */ - if ($id == $ignore_vip_id || (substr($ignore_if, 0, 4) == '_vip') && substr($ignore_vip_if, 5) == $vip['uniqdid']) { + if ($id == $ignore_vip_id || (substr($ignore_if, 0, 4) == '_vip') && substr($ignore_vip_if, 5) == $vip['uniqdid']) { continue; } if (strcasecmp($ipaddr, $vip['ipaddr']) == 0) { @@ -2876,8 +2876,8 @@ function set_language($lang = 'en_US', $encoding = "UTF-8") { putenv("LANG={$lang}.{$encoding}"); setlocale(LC_ALL, "{$lang}.{$encoding}"); textdomain("pfSense"); - bindtextdomain("pfSense","/usr/local/share/locale"); - bind_textdomain_codeset("pfSense","{$lang}.{$encoding}"); + bindtextdomain("pfSense", "/usr/local/share/locale"); + bind_textdomain_codeset("pfSense", "{$lang}.{$encoding}"); } function get_locale_list() { @@ -3172,7 +3172,7 @@ function pkg_call_plugins($plugin_type, $plugin_params) { continue; } $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], 'packagegui'); - $pkgname = substr(reverse_strrchr($package['configurationfile'], "."),0,-1); + $pkgname = substr(reverse_strrchr($package['configurationfile'], "."), 0, -1); if (is_array($pkg_config['plugins']['item'])) { foreach ($pkg_config['plugins']['item'] as $plugin) { if ($plugin['type'] == $plugin_type) { diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index 333261d..10f0451 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -391,7 +391,7 @@ function services_dhcpd_configure($family = "all", $blacklist = array()) { global $config, $g; /* configure DHCPD chroot once */ - $fd = fopen("{$g['tmp_path']}/dhcpd.sh","w"); + $fd = fopen("{$g['tmp_path']}/dhcpd.sh", "w"); fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}\n"); fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/dev\n"); fwrite($fd, "/bin/mkdir -p {$g['dhcpd_chroot_path']}/etc\n"); @@ -406,7 +406,7 @@ function services_dhcpd_configure($family = "all", $blacklist = array()) { fwrite($fd, "/bin/cp -n /usr/local/sbin/dhcpd {$g['dhcpd_chroot_path']}/usr/local/sbin/\n"); fwrite($fd, "/bin/chmod a+rx {$g['dhcpd_chroot_path']}/usr/local/sbin/dhcpd\n"); - $status = `/sbin/mount | /usr/bin/grep -v grep | /usr/bin/grep "{$g['dhcpd_chroot_path']}/dev"`; + $status = `/sbin/mount | /usr/bin/grep -v grep | /usr/bin/grep "{$g['dhcpd_chroot_path']}/dev"`; if (!trim($status)) { fwrite($fd, "/sbin/mount -t devfs devfs {$g['dhcpd_chroot_path']}/dev\n"); } @@ -596,7 +596,7 @@ EOD; $my_port = "519"; $peer_port = "520"; $type = "primary"; - $dhcpdconf_pri = "split 128;\n"; + $dhcpdconf_pri = "split 128;\n"; $dhcpdconf_pri .= " mclt 600;\n"; } @@ -709,16 +709,16 @@ EOPP; $all_mac_strings[] = $dhcpifconf['mac_allow']; $all_mac_strings[] = $dhcpifconf['mac_deny']; if (!empty($all_mac_strings)) { - $all_mac_list = array_unique(explode(',', implode(',', $all_mac_strings))); - foreach ($all_mac_list as $mac) { - if (empty($mac)) { - continue; + $all_mac_list = array_unique(explode(',', implode(',', $all_mac_strings))); + foreach ($all_mac_list as $mac) { + if (empty($mac)) { + continue; + } + $dhcpdconf .= 'class "' . str_replace(':', '', $mac) . '" {' . "\n"; + // Skip the first octet of the MAC address - for media type, typically Ethernet ("01") and match the rest. + $dhcpdconf .= ' match if substring (hardware, 1, ' . (substr_count($mac, ':') + 1) . ') = ' . $mac . ';' . "\n"; + $dhcpdconf .= '}' . "\n"; } - $dhcpdconf .= 'class "' . str_replace(':', '', $mac) . '" {' . "\n"; - // Skip the first octet of the MAC address - for media type, typically Ethernet ("01") and match the rest. - $dhcpdconf .= ' match if substring (hardware, 1, ' . (substr_count($mac, ':') + 1) . ') = ' . $mac . ';' . "\n"; - $dhcpdconf .= '}' . "\n"; - } } $dhcpdconf .= "subnet {$subnet} netmask {$subnetmask} {\n"; @@ -1603,7 +1603,7 @@ function services_dhcrelay_configure() { if (!is_array($srvips)) { log_error("No destination IP has been configured!"); return; - } + } $dhcrelayifs = array_unique($dhcrelayifs); @@ -1613,10 +1613,10 @@ function services_dhcrelay_configure() { return; /* XXX */ } - $cmd = "/usr/local/sbin/dhcrelay -i " . implode(" -i ", $dhcrelayifs); + $cmd = "/usr/local/sbin/dhcrelay -i " . implode(" -i ", $dhcrelayifs); if (isset($dhcrelaycfg['agentoption'])) { - $cmd .= " -a -m replace"; + $cmd .= " -a -m replace"; } $cmd .= " " . implode(" ", $srvips); @@ -1711,8 +1711,8 @@ function services_dyndns_configure_client($conf) { $dnsPort = NULL, $dnsUpdateURL = "{$conf['updateurl']}", $forceUpdate = $conf['force'], - $dnsZoneID=$conf['zoneid'], - $dnsTTL=$conf['ttl'], + $dnsZoneID = $conf['zoneid'], + $dnsTTL = $conf['ttl'], $dnsResultMatch = "{$conf['resultmatch']}", $dnsRequestIf = "{$conf['requestif']}", $dnsID = "{$conf['id']}", @@ -1811,7 +1811,7 @@ function services_dnsmasq_configure() { } /* generate hosts file */ - if (system_hosts_generate()!=0) { + if (system_hosts_generate() != 0) { $return = 1; } @@ -1967,7 +1967,7 @@ function services_dnsmasq_configure() { } if (!platform_booting()) { - if (services_dhcpd_configure()!=0) { + if (services_dhcpd_configure() != 0) { $return = 1; } } @@ -1997,7 +1997,7 @@ function services_unbound_configure() { } /* generate hosts file */ - if (system_hosts_generate()!=0) { + if (system_hosts_generate() != 0) { $return = 1; } @@ -2011,7 +2011,7 @@ function services_unbound_configure() { } if (!platform_booting()) { - if (services_dhcpd_configure()!=0) { + if (services_dhcpd_configure() != 0) { $return = 1; } } @@ -2042,7 +2042,7 @@ function services_snmpd_configure() { /* generate snmpd.conf */ $fd = fopen("{$g['varetc_path']}/snmpd.conf", "w"); if (!$fd) { - printf(gettext("Error: cannot open snmpd.conf in services_snmpd_configure().%s"),"\n"); + printf(gettext("Error: cannot open snmpd.conf in services_snmpd_configure().%s"), "\n"); return 1; } @@ -2483,10 +2483,11 @@ function upnp_start() { } } -function install_cron_job($command, $active=false, $minute="0", $hour="*", $monthday="*", $month="*", $weekday="*", $who="root") { +function install_cron_job($command, $active = false, $minute = "0", $hour = "*", $monthday = "*", $month = "*", $weekday = "*", $who = "root") { global $config, $g; $is_installed = false; + $cron_changed = true; if (!is_array($config['cron'])) { $config['cron'] = array(); @@ -2495,7 +2496,7 @@ function install_cron_job($command, $active=false, $minute="0", $hour="*", $mont $config['cron']['item'] = array(); } - $x=0; + $x = 0; foreach ($config['cron']['item'] as $item) { if (strstr($item['command'], $command)) { $is_installed = true; @@ -2517,8 +2518,13 @@ function install_cron_job($command, $active=false, $minute="0", $hour="*", $mont $config['cron']['item'][] = $cron_item; write_config(sprintf(gettext("Installed cron job for %s"), $command)); } else { - $config['cron']['item'][$x] = $cron_item; - write_config(sprintf(gettext("Updated cron job for %s"), $command)); + if ($config['cron']['item'][$x] == $cron_item) { + $cron_changed = false; + log_error(sprintf(gettext("Checked cron job for %s, no change needed"), $command)); + } else { + $config['cron']['item'][$x] = $cron_item; + write_config(sprintf(gettext("Updated cron job for %s"), $command)); + } } } else { if ($is_installed == true) { diff --git a/src/etc/inc/shaper.inc b/src/etc/inc/shaper.inc index fa86b16..bb84144 100644 --- a/src/etc/inc/shaper.inc +++ b/src/etc/inc/shaper.inc @@ -233,7 +233,7 @@ function get_interface_bandwidth($object) { $altq =& $altq_list_queues[$int]; if ($altq) { $bw_3 = $altq->GetBandwidth(); - $bw_3 = $bw_3 * get_bandwidthtype_scale($altq->GetBwscale()); + $bw_3 = $bw_3 * get_bandwidthtype_scale($altq->GetBwscale()); return floatval($bw_3); } else { return 0; @@ -550,7 +550,7 @@ class altq_root_queue { function &find_parentqueue($interface, $qname) { if ($qname == $interface) { - $result = NULL; + $result = NULL; } else if ($this->queues[$qname]) { $result = $this; } else if ($this->GetScheduler() <> "PRIQ") { @@ -570,7 +570,7 @@ class altq_root_queue { $tree .= "\">" . $shaperIFlist[$this->GetInterface()] . ""; if (is_array($this->queues)) { $tree .= "
    "; - foreach ($this->queues as $q) { + foreach ($this->queues as $q) { $tree .= $q->build_tree(); } $tree .= "
"; @@ -609,7 +609,7 @@ class altq_root_queue { function build_rules(&$default = false) { if (count($this->queues) > 0 && $this->GetEnabled() == "on") { $default = false; - $rules = " altq on " . get_real_interface($this->GetInterface()); + $rules = " altq on " . get_real_interface($this->GetInterface()); if ($this->GetScheduler()) { $rules .= " ".strtolower($this->GetScheduler()); } @@ -650,7 +650,7 @@ class altq_root_queue { } $frule .= $rules; } else if ($this->GetEnabled() == "on" && $this->GetScheduler() == "CODELQ") { - $rules = " altq on " . get_real_interface($this->GetInterface()); + $rules = " altq on " . get_real_interface($this->GetInterface()); if ($this->GetScheduler()) { $rules .= " ".strtolower($this->GetScheduler()); } @@ -1126,7 +1126,7 @@ class priq_queue { $input_errors[] = "Bandwidth cannot be negative."; } if ($data['priority'] && (!is_numeric($data['priority']) || - ($data['priority'] < 1) || ($data['priority'] > 15))) { + ($data['priority'] < 1) || ($data['priority'] > 15))) { $input_errors[] = gettext("The priority must be an integer between 1 and 15."); } if ($data['qlimit'] && (!is_numeric($data['qlimit']))) { @@ -1766,7 +1766,7 @@ class hfsc_queue extends priq_queue { unref_on_altq_queue_list($this->GetQname()); cleanup_queue_from_rules($this->GetQname()); $parent =& $this->GetParent(); - foreach ($this->subqueues as $q) { + foreach ($this->subqueues as $q) { $this->SetAvailableBandwidth($this->GetAvailableBandwidth() + $q->GetAvailableBandwidth()); $q->delete_queue(); } @@ -1840,10 +1840,10 @@ class hfsc_queue extends priq_queue { */ } - if ($data['upperlimit1'] <> "" && $data['upperlimit2'] == "") { + if ($data['upperlimit1'] <> "" && $data['upperlimit2'] == "") { $input_errors[] = gettext("upperlimit service curve defined but missing (d) value"); } - if ($data['upperlimit2'] <> "" && $data['upperlimit1'] == "") { + if ($data['upperlimit2'] <> "" && $data['upperlimit1'] == "") { $input_errors[] = gettext("upperlimit service curve defined but missing initial bandwidth (m1) value"); } if ($data['upperlimit1'] <> "" && !is_valid_shaperbw($data['upperlimit1'])) { @@ -1869,10 +1869,10 @@ class hfsc_queue extends priq_queue { } } */ - if ($data['linkshare1'] <> "" && $data['linkshare2'] == "") { + if ($data['linkshare1'] <> "" && $data['linkshare2'] == "") { $input_errors[] = gettext("linkshare service curve defined but missing (d) value"); } - if ($data['linkshare2'] <> "" && $data['linkshare1'] == "") { + if ($data['linkshare2'] <> "" && $data['linkshare1'] == "") { $input_errors[] = gettext("linkshare service curve defined but missing initial bandwidth (m1) value"); } if ($data['linkshare1'] <> "" && !is_valid_shaperbw($data['linkshare1'])) { @@ -1884,10 +1884,10 @@ class hfsc_queue extends priq_queue { if ($data['linkshare3'] <> "" && !is_valid_shaperbw($data['linkshare3'])) { $input_errors[] = gettext("linkshare m2 value needs to be Kb, Mb, Gb, or %"); } - if ($data['realtime1'] <> "" && $data['realtime2'] == "") { + if ($data['realtime1'] <> "" && $data['realtime2'] == "") { $input_errors[] = gettext("realtime service curve defined but missing (d) value"); } - if ($data['realtime2'] <> "" && $data['realtime1'] == "") { + if ($data['realtime2'] <> "" && $data['realtime1'] == "") { $input_errors[] = gettext("realtime service curve defined but missing initial bandwidth (m1) value"); } @@ -1995,7 +1995,7 @@ class hfsc_queue extends priq_queue { $tree .= " >" . $this->GetQname() . ""; if (is_array($this->subqueues)) { $tree .= "
    "; - foreach ($this->subqueues as $q) { + foreach ($this->subqueues as $q) { $tree .= $q->build_tree(); } $tree .= "
"; @@ -2061,13 +2061,13 @@ class hfsc_queue extends priq_queue { $default = true; } - if ($this->GetRealtime() <> "") { + if ($this->GetRealtime() <> "") { if ($comma) { $pfq_rule .= " , "; } - if ($this->GetR_m1() <> "" && $this->GetR_d() <> "" && $this->GetR_m2() <> "") { + if ($this->GetR_m1() <> "" && $this->GetR_d() <> "" && $this->GetR_m2() <> "") { $pfq_rule .= " realtime (".$this->GetR_m1() . ", " . $this->GetR_d().", ". $this->GetR_m2() .") "; - } else if ($this->GetR_m2() <> "") { + } else if ($this->GetR_m2() <> "") { $pfq_rule .= " realtime " . $this->GetR_m2(); } $comma = 1; @@ -2641,7 +2641,7 @@ class cbq_queue extends priq_queue { $tree .= " >" . $this->GetQname() . ""; if (is_array($this->subqueues)) { $tree .= "
    "; - foreach ($this->subqueues as $q) { + foreach ($this->subqueues as $q) { $tree .= $q->build_tree(); } $tree .= "
"; @@ -2977,7 +2977,7 @@ class fairq_queue extends priq_queue { $pfq_rule .= " qlimit " . $this->GetQlimit(); } if ($this->GetDefault() || $this->GetRed() || $this->GetRio() || - $this->GetEcn() || $this->GetBuckets() || $this->GetHogs() || $this->GetCodel()) { + $this->GetEcn() || $this->GetBuckets() || $this->GetHogs() || $this->GetCodel()) { $pfq_rule .= " fairq ( "; $tmpvalue = trim($this->GetRed()); if (!empty($tmpvalue)) { @@ -3070,13 +3070,13 @@ class fairq_queue extends priq_queue { $form .= "GetBuckets()); if (!empty($tmpvalue)) { - $form .= $this->GetBuckets(); + $form .= $this->GetBuckets(); } $form .= "\" /> " . gettext("Number of buckets available.") . "
"; $form .= "GetHogs()); if (!empty($tmpvalue)) { - $form .= $this->GetHogs(); + $form .= $this->GetHogs(); } $form .= "\" /> " . gettext("Bandwidth limit for hosts to not saturate link.") . "
"; $form .= ""; @@ -3278,12 +3278,12 @@ class dummynet_class { shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors); if ($data['plr'] && (!is_numeric($data['plr']) || - ($data['plr'] < 0) || ($data['plr'] > 1))) { - $input_errors[] = gettext("Plr must be a value between 0 and 1."); + ($data['plr'] < 0) || ($data['plr'] > 1))) { + $input_errors[] = gettext("Plr must be a value between 0 and 1."); } if ($data['buckets'] && (!is_numeric($data['buckets']) || - ($data['buckets'] < 16) || ($data['buckets'] > 65535))) { - $input_errors[] = gettext("Buckets must be an integer between 16 and 65535."); + ($data['buckets'] < 16) || ($data['buckets'] > 65535))) { + $input_errors[] = gettext("Buckets must be an integer between 16 and 65535."); } if ($data['qlimit'] && (!is_numeric($data['qlimit']))) { $input_errors[] = gettext("Queue limit must be an integer"); @@ -3562,7 +3562,7 @@ class dnpipe_class extends dummynet_class { $tree .= $this->GetQname() . ""; if (is_array($this->subqueues)) { $tree .= "
    "; - foreach ($this->subqueues as $q) { + foreach ($this->subqueues as $q) { $tree .= $q->build_tree(); } $tree .= "
"; @@ -3995,7 +3995,7 @@ class dnqueue_class extends dummynet_class { parent::validate_input($data, $input_errors); if ($data['weight'] && ((!is_numeric($data['weight'])) || - ($data['weight'] < 1 && $data['weight'] > 100))) { + ($data['weight'] < 1 && $data['weight'] > 100))) { $input_errors[] = gettext("Weight must be an integer between 1 and 100."); } } @@ -4669,7 +4669,7 @@ function read_layer7_config() { continue; /* XXX: grrrrrr at php */ } $root =& new layer7(); - $root->ReadConfig($conf['name'],$conf); + $root->ReadConfig($conf['name'], $conf); $layer7_rules_list[$root->GetRName()] = &$root; } } @@ -4710,8 +4710,8 @@ function generate_layer7_files() { $rules = $l7rules->build_l7_rules(); - $fp = fopen($path,'w'); - fwrite($fp,$rules); + $fp = fopen($path, 'w'); + fwrite($fp, $rules); fclose($fp); } } @@ -4966,7 +4966,7 @@ function read_dummynet_config() { $dummynet_pipe_list = array(); if (!is_array($config['dnshaper']['queue']) || - !count($config['dnshaper']['queue'])) { + !count($config['dnshaper']['queue'])) { return; } @@ -5002,7 +5002,7 @@ function get_interface_list_to_show() { foreach ($shaperIFlist as $shif => $shDescr) { if ($altq_list_queues[$shif]) { continue; - } else { + } else { if (!is_altq_capable(get_real_interface($shif))) { continue; } diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index f5268d2..b91905c 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -743,7 +743,7 @@ function upgrade_042_to_043() { $gateways = array(); $i = 0; foreach ($iflist as $ifname => $interface) { - if (! interface_has_gateway($ifname)) { + if (!interface_has_gateway($ifname)) { continue; } $config['gateways']['gateway_item'][$i] = array(); @@ -1087,7 +1087,7 @@ function upgrade_046_to_047() { $type = $tunnel['local-subnet']['network']; } if ($tunnel['local-subnet']['address']) { - list($address,$netbits) = explode("/",$tunnel['local-subnet']['address']); + list($address, $netbits) = explode("/", $tunnel['local-subnet']['address']); if (is_null($netbits)) { $type = "address"; } else { @@ -1097,18 +1097,18 @@ function upgrade_046_to_047() { switch ($type) { case "address": - $ph2ent['localid'] = array('type' => $type,'address' => $address); + $ph2ent['localid'] = array('type' => $type, 'address' => $address); break; case "network": - $ph2ent['localid'] = array('type' => $type,'address' => $address,'netbits' => $netbits); + $ph2ent['localid'] = array('type' => $type, 'address' => $address, 'netbits' => $netbits); break; default: $ph2ent['localid'] = array('type' => $type); break; } - list($address,$netbits) = explode("/",$tunnel['remote-subnet']); - $ph2ent['remoteid'] = array('type' => 'network','address' => $address,'netbits' => $netbits); + list($address, $netbits) = explode("/", $tunnel['remote-subnet']); + $ph2ent['remoteid'] = array('type' => 'network', 'address' => $address, 'netbits' => $netbits); $ph2ent['protocol'] = $tunnel['p2']['protocol']; @@ -1407,7 +1407,7 @@ function upgrade_048_to_049() { $group['member'] = array(); foreach ($config['system']['user'] as & $user) { $groupnames = explode(",", $user['groupname']); - if (in_array($group['name'],$groupnames)) { + if (in_array($group['name'], $groupnames)) { $group['member'][] = $user['uid']; } } @@ -1429,7 +1429,7 @@ function upgrade_048_to_049() { /* insert new all group */ $groups = Array(); $groups[] = $all; - $groups = array_merge($config['system']['group'],$groups); + $groups = array_merge($config['system']['group'], $groups); $config['system']['group'] = $groups; } @@ -1682,7 +1682,7 @@ function upgrade_051_to_052() { $tmpstr = ""; foreach ($tmpcstmopts as $tmpcstmopt) { $tmpstr = str_replace(" ", "", $tmpcstmopt); - if (substr($tmpstr,0 ,6) == "devtun") { + if (substr($tmpstr, 0, 6) == "devtun") { $assigned_if = substr($tmpstr, 3); continue; } else if (substr($tmpstr, 0, 5) == "local") { @@ -1787,7 +1787,7 @@ function upgrade_051_to_052() { $tmpstr = ""; foreach ($tmpcstmopts as $tmpcstmopt) { $tmpstr = str_replace(" ", "", $tmpcstmopt); - if (substr($tmpstr,0 ,6) == "devtun") { + if (substr($tmpstr, 0, 6) == "devtun") { $assigned_if = substr($tmpstr, 3); continue; } else if (substr($tmpstr, 0, 5) == "local") { @@ -1965,7 +1965,7 @@ function upgrade_053_to_054() { $gateway_group_arr = array(); $gateways = return_gateways_array(); $group_name_changes = array(); - if (! is_array($config['gateways']['gateway_item'])) { + if (!is_array($config['gateways']['gateway_item'])) { $config['gateways']['gateway_item'] = array(); } @@ -2415,7 +2415,7 @@ function upgrade_062_to_063() { function upgrade_063_to_064() { global $config; - $j=0; + $j = 0; $ifcfg = &$config['interfaces']; if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) { @@ -2448,7 +2448,7 @@ function upgrade_063_to_064() { if (isset($ifinfo['ptpid'])) { continue; } - $ppp['ptpid'] = $j; + $ppp['ptpid'] = $j; $ppp['type'] = $ifinfo['ipaddr']; $ppp['if'] = $ifinfo['ipaddr'].$j; $ppp['ports'] = $ifinfo['if']; -- cgit v1.1 From 52b59a96afcde00f98eecfe0bb7924ec406a02ec Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sun, 30 Aug 2015 22:26:15 +0545 Subject: Update bandwidth_by_ip in bootstrap Somehow an old version of bandwidth_by_ip is still in bootstrap branch. Update it with the current version from master - there are no boostrap-specific changes for this file. --- src/usr/local/www/bandwidth_by_ip.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src') 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 @@ \ No newline at end of file +} +?> -- cgit v1.1 From 6de4dd1dd743e629f6c16c0d1deb0b1c07e92112 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sun, 30 Aug 2015 23:21:16 +0545 Subject: diag_ipsec dodgy=looking things for bootstrap Does ettext() return some extra-terrestrial language translation? :) The floating "if" at line 377 looks like it is missing its code block - I have guessed what it could be by cut/paste/change of the "if" statement above. Note that this would have fallen through to putting the "IPComp" stuff inside this "if" statement. I do not think that is what is intended? I see that we are not putting {} curlies around every code block any more - that is a shame, because this is just the sort of thing that can be prevented/noticed easily if {} are used everywhere. --- src/usr/local/www/diag_ipsec.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/usr/local/www/diag_ipsec.php b/src/usr/local/www/diag_ipsec.php index f5a83c8..cd99e51 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('
' . $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']) . '
'); if (!empty($childsa['esn'])) + print(htmlspecialchars($childsa['esn']) . '
'); print(gettext("IPComp: ") . htmlspecialchars($childsa['ipcomp'])); ?> -- cgit v1.1 From 9ebe17964c012932b03a3f91ac67a2ff3e051e43 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sun, 30 Aug 2015 23:49:13 +0545 Subject: diag_logs_filter bootstrap The tabbing of these lines makes them look like they were intended to be part of other "if" statements. Actually I do not think they were. The code logic seems OK, just the tabbing made it unclear. --- src/usr/local/www/diag_logs_filter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/usr/local/www/diag_logs_filter.php b/src/usr/local/www/diag_logs_filter.php index c8e47a2..64bcc01 100644 --- a/src/usr/local/www/diag_logs_filter.php +++ b/src/usr/local/www/diag_logs_filter.php @@ -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); ?>
@@ -420,7 +420,7 @@ if (!isset($config['syslog']['rawfilter'])) { -- cgit v1.1 From ad2879b89a96cad751dd161fe01bc78aaabacc79 Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Mon, 31 Aug 2015 01:09:10 +0200 Subject: bootstrap, use require_once for classes/Form.class.php --- src/usr/local/www/diag_authentication.php | 2 +- src/usr/local/www/diag_backup.php | 2 +- src/usr/local/www/diag_dns.php | 2 +- src/usr/local/www/diag_dump_states.php | 2 +- src/usr/local/www/diag_dump_states_sources.php | 2 +- src/usr/local/www/diag_logs.php | 2 +- src/usr/local/www/diag_logs_filter.php | 2 +- src/usr/local/www/diag_logs_settings.php | 2 +- src/usr/local/www/diag_nanobsd.php | 2 +- src/usr/local/www/diag_packet_capture.php | 2 +- src/usr/local/www/diag_patterns.php | 2 +- src/usr/local/www/diag_pf_info.php | 2 +- src/usr/local/www/diag_ping.php | 2 +- src/usr/local/www/diag_resetstate.php | 2 +- src/usr/local/www/diag_routes.php | 2 +- src/usr/local/www/diag_smart.php | 2 +- src/usr/local/www/diag_system_pftop.php | 2 +- src/usr/local/www/diag_tables.php | 2 +- src/usr/local/www/diag_testport.php | 2 +- src/usr/local/www/diag_traceroute.php | 2 +- src/usr/local/www/firewall_aliases_edit.php | 2 +- src/usr/local/www/firewall_aliases_import.php | 2 +- src/usr/local/www/firewall_nat_1to1_edit.php | 2 +- src/usr/local/www/firewall_nat_edit.php | 2 +- src/usr/local/www/firewall_nat_npt_edit.php | 2 +- src/usr/local/www/firewall_nat_out.php | 2 +- src/usr/local/www/firewall_nat_out_edit.php | 2 +- src/usr/local/www/firewall_rules_edit.php | 2 +- src/usr/local/www/firewall_schedule_edit.php | 2 +- src/usr/local/www/firewall_shaper.php | 2 +- src/usr/local/www/firewall_shaper_layer7.php | 2 +- src/usr/local/www/firewall_shaper_vinterface.php | 2 +- src/usr/local/www/interfaces.php | 2 +- src/usr/local/www/interfaces_assign.php | 2 +- src/usr/local/www/interfaces_bridge_edit.php | 2 +- src/usr/local/www/interfaces_gif_edit.php | 2 +- src/usr/local/www/interfaces_gre_edit.php | 2 +- src/usr/local/www/interfaces_groups_edit.php | 2 +- src/usr/local/www/interfaces_lagg_edit.php | 2 +- src/usr/local/www/interfaces_ppps_edit.php | 2 +- src/usr/local/www/interfaces_qinq_edit.php | 2 +- src/usr/local/www/interfaces_vlan_edit.php | 2 +- src/usr/local/www/interfaces_wireless_edit.php | 2 +- src/usr/local/www/load_balancer_monitor_edit.php | 2 +- src/usr/local/www/load_balancer_pool_edit.php | 2 +- src/usr/local/www/load_balancer_setting.php | 2 +- src/usr/local/www/pkg_mgr_settings.php | 2 +- src/usr/local/www/services_captiveportal.php | 2 +- src/usr/local/www/services_captiveportal_filemanager.php | 2 +- src/usr/local/www/services_captiveportal_hostname_edit.php | 2 +- src/usr/local/www/services_captiveportal_ip_edit.php | 2 +- src/usr/local/www/services_captiveportal_mac_edit.php | 2 +- src/usr/local/www/services_captiveportal_vouchers.php | 2 +- src/usr/local/www/services_captiveportal_vouchers_edit.php | 2 +- src/usr/local/www/services_captiveportal_zones_edit.php | 2 +- src/usr/local/www/services_dhcp_edit.php | 2 +- src/usr/local/www/services_dhcp_relay.php | 2 +- src/usr/local/www/services_dhcpv6.php | 2 +- src/usr/local/www/services_dhcpv6_edit.php | 2 +- src/usr/local/www/services_dhcpv6_relay.php | 2 +- src/usr/local/www/services_dnsmasq.php | 2 +- src/usr/local/www/services_dnsmasq_domainoverride_edit.php | 2 +- src/usr/local/www/services_dyndns_edit.php | 2 +- src/usr/local/www/services_igmpproxy_edit.php | 2 +- src/usr/local/www/services_ntpd.php | 2 +- src/usr/local/www/services_ntpd_gps.php | 2 +- src/usr/local/www/services_ntpd_pps.php | 2 +- src/usr/local/www/services_rfc2136_edit.php | 2 +- src/usr/local/www/services_snmp.php | 2 +- src/usr/local/www/services_unbound_acls.php | 2 +- src/usr/local/www/services_unbound_advanced.php | 2 +- src/usr/local/www/services_unbound_domainoverride_edit.php | 2 +- src/usr/local/www/services_wol.php | 2 +- src/usr/local/www/services_wol_edit.php | 2 +- src/usr/local/www/status_captiveportal.php | 2 +- src/usr/local/www/status_captiveportal_expire.php | 2 +- src/usr/local/www/status_captiveportal_test.php | 2 +- src/usr/local/www/status_graph.php | 2 +- src/usr/local/www/status_rrd_graph.php | 2 +- src/usr/local/www/status_rrd_graph_settings.php | 2 +- src/usr/local/www/system.php | 2 +- src/usr/local/www/system_advanced_admin.php | 2 +- src/usr/local/www/system_advanced_firewall.php | 2 +- src/usr/local/www/system_advanced_misc.php | 2 +- src/usr/local/www/system_advanced_network.php | 2 +- src/usr/local/www/system_advanced_notifications.php | 2 +- src/usr/local/www/system_advanced_sysctl.php | 2 +- src/usr/local/www/system_authservers.php | 2 +- src/usr/local/www/system_camanager.php | 2 +- src/usr/local/www/system_certmanager.php | 2 +- src/usr/local/www/system_crlmanager.php | 2 +- src/usr/local/www/system_firmware.php | 2 +- src/usr/local/www/system_firmware_settings.php | 2 +- src/usr/local/www/system_gateway_groups_edit.php | 2 +- src/usr/local/www/system_gateways_edit.php | 2 +- src/usr/local/www/system_groupmanager.php | 2 +- src/usr/local/www/system_groupmanager_addprivs.php | 2 +- src/usr/local/www/system_hasync.php | 2 +- src/usr/local/www/system_routes_edit.php | 2 +- src/usr/local/www/system_usermanager.php | 2 +- src/usr/local/www/system_usermanager_addprivs.php | 2 +- src/usr/local/www/system_usermanager_passwordmg.php | 2 +- src/usr/local/www/system_usermanager_settings.php | 2 +- src/usr/local/www/vpn_ipsec_keys_edit.php | 2 +- src/usr/local/www/vpn_ipsec_mobile.php | 2 +- src/usr/local/www/vpn_ipsec_phase1.php | 2 +- src/usr/local/www/vpn_ipsec_phase2.php | 2 +- src/usr/local/www/vpn_ipsec_settings.php | 2 +- src/usr/local/www/vpn_openvpn_client.php | 2 +- src/usr/local/www/vpn_openvpn_csc.php | 2 +- src/usr/local/www/vpn_openvpn_server.php | 2 +- src/usr/local/www/vpn_pppoe_edit.php | 2 +- 112 files changed, 112 insertions(+), 112 deletions(-) (limited to 'src') 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(''); -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 39bcc70..4451a46 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 a1267e2..4629a4c 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(''); -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 9bd63f1..368b4d1 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 04c8c03..5ad9f2c 100644 --- a/src/usr/local/www/diag_dump_states_sources.php +++ b/src/usr/local/www/diag_dump_states_sources.php @@ -126,7 +126,7 @@ events.push(function(){ addGlobal(new Form_Input( 'getactivity', diff --git a/src/usr/local/www/diag_ping.php b/src/usr/local/www/diag_ping.php index cb4bf2e..d812bc2 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 7dff11c..93f313b 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 3b8e3ab..156b2cb 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 d09a891..22592f5 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 762b83e..1da864c 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 5ff0140..c0bfa30 100644 --- a/src/usr/local/www/diag_testport.php +++ b/src/usr/local/www/diag_testport.php @@ -235,7 +235,7 @@ else { print(''); } -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 f82b963..22f6c83 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/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index 84d9d96..6d2a886 100755 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -609,7 +609,7 @@ if (empty($tab)) { if ($input_errors) print_input_errors($input_errors); -require('classes/Form.class.php'); +require_once('classes/Form.class.php'); $form = new Form; $form->addGlobal(new Form_Input( diff --git a/src/usr/local/www/firewall_aliases_import.php b/src/usr/local/www/firewall_aliases_import.php index 0199426..2d642b2 100755 --- a/src/usr/local/www/firewall_aliases_import.php +++ b/src/usr/local/www/firewall_aliases_import.php @@ -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_1to1_edit.php b/src/usr/local/www/firewall_nat_1to1_edit.php index ba92003..a8efcd9 100644 --- a/src/usr/local/www/firewall_nat_1to1_edit.php +++ b/src/usr/local/www/firewall_nat_1to1_edit.php @@ -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', diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php index 2b15c80..88c5151 100644 --- a/src/usr/local/www/firewall_nat_edit.php +++ b/src/usr/local/www/firewall_nat_edit.php @@ -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', diff --git a/src/usr/local/www/firewall_nat_npt_edit.php b/src/usr/local/www/firewall_nat_npt_edit.php index 7e385e5..5471fb2 100644 --- a/src/usr/local/www/firewall_nat_npt_edit.php +++ b/src/usr/local/www/firewall_nat_npt_edit.php @@ -215,7 +215,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/firewall_nat_out.php b/src/usr/local/www/firewall_nat_out.php index 8f3d458..ad13e9f 100644 --- a/src/usr/local/www/firewall_nat_out.php +++ b/src/usr/local/www/firewall_nat_out.php @@ -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(); diff --git a/src/usr/local/www/firewall_nat_out_edit.php b/src/usr/local/www/firewall_nat_out_edit.php index 4d85609..4ad8091 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', diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php index 8b77041..7ad681c 100644 --- a/src/usr/local/www/firewall_rules_edit.php +++ b/src/usr/local/www/firewall_rules_edit.php @@ -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'); diff --git a/src/usr/local/www/firewall_schedule_edit.php b/src/usr/local/www/firewall_schedule_edit.php index bec4029..653a428 100644 --- a/src/usr/local/www/firewall_schedule_edit.php +++ b/src/usr/local/www/firewall_schedule_edit.php @@ -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(); diff --git a/src/usr/local/www/firewall_shaper.php b/src/usr/local/www/firewall_shaper.php index 5050f9a..7bc902e 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"); diff --git a/src/usr/local/www/firewall_shaper_layer7.php b/src/usr/local/www/firewall_shaper_layer7.php index db350bd..0946bd7 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"); diff --git a/src/usr/local/www/firewall_shaper_vinterface.php b/src/usr/local/www/firewall_shaper_vinterface.php index da5ae24..11f3d59 100644 --- a/src/usr/local/www/firewall_shaper_vinterface.php +++ b/src/usr/local/www/firewall_shaper_vinterface.php @@ -67,7 +67,7 @@ ##|*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"); 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' . '
' . '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']) : ?> " . 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_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_acls.php b/src/usr/local/www/services_unbound_acls.php index 94e0b71..47cafe0 100644 --- a/src/usr/local/www/services_unbound_acls.php +++ b/src/usr/local/www/services_unbound_acls.php @@ -184,7 +184,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 2f8533c..94793eb 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_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/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)
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 4b38b49..0e6ca82 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); ?>
setAction('system_authservers.php?act=edit'); $form->addGlobal(new Form_Input( 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 f9f2702..5174826 100644 --- a/src/usr/local/www/system_certmanager.php +++ b/src/usr/local/www/system_certmanager.php @@ -644,7 +644,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 128c761..c13d401 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)) { 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(){ 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 dc84a7a..23464de 100644 --- a/src/usr/local/www/system_usermanager.php +++ b/src/usr/local/www/system_usermanager.php @@ -485,7 +485,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"); Date: Mon, 31 Aug 2015 22:19:01 +0545 Subject: Duplicated code in exec.php bootstrap I am not sure why these lines had been duplicated, so please explain if it does something that is needed. --- src/usr/local/www/exec.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/usr/local/www/exec.php b/src/usr/local/www/exec.php index a7d9cfd..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; @@ -299,4 +297,4 @@ if (!isBlank($_POST['txtCommand'])):?> include("foot.inc"); if($_POST) - conf_mount_ro(); \ No newline at end of file + conf_mount_ro(); -- cgit v1.1 From e6f34d22cf841af5ee8cfeba9f71a9729dc113d9 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Tue, 1 Sep 2015 01:08:25 +0545 Subject: bootstrap usr\local\www\f minor changes --- src/usr/local/www/firewall_aliases.php | 26 +- src/usr/local/www/firewall_aliases_edit.php | 180 +++++----- src/usr/local/www/firewall_aliases_import.php | 2 +- src/usr/local/www/firewall_nat.php | 6 +- src/usr/local/www/firewall_nat_1to1_edit.php | 38 +- src/usr/local/www/firewall_nat_edit.php | 64 ++-- src/usr/local/www/firewall_nat_npt_edit.php | 14 +- src/usr/local/www/firewall_nat_out.php | 60 ++-- src/usr/local/www/firewall_nat_out_edit.php | 32 +- src/usr/local/www/firewall_rules.php | 34 +- src/usr/local/www/firewall_rules_edit.php | 76 ++-- src/usr/local/www/firewall_schedule.php | 18 +- src/usr/local/www/firewall_schedule_edit.php | 422 +++++++++++------------ src/usr/local/www/firewall_shaper.php | 10 +- src/usr/local/www/firewall_shaper_layer7.php | 56 +-- src/usr/local/www/firewall_shaper_queues.php | 2 +- src/usr/local/www/firewall_shaper_vinterface.php | 56 +-- src/usr/local/www/firewall_shaper_wizards.php | 2 +- src/usr/local/www/firewall_virtual_ip.php | 12 +- 19 files changed, 555 insertions(+), 555 deletions(-) (limited to 'src') diff --git a/src/usr/local/www/firewall_aliases.php b/src/usr/local/www/firewall_aliases.php index c7be7d9..aeed7f1 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.") . "
" . 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); $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"] . "
"; } 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 "…
"; } echo "
\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..de47a5d 100755 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -110,8 +110,8 @@ if ($_POST) { $adrs = count($_POST['address']); -for($idx=0; $idx<$adrs; $idx++) { - if($_POST['address'][$idx] == "") +for ($idx = 0; $idx < $adrs; $idx++) { + if ($_POST['address'][$idx] == "") unset($_POST['address'][$idx]); } @@ -260,9 +260,9 @@ if ($_POST) { download_file($post_address, $temp_filename . "/aliases", $verify_ssl); /* if the item is tar gzipped then extract */ - if(stristr($post_address, ".tgz")) + if (stristr($post_address, ".tgz")) process_alias_tgz($temp_filename); - else if(stristr($post_address, ".zip")) + else if (stristr($post_address, ".zip")) process_alias_unzip($temp_filename); if (!isset($alias['aliasurl'])) { @@ -312,47 +312,75 @@ 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 != "") { + 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; - } 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, "|")); - if (!$desc_fmt_err_found) { - $input_errors[] = $vertical_bar_err_text; - $desc_fmt_err_found = true; - } - } + if ((strpos($post_address, "||") === false) && (substr($post_address, 0, 1) != "|") && (substr($post_address, -1, 1) != "|")) { + $detail_text = $post_address; } else { - $detail_text = sprintf(gettext("Entry added %s"), date('r')); + /* 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, "|")); + if (!$desc_fmt_err_found) { + $input_errors[] = $vertical_bar_err_text; + $desc_fmt_err_found = true; + } } - - $address_items = explode(" ", trim($post_address)); - 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") { - // For network type aliases, expand an IPv4 range into an array of subnets. - $rangesubnets = ip_range_to_subnet_array($startip, $endip); - foreach ($rangesubnets as $rangesubnet) { - if ($alias_address_count > $max_alias_addresses) { - break; - } - list($address_part, $subnet_part) = explode("/", $rangesubnet); - $input_addresses[] = $address_part; - $input_address_subnet[] = $subnet_part; + } else { + $detail_text = sprintf(gettext("Entry added %s"), date('r')); + } + + $address_items = explode(" ", trim($post_address)); + 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") { + // For network type aliases, expand an IPv4 range into an array of subnets. + $rangesubnets = ip_range_to_subnet_array($startip, $endip); + foreach ($rangesubnets as $rangesubnet) { + if ($alias_address_count > $max_alias_addresses) { + break; + } + list($address_part, $subnet_part) = explode("/", $rangesubnet); + $input_addresses[] = $address_part; + $input_address_subnet[] = $subnet_part; + $final_address_details[] = $detail_text; + $alias_address_count++; + } + } else { + // For host type aliases, expand an IPv4 range into a list of individual IPv4 addresses. + $rangeaddresses = ip_range_to_address_array($startip, $endip, $max_alias_addresses - $alias_address_count); + if (is_array($rangeaddresses)) { + foreach ($rangeaddresses as $rangeaddress) { + $input_addresses[] = $rangeaddress; + $input_address_subnet[] = ""; $final_address_details[] = $detail_text; $alias_address_count++; } } else { - // For host type aliases, expand an IPv4 range into a list of individual IPv4 addresses. - $rangeaddresses = ip_range_to_address_array($startip, $endip, $max_alias_addresses - $alias_address_count); - if (is_array($rangeaddresses)) { + $input_errors[] = sprintf(gettext('Range is too large to expand into individual host IP addresses (%s)'), $address_item); + $input_errors[] = sprintf(gettext('The maximum number of entries in an alias is %s'), $max_alias_addresses); + // Put the user-entered data in the output anyway, so it will be re-displayed for correction. + $input_addresses[] = $address_item; + $input_address_subnet[] = ""; + $final_address_details[] = $detail_text; + } + } + } else if ($iprange_type == 6) { + $input_errors[] = sprintf(gettext('IPv6 address ranges are not supported (%s)'), $address_item); + // Put the user-entered data in the output anyway, so it will be re-displayed for correction. + $input_addresses[] = $address_item; + $input_address_subnet[] = ""; + $final_address_details[] = $detail_text; + } else { + $subnet_type = is_subnet($address_item); + if (($_POST['type'] == "host") && $subnet_type) { + if ($subnet_type == 4) { + // For host type aliases, if the user enters an IPv4 subnet, expand it into a list of individual IPv4 addresses. + if (subnet_size($address_item) <= ($max_alias_addresses - $alias_address_count)) { + $rangeaddresses = subnetv4_expand($address_item); foreach ($rangeaddresses as $rangeaddress) { $input_addresses[] = $rangeaddress; $input_address_subnet[] = ""; @@ -360,75 +388,47 @@ if ($_POST) { $alias_address_count++; } } else { - $input_errors[] = sprintf(gettext('Range is too large to expand into individual host IP addresses (%s)'), $address_item); + $input_errors[] = sprintf(gettext('Subnet is too large to expand into individual host IP addresses (%s)'), $address_item); $input_errors[] = sprintf(gettext('The maximum number of entries in an alias is %s'), $max_alias_addresses); // Put the user-entered data in the output anyway, so it will be re-displayed for correction. $input_addresses[] = $address_item; $input_address_subnet[] = ""; $final_address_details[] = $detail_text; } + } else { + $input_errors[] = sprintf(gettext('IPv6 subnets are not supported in host aliases (%s)'), $address_item); + // Put the user-entered data in the output anyway, so it will be re-displayed for correction. + $input_addresses[] = $address_item; + $input_address_subnet[] = ""; + $final_address_details[] = $detail_text; } - } else if ($iprange_type == 6) { - $input_errors[] = sprintf(gettext('IPv6 address ranges are not supported (%s)'), $address_item); - // Put the user-entered data in the output anyway, so it will be re-displayed for correction. - $input_addresses[] = $address_item; - $input_address_subnet[] = ""; - $final_address_details[] = $detail_text; } else { - $subnet_type = is_subnet($address_item); - if (($_POST['type'] == "host") && $subnet_type) { - if ($subnet_type == 4) { - // For host type aliases, if the user enters an IPv4 subnet, expand it into a list of individual IPv4 addresses. - if (subnet_size($address_item) <= ($max_alias_addresses - $alias_address_count)) { - $rangeaddresses = subnetv4_expand($address_item); - foreach ($rangeaddresses as $rangeaddress) { - $input_addresses[] = $rangeaddress; - $input_address_subnet[] = ""; - $final_address_details[] = $detail_text; - $alias_address_count++; - } - } else { - $input_errors[] = sprintf(gettext('Subnet is too large to expand into individual host IP addresses (%s)'), $address_item); - $input_errors[] = sprintf(gettext('The maximum number of entries in an alias is %s'), $max_alias_addresses); - // Put the user-entered data in the output anyway, so it will be re-displayed for correction. - $input_addresses[] = $address_item; - $input_address_subnet[] = ""; - $final_address_details[] = $detail_text; - } + list($address_part, $subnet_part) = explode("/", $address_item); + if (!empty($subnet_part)) { + if (is_subnet($address_item)) { + $input_addresses[] = $address_part; + $input_address_subnet[] = $subnet_part; } else { - $input_errors[] = sprintf(gettext('IPv6 subnets are not supported in host aliases (%s)'), $address_item); - // Put the user-entered data in the output anyway, so it will be re-displayed for correction. + // The user typed something like "1.2.3.444/24" or "1.2.3.0/36" or similar rubbish. + // Feed it through without splitting it apart, then it will be caught by the validation loop below. $input_addresses[] = $address_item; $input_address_subnet[] = ""; - $final_address_details[] = $detail_text; } } else { - list($address_part, $subnet_part) = explode("/", $address_item); - if (!empty($subnet_part)) { - if (is_subnet($address_item)) { - $input_addresses[] = $address_part; - $input_address_subnet[] = $subnet_part; - } else { - // The user typed something like "1.2.3.444/24" or "1.2.3.0/36" or similar rubbish. - // Feed it through without splitting it apart, then it will be caught by the validation loop below. - $input_addresses[] = $address_item; - $input_address_subnet[] = ""; - } - } else { - $input_addresses[] = $address_part; - $input_address_subnet[] = $_POST["address_subnet"][$idx]; - } - - $final_address_details[] = $detail_text; - $alias_address_count++; + $input_addresses[] = $address_part; + $input_address_subnet[] = $_POST["address_subnet"][$idx]; } + + $final_address_details[] = $detail_text; + $alias_address_count++; } - if ($alias_address_count > $max_alias_addresses) { - $input_errors[] = sprintf(gettext('The maximum number of entries in an alias has been exceeded (%s)'), $max_alias_addresses); - break; - } + } + if ($alias_address_count > $max_alias_addresses) { + $input_errors[] = sprintf(gettext('The maximum number of entries in an alias has been exceeded (%s)'), $max_alias_addresses); + break; } } + } // Validate the input data expanded above. foreach ($input_addresses as $idx => $input_address) { diff --git a/src/usr/local/www/firewall_aliases_import.php b/src/usr/local/www/firewall_aliases_import.php index 0199426..cb54c29 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")); 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; ?> "> 0) { +if (count($a_nat) > 0) { ?>
diff --git a/src/usr/local/www/firewall_nat_1to1_edit.php b/src/usr/local/www/firewall_nat_1to1_edit.php index ba92003..4970ba9 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'); @@ -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 2b15c80..57f64a4 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'); @@ -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 = '' . gettext("View the filter rule") . '
'; } } @@ -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
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 $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) diff --git a/src/usr/local/www/firewall_nat_out.php b/src/usr/local/www/firewall_nat_out.php index 8f3d458..0412348 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="\'loader\' " .gettext("loading...").""; - 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) @@ -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']) + ); ?> @@ -464,9 +464,9 @@ print($form); @@ -487,9 +487,9 @@ print($form); @@ -560,7 +560,7 @@ print($form); @@ -687,7 +687,7 @@ if ($mode == "automatic" || $mode == "hybrid"): ' . + 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.' . '
' . '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.' . '
' . 'If hybrid outbound NAT is selected, mappings you specify on this page will be used, followed by the automatically generated ones.' . '
' . diff --git a/src/usr/local/www/firewall_nat_out_edit.php b/src/usr/local/www/firewall_nat_out_edit.php index 4d85609..6ecf2ac 100644 --- a/src/usr/local/www/firewall_nat_out_edit.php +++ b/src/usr/local/www/firewall_nat_out_edit.php @@ -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
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
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
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.
You can also %s monitor %s the reload progress"),"
",""); + $savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background.
You can also %s monitor %s the reload progress"), "", ""); } } @@ -268,8 +268,8 @@ display_top_tabs($tab_array); 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('
', filter_get_antilockout_ports(true)); ?> @@ -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); '; echo $filterent['icmptype']; echo ''; diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php index 8b77041..1162dea 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"); } @@ -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 = '
'. gettext('View the NAT rule') .''; } @@ -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( @@ -1211,7 +1211,7 @@ $section->addInput(new Form_Select( 'carp' => 'CARP', 'pfsync' => 'PFSYNC', ) -))->setHelp('Choose which IP protocol this rule should match. In most cases, you should specify TCP here.'); +))->setHelp('Choose which IP protocol this rule should match. In most cases, you should specify TCP here.'); $section->addInput(new Form_Select( 'icmptype', @@ -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 any. You can leave the "To" field '. + 'should usually be any). 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); } @@ -1669,7 +1669,7 @@ events.push(function(){ // Hides the
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'); @@ -1678,7 +1678,7 @@ events.push(function(){ // Hides the
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'); @@ -1686,7 +1686,7 @@ events.push(function(){ // Hides the
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'); @@ -1699,7 +1699,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(); @@ -1707,7 +1707,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(); @@ -1760,7 +1760,7 @@ events.push(function(){ disableInput('dstbeginport', true); disableInput('dstendport', true); } else { - if( editenabled ) { + if (editenabled) { disableInput('srcbeginport', false); disableInput('srcendport', false); disableInput('dstbeginport', false); @@ -1776,7 +1776,7 @@ events.push(function(){ } function typesel_change() { - if( editenabled ) { + if (editenabled) { switch ($('#srctype').find(":selected").index()) { case 1: // single disableInput('src', false); @@ -1840,11 +1840,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 @@ -1856,7 +1856,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 { @@ -1932,12 +1932,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'); @@ -1951,7 +1951,7 @@ events.push(function(){ function setOptText(target, val) { var dispstr = ''; - if(val == 'keep state') + if (val == 'keep state') dispstr += 'Keep: works with all IP protocols'; 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): "; @@ -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 .= "
"; @@ -269,7 +269,7 @@ endforeach;
- 0) ? gettext(CLOCK . ' Indicates that the scedule is currently active.'):''?> + 0) ? gettext(CLOCK . ' Indicates that the schedule is currently active.'):''?>