From 6c07db487164262f9191ad02805523bd153e0ba6 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 15 Jun 2015 14:19:11 +0545 Subject: Code spacing and other random stuff I noticed. I think this finishes messing with code style. The codebase should match the developer style guide closely enough that 99.9% of changes will not feel the need to also massage the formatting. --- etc/inc/auth.inc | 6 +-- etc/inc/captiveportal.inc | 10 ++-- etc/inc/certs.inc | 8 +-- etc/inc/config.console.inc | 5 +- etc/inc/config.lib.inc | 10 ++-- etc/inc/dyndns.class | 16 +++--- etc/inc/filter.inc | 2 +- etc/inc/filter_log.inc | 2 +- etc/inc/functions.inc | 2 +- etc/inc/gwlb.inc | 22 ++++---- etc/inc/interfaces.inc | 28 +++++----- etc/inc/ipsec.inc | 6 +-- etc/inc/led.inc | 4 +- etc/inc/meta.inc | 8 +-- etc/inc/notices.inc | 4 +- etc/inc/openvpn.inc | 24 ++++----- etc/inc/pfsense-utils.inc | 88 +++++++++++++++--------------- etc/inc/priv.inc | 4 +- etc/inc/rrd.inc | 2 +- etc/inc/services.inc | 20 +++---- etc/inc/shaper.inc | 132 ++++++++++++++++++++++----------------------- etc/inc/system.inc | 10 ++-- etc/inc/upgrade_config.inc | 4 +- etc/inc/util.inc | 14 ++--- etc/inc/voucher.inc | 12 ++--- etc/inc/vpn.inc | 13 ++--- etc/inc/vslb.inc | 12 ++--- 27 files changed, 236 insertions(+), 232 deletions(-) (limited to 'etc/inc') diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 8b9377b..594b57b 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -1214,7 +1214,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 */ @@ -1242,9 +1242,9 @@ 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))); diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 0d46fec..1d95971 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -1825,7 +1825,7 @@ function portal_hostname_from_client_ip($cliip) { $ourhostname .= ":" . $listenporthttps; } } else { - $listenporthttp = $cpcfg['listenporthttp'] ? $cpcfg['listenporthttp'] : ($cpcfg['zoneid'] + 8000); + $listenporthttp = $cpcfg['listenporthttp'] ? $cpcfg['listenporthttp'] : ($cpcfg['zoneid'] + 8000); $ifip = portal_ip_from_client_ip($cliip); if (!$ifip) { $ourhostname = "{$config['system']['hostname']}.{$config['system']['domain']}"; @@ -1930,7 +1930,7 @@ function captiveportal_reapply_attributes($cpentry, $attributes) { unset($bw_up_pipeno, $bw_down_pipeno, $bw_up, $bw_down); } -function portal_allow($clientip, $clientmac, $username, $password = null, $attributes = null, $pipeno = null, $radiusctx = null) { +function portal_allow($clientip, $clientmac, $username, $password = null, $attributes = null, $pipeno = null, $radiusctx = null) { global $redirurl, $g, $config, $type, $passthrumac, $_POST, $cpzone, $cpzoneid; // Ensure we create an array if we are missing attributes @@ -2073,9 +2073,9 @@ function portal_allow($clientip, $clientmac, $username, $password = null, $attri } } if ($username == "unauthenticated") { - $mac['descr'] = "Auto-added"; + $mac['descr'] = "Auto-added"; } else { - $mac['descr'] = "Auto-added for user {$username}"; + $mac['descr'] = "Auto-added for user {$username}"; } if (!empty($bw_up)) { $mac['bw_up'] = $bw_up; @@ -2149,7 +2149,7 @@ function portal_allow($clientip, $clientmac, $username, $password = null, $attri /* encode password in Base64 just in case it contains commas */ $bpassword = base64_encode($password); - $insertquery = "INSERT INTO captiveportal (allow_time, pipeno, ip, mac, username, sessionid, bpassword, session_timeout, idle_timeout, session_terminate_time, interim_interval, radiusctx) "; + $insertquery = "INSERT INTO captiveportal (allow_time, pipeno, ip, mac, username, sessionid, bpassword, session_timeout, idle_timeout, session_terminate_time, interim_interval, radiusctx) "; $insertquery .= "VALUES ({$allow_time}, {$pipeno}, '{$clientip}', '{$clientmac}', '{$safe_username}', '{$sessionid}', '{$bpassword}', "; $insertquery .= "{$session_timeout}, {$idle_timeout}, {$session_terminate_time}, {$interim_interval}, '{$radiusctx}')"; diff --git a/etc/inc/certs.inc b/etc/inc/certs.inc index 75f9fd9..9c99952 100644 --- a/etc/inc/certs.inc +++ b/etc/inc/certs.inc @@ -153,7 +153,7 @@ function ca_chain(& $cert) { return ""; } -function ca_import(& $ca, $str, $key="", $serial=0) { +function ca_import(& $ca, $str, $key = "", $serial = 0) { global $config; $ca['crt'] = base64_encode($str); @@ -306,7 +306,7 @@ function cert_import(& $cert, $crt_str, $key_str) { return true; } -function cert_create(& $cert, $caref, $keylen, $lifetime, $dn, $type="user", $digest_alg = "sha256") { +function cert_create(& $cert, $caref, $keylen, $lifetime, $dn, $type = "user", $digest_alg = "sha256") { $cert['type'] = $type; @@ -692,7 +692,7 @@ function cert_in_use($certref) { is_captiveportal_cert($certref)); } -function crl_create(& $crl, $caref, $name, $serial=0, $lifetime=9999) { +function crl_create(& $crl, $caref, $name, $serial = 0, $lifetime = 9999) { global $config; $ca =& lookup_ca($caref); if (!$ca) { @@ -732,7 +732,7 @@ function crl_update(& $crl) { return $crl_res; } -function cert_revoke($cert, & $crl, $reason=OCSP_REVOKED_STATUS_UNSPECIFIED) { +function cert_revoke($cert, & $crl, $reason = OCSP_REVOKED_STATUS_UNSPECIFIED) { global $config; if (is_cert_revoked($cert, $crl['refid'])) { return true; diff --git a/etc/inc/config.console.inc b/etc/inc/config.console.inc index 8640628..df3fa6f 100644 --- a/etc/inc/config.console.inc +++ b/etc/inc/config.console.inc @@ -175,7 +175,8 @@ EOD; $config['system']['enablesshd'] = 'enabled'; $key = 'y'; - } else { //Manually assign interfaces + } else { + //Manually assign interfaces if (in_array($key, array('y', 'Y'))) { vlan_setup(); } @@ -515,7 +516,7 @@ EOD; if (!is_array($iflist)) { echo gettext("No interfaces found!") . "\n"; } else { - $vlan_capable=0; + $vlan_capable = 0; foreach ($iflist as $iface => $ifa) { if (is_jumbo_capable($iface)) { echo sprintf("% -8s%s%s\n", $iface, $ifa['mac'], diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index 29c8817..5eb3d5c 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -898,9 +898,10 @@ function backup_config() { function set_device_perms() { $devices = array( - 'pf' => array( 'user' => 'root', - 'group' => 'proxy', - 'mode' => 0660), + 'pf' => array( + 'user' => 'root', + 'group' => 'proxy', + 'mode' => 0660), ); foreach ($devices as $name => $attr) { @@ -975,8 +976,7 @@ function pfSense_clear_globals() { $errorstr = "PHP ERROR: Type: {$error['type']}, File: {$error['file']}, Line: {$error['line']}, Message: {$error['message']}"; print($errorstr); log_error($errorstr); - } else - if ($error['type'] != E_NOTICE) { + } else if ($error['type'] != E_NOTICE) { $errorstr = "PHP WARNING: Type: {$error['type']}, File: {$error['file']}, Line: {$error['line']}, Message: {$error['message']}"; // XXX: comment out for now, should re-enable post-2.2 //print($errorstr); diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class index ff708fd..29b5689 100644 --- a/etc/inc/dyndns.class +++ b/etc/inc/dyndns.class @@ -595,10 +595,10 @@ /* Setting Variables */ $hostname = "{$this->_dnsHost}."; $ZoneID = $this->_dnsZoneID; - $AccessKeyId=$this->_dnsUser; - $SecretAccessKey=$this->_dnsPass; - $NewIP=$this->_dnsIP; - $NewTTL=$this->_dnsTTL; + $AccessKeyId = $this->_dnsUser; + $SecretAccessKey = $this->_dnsPass; + $NewIP = $this->_dnsIP; + $NewTTL = $this->_dnsTTL; /* Include Route 53 Library Class */ require_once('/etc/inc/r53.class'); @@ -623,10 +623,10 @@ /* Get IP for your hostname in Route 53 */ if (false !== ($a_result = SearchRecords($records['ResourceRecordSets'], "$hostname"))) { - $OldTTL=$a_result[0][TTL]; - $OldIP=$a_result[0][ResourceRecords][0]; + $OldTTL = $a_result[0][TTL]; + $OldIP = $a_result[0][ResourceRecords][0]; } else { - $OldIP=""; + $OldIP = ""; } /* Check if we need to update DNS Record */ @@ -1231,7 +1231,7 @@ $lines = count($data)-1; // loop over the lines - for ($pos=0; ($successful_update || $pos == 0) && $pos < $lines; $pos++) { + for ($pos = 0; ($successful_update || $pos == 0) && $pos < $lines; $pos++) { $resp = $data[$pos]; if (preg_match('/UAUTH/i', $resp)) { $status = "DynDNS: The username specified is not authorized to update this hostname and domain."; diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 6439585..910ea80 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -3802,7 +3802,7 @@ function filter_tdr_install_cron($should_install) { $config['cron']['item'] = array(); } - $x=0; + $x = 0; $is_installed = false; foreach ($config['cron']['item'] as $item) { if (strstr($item['command'], "filter_configure_sync")) { diff --git a/etc/inc/filter_log.inc b/etc/inc/filter_log.inc index 2276a1b..999d81a 100644 --- a/etc/inc/filter_log.inc +++ b/etc/inc/filter_log.inc @@ -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++]; diff --git a/etc/inc/functions.inc b/etc/inc/functions.inc index 0ccd845..2c8f4c8 100644 --- a/etc/inc/functions.inc +++ b/etc/inc/functions.inc @@ -81,7 +81,7 @@ if (!function_exists("get_menu_messages")) { global $g, $config; if (are_notices_pending()) { $notices = get_notices(); - $requests=array(); + $requests = array(); ## Get Query Arguments from URL ### foreach ($_REQUEST as $key => $value) { diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 724a714..0627cb3 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -267,10 +267,10 @@ EOD; $apingercfg .= " srcip \"{$gwifip}\"\n"; ## How often the probe should be sent - if (!empty($gateway['interval']) && is_numeric($gateway['interval'])) { + if (!empty($gateway['interval']) && is_numeric($gateway['interval'])) { $interval = intval($gateway['interval']); # Restrict to Integer - if ($interval < 1) { - $interval = 1; # Minimum + if ($interval < 1) { + $interval = 1; # Minimum } if ($interval != $apinger_default['interval']) { # If not default value $apingercfg .= " interval " . $interval . "s\n"; @@ -281,8 +281,8 @@ EOD; ## for controlling "delay" alarms if (!empty($gateway['avg_delay_samples']) && is_numeric($gateway['avg_delay_samples'])) { $avg_delay_samples = intval($gateway['avg_delay_samples']); # Restrict to Integer - if ($avg_delay_samples < 1) { - $avg_delay_samples = 1; # Minimum + if ($avg_delay_samples < 1) { + $avg_delay_samples = 1; # Minimum } if ($avg_delay_samples != $apinger_default['avg_delay_samples']) { # If not default value $apingercfg .= " avg_delay_samples " . $avg_delay_samples . "\n"; @@ -629,7 +629,7 @@ function return_gateways_array($disabled = false, $localhost = false, $inactive break; default: $tunnelif = substr($ifcfg['if'], 0, 3); - if (substr($ifcfg['if'], 0, 4) == "ovpn") { + if (substr($ifcfg['if'], 0, 4) == "ovpn") { // if current iface is an ovpn server endpoint then check its type, skip tap only if (substr($ifcfg['if'], 4, 1) == 's') { $ovpnid = substr($ifcfg['if'], 5); @@ -725,7 +725,7 @@ function return_gateways_array($disabled = false, $localhost = false, $inactive break; default: $tunnelif = substr($ifcfg['if'], 0, 3); - if (substr($ifcfg['if'], 0, 4) == "ovpn") { + if (substr($ifcfg['if'], 0, 4) == "ovpn") { // if current iface is an ovpn server endpoint then check its type, skip tap only if (substr($ifcfg['if'], 4, 1) == 's') { $ovpnid = substr($ifcfg['if'], 5); @@ -762,7 +762,7 @@ function return_gateways_array($disabled = false, $localhost = false, $inactive $gateway['name'] = "{$friendly}{$ctype}"; $gateway['attribute'] = "system"; - if (($gateway['dynamic'] === "default") && ($found_defaultv6 == 0)) { + if (($gateway['dynamic'] === "default") && ($found_defaultv6 == 0)) { $gateway['defaultgw'] = true; $gateway['dynamic'] = true; $found_defaultv6 = 1; @@ -992,9 +992,9 @@ function return_gateway_groups_array() { $gateway_groups_array[$group['name']]['ipprotocol'] = $gateway['ipprotocol']; if (is_ipaddr($gatewayip)) { $groupmember = array(); - $groupmember['int'] = $int; - $groupmember['gwip'] = $gatewayip; - $groupmember['weight'] = isset($gateway['weight']) ? $gateway['weight'] : 1; + $groupmember['int'] = $int; + $groupmember['gwip'] = $gatewayip; + $groupmember['weight'] = isset($gateway['weight']) ? $gateway['weight'] : 1; if (is_array($gwvip_arr[$group['name']])&& !empty($gwvip_arr[$group['name']][$member])) { $groupmember['vip'] = $gwvip_arr[$group['name']][$member]; } diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index ae44af4..a192591 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -235,7 +235,7 @@ function interface_vlan_configure(&$vlan) { return; } $if = $vlan['if']; - $vlanif = empty($vlan['vlanif']) ? "{$if}_vlan{$vlan['tag']}" : $vlan['vlanif']; + $vlanif = empty($vlan['vlanif']) ? "{$if}_vlan{$vlan['tag']}" : $vlan['vlanif']; $tag = $vlan['tag']; if (empty($if)) { @@ -2020,12 +2020,12 @@ EOD; mwexec("/bin/ps auxww|grep \"{$interface}\" |grep \"[3]gstats\" | awk '{print $2}' |xargs kill"); foreach ($ports as $port) { if (preg_match("/huawei/i", implode("\n", $usbmodemoutput))) { - $mondev = substr(basename($port), 0, -1); + $mondev = substr(basename($port), 0, -1); $devlist = glob("/dev/{$mondev}?"); $mondev = basename(end($devlist)); } if (preg_match("/zte/i", implode("\n", $usbmodemoutput))) { - $mondev = substr(basename($port), 0, -1) . "1"; + $mondev = substr(basename($port), 0, -1) . "1"; } if ($mondev != '') { log_error("Starting 3gstats.php on device '{$mondev}' for interface '{$interface}'"); @@ -2169,7 +2169,7 @@ function interface_proxyarp_configure($interface = "") { mwexec_bg("/usr/local/sbin/choparp " . $args); } } else if (count($paa) > 0) { - foreach ($paa as $paif => $paents) { + foreach ($paa as $paif => $paents) { $paaifip = get_interface_ip($paif); if (!is_ipaddr($paaifip)) { continue; @@ -3162,7 +3162,7 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven if ($wancfg['spoofmac'] && ($wancfg['spoofmac'] != $mac)) { mwexec("/sbin/ifconfig " . escapeshellarg($realhwif) . " link " . escapeshellarg($wancfg['spoofmac'])); - } else { + } else { if ($mac == "ff:ff:ff:ff:ff:ff") { /* this is not a valid mac address. generate a @@ -3963,7 +3963,7 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif) { $id_assoc_statement_address .= ";\n"; } - $id_assoc_statement_address .= "};\n"; + $id_assoc_statement_address .= "};\n"; } $id_assoc_statement_prefix = ""; @@ -4005,7 +4005,7 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif) { $id_assoc_statement_prefix .= "\n"; } - $id_assoc_statement_prefix .= "};\n"; + $id_assoc_statement_prefix .= "};\n"; } $authentication_statement = ""; @@ -4135,7 +4135,7 @@ EOD; $subnetmask = gen_subnet_mask($wancfg['alias-subnet']); $dhclientconf .= << $vip) { - if ($vip['mode'] == "carp") { + if ($vip['mode'] == "carp") { if ($interface == "{$vip['interface']}_vip{$vip['vhid']}") { return $vip['interface']; } @@ -4452,7 +4452,7 @@ function convert_friendly_interface_to_friendly_descr($interface) { } else if (substr($interface, 0, 4) == '_vip') { if (is_array($config['virtualip']['vip'])) { foreach ($config['virtualip']['vip'] as $counter => $vip) { - if ($vip['mode'] == "carp") { + if ($vip['mode'] == "carp") { if ($interface == "{$vip['interface']}_vip{$vip['vhid']}") { return "{$vip['subnet']} - {$vip['descr']}"; } @@ -5438,7 +5438,7 @@ function get_interfaces_with_gateway() { $ints[$ifdescr] = $ifdescr; break; default: - if (substr($ifname['if'], 0, 4) == "ovpn" || + if (substr($ifname['if'], 0, 4) == "ovpn" || !empty($ifname['gateway'])) { $ints[$ifdescr] = $ifdescr; } @@ -5463,7 +5463,7 @@ function interface_has_gateway($friendly) { return true; break; default: - if (substr($ifname['if'], 0, 4) == "ovpn") { + if (substr($ifname['if'], 0, 4) == "ovpn") { return true; } $tunnelif = substr($ifname['if'], 0, 3); @@ -5494,7 +5494,7 @@ function interface_has_gatewayv6($friendly) { return true; break; default: - if (substr($ifname['if'], 0, 4) == "ovpn") { + if (substr($ifname['if'], 0, 4) == "ovpn") { return true; } $tunnelif = substr($ifname['if'], 0, 3); @@ -5671,7 +5671,7 @@ function get_interface_mac($interface) { ******/ function generate_random_mac_address() { $mac = "02"; - for ($x=0; $x<5; $x++) { + for ($x = 0; $x < 5; $x++) { $mac .= ":" . dechex(rand(16, 255)); } return $mac; diff --git a/etc/inc/ipsec.inc b/etc/inc/ipsec.inc index d8fa843..5c7d15d 100644 --- a/etc/inc/ipsec.inc +++ b/etc/inc/ipsec.inc @@ -220,7 +220,7 @@ function ipsec_get_phase1_src(& $ph1ent) { $interfaceip = get_interface_ip($if); } } else { - $interfaceip=$ph1ent['interface']; + $interfaceip = $ph1ent['interface']; } } else { $if = "wan"; @@ -511,7 +511,7 @@ function ipsec_dump_spd() { $upperspec = explode("/", $linea[0]); $cursp['proto'] = $upperspec[0]; list($cursp['src'], $cursp['dst']) = explode("-", $upperspec[2]); - $cursp['reqid'] = substr($upperspec[3], strpos($upperspec[3], "#")+1); + $cursp['reqid'] = substr($upperspec[3], strpos($upperspec[3], "#")+1); break; } } @@ -619,7 +619,7 @@ function ipsec_get_number_of_phase2($ikeid) { global $config; $a_phase2 = $config['ipsec']['phase2']; - $nbph2=0; + $nbph2 = 0; if (is_array($a_phase2) && count($a_phase2)) { foreach ($a_phase2 as $ph2tmp) { diff --git a/etc/inc/led.inc b/etc/inc/led.inc index 1661950..a08eef4 100644 --- a/etc/inc/led.inc +++ b/etc/inc/led.inc @@ -29,7 +29,7 @@ function led_ctl($led, $str) { /* * Blink an LED at set speed from 1-9 (1=Very Fast, 9=Very Slow) */ -function led_blink($led, $speed=0) { +function led_blink($led, $speed = 0) { switch ($speed) { case "reallyfast": case "veryfast": @@ -60,7 +60,7 @@ function led_blink($led, $speed=0) { * Letters A-J are on from 1/10s to 1s * Letters a-j are off from 1/10s to 1s */ -function led_pattern($led, $pattern, $repeat=true) { +function led_pattern($led, $pattern, $repeat = true) { /* End with a . to stop after one iteration. */ $end = $repeat ? "" : "."; return led_ctl($led, "s{$pattern}{$end}"); diff --git a/etc/inc/meta.inc b/etc/inc/meta.inc index 520e622..ac8bdfc 100644 --- a/etc/inc/meta.inc +++ b/etc/inc/meta.inc @@ -95,9 +95,9 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { } $fname = $fpath; - $slash = strrpos($fname,"/"); + $slash = strrpos($fname, "/"); if ($slash) { - $fname = substr($fname,$slash + 1); + $fname = substr($fname, $slash + 1); } $fdata = @file_get_contents($fpath); @@ -157,14 +157,14 @@ function read_file_metadata($fpath, & $metadata, $taglist = false) { $offset = $tagend_trm + 1; if (is_array($taglist)) { - if (!in_array($tagbeg,$taglist)) { + if (!in_array($tagbeg, $taglist)) { continue; } } $vals = array(); - $lines = explode("\n",$mdata); + $lines = explode("\n", $mdata); foreach ($lines as $line) { if (!strlen($line)) { diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc index 1ea30c8..891c18b 100644 --- a/etc/inc/notices.inc +++ b/etc/inc/notices.inc @@ -346,7 +346,7 @@ function send_smtp_message($message, $subject = "(no subject)", $force = false) $smtp->tls = (isset($config['notifications']['smtp']['tls'])) ? 1 : 0; $smtp->debug = 0; $smtp->html_debug = 0; - $smtp->localhost=$config['system']['hostname'].".".$config['system']['domain']; + $smtp->localhost = $config['system']['hostname'] . "." . $config['system']['domain']; if ($config['notifications']['smtp']['fromaddress']) { $from = $config['notifications']['smtp']['fromaddress']; @@ -410,7 +410,7 @@ function notify_via_growl($message, $force=false) { $growl_name = $config['notifications']['growl']['name']; $growl_notification = $config['notifications']['growl']['notification_name']; - if(!empty($growl_ip) && (is_ipaddr($growl_ip) || dns_get_record($growl_ip, DNS_A) || dns_get_record($growl_ip, DNS_AAAA))) { + if (!empty($growl_ip) && (is_ipaddr($growl_ip) || dns_get_record($growl_ip, DNS_A) || dns_get_record($growl_ip, DNS_AAAA))) { $growl = new Growl($growl_ip, $growl_password, $growl_name); $growl->notify("{$growl_notification}", gettext(sprintf("%s (%s) - Notification", $g['product_name'], $hostname)), "{$message}"); } diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index fba87da..6e81c03 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -526,14 +526,14 @@ 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); } } if (is_ipaddrv6($ipaddr)) { - $iface_ipv6=$ipaddr; + $iface_ipv6 = $ipaddr; } else { if ((!empty($interface)) && (strcmp($interface, "any"))) { $iface_ipv6=get_interface_ipv6($interface); @@ -1326,7 +1326,7 @@ function openvpn_get_active_clients() { $client['vpnid'] = $settings['vpnid']; $client['mgmt'] = "client{$client['vpnid']}"; $socket = "unix://{$g['varetc_path']}/openvpn/{$client['mgmt']}.sock"; - $client['status']="down"; + $client['status'] = "down"; $clients[] = openvpn_get_client_status($client, $socket); } @@ -1355,28 +1355,28 @@ function openvpn_get_client_status($client, $socket) { /* Get the client state */ if (strstr($line, "CONNECTED")) { - $client['status']="up"; + $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"; + $client['status'] = "connecting"; } if (strstr($line, "ASSIGN_IP")) { - $client['status']="waiting"; + $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"; + $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 */ diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 9986f52..a4ef718 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -98,7 +98,7 @@ 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", @@ -498,7 +498,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])); } @@ -515,7 +515,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))); } @@ -981,7 +981,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"; @@ -1260,7 +1260,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; @@ -1288,7 +1288,7 @@ 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; + $sec = 0; foreach ($uptime_data as $upt) { $sec += substr($upt, 1 + strpos($upt, " ")); } @@ -1770,10 +1770,11 @@ function download_file($url, $destination, $verify_ssl = true, $connect_timeout curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - if (!isset($config['system']['host_uuid'])) + if (!isset($config['system']['host_uuid'])) { curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version") . ' : ' . get_single_sysctl('kern.hostuuid'))); - else + } else { curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version"))); + } if (!empty($config['system']['proxyurl'])) { curl_setopt($ch, CURLOPT_PROXY, $config['system']['proxyurl']); @@ -1793,10 +1794,10 @@ function download_file($url, $destination, $verify_ssl = true, $connect_timeout return ($http_code == 200) ? true : $http_code; } -function download_file_with_progress_bar($url_file, $destination_file, $readbody = 'read_body', $connect_timeout = 5, $timeout=0) { +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 */ @@ -1815,10 +1816,11 @@ function download_file_with_progress_bar($url_file, $destination_file, $readbody curl_setopt($ch, CURLOPT_NOPROGRESS, '1'); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $connect_timeout); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); - if (!isset($config['system']['host_uuid'])) + if (!isset($config['system']['host_uuid'])) { curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version") . ' : ' . get_single_sysctl('kern.hostuuid'))); - else + } else { curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version"))); + } if (!empty($config['system']['proxyurl'])) { curl_setopt($ch, CURLOPT_PROXY, $config['system']['proxyurl']); @@ -2354,21 +2356,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}"); @@ -2442,23 +2444,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) { @@ -2657,7 +2659,7 @@ 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); @@ -2697,7 +2699,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; @@ -2819,7 +2821,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) { diff --git a/etc/inc/priv.inc b/etc/inc/priv.inc index 45dcc3b..7549844 100644 --- a/etc/inc/priv.inc +++ b/etc/inc/priv.inc @@ -133,7 +133,7 @@ function cmp_page_matches($page, & $matches, $fullwc = true) { } /* compare exact or wildcard match */ - $match = str_replace(array(".", "*", "?"), array("\.", ".*", "\?"), $match); + $match = str_replace(array(".", "*", "?"), array("\.", ".*", "\?"), $match); $result = preg_match("@^/{$match}$@", "/{$page}"); if ($result) { @@ -328,7 +328,7 @@ function sort_user_privs($privs) { $priority_privs = array("page-dashboard-all", "page-system-login/logout"); $fprivs = array_intersect($privs, $priority_privs); - $sprivs = array_diff($privs, $priority_privs); + $sprivs = array_diff($privs, $priority_privs); return array_merge($fprivs, $sprivs); } diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index d0f14ec..b15f8eb 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -485,7 +485,7 @@ function enable_rrd_graphing() { break; } $qbandwidth = $altq->GetBandwidth() * $factor; - if ($qbandwidth <=0) { + if ($qbandwidth <= 0) { $qbandwidth = 100 * 1000 * 1000; /* 100Mbit */ } $qlist =& $altq->get_queue_list($notused); diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 8ea9f9d..c0a2b34 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -410,7 +410,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"); } @@ -600,7 +600,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"; } @@ -1622,7 +1622,7 @@ function services_dhcrelay_configure() { if (!is_ipaddr($subnet)) { continue; } - $subnet .= "/" . get_interface_subnet($ifname); + $subnet .= "/" . get_interface_subnet($ifname); if (ip_in_subnet($srvip, $subnet)) { $destif = get_real_interface($ifname); break; @@ -1688,10 +1688,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); @@ -1755,7 +1755,7 @@ function services_dhcrelay6_configure() { if (!is_ipaddrv6($subnet)) { continue; } - $subnet .= "/" . get_interface_subnetv6($ifname); + $subnet .= "/" . get_interface_subnetv6($ifname); if (ip_in_subnet($srvip, $subnet)) { $destif = get_real_interface($ifname); break; @@ -1848,8 +1848,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']}", @@ -2621,7 +2621,7 @@ 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; @@ -2634,7 +2634,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; diff --git a/etc/inc/shaper.inc b/etc/inc/shaper.inc index 416f920..9f2f4b6 100644 --- a/etc/inc/shaper.inc +++ b/etc/inc/shaper.inc @@ -525,7 +525,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") { @@ -545,7 +545,7 @@ class altq_root_queue { $tree .= "\">" . $shaperIFlist[$this->GetInterface()] . ""; if (is_array($this->queues)) { $tree .= ""; @@ -707,7 +707,7 @@ class altq_root_queue { $form .= "
"; $form .= " GetEnabled() == "on") { - $form .= " checked=\"checked\""; + $form .= " checked=\"checked\""; } $form .= " /> " . gettext("Enable/disable discipline and its children") . ""; $form .= ""; @@ -790,8 +790,8 @@ class altq_root_queue { $form .= "\" />"; $form .= "
"; $form .= gettext("Adjusts the size, in bytes, of the token bucket regulator. " - . "If not specified, heuristics based on the interface " - . "bandwidth are used to determine the size."); + . "If not specified, heuristics based on the interface " + . "bandwidth are used to determine the size."); $form .= ""; $form .= "GetInterface() . "\" />"; @@ -1278,7 +1278,7 @@ class priq_queue { $form .= "
"; $form .= " GetEnabled() == "on") { - $form .= " checked=\"checked\""; + $form .= " checked=\"checked\""; } $form .= " /> " . gettext("Enable/Disable queue and its children") . ""; $form .= ""; @@ -1322,25 +1322,25 @@ class priq_queue { $form .= "GetRed(); if (!empty($tmpvalue)) { - $form .= " checked=\"checked\""; + $form .= " checked=\"checked\""; } $form .= " /> " . gettext("Random Early Detection") . "
"; $form .= "GetRio(); if (!empty($tmpvalue)) { - $form .= " checked=\"checked\""; + $form .= " checked=\"checked\""; } $form .= " /> " . gettext("Random Early Detection In and Out") . "
"; $form .= "GetEcn(); if (!empty($tmpvalue)) { - $form .= " checked=\"checked\""; + $form .= " checked=\"checked\""; } $form .= " /> " . gettext("Explicit Congestion Notification") . "
"; $form .= "GetCodel(); if (!empty($tmpvalue)) { - $form .= " checked=\"checked\""; + $form .= " checked=\"checked\""; } $form .= " /> " . gettext("Codel Active Queue") . "
"; $form .= "
" . gettext("Select options for this queue"); @@ -1698,7 +1698,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(); } @@ -1772,10 +1772,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'])) { @@ -1801,10 +1801,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'])) { @@ -1816,10 +1816,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"); } @@ -1927,7 +1927,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 .= "
"; @@ -1993,13 +1993,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; @@ -2136,7 +2136,7 @@ class hfsc_queue extends priq_queue { $form .= " 
m1
d
m2
"; $form .= "GetUpperlimit()<> "") { - $form .= " checked=\"checked\" "; + $form .= " checked=\"checked\" "; } $form .= "onchange=\"enable_upperlimit()\" /> " . gettext("Upperlimit:") . "GetU_m1()); @@ -2159,7 +2159,7 @@ class hfsc_queue extends priq_queue { $form .= " />" . gettext("The maximum allowed bandwidth for the queue.") . ""; $form .= "GetRealtime() <> "") { - $form .= " checked=\"checked\" "; + $form .= " checked=\"checked\" "; } $form .= "onchange=\"enable_realtime()\" /> " . gettext("Real time:") . "GetR_m1()); @@ -2182,7 +2182,7 @@ class hfsc_queue extends priq_queue { $form .= " />" . gettext("The minimum required bandwidth for the queue.") . ""; $form .= "GetLinkshare() <> "") { - $form .= " checked=\"checked\" "; + $form .= " checked=\"checked\" "; } $form .= "onchange=\"enable_linkshare()\" /> " . gettext("Link share:") . "GetL_m1()); @@ -2205,9 +2205,9 @@ class hfsc_queue extends priq_queue { $form .= " />" . gettext("The bandwidth share of a backlogged queue - this overrides priority.") . ""; $form .= "
"; $form .= gettext("The format for service curve specifications is (m1, d, m2). m2 controls " - . "the bandwidth assigned to the queue. m1 and d are optional and can be " - . "used to control the initial bandwidth assignment. For the first d milliseconds the queue gets the bandwidth given as m1, afterwards the value " - . "given in m2."); + . "the bandwidth assigned to the queue. m1 and d are optional and can be " + . "used to control the initial bandwidth assignment. For the first d milliseconds the queue gets the bandwidth given as m1, afterwards the value " + . "given in m2."); $form .= ""; $form .= ""; @@ -2543,7 +2543,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 .= "
"; @@ -2677,7 +2677,7 @@ class cbq_queue extends priq_queue { $form .= "" . gettext("Scheduler specific options") . ""; $form .= "GetBorrow() == "on") { - $form .= " checked=\"checked\" "; + $form .= " checked=\"checked\" "; } $form .= " /> " . gettext("Borrow from other queues when available") . "
"; @@ -2989,13 +2989,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 .= ""; @@ -3481,7 +3481,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 .= "
"; @@ -3655,7 +3655,7 @@ EOD; $form .= ""; $form .= " GetEnabled() == "on") { - $form .= " checked=\"checked\""; + $form .= " checked=\"checked\""; } $form .= " /> " . gettext("Enable limiter and its children") . ""; $form .= ""; @@ -3740,10 +3740,10 @@ EOD; $form .= ""; $form .= " 
"; $form .= "" . gettext("If 'source' or 'destination' slots is chosen, \n" - . "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n" - . "be created for each source/destination IP address encountered, \n" - . "respectively. This makes it possible to easily specify bandwidth \n" - . "limits per host.") . "
"; + . "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n" + . "be created for each source/destination IP address encountered, \n" + . "respectively. This makes it possible to easily specify bandwidth \n" + . "limits per host.") . "

"; $form .= "255.255.255.255/  "none") { $form .= $mask['bits']; @@ -3765,9 +3765,9 @@ EOD; $form .= " />"; $form .= "  IPV6 mask bits (1-128)
"; $form .= "" . gettext("If 'source' or 'destination' slots is chosen, \n" - . "leaving the mask bits blank will create one pipe per host. Otherwise specify \n" - . "the number of 'one' bits in the subnet mask used to group multiple hosts \n" - . "per pipe.") . ""; + . "leaving the mask bits blank will create one pipe per host. Otherwise specify \n" + . "the number of 'one' bits in the subnet mask used to group multiple hosts \n" + . "per pipe.") . ""; $form .= ""; $form .= "" . gettext("Description") . ""; $form .= ""; @@ -3790,7 +3790,7 @@ EOD; $form .= "GetDelay() . "\" />"; $form .= " ms
" . gettext("Hint: in most cases, you " - . "should specify 0 here (or leave the field empty)") . "
"; + . "should specify 0 here (or leave the field empty)") . "
"; $form .= ""; $form .= ""; $form .= "" . gettext("Packet loss rate") . ""; @@ -3798,8 +3798,8 @@ EOD; $form .= "GetPlr() . "\" />"; $form .= " 
" . gettext("Hint: in most cases, you " - . "should specify 0 here (or leave the field empty). " - . "A value of 0.001 means one packet in 1000 gets dropped") . ""; + . "should specify 0 here (or leave the field empty). " + . "A value of 0.001 means one packet in 1000 gets dropped") . ""; $form .= ""; $form .= ""; $form .= "" . gettext("Queue Size") . ""; @@ -3808,9 +3808,9 @@ EOD; $form .= $this->GetQlimit() . "\" />"; $form .= " slots
"; $form .= "" . gettext("Hint: in most cases, you " - . "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, " - . "then they are delayed by value specified in the Delay field, and then they " - . "are delivered to their destination.") . ""; + . "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, " + . "then they are delayed by value specified in the Delay field, and then they " + . "are delivered to their destination.") . ""; $form .= ""; $form .= ""; $form .= "" . gettext("Bucket Size") . ""; @@ -3819,7 +3819,7 @@ EOD; $form .= $this->GetBuckets() . "\" />"; $form .= " slots
"; $form .= "" . gettext("Hint: in most cases, you " - . "should leave the field empty. It increases the hash size set."); + . "should leave the field empty. It increases the hash size set."); $form .= ""; return $form; @@ -4011,7 +4011,7 @@ class dnqueue_class extends dummynet_class { $form .= ""; $form .= " GetEnabled() == "on") { - $form .= " checked=\"checked\""; + $form .= " checked=\"checked\""; } $form .= " /> " . gettext("Enable/Disable queue") . ""; $form .= ""; @@ -4048,10 +4048,10 @@ class dnqueue_class extends dummynet_class { $form .= ""; $form .= " slots
"; $form .= "" . gettext("If 'source' or 'destination' slots is chosen, \n" - . "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n" - . "be created for each source/destination IP address encountered, \n" - . "respectively. This makes it possible to easily specify bandwidth \n" - . "limits per host.") . "
"; + . "a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will \n" + . "be created for each source/destination IP address encountered, \n" + . "respectively. This makes it possible to easily specify bandwidth \n" + . "limits per host.") . "
"; $form .= "255.255.255.255/  "none") { $form .= $mask['bits']; @@ -4073,9 +4073,9 @@ class dnqueue_class extends dummynet_class { $form .= " />"; $form .= "  IPV6 mask bits (1-128)
"; $form .= "" . gettext("If 'source' or 'destination' slots is chosen, \n" - . "leaving the mask bits blank will create one pipe per host. Otherwise specify \n" - . "the number of 'one' bits in the subnet mask used to group multiple hosts \n" - . "per queue.") . ""; + . "leaving the mask bits blank will create one pipe per host. Otherwise specify \n" + . "the number of 'one' bits in the subnet mask used to group multiple hosts \n" + . "per queue.") . ""; $form .= ""; $form .= "" . gettext("Description") . ""; $form .= ""; @@ -4097,7 +4097,7 @@ class dnqueue_class extends dummynet_class { $form .= "GetWeight() . "\" />"; $form .= " 
" . gettext("Hint: For queues under the same parent " - . "this specifies the share that a queue gets(values range from 1 to 100, you can leave it blank otherwise)") . ""; + . "this specifies the share that a queue gets(values range from 1 to 100, you can leave it blank otherwise)") . ""; $form .= ""; $form .= ""; $form .= "" . gettext("Packet loss rate") . ""; @@ -4105,8 +4105,8 @@ class dnqueue_class extends dummynet_class { $form .= "GetPlr() . "\" />"; $form .= " 
" . gettext("Hint: in most cases, you " - . "should specify 0 here (or leave the field empty). " - . "A value of 0.001 means one packet in 1000 gets dropped") . ""; + . "should specify 0 here (or leave the field empty). " + . "A value of 0.001 means one packet in 1000 gets dropped") . ""; $form .= ""; $form .= ""; $form .= "" . gettext("Queue Size") . ""; @@ -4115,9 +4115,9 @@ class dnqueue_class extends dummynet_class { $form .= $this->GetQlimit() . "\" />"; $form .= " slots
"; $form .= "" . gettext("Hint: in most cases, you " - . "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, " - . "then they are delayed by value specified in the Delay field, and then they " - . "are delivered to their destination.") . ""; + . "should leave the field empty. All packets in this pipe are placed into a fixed-size queue first, " + . "then they are delayed by value specified in the Delay field, and then they " + . "are delivered to their destination.") . ""; $form .= ""; $form .= ""; $form .= "" . gettext("Bucket Size") . ""; @@ -4126,7 +4126,7 @@ class dnqueue_class extends dummynet_class { $form .= $this->GetBuckets() . "\" />"; $form .= " " . gettext("slots") . "
"; $form .= "" . gettext("Hint: in most cases, you " - . "should leave the field empty. It increases the hash size set."); + . "should leave the field empty. It increases the hash size set."); $form .= ""; $form .= ""; $form .= " GetREnabled() == "on") { - $form .= "checked=\"checked\""; + $form .= "checked=\"checked\""; } $form .= " /> " . gettext("Enable/Disable layer7 Container") . ""; $form .= ""; @@ -4816,7 +4816,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; } @@ -4952,14 +4952,14 @@ function build_iface_without_this_queue($iface, $qname) { } -$default_shaper_msg = ""; +$default_shaper_msg = ""; $default_shaper_msg .= "" . sprintf(gettext("Welcome to the %s Traffic Shaper."), $g['product_name']) . "
"; $default_shaper_msg .= gettext("The tree on the left helps you navigate through the queues
" . "buttons at the bottom represent queue actions and are activated accordingly."); $default_shaper_msg .= "
"; $default_shaper_msg .= ""; -$dn_default_shaper_msg = ""; +$dn_default_shaper_msg = ""; $dn_default_shaper_msg .= "" . sprintf(gettext("Welcome to the %s Traffic Shaper."), $g['product_name']) . "
"; $dn_default_shaper_msg .= gettext("The tree on the left helps you navigate through the queues
" . "buttons at the bottom represent queue actions and are activated accordingly."); diff --git a/etc/inc/system.inc b/etc/inc/system.inc index cefc177..7909451 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -331,7 +331,7 @@ function system_hosts_generate() { $dnsmasqcfg = $config['dnsmasq']; } - $hosts = "127.0.0.1 localhost localhost.{$syscfg['domain']}\n"; + $hosts = "127.0.0.1 localhost localhost.{$syscfg['domain']}\n"; $hosts .= "::1 localhost localhost.{$syscfg['domain']}\n"; $lhosts = ""; $dhosts = ""; @@ -782,7 +782,7 @@ function system_syslogd_get_remote_servers($syslogcfg, $facility = "*.*") { // Rather than repeatedly use the same code, use this function to build a list of remote servers. $facility .= " ". $remote_servers = ""; - $pad_to = 56; + $pad_to = 56; $padding = ceil(($pad_to - strlen($facility))/8)+1; if ($syslogcfg['remoteserver']) { $remote_servers .= "{$facility}" . str_repeat("\t", $padding) . "@" . system_syslogd_fixup_server($syslogcfg['remoteserver']) . "\n"; @@ -1106,7 +1106,7 @@ function system_webgui_start() { if (!$config['system']['webgui']['port']) { $portarg = "443"; } - $ca = ca_chain($cert); + $ca = ca_chain($cert); } /* generate lighttpd configuration */ @@ -1157,7 +1157,7 @@ function system_generate_lighty_config($filename, echo "system_generate_lighty_config() being called $mt\n"; } - if ($captive_portal !== false) { + if ($captive_portal !== false) { $captiveportal = ",\"mod_rewrite\",\"mod_evasive\""; $captive_portal_rewrite = "url.rewrite-once = ( \"(.*captiveportal.*)\" => \"$1\", \"(.*)\" => \"/index.php?zone={$captive_portal}&redirurl=$1\" )\n"; @@ -1199,7 +1199,7 @@ function system_generate_lighty_config($filename, } // Ramp up captive portal max procs, assuming each PHP process can consume up to 64MB RAM - if ($captive_portal !== false) { + if ($captive_portal !== false) { if ($realmem > 135 and $realmem < 256) { $max_procs += 1; // 2 worker processes } else if ($realmem > 255 and $realmem < 513) { diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index c66eb3f..c3ce9e5 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -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']; diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 2cbfce4..169f784 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -762,7 +762,7 @@ function subnet_expand($subnet) { function subnetv4_expand($subnet) { $result = array(); list ($ip, $bits) = explode("/", $subnet); - $net = ip2long($ip); + $net = ip2long($ip); $mask = (0xffffffff << (32 - $bits)); $net &= $mask; $size = round(exp(log(2) * (32 - $bits))); @@ -1064,7 +1064,7 @@ function get_configured_carp_interface_list($carpinterface = '', $family = 'inet function get_configured_ip_aliases_list($returnfullentry = false) { global $config; - $alias_list=array(); + $alias_list = array(); if (is_array($config['virtualip']['vip'])) { $viparr = &$config['virtualip']['vip']; @@ -1086,7 +1086,7 @@ function get_configured_ip_aliases_list($returnfullentry = false) { function get_configured_vips_list() { global $config; - $alias_list=array(); + $alias_list = array(); if (is_array($config['virtualip']['vip'])) { $viparr = &$config['virtualip']['vip']; @@ -1708,7 +1708,7 @@ function run_plugins($directory) { * safe_mkdir($path, $mode = 0755) * create directory if it doesn't already exist and isn't a file! */ -function safe_mkdir($path, $mode=0755) { +function safe_mkdir($path, $mode = 0755) { global $g; if (!is_file($path) && !is_dir($path)) { @@ -1951,7 +1951,7 @@ function isAjax() { function timeout($timer = 9) { while (!isset($key)) { if ($timer >= 9) { - echo chr(8) . chr(8) . ($timer == 9 ? chr(32) : null) . "{$timer}"; + echo chr(8) . chr(8) . ($timer == 9 ? chr(32) : null) . "{$timer}"; } else { echo chr(8). "{$timer}"; } @@ -1977,11 +1977,11 @@ function timeout($timer = 9) { * RESULT * returns newly sorted array ******/ -function msort($array, $id="id", $sort_ascending=true) { +function msort($array, $id = "id", $sort_ascending = true) { $temp_array = array(); while (count($array)>0) { $lowest_id = 0; - $index=0; + $index = 0; foreach ($array as $item) { if (isset($item[$id])) { if ($array[$lowest_id][$id]) { diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 54df10b..bf18fcb 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -56,7 +56,7 @@ function xmlrpc_sync_voucher_expire($vouchers, $syncip, $port, $password, $usern /* Construct code that is run on remote machine */ $method = 'pfsense.exec_php'; - $execcmd = <<value()); + $toreturn = XML_RPC_Decode($resp->value()); return $toreturn; } @@ -114,7 +114,7 @@ function xmlrpc_sync_voucher_disconnect($dbent, $syncip, $port, $password, $user $dbent_str = serialize($dbent); $tmp_stop_time = (isset($stop_time)) ? $stop_time : "null"; $method = 'pfsense.exec_php'; - $execcmd = <<value()); + $toreturn = XML_RPC_Decode($resp->value()); return $toreturn; } @@ -172,7 +172,7 @@ function xmlrpc_sync_used_voucher($voucher_received, $syncip, $port, $password, /* Construct code that is run on remote machine */ $method = 'pfsense.exec_php'; - $execcmd = <<value()); + $toreturn = XML_RPC_Decode($resp->value()); if (!is_array($config['voucher'])) { $config['voucher'] = array(); } diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 437f148..0430ce3 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -154,8 +154,9 @@ function vpn_ipsec_configure($restart = false) { mwexec("/sbin/ifconfig enc0 up"); set_single_sysctl("net.inet.ip.ipsec_in_use", "1"); - if (php_uname('m') != "amd64") + if (php_uname('m') != "amd64") { set_single_sysctl("net.inet.ipsec.directdispatch", "0"); + } /* needed for config files */ if (!is_dir("{$g['varetc_path']}/ipsec")) { @@ -683,7 +684,7 @@ EOD; /* begin ipsec.conf */ $ipsecconf = ""; $enablecompression = false; - if (is_array($a_phase1) && count($a_phase1)) { + if (is_array($a_phase1) && count($a_phase1)) { $ipsecconf .= "# This file is automatically generated. Do not edit\n"; $ipsecconf .= "config setup\n\tuniqueids = {$uniqueids}\n"; @@ -1005,7 +1006,7 @@ EOD; continue; } if (!empty($ph2ent['natlocalid'])) { - $natleftsubnet_data = ipsec_idinfo_to_cidr($ph2ent['natlocalid'], false, $ph2ent['mode']); + $natleftsubnet_data = ipsec_idinfo_to_cidr($ph2ent['natlocalid'], false, $ph2ent['mode']); if ($ph2ent['natlocalid']['type'] != "address") { if (is_subnet($natleftsubnet_data)) { $leftsubnet_data = "{$natleftsubnet_data}|{$leftsubnet_data}"; @@ -1063,7 +1064,7 @@ EOD; /* XXX: in some cases where include ordering is suspect these variables * are somehow 0 and we enter this loop forever and timeout after 900 * seconds wrecking bootup */ - if ($key_hi != 0 and $key_lo !=0 and $key_step !=0) { + if ($key_hi != 0 and $key_lo != 0 and $key_step != 0) { for ($keylen = $key_hi; $keylen >= $key_lo; $keylen -= $key_step) { if (!empty($ph2ent['hash-algorithm-option']) && is_array($ph2ent['hash-algorithm-option'])) { foreach ($ph2ent['hash-algorithm-option'] as $halgo) { @@ -1449,8 +1450,8 @@ EOD; EOD; } - if (isset($pptpdcfg["wins"]) && $pptpdcfg['wins'] != "") { - $mpdconf .= " set ipcp nbns {$pptpdcfg['wins']}\n"; + if (isset($pptpdcfg["wins"]) && $pptpdcfg['wins'] != "") { + $mpdconf .= " set ipcp nbns {$pptpdcfg['wins']}\n"; } if (!empty($pptpdcfg['dns1'])) { diff --git a/etc/inc/vslb.inc b/etc/inc/vslb.inc index 74b978f..b163e15 100644 --- a/etc/inc/vslb.inc +++ b/etc/inc/vslb.inc @@ -124,12 +124,12 @@ function echo_lbaction($action) { // Index actions by name $actions_a = array(); - for ($i=0; isset($config['load_balancer']['lbaction'][$i]); $i++) { + for ($i = 0; isset($config['load_balancer']['lbaction'][$i]); $i++) { $actions_a[$config['load_balancer']['lbaction'][$i]['name']] = $config['load_balancer']['lbaction'][$i]; } $ret = ""; - $ret .= "{$actions_a[$action]['direction']} {$actions_a[$action]['type']} {$actions_a[$action]['action']}"; + $ret .= "{$actions_a[$action]['direction']} {$actions_a[$action]['type']} {$actions_a[$action]['action']}"; switch ($actions_a[$action]['action']) { case 'append': $ret .= " \"{$actions_a[$action]['options']['value']}\" to \"{$actions_a[$action]['options']['akey']}\""; @@ -303,7 +303,7 @@ function relayd_configure($kill_first=false) { for ($j = 0; $j < count($ip_list); $j += 1) { $ip = $ip_list[$j]; for ($k = 0; $k < count($src_port_array) && $k < count($dest_port_array); $k += 1) { - $src_port = $src_port_array[$k]; + $src_port = $src_port_array[$k]; $dest_port = $dest_port_array[$k]; $name = $vs_a[$i]['name']; @@ -330,11 +330,11 @@ function relayd_configure($kill_first=false) { $conf .= " forward to <{$vs_a[$i]['poolname']}> port {$dest_port} {$lbmode} {$check_a[$pools[$vs_a[$i]['poolname']]['monitor']]} \n"; - if (isset($vs_a[$i]['sitedown']) && strlen($vs_a[$i]['sitedown']) > 0 && ($vs_a[$i]['relay_protocol'] != 'dns')) { + if (isset($vs_a[$i]['sitedown']) && strlen($vs_a[$i]['sitedown']) > 0 && ($vs_a[$i]['relay_protocol'] != 'dns')) { $conf .= " forward to <{$vs_a[$i]['sitedown']}> port {$dest_port} {$lbmode} {$check_a[$pools[$vs_a[$i]['poolname']]['monitor']]} \n"; } $conf .= "}\n"; - } else { + } else { $conf .= "redirect \"{$name}\" {\n"; $conf .= " listen on {$ip} port {$src_port}\n"; $conf .= " forward to <{$vs_a[$i]['poolname']}> port {$dest_port} {$check_a[$pools[$vs_a[$i]['poolname']]['monitor']]} \n"; @@ -358,7 +358,7 @@ function relayd_configure($kill_first=false) { fclose($fd); if (is_process_running('relayd')) { - if (! empty($vs_a)) { + if (!empty($vs_a)) { if ($kill_first) { mwexec('pkill relayd'); /* Remove all active relayd anchors now that relayd is no longer running. */ -- cgit v1.1