diff options
Diffstat (limited to 'src/usr/local')
33 files changed, 143 insertions, 142 deletions
diff --git a/src/usr/local/www/carp_status.php b/src/usr/local/www/carp_status.php index 6ba07fa..09d9873 100644 --- a/src/usr/local/www/carp_status.php +++ b/src/usr/local/www/carp_status.php @@ -175,8 +175,8 @@ include("head.inc"); <?php $carpcount = 0; -if(is_array($config['virtualip']['vip'])) { - foreach($config['virtualip']['vip'] as $carp) { +if (is_array($config['virtualip']['vip'])) { + foreach ($config['virtualip']['vip'] as $carp) { if ($carp['mode'] == "carp") { $carpcount++; break; @@ -203,21 +203,22 @@ if ($carpcount > 0): <td><?=gettext("Status")?></td> </tr> <?php - foreach($config['virtualip']['vip'] as $carp) { - if ($carp['mode'] != "carp") + foreach ($config['virtualip']['vip'] as $carp) { + if ($carp['mode'] != "carp") { continue; + } $ipaddress = $carp['subnet']; $vhid = $carp['vhid']; $status = get_carp_interface_status("{$carp['interface']}_vip{$carp['vhid']}"); - if($carp_enabled == false) { + if ($carp_enabled == false) { $icon = 'remove-sign'; $status = "DISABLED"; } else { - if($status == "MASTER") { + if ($status == "MASTER") { $icon = 'ok-sign'; - } else if($status == "BACKUP") { + } else if ($status == "BACKUP") { $icon = 'ok-circle'; - } else if($status == "INIT") { + } else if ($status == "INIT") { $icon = 'question-sign'; } } @@ -236,8 +237,9 @@ if ($carpcount > 0): <h4><?=gettext("pfSync nodes")?></h4> <ul> <?php - foreach (explode("\n", exec_command("/sbin/pfctl -vvss | /usr/bin/grep creator | /usr/bin/cut -d\" \" -f7 | /usr/bin/sort -u")) as $node) + foreach (explode("\n", exec_command("/sbin/pfctl -vvss | /usr/bin/grep creator | /usr/bin/cut -d\" \" -f7 | /usr/bin/sort -u")) as $node) { echo '<li>'. $node .'</li>'; + } ?> </ul> diff --git a/src/usr/local/www/crash_reporter.php b/src/usr/local/www/crash_reporter.php index dc0a7c9..50e105f 100644 --- a/src/usr/local/www/crash_reporter.php +++ b/src/usr/local/www/crash_reporter.php @@ -75,7 +75,7 @@ function upload_crash_report($files) { global $g; $post = array(); $counter = 0; - foreach($files as $file) { + foreach ($files as $file) { $post["file{$counter}"] = "@{$file}"; $counter++; } @@ -91,7 +91,7 @@ function upload_crash_report($files) { return $response; } -$pgtitle = array(gettext("Diagnostics"),gettext("Crash reporter")); +$pgtitle = array(gettext("Diagnostics"), gettext("Crash reporter")); include('head.inc'); $crash_report_header = "Crash report begins. Anonymous machine information:\n\n"; @@ -119,7 +119,7 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors); echo gettext("Uploading..."); ob_flush(); flush(); - if(is_array($files_to_upload)) { + if (is_array($files_to_upload)) { $resp = upload_crash_report($files_to_upload); array_map('unlink', glob("/var/crash/*")); // Erase the contents of the PHP error log @@ -130,7 +130,7 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors); } else { echo "Could not find any crash files."; } - } else if(gettext($_POST['Submit']) == "No") { + } else if (gettext($_POST['Submit']) == "No") { array_map('unlink', glob("/var/crash/*")); // Erase the contents of the PHP error log fclose(fopen("/tmp/PHP_errors.log", 'w')); @@ -143,9 +143,9 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors); $crash_reports .= "\nPHP Errors:\n"; $crash_reports .= implode("\n", $php_errors) . "\n\n"; } - if(is_array($crash_files)) { - foreach($crash_files as $cf) { - if(filesize($cf) < FILE_SIZE) { + if (is_array($crash_files)) { + foreach ($crash_files as $cf) { + if (filesize($cf) < FILE_SIZE) { $crash_reports .= "\nFilename: {$cf}\n"; $crash_reports .= file_get_contents($cf); } diff --git a/src/usr/local/www/diag_backup.php b/src/usr/local/www/diag_backup.php index 4451a46..943d57d 100644 --- a/src/usr/local/www/diag_backup.php +++ b/src/usr/local/www/diag_backup.php @@ -594,9 +594,9 @@ function build_area_list($showall) { $list = array("" => gettext("All")); - if($showall) + if ($showall) { return($list + $areas); - else { + } else { foreach ($areas as $area => $areaname) { if ($area === "rrddata" || check_and_returnif_section_exists($area) == true) { $list[$area] = $areaname; diff --git a/src/usr/local/www/diag_confbak.php b/src/usr/local/www/diag_confbak.php index 08c273a..b048f5e 100644 --- a/src/usr/local/www/diag_confbak.php +++ b/src/usr/local/www/diag_confbak.php @@ -89,8 +89,8 @@ if ($_GET['getcfg'] != "") { } if (($_GET['diff'] == 'Diff') && isset($_GET['oldtime']) && isset($_GET['newtime']) && - (is_numeric($_GET['oldtime'])) && - (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) { + (is_numeric($_GET['oldtime'])) && + (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) { $diff = ""; $oldfile = $g['conf_path'] . '/backup/config-' . $_GET['oldtime'] . '.xml'; $oldtime = $_GET['oldtime']; @@ -281,4 +281,4 @@ endif; </form> </div> -<?php include("foot.inc");
\ No newline at end of file +<?php include("foot.inc"); diff --git a/src/usr/local/www/diag_dns.php b/src/usr/local/www/diag_dns.php index 4629a4c..140bf4b 100755 --- a/src/usr/local/www/diag_dns.php +++ b/src/usr/local/www/diag_dns.php @@ -91,9 +91,9 @@ if (isset($_POST['create_alias']) && (is_hostname($host) || is_ipaddr($host))) { $resolved = array(); exec("/usr/bin/drill {$host_esc} A | /usr/bin/grep {$host_esc} | /usr/bin/grep -v ';' | /usr/bin/awk '{ print $5 }'", $resolved); $isfirst = true; - foreach($resolved as $re) { - if($re != "") { - if(!$isfirst) + foreach ($resolved as $re) { + if ($re != "") { + if (!$isfirst) $addresses .= " "; $addresses .= rtrim($re) . "/32"; $isfirst = false; diff --git a/src/usr/local/www/diag_dump_states.php b/src/usr/local/www/diag_dump_states.php index 368b4d1..aeb1679 100755 --- a/src/usr/local/www/diag_dump_states.php +++ b/src/usr/local/www/diag_dump_states.php @@ -180,9 +180,9 @@ print $form; $row = 0; /* get our states */ $grepline = (isset($_POST['filter'])) ? "| /usr/bin/egrep " . escapeshellarg(htmlspecialchars($_POST['filter'])) : ""; - $fd = popen("/sbin/pfctl -s state {$grepline}", "r" ); + $fd = popen("/sbin/pfctl -s state {$grepline}", "r"); while ($line = chop(fgets($fd))) { - if($row >= 10000) + if ($row >= 10000) break; $line_split = preg_split("/\s+/", $line); diff --git a/src/usr/local/www/diag_dump_states_sources.php b/src/usr/local/www/diag_dump_states_sources.php index 5ad9f2c..360ec58 100644 --- a/src/usr/local/www/diag_dump_states_sources.php +++ b/src/usr/local/www/diag_dump_states_sources.php @@ -69,8 +69,8 @@ require_once("guiconfig.inc"); /* handle AJAX operations */ -if($_POST['action']) { - if($_POST['action'] == "remove") { +if ($_POST['action']) { + if ($_POST['action'] == "remove") { if (is_ipaddr($_POST['srcip']) && is_ipaddr($_POST['dstip'])) { $retval = mwexec("/sbin/pfctl -K " . escapeshellarg($_POST['srcip']) . " -K " . escapeshellarg($_POST['dstip'])); echo htmlentities("|{$_GET['srcip']}|{$_POST['dstip']}|{$retval}|"); @@ -82,15 +82,14 @@ if($_POST['action']) { } /* get our states */ -if($_POST['filter']) { +if ($_POST['filter']) { exec("/sbin/pfctl -s Sources | grep " . escapeshellarg(htmlspecialchars($_GET['filter'])), $sources); -} -else { +} else { exec("/sbin/pfctl -s Sources", $sources); } -$pgtitle = array(gettext("Diagnostics"),gettext("Show Source Tracking")); +$pgtitle = array(gettext("Diagnostics"), gettext("Show Source Tracking")); include("head.inc"); $tab_array = array(); diff --git a/src/usr/local/www/diag_ipsec.php b/src/usr/local/www/diag_ipsec.php index cd99e51..5291e8a 100644 --- a/src/usr/local/www/diag_ipsec.php +++ b/src/usr/local/www/diag_ipsec.php @@ -265,7 +265,7 @@ if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_ </td> <td> <?php - if($ikesa['status'] == 'established') + if ($ikesa['status'] == 'established') print('<span style="color:green">'); else print('<span>'); @@ -327,8 +327,8 @@ if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_ <td> <?php if (is_array($childsa['local']) && - is_array($childsa['local']['networks']) && - is_array($childsa['local']['networks']['network'])) + is_array($childsa['local']['networks']) && + is_array($childsa['local']['networks']['network'])) foreach ($childsa['local']['networks']['network'] as $lnets) print(htmlspecialchars(ipsec_fixup_network($lnets)) . "<br />"); else @@ -347,8 +347,8 @@ if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_ <td> <?php if (is_array($childsa['remote']) && - is_array($childsa['remote']['networks']) && - is_array($childsa['remote']['networks']['network'])) + is_array($childsa['remote']['networks']) && + is_array($childsa['remote']['networks']['network'])) foreach ($childsa['remote']['networks']['network'] as $rnets) print(htmlspecialchars(ipsec_fixup_network($rnets)) . '<br />'); else diff --git a/src/usr/local/www/diag_ipsec_leases.php b/src/usr/local/www/diag_ipsec_leases.php index 0bf5012..1331ebe 100644 --- a/src/usr/local/www/diag_ipsec_leases.php +++ b/src/usr/local/www/diag_ipsec_leases.php @@ -72,7 +72,7 @@ define(DEBUG, true); // Force dummy data for testing. Setting up a pFSense box t require("guiconfig.inc"); require("ipsec.inc"); -$pgtitle = array(gettext("Status"),gettext("IPsec"),gettext("Leases")); +$pgtitle = array(gettext("Status"), gettext("IPsec"), gettext("Leases")); $shortcut_section = "ipsec"; include("head.inc"); @@ -102,7 +102,7 @@ if (isset($mobile['pool']) && is_array($mobile['pool'])) { </thead> <tbody> <?php - foreach($mobile['pool'] as $pool) { + foreach ($mobile['pool'] as $pool) { // The first row of each pool includes the pool information ?> <tr> @@ -120,7 +120,7 @@ if (isset($mobile['pool']) && is_array($mobile['pool'])) { $leaserow = true; if (is_array($pool['lease']) && count($pool['lease']) > 0) { foreach ($pool['lease'] as $lease) { - if(!$leaserow) { + if (!$leaserow) { // On subsequent rows the first three columns are blank ?> <tr> diff --git a/src/usr/local/www/diag_ipsec_sad.php b/src/usr/local/www/diag_ipsec_sad.php index 2a9579f..288c509 100644 --- a/src/usr/local/www/diag_ipsec_sad.php +++ b/src/usr/local/www/diag_ipsec_sad.php @@ -70,7 +70,7 @@ require("guiconfig.inc"); require("ipsec.inc"); -$pgtitle = array(gettext("Status"),gettext("IPsec"),gettext("SAD")); +$pgtitle = array(gettext("Status"), gettext("IPsec"), gettext("SAD")); $shortcut_section = "ipsec"; include("head.inc"); diff --git a/src/usr/local/www/diag_ipsec_spd.php b/src/usr/local/www/diag_ipsec_spd.php index c952188..ef14523 100644 --- a/src/usr/local/www/diag_ipsec_spd.php +++ b/src/usr/local/www/diag_ipsec_spd.php @@ -74,11 +74,11 @@ define(LEFTARROW, '◀'); require("guiconfig.inc"); require("ipsec.inc"); -$pgtitle = array(gettext("Status"),gettext("IPsec"),gettext("SPD")); +$pgtitle = array(gettext("Status"), gettext("IPsec"), gettext("SPD")); $shortcut_section = "ipsec"; include("head.inc"); -if(DEBUG) { // Dummy data for testing. REMOVE for production +if (DEBUG) { // Dummy data for testing. REMOVE for production $spd = array ( 0 => array ( 'srcid' => '172.27.0.0/16', 'dstid' => '172.21.2.0/24', 'dir' => 'in' , 'proto' => 'esp', 'dst' => '184.57.8.247', 'src' => '208.123.73.7', 'reqid' => 'nique:1' ), 1 => array ( 'srcid' => '172.21.2.0/24', 'dstid' => '172.27.0.0/16', 'dir' => 'out', 'proto' => 'esp', 'dst' => '208.123.73.7', 'src' => '184.57.8.247', 'reqid' => 'nique:1' ) ); } @@ -93,7 +93,7 @@ $tab_array[3] = array(gettext("SPD"), true, "diag_ipsec_spd.php"); $tab_array[4] = array(gettext("Logs"), false, "diag_logs.php?logfile=ipsec"); display_top_tabs($tab_array); -if (count($spd)){ +if (count($spd)) { ?> <div class="table-responsive"> <table class="table table-striped table-hover table-condensed"> @@ -110,7 +110,7 @@ if (count($spd)){ <tbody> <?php foreach ($spd as $sp) { - if($sp['dir'] == 'in') + if ($sp['dir'] == 'in') $dirstr = LEFTARROW . ' Inbound'; else $dirstr = RIGHTARROW . ' Outbound'; diff --git a/src/usr/local/www/diag_logs.php b/src/usr/local/www/diag_logs.php index 5e79b6c..ebd0c61 100755 --- a/src/usr/local/www/diag_logs.php +++ b/src/usr/local/www/diag_logs.php @@ -69,7 +69,7 @@ require("guiconfig.inc"); // The logs to display are specified in a GET argument. Default to 'system' logs -if(!$_GET['logfile']) +if (!$_GET['logfile']) $logfile = 'system'; else $logfile = $_GET['logfile']; @@ -151,7 +151,7 @@ $form->addGlobal(new Form_Button( $form->add($section); print $form; -if($logfile == 'dhcpd') +if ($logfile == 'dhcpd') print_info_box('Warning: Clearing the log file will restart the DHCP daemon.'); ?> @@ -159,12 +159,12 @@ if($logfile == 'dhcpd') <div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=$logfile?><?=gettext(" log entries")?></h2></div> <pre> <?php - if(($logfile == 'resolver') || ($logfile == 'system')) + if (($logfile == 'resolver') || ($logfile == 'system')) $inverse = array("ppp"); else $inverse = null; - if($filtertext) + if ($filtertext) dump_clog_no_table($system_logfile, $nentries, true, array("$filtertext"), $inverse); else dump_clog_no_table($system_logfile, $nentries, true, array(), $inverse); diff --git a/src/usr/local/www/diag_logs_filter.php b/src/usr/local/www/diag_logs_filter.php index 3179959..8b3a92f 100644 --- a/src/usr/local/www/diag_logs_filter.php +++ b/src/usr/local/www/diag_logs_filter.php @@ -218,7 +218,7 @@ if ($filterfieldsarray['interface'] == "All") require_once('classes/Form.class.php'); -if(!isset($config['syslog']['rawfilter'])) { // Advanced log filter form +if (!isset($config['syslog']['rawfilter'])) { // Advanced log filter form $form = new Form(new Form_Button( 'filterlogentries_submit', 'Filter' @@ -365,8 +365,8 @@ if (!isset($config['syslog']['rawfilter'])) { <div class="panel-heading"> <h2 class="panel-title"> <?php - if ( (!$filtertext) && (!$filterfieldsarray) ) - printf(gettext("Last %s firewall log entries."),count($filterlog)); + if ((!$filtertext) && (!$filterfieldsarray)) + printf(gettext("Last %s firewall log entries."), count($filterlog)); else print(count($filterlog). ' ' . gettext('matched log entries.') . ' '); @@ -431,7 +431,7 @@ if (!isset($config['syslog']['rawfilter'])) { $int = strtolower($filterent['interface']); $proto = strtolower($filterent['proto']); - if($filterent['version'] == '6') { + if ($filterent['version'] == '6') { $ipproto = "inet6"; $filterent['srcip'] = "[{$filterent['srcip']}]"; $filterent['dstip'] = "[{$filterent['dstip']}]"; @@ -461,7 +461,7 @@ if (!isset($config['syslog']['rawfilter'])) { <?php if ($filterent['proto'] == "TCP") $filterent['proto'] .= ":{$filterent['tcpflags']}"; - ?> +?> <td><?=htmlspecialchars($filterent['proto'])?></td> </tr> <?php @@ -474,10 +474,10 @@ if (!isset($config['syslog']['rawfilter'])) { <?php } } // e-o-foreach - buffer_rules_clear(); + buffer_rules_clear(); } else - { +{ ?> <tr> <td colspan="2"> @@ -485,7 +485,7 @@ else </td> </tr> <?php - if($filtertext) + if ($filtertext) dump_clog($filter_logfile, $nentries, true, array("$filtertext")); else dump_clog($filter_logfile, $nentries); diff --git a/src/usr/local/www/diag_logs_filter_dynamic.php b/src/usr/local/www/diag_logs_filter_dynamic.php index ca32b46..478d229 100755 --- a/src/usr/local/www/diag_logs_filter_dynamic.php +++ b/src/usr/local/www/diag_logs_filter_dynamic.php @@ -235,7 +235,7 @@ display_top_tabs($tab_array, false, 'nav nav-tabs'); </div> <?php -if($tcpcnt > 0) +if ($tcpcnt > 0) print_info_box('<a href="https://doc.pfsense.org/index.php/What_are_TCP_Flags%3F">' . gettext("TCP Flags") . '</a>: F - FIN, S - SYN, A or . - ACK, R - RST, P - PSH, U - URG, E - ECE, C - CWR'); ?> diff --git a/src/usr/local/www/diag_logs_filter_summary.php b/src/usr/local/www/diag_logs_filter_summary.php index 8d88310..7a83b95 100644 --- a/src/usr/local/www/diag_logs_filter_summary.php +++ b/src/usr/local/www/diag_logs_filter_summary.php @@ -121,7 +121,7 @@ function stat_block($summary, $stat, $num) { } } - if(!is_ipaddr($outstr)) + if (!is_ipaddr($outstr)) print('<tr><td>' . $outstr . '</td><td>' . $summary[$stat][$k[$i]] . '</td><td></td></tr>'); } } @@ -173,11 +173,11 @@ var pie = new d3pie("pieChart<?=$chartnum?>", { $total = 0; $numentries = 0; - for ($i=0; $i < $num; $i++) { + for ($i = 0; $i < $num; $i++) { if ($k[$i]) { $total += $summary[$stat][$k[$i]]; $numentries++; - if($i > 0) + if ($i > 0) print(",\r\n"); print("{"); @@ -298,7 +298,7 @@ print_info_box($infomsg); <?php $chartnum=0; -foreach(array_keys($fields) as $field) { +foreach (array_keys($fields) as $field) { ?> <div class="panel panel-default"> <div class="panel-heading"><h2 class="panel-title"><?=$fields[$field]?></h2></div> diff --git a/src/usr/local/www/diag_logs_settings.php b/src/usr/local/www/diag_logs_settings.php index 1e1be6e..686df32 100644 --- a/src/usr/local/www/diag_logs_settings.php +++ b/src/usr/local/www/diag_logs_settings.php @@ -189,9 +189,9 @@ if ($_POST['resetlogs'] == gettext("Reset Log Files")) { $retval = 0; $retval = system_syslogd_start(); if (($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock'])) || - ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass'])) || - ($oldnologbogons !== isset($config['syslog']['nologbogons'])) || - ($oldnologprivatenets !== isset($config['syslog']['nologprivatenets']))) { + ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass'])) || + ($oldnologbogons !== isset($config['syslog']['nologbogons'])) || + ($oldnologprivatenets !== isset($config['syslog']['nologprivatenets']))) { $retval |= filter_configure(); } @@ -366,7 +366,7 @@ $section->addInput(new Form_Select( ))->setHelp('This option is only used when a non-default address is chosen as the source above. ' . 'This option only expresses a preference; If an IP address of the selected type is not found on the chosen interface, the other type will be tried.'); -// Group colapses/appears based on 'enable' checkbox above +// Group collapses/appears based on 'enable' checkbox above $group = new Form_Group('Remote log servers'); $group->addClass('remotelogging'); diff --git a/src/usr/local/www/diag_logs_vpn.php b/src/usr/local/www/diag_logs_vpn.php index e5ce76b..6429a0c 100755 --- a/src/usr/local/www/diag_logs_vpn.php +++ b/src/usr/local/www/diag_logs_vpn.php @@ -213,7 +213,7 @@ display_top_tabs($tab_array, false, 'nav nav-tabs'); </tbody> </table> <?php - if($rows == 0) + if ($rows == 0) print_info_box('No logs to display'); ?> </div> @@ -223,7 +223,7 @@ display_top_tabs($tab_array, false, 'nav nav-tabs'); ?> <pre> <?php - if(dump_clog_no_table("/var/log/{$logname}.log", $nentries) == 0) + if (dump_clog_no_table("/var/log/{$logname}.log", $nentries) == 0) print('No logs to display'); ?> </pre> diff --git a/src/usr/local/www/diag_nanobsd.php b/src/usr/local/www/diag_nanobsd.php index 4b71e38..09532f1 100644 --- a/src/usr/local/www/diag_nanobsd.php +++ b/src/usr/local/www/diag_nanobsd.php @@ -90,8 +90,8 @@ nanobsd_detect_slice_info(); $NANOBSD_SIZE = nanobsd_get_size(); $class='alert-warning'; -if($_POST['bootslice']) { - if(!DEBUG) +if ($_POST['bootslice']) { + if (!DEBUG) nanobsd_switch_boot_slice(); else sleep(4); @@ -102,10 +102,10 @@ if($_POST['bootslice']) { nanobsd_detect_slice_info(); } -if($_POST['destslice'] && $_POST['duplicateslice']) { +if ($_POST['destslice'] && $_POST['duplicateslice']) { $statusmsg = gettext("Duplicating slice. Please wait, this will take a moment..."); - if(!DEBUG && nanobsd_clone_slice($_POST['destslice'])) { + if (!DEBUG && nanobsd_clone_slice($_POST['destslice'])) { $savemsg = gettext("The slice has been duplicated.") . "<p/>" . gettext("If you would like to boot from this newly duplicated slice please set it using the bootup information area."); $class='alert-success'; } else { @@ -125,7 +125,7 @@ if ($_POST['changero']) { } if ($_POST['setrw']) { - if(!DEBUG) { + if (!DEBUG) { conf_mount_rw(); if (isset($_POST['nanobsd_force_rw'])) $config['system']['nanobsd_force_rw'] = true; @@ -225,7 +225,7 @@ $section->addInput(new Form_StaticText( 'These options have been relocated to the ' . '<a href="system_advanced_misc.php">' . 'System > Advanced, Miscellaneous</a> tab.' )); -if(file_exists("/conf/upgrade_log.txt")) { +if (file_exists("/conf/upgrade_log.txt")) { $viewbtn = new Form_Button('viewupgradelog', 'View log'); $viewbtn->removeClass('btn-primary')->addClass('btn-default btn-sm'); @@ -237,7 +237,7 @@ if(file_exists("/conf/upgrade_log.txt")) { $form->add($section); print($form); -if(file_exists("/conf/upgrade_log.txt") && $_POST['viewupgradelog']) { +if (file_exists("/conf/upgrade_log.txt") && $_POST['viewupgradelog']) { ?> <div class="panel panel-default"> <div class="panel-heading"><h2 class="panel-title"><?=gettext("Previous upgrade log")?></h2></div> diff --git a/src/usr/local/www/diag_ndp.php b/src/usr/local/www/diag_ndp.php index 1fe0b24..cb6c889 100644 --- a/src/usr/local/www/diag_ndp.php +++ b/src/usr/local/www/diag_ndp.php @@ -154,7 +154,7 @@ include("head.inc"); ?> <?=$mac?> - <? if(isset($mac_man[$mac_hi])):?> + <? if (isset($mac_man[$mac_hi])):?> (<?=$mac_man[$mac_hi]?>) <?endif?> @@ -164,7 +164,7 @@ include("head.inc"); </td> <td> <?php - if(isset($hwif[$entry['interface']])) + if (isset($hwif[$entry['interface']])) echo $hwif[$entry['interface']]; else echo $entry['interface']; diff --git a/src/usr/local/www/diag_patterns.php b/src/usr/local/www/diag_patterns.php index 47cd3b9..87b6516 100644 --- a/src/usr/local/www/diag_patterns.php +++ b/src/usr/local/www/diag_patterns.php @@ -73,7 +73,7 @@ $buttonlabel = gettext("Upload Pattern file"); //Move the upload file to /usr/local/share/protocols (is_uploaded_file must use tmp_name as argument) if (($_POST['submit'] == $buttonlabel) && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { - if(fileExtension($_FILES['ulfile']['name'])) { + if (fileExtension($_FILES['ulfile']['name'])) { if (!is_array($config['l7shaper']['custom_pat'])) $config['l7shaper']['custom_pat'] = array(); @@ -98,7 +98,7 @@ function fileExtension($nameFile) { $pgtitle = array(gettext("Diagnostics"), gettext("Add layer7 pattern")); include("head.inc"); -if($ulmsg) +if ($ulmsg) print_info_box($ulmsg, $class); require_once('classes/Form.class.php'); diff --git a/src/usr/local/www/diag_pf_info.php b/src/usr/local/www/diag_pf_info.php index 03c0404..8ede5c5 100644 --- a/src/usr/local/www/diag_pf_info.php +++ b/src/usr/local/www/diag_pf_info.php @@ -76,7 +76,7 @@ if (stristr($_POST['Submit'], gettext("No"))) { exit; } -if($_REQUEST['getactivity']) { +if ($_REQUEST['getactivity']) { $text = `/sbin/pfctl -vvsi`; $text .= "<p/>"; $text .= `/sbin/pfctl -vvsm`; diff --git a/src/usr/local/www/diag_ping.php b/src/usr/local/www/diag_ping.php index d812bc2..125eebb 100644 --- a/src/usr/local/www/diag_ping.php +++ b/src/usr/local/www/diag_ping.php @@ -121,7 +121,7 @@ if (!isset($do_ping)) { $count = DEFAULT_COUNT; } -if($do_ping) { +if ($do_ping) { ?> <script type="text/javascript"> //<![CDATA[ @@ -152,7 +152,7 @@ if($do_ping) { //echo "Ping command: {$cmd}\n"; $result = shell_exec($cmd); - if(empty($result)) + if (empty($result)) $input_errors[] = "Host \"" . $host . "\" did not respond or could not be resolved."; } @@ -211,7 +211,7 @@ $section->addInput(new Form_Select( $form->add($section); print $form; -if($do_ping && !empty($result) && !$input_errors) { +if ($do_ping && !empty($result) && !$input_errors) { ?> <div class="panel panel-default"> <div class="panel-heading"> diff --git a/src/usr/local/www/diag_pkglogs.php b/src/usr/local/www/diag_pkglogs.php index e02cfff..4bafa87 100755 --- a/src/usr/local/www/diag_pkglogs.php +++ b/src/usr/local/www/diag_pkglogs.php @@ -111,16 +111,16 @@ if (!$apkg) { // If we aren't looking for a specific package, locate the first p $pgtitle = array(gettext("Status"), gettext("Package logs")); include("head.inc"); -if($pkgwithlogging == false) { +if ($pkgwithlogging == false) { print_info_box(gettext("No packages with logging facilities are currently installed.")); } else { $tab_array = array(); - foreach($config['installedpackages']['package'] as $package) { - if(is_array($package['logging'])) { - if(!($logtab = $package['logging']['logtab'])) + foreach ($config['installedpackages']['package'] as $package) { + if (is_array($package['logging'])) { + if (!($logtab = $package['logging']['logtab'])) $logtab = $package['name']; - if($apkg == $package['name']) { + if ($apkg == $package['name']) { $curtab = $logtab; $tab_array[] = array(sprintf(gettext("%s"), $logtab), true, "diag_pkglogs.php?pkg=".$package['name']); } else { @@ -132,7 +132,7 @@ if($pkgwithlogging == false) { ?> <div class="panel panel-default"> - <div class="panel-heading"><h2 class="panel-title"><?=printf(gettext('Last %1$s %2$s log entries'),$nentries,$curtab)?></h2></div> + <div class="panel-heading"><h2 class="panel-title"><?=printf(gettext('Last %1$s %2$s log entries'), $nentries, $curtab)?></h2></div> <div>class="panel-body"> <pre> <?php diff --git a/src/usr/local/www/diag_resetstate.php b/src/usr/local/www/diag_resetstate.php index 93f313b..8630b59 100644 --- a/src/usr/local/www/diag_resetstate.php +++ b/src/usr/local/www/diag_resetstate.php @@ -98,7 +98,7 @@ if ($input_errors) if ($savemsg) print_info_box($savemsg, 'alert-success'); -$statetabelhelp = 'Resetting the state tables will remove all entries from the corresponding tables. This means that all open connections ' . +$statetablehelp = 'Resetting the state tables will remove all entries from the corresponding tables. This means that all open connections ' . 'will be broken and will have to be re-established. This may be necessary after making substantial changes to the ' . 'firewall and/or NAT rules, especially if there are IP protocol mappings (e.g. for PPTP or IPv6) with open connections.' . '<br /><br />' . @@ -140,9 +140,9 @@ $section->addInput(new Form_Checkbox( 'State Table', 'Reset the firewall state table', true -))->setHelp($statetabelhelp); +))->setHelp($statetablehelp); -if(isset($config['system']['lb_use_sticky'])) { +if (isset($config['system']['lb_use_sticky'])) { $section->addInput(new Form_Checkbox( 'sourcetracking', 'Source Tracking', diff --git a/src/usr/local/www/diag_routes.php b/src/usr/local/www/diag_routes.php index 156b2cb..711e6b7 100644 --- a/src/usr/local/www/diag_routes.php +++ b/src/usr/local/www/diag_routes.php @@ -68,8 +68,8 @@ include('guiconfig.inc'); -$limit='100'; -$filter=''; +$limit = '100'; +$filter = ''; if (isset($_REQUEST['isAjax'])) { $netstat = "/usr/bin/netstat -rW"; @@ -121,7 +121,7 @@ $section->addInput(new Form_Checkbox( 'Resolve names', 'Enable', $resolve -))->setHelp('Enabling name resolution may cause the query should take longer.'. +))->setHelp('Enabling name resolution may cause the query to take longer.'. ' You can stop it at any time by clicking the Stop button in your browser.'); $validLimits = array('10', '50', '100', '200', '500', '1000', 'all'); diff --git a/src/usr/local/www/diag_smart.php b/src/usr/local/www/diag_smart.php index 22592f5..3defed1 100644 --- a/src/usr/local/www/diag_smart.php +++ b/src/usr/local/www/diag_smart.php @@ -118,7 +118,7 @@ $tab_array[0] = array(gettext("Information/Tests"), ($action != 'config'), $_SER $tab_array[1] = array(gettext("Config"), ($action == 'config'), $_SERVER['PHP_SELF'] . "?action=config"); display_top_tabs($tab_array); -switch($action) { +switch ($action) { // Testing devices case 'test': { @@ -219,7 +219,7 @@ switch($action) { // Config changes, users email in xml config and write changes to smartd.conf case 'config': { - if(isset($_POST['test'])) { + if (isset($_POST['test'])) { // FIXME shell_exec($smartd . " -M test -m " . $config['system']['smartmonemail']); $savemsg = sprintf(gettext("Email sent to %s"), $config['system']['smartmonemail']); @@ -227,7 +227,7 @@ switch($action) { smartmonctl("start"); $style = 'warning'; } - else if(isset($_POST['save'])) + else if (isset($_POST['save'])) { $config['system']['smartmonemail'] = $_POST['smartmonemail']; write_config(); @@ -235,7 +235,7 @@ switch($action) { // Don't know what all this means, but it adds the config changed header when config is saved $retval = 0; config_lock(); - if(stristr($retval, "error") != true) { + if (stristr($retval, "error") != true) { $savemsg = get_std_save_message($retval); $style = 'success'; } @@ -253,7 +253,7 @@ switch($action) { shell_exec("/usr/bin/killall -HUP smartd"); } - // Was the config changed? if so , print the message + // Was the config changed? if so, print the message if ($savemsg) print_info_box($savemsg, $style); @@ -273,7 +273,7 @@ switch($action) { $form->add($section); - if(!empty($pconfig['smartmonemail'])) { + if (!empty($pconfig['smartmonemail'])) { $form->addGlobal(new Form_Button( 'test', 'Send test email' diff --git a/src/usr/local/www/diag_sockets.php b/src/usr/local/www/diag_sockets.php index 84c9642..5701640 100644 --- a/src/usr/local/www/diag_sockets.php +++ b/src/usr/local/www/diag_sockets.php @@ -148,7 +148,7 @@ $showAllOption = $showAll ? "" : "?showAll"; <div class="panel panel-default"> <div class="panel-heading"><h2 class="panel-title">Socket information - explanation</h2></div> <div class="panel-body"> - This page show the output for the commands: "sockstat -4lL" and "sockstat -6lL".<br /> + This page shows the output for the commands: "sockstat -4lL" and "sockstat -6lL".<br /> Or in case of showing all sockets the output for: "sockstat -4" and "sockstat -6".<br /> <br /> The information listed for each socket is: diff --git a/src/usr/local/www/diag_states_summary.php b/src/usr/local/www/diag_states_summary.php index 587ddcd..502c53c 100644 --- a/src/usr/local/www/diag_states_summary.php +++ b/src/usr/local/www/diag_states_summary.php @@ -192,7 +192,7 @@ function print_summary_table($label, $iparr, $sort = TRUE) </tr> </thead> <tbody> -<?php foreach($iparr as $ip => $ipinfo): +<?php foreach ($iparr as $ip => $ipinfo): $protocolCount = count($ipinfo['protos']); $rowSpan = ''; $i = 0; @@ -204,7 +204,7 @@ function print_summary_table($label, $iparr, $sort = TRUE) <td<?= $rowSpan ?>><?php echo $ip; ?></td> <td<?= $rowSpan ?> class="text-center"><?php echo $ipinfo['seen']; ?></td> -<?php foreach($ipinfo['protos'] as $proto => $protoinfo): ?> +<?php foreach ($ipinfo['protos'] as $proto => $protoinfo): ?> <?php if ($protocolCount > 1 && $i > 0): ?> </tr><tr> <?php endif; ?> diff --git a/src/usr/local/www/diag_system_activity.php b/src/usr/local/www/diag_system_activity.php index 488f69f..22f19f1 100644 --- a/src/usr/local/www/diag_system_activity.php +++ b/src/usr/local/www/diag_system_activity.php @@ -69,7 +69,7 @@ require("guiconfig.inc"); -$pgtitle = array(gettext("Diagnostics"),gettext("System Activity")); +$pgtitle = array(gettext("Diagnostics"), gettext("System Activity")); if ($_REQUEST['getactivity']) { $text = `/usr/bin/top -aHS | /usr/bin/cut -c1-105`; diff --git a/src/usr/local/www/diag_tables.php b/src/usr/local/www/diag_tables.php index 1da864c..2dfd348 100644 --- a/src/usr/local/www/diag_tables.php +++ b/src/usr/local/www/diag_tables.php @@ -88,7 +88,7 @@ if ($_REQUEST['delete']) { exit; } -if($_POST['deleteall']) { +if ($_POST['deleteall']) { exec("/sbin/pfctl -t " . escapeshellarg($tablename) . " -T show", $entries); if (is_array($entries)) { foreach ($entries as $entryA) { @@ -98,23 +98,23 @@ if($_POST['deleteall']) { } } -if(($tablename == "bogons") || ($tablename == "bogonsv6")) { +if (($tablename == "bogons") || ($tablename == "bogonsv6")) { $bogons = true; - if($_POST['Download']) { + if ($_POST['Download']) { mwexec_bg("/etc/rc.update_bogons.sh now"); $maxtimetowait = 0; $loading = true; - while($loading == true) { + while ($loading == true) { $isrunning = `/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep bogons`; - if($isrunning == "") + if ($isrunning == "") $loading = false; $maxtimetowait++; - if($maxtimetowait > 89) + if ($maxtimetowait > 89) $loading = false; sleep(1); } - if($maxtimetowait < 90) + if ($maxtimetowait < 90) $savemsg = gettext("The bogons database has been updated."); } } diff --git a/src/usr/local/www/diag_testport.php b/src/usr/local/www/diag_testport.php index c0bfa30..3b7cf5a 100644 --- a/src/usr/local/www/diag_testport.php +++ b/src/usr/local/www/diag_testport.php @@ -66,8 +66,8 @@ ##|*MATCH=diag_testport.php* ##|-PRIV -// Calling netcat and parsing hte results has been moved to the if ($_POST) section so that the results are known -// before we draw the form and any resulting error messages will allear in the correct place +// Calling netcat and parsing the results has been moved to the if ($_POST) section so that the results are known +// before we draw the form and any resulting error messages will appear in the correct place $allowautocomplete = true; @@ -118,7 +118,7 @@ if ($_POST || $_REQUEST['host']) { $showtext = isset($_REQUEST['showtext']); $ipprotocol = $_REQUEST['ipprotocol']; - if ( $do_testport ) { + if ($do_testport) { ?> <script type="text/javascript"> //<![CDATA[ @@ -209,27 +209,27 @@ if ($_POST || $_REQUEST['host']) { include("head.inc"); -// Handle the display of all messages here wher the user can readily see them +// Handle the display of all messages here where the user can readily see them if ($input_errors) print_input_errors($input_errors); else { // New page - if(empty($result) && $retval != 0 && !$showtext) { + if (empty($result) && $retval != 0 && !$showtext) { print('<div class="alert alert-warning" role="alert">This page allows you to perform a simple TCP connection test to determine if a host is up and accepting connections on a given port.' . ' This test does not function for UDP since there is no way to reliably determine if a UDP port accepts connections in this manner.</div>'); } // Good host & port - if($retval == 0 && $do_testport == 1) { - if(!$showtext) + if ($retval == 0 && $do_testport == 1) { + if (!$showtext) print('<div class="alert alert-success" role="alert">'.gettext("Port test to host: " . $host . " Port: " . $port . " successful").'</div>'); else print('<div class="alert alert-success" role="alert">'.gettext("Port test to host: " . $host . " Port: " . $port . " successful") . '. Any text received from the host will be shown below the form.</div>'); } // netcat exit value != 0 - if($retval != 0 && !empty($result)) - if($showtext) + if ($retval != 0 && !empty($result)) + if ($showtext) print('<div class="alert alert-danger" role="alert">'.gettext('No output received, or connection failed. Try with "Show Remote Text" unchecked first.').'</div>'); else print('<div class="alert alert-danger" role="alert">'.gettext('Connection failed.').'</div>'); @@ -290,7 +290,7 @@ $section->addInput(new Form_Select( $form->add($section); print $form; -if($ncoutput && !empty($result) && $showtext && $retval == 0): ?> +if ($ncoutput && !empty($result) && $showtext && $retval == 0): ?> <div class="panel panel-default"> <div class="panel-heading"> <h2 class="panel-title">Received Remote Text</h2> diff --git a/src/usr/local/www/diag_traceroute.php b/src/usr/local/www/diag_traceroute.php index 22f6c83..4c5b3c1 100644 --- a/src/usr/local/www/diag_traceroute.php +++ b/src/usr/local/www/diag_traceroute.php @@ -175,7 +175,7 @@ $section->addInput(new Form_Checkbox( 'Reverse Address Lookup', '', $resolve -))->setHelp('When checked, traceroute will attempt to perform a PTR lookup to locate hostnames for hops along the path. Will slow down the process as it has to wait for DNS replies.'); +))->setHelp('When checked, traceroute will attempt to perform a PTR lookup to locate hostnames for hops along the path. This will slow down the process as it has to wait for DNS replies.'); $section->addInput(new Form_Checkbox( 'useicmp', @@ -193,17 +193,17 @@ if (!$input_errors && $do_traceroute) { $useicmp = isset($_REQUEST['useicmp']) ? "-I" : ""; $n = isset($resolve) ? "" : "-n"; - $command = "/usr/sbin/traceroute"; - if ($ipproto == "ipv6") { - $command .= "6"; - $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip); - } else { - $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip); - } - - if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) { - $srcip = "-s " . escapeshellarg($ifaddr); - } + $command = "/usr/sbin/traceroute"; + if ($ipproto == "ipv6") { + $command .= "6"; + $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip); + } else { + $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip); + } + + if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) { + $srcip = "-s " . escapeshellarg($ifaddr); + } $cmd = "{$command} {$n} {$srcip} -w 2 {$useicmp} -m " . escapeshellarg($ttl) . " " . escapeshellarg($host); ?> diff --git a/src/usr/local/www/edit.php b/src/usr/local/www/edit.php index aedf9ed..a00069c 100644 --- a/src/usr/local/www/edit.php +++ b/src/usr/local/www/edit.php @@ -72,15 +72,15 @@ require("guiconfig.inc"); if ($_POST['action']) { switch ($_POST['action']) { case 'load': - if(strlen($_POST['file']) < 1) { + if (strlen($_POST['file']) < 1) { print('|5|' . '<div class="alert alert-danger" role="alert">'.gettext("No file name specified").'</div>' . '|'); - } elseif(is_dir($_POST['file'])) { + } elseif (is_dir($_POST['file'])) { print('|4|' . '<div class="alert alert-danger" role="alert">' . gettext("Loading a directory is not supported") .'</div>' . '|'); - } elseif(! is_file($_POST['file'])) { + } elseif (!is_file($_POST['file'])) { print('|3|' . '<div class="alert alert-danger" role="alert">' . gettext("File does not exist or is not a regular file") . '</div>' . '|'); } else { $data = file_get_contents(urldecode($_POST['file'])); - if($data === false) { + if ($data === false) { print('|1|' . '<div class="alert alert-danger" role="alert">' . gettext("Failed to read file") . '</div>' . '|'); } else { $data = base64_encode($data); @@ -90,7 +90,7 @@ if ($_POST['action']) { exit; case 'save': - if(strlen($_POST['file']) < 1) { + if (strlen($_POST['file']) < 1) { print('|' . '<div class="alert alert-danger" role="alert">'.gettext("No file name specified").'</div>' . '|'); } else { conf_mount_rw(); @@ -103,9 +103,9 @@ if ($_POST['action']) { } disable_security_checks(); } - if($ret === false) { + if ($ret === false) { print('|' . '<div class="alert alert-danger" role="alert">' . gettext("Failed to write file") . '</div>' . '|'); - } elseif($ret != strlen($_POST['data'])) { + } elseif ($ret != strlen($_POST['data'])) { print('|' . '<div class="alert alert-danger" role="alert">' . gettext("Error while writing file") . '</div>' . '|'); } else { print('|' . '<div class="alert alert-success" role="alert">' . gettext("File saved successfully") . '</div>' . '|'); @@ -201,7 +201,7 @@ require("head.inc"); ); } - <?php if($_GET['action'] == "load"): ?> + <?php if ($_GET['action'] == "load"): ?> events.push(function() { jQuery("#fbTarget").val("<?=htmlspecialchars($_GET['path'])?>"); loadFile(); |