From 5f6010605ba8e3ab2fbc27080ec2db80dbd0e32e Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sun, 19 Apr 2015 18:00:00 +0545 Subject: Code style usr-local-www diag --- usr/local/www/diag_logs_vpn.php | 47 +++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'usr/local/www/diag_logs_vpn.php') diff --git a/usr/local/www/diag_logs_vpn.php b/usr/local/www/diag_logs_vpn.php index 6a7a7f8..be2de56 100755 --- a/usr/local/www/diag_logs_vpn.php +++ b/usr/local/www/diag_logs_vpn.php @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. */ -/* +/* pfSense_BUILDER_BINARIES: /usr/sbin/fifolog_reader /usr/local/sbin/clog pfSense_MODULE: vpn */ @@ -47,23 +47,24 @@ require("guiconfig.inc"); require_once("vpn.inc"); $nentries = $config['syslog']['nentries']; -if (!$nentries) +if (!$nentries) { $nentries = 50; +} -if (htmlspecialchars($_POST['vpntype'])) +if (htmlspecialchars($_POST['vpntype'])) { $vpntype = htmlspecialchars($_POST['vpntype']); -elseif (htmlspecialchars($_GET['vpntype'])) +} elseif (htmlspecialchars($_GET['vpntype'])) { $vpntype = htmlspecialchars($_GET['vpntype']); -else +} else { $vpntype = "pptp"; - -if (htmlspecialchars($_POST['mode'])) +} +if (htmlspecialchars($_POST['mode'])) { $mode = htmlspecialchars($_POST['mode']); -elseif (htmlspecialchars($_GET['mode'])) +} elseif (htmlspecialchars($_GET['mode'])) { $mode = htmlspecialchars($_GET['mode']); -else +} else { $mode = "login"; - +} switch ($vpntype) { case 'pptp': $logname = "pptps"; @@ -77,10 +78,11 @@ switch ($vpntype) { } if ($_POST['clear']) { - if ($mode != "raw") + if ($mode != "raw") { clear_log_file("/var/log/vpn.log"); - else + } else { clear_log_file("/var/log/{$logname}.log"); + } } function dump_clog_vpn($logfile, $tail) { @@ -89,25 +91,28 @@ function dump_clog_vpn($logfile, $tail) { $sor = isset($config['syslog']['reverse']) ? "-r" : ""; $logarr = ""; - - if(isset($config['system']['usefifolog'])) + + if (isset($config['system']['usefifolog'])) { exec("/usr/sbin/fifolog_reader " . escapeshellarg($logfile) . " | tail {$sor} -n " . $tail, $logarr); - else + } else { exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . " | tail {$sor} -n " . $tail, $logarr); + } foreach ($logarr as $logent) { $logent = preg_split("/\s+/", $logent, 6); $llent = explode(",", $logent[5]); $iftype = substr($llent[1], 0, 4); - if ($iftype != $vpntype) + if ($iftype != $vpntype) { continue; + } echo "\n"; echo "" . htmlspecialchars(join(" ", array_slice($logent, 0, 3))) . "\n"; - if ($llent[0] == "login") + if ($llent[0] == "login") { echo "\"in\"\n"; - else + } else { echo "\"out\"\n"; + } echo "" . htmlspecialchars($llent[3]) . "\n"; echo "" . htmlspecialchars($llent[2]) . " \n"; @@ -163,7 +168,7 @@ include("head.inc"); ?> - +
@@ -178,9 +183,9 @@ include("head.inc"); - + endif; ?>

-- cgit v1.1