summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/etc/inc/auth.inc40
-rw-r--r--src/etc/inc/authgui.inc2
-rw-r--r--src/etc/inc/filter_log.inc24
-rw-r--r--src/etc/inc/openvpn.inc36
-rw-r--r--src/etc/inc/pfsense-utils.inc130
-rw-r--r--src/etc/inc/services.inc58
-rw-r--r--src/etc/inc/shaper.inc64
-rw-r--r--src/etc/inc/upgrade_config.inc26
8 files changed, 193 insertions, 187 deletions
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) {
<div class="container">
<div class="col-sm-offset-3 col-sm-6 col-xs-12">
<?php
- if(is_ipaddr($http_host) && !$local_ip && !isset($config['system']['webgui']['nohttpreferercheck'])) {
+ if (is_ipaddr($http_host) && !$local_ip && !isset($config['system']['webgui']['nohttpreferercheck'])) {
$nifty_background = "#999";
print_info_box(gettext("You are accessing this router by an IP address not configured locally, which may be forwarded by NAT or other means. <br /><br />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: ",'<img src="/themes/'.$g['theme'].'/images/icons/icon_frmfld_user.png" width="11" height="12" title="USER_RULE" alt="USER_RULE"/> ',$rulename);
+ list(,$rulename,) = explode("\"", $ruleString);
+ $rulename = str_replace("USER_RULE: ", '<img src="/themes/' . $g['theme'] . '/images/icons/icon_frmfld_user.png" width="11" height="12" title="USER_RULE" alt="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 2e12d96..e782228 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("<?php", "", $code);
$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 d13f44a..7dd1739 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";
@@ -1611,7 +1611,7 @@ function services_dhcrelay_configure() {
if (!is_array($srvips)) {
log_error("No destination IP has been configured!");
return;
- }
+ }
$dhcrelayifs = array_unique($dhcrelayifs);
@@ -1621,10 +1621,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);
@@ -1719,8 +1719,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']}",
@@ -1819,7 +1819,7 @@ function services_dnsmasq_configure() {
}
/* generate hosts file */
- if (system_hosts_generate()!=0) {
+ if (system_hosts_generate() != 0) {
$return = 1;
}
@@ -1975,7 +1975,7 @@ function services_dnsmasq_configure() {
}
if (!platform_booting()) {
- if (services_dhcpd_configure()!=0) {
+ if (services_dhcpd_configure() != 0) {
$return = 1;
}
}
@@ -2005,7 +2005,7 @@ function services_unbound_configure() {
}
/* generate hosts file */
- if (system_hosts_generate()!=0) {
+ if (system_hosts_generate() != 0) {
$return = 1;
}
@@ -2019,7 +2019,7 @@ function services_unbound_configure() {
}
if (!platform_booting()) {
- if (services_dhcpd_configure()!=0) {
+ if (services_dhcpd_configure() != 0) {
$return = 1;
}
}
@@ -2050,7 +2050,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;
}
@@ -2496,10 +2496,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();
@@ -2508,7 +2509,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;
@@ -2530,8 +2531,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()] . "</a>";
if (is_array($this->queues)) {
$tree .= "<ul>";
- foreach ($this->queues as $q) {
+ foreach ($this->queues as $q) {
$tree .= $q->build_tree();
}
$tree .= "</ul>";
@@ -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() . "</a>";
if (is_array($this->subqueues)) {
$tree .= "<ul>";
- foreach ($this->subqueues as $q) {
+ foreach ($this->subqueues as $q) {
$tree .= $q->build_tree();
}
$tree .= "</ul>";
@@ -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() . "</a>";
if (is_array($this->subqueues)) {
$tree .= "<ul>";
- foreach ($this->subqueues as $q) {
+ foreach ($this->subqueues as $q) {
$tree .= $q->build_tree();
}
$tree .= "</ul>";
@@ -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 .= "<input id=\"buckets\" name=\"buckets\" value=\"";
$tmpvalue = trim($this->GetBuckets());
if (!empty($tmpvalue)) {
- $form .= $this->GetBuckets();
+ $form .= $this->GetBuckets();
}
$form .= "\" /> " . gettext("Number of buckets available.") . "<br /></td></tr>";
$form .= "<tr><td class=\"vtable\"><input id=\"hogs\" name=\"hogs\" value=\"";
$tmpvalue = trim($this->GetHogs());
if (!empty($tmpvalue)) {
- $form .= $this->GetHogs();
+ $form .= $this->GetHogs();
}
$form .= "\" /> " . gettext("Bandwidth limit for hosts to not saturate link.") . "<br /></td></tr>";
$form .= "</table></td></tr>";
@@ -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() . "</a>";
if (is_array($this->subqueues)) {
$tree .= "<ul>";
- foreach ($this->subqueues as $q) {
+ foreach ($this->subqueues as $q) {
$tree .= $q->build_tree();
}
$tree .= "</ul>";
@@ -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 d68d495..ab5cb3e 100644
--- a/src/etc/inc/upgrade_config.inc
+++ b/src/etc/inc/upgrade_config.inc
@@ -764,7 +764,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();
@@ -1108,7 +1108,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 {
@@ -1118,18 +1118,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'];
@@ -1428,7 +1428,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'];
}
}
@@ -1450,7 +1450,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;
}
@@ -1705,7 +1705,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") {
@@ -1810,7 +1810,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") {
@@ -1988,7 +1988,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();
}
@@ -2440,7 +2440,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'])) {
@@ -2473,7 +2473,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'];
OpenPOWER on IntegriCloud