summaryrefslogtreecommitdiffstats
path: root/usr/local/www/diag_ping.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-04-19 18:00:00 +0545
committerPhil Davis <phil.davis@inf.org>2015-04-19 18:00:00 +0545
commit5f6010605ba8e3ab2fbc27080ec2db80dbd0e32e (patch)
treecd25c71caf551eb882f460ac6e1c32c8220fe58f /usr/local/www/diag_ping.php
parent0608bd3c354ea76eb6df9ed9322e2ef8686f15e7 (diff)
downloadpfsense-5f6010605ba8e3ab2fbc27080ec2db80dbd0e32e.zip
pfsense-5f6010605ba8e3ab2fbc27080ec2db80dbd0e32e.tar.gz
Code style usr-local-www diag
Diffstat (limited to 'usr/local/www/diag_ping.php')
-rw-r--r--usr/local/www/diag_ping.php27
1 files changed, 16 insertions, 11 deletions
diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php
index 0c289cf..954d9f2 100644
--- a/usr/local/www/diag_ping.php
+++ b/usr/local/www/diag_ping.php
@@ -13,11 +13,11 @@
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -47,7 +47,6 @@ $allowautocomplete = true;
$pgtitle = array(gettext("Diagnostics"), gettext("Ping"));
require_once("guiconfig.inc");
-
define('MAX_COUNT', 10);
define('DEFAULT_COUNT', 3);
@@ -66,17 +65,20 @@ if ($_POST || $_REQUEST['host']) {
$host = trim($_REQUEST['host']);
$ipproto = $_REQUEST['ipproto'];
- if (($ipproto == "ipv4") && is_ipaddrv6($host))
+ if (($ipproto == "ipv4") && is_ipaddrv6($host)) {
$input_errors[] = gettext("When using IPv4, the target host must be an IPv4 address or hostname.");
- if (($ipproto == "ipv6") && is_ipaddrv4($host))
+ }
+ if (($ipproto == "ipv6") && is_ipaddrv4($host)) {
$input_errors[] = gettext("When using IPv6, the target host must be an IPv6 address or hostname.");
+ }
if (!$input_errors) {
$do_ping = true;
$sourceip = $_REQUEST['sourceip'];
$count = $_POST['count'];
- if (preg_match('/[^0-9]/', $count) )
+ if (preg_match('/[^0-9]/', $count) ) {
$count = DEFAULT_COUNT;
+ }
}
}
if (!isset($do_ping)) {
@@ -118,8 +120,9 @@ include("head.inc"); ?>
<?php $sourceips = get_possible_traffic_source_addresses(true);
foreach ($sourceips as $sipvalue => $sipname):
$selected = "";
- if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip))
+ if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip)) {
$selected = "selected=\"selected\"";
+ }
?>
<option value="<?=$sipvalue;?>" <?=$selected;?>>
<?=htmlspecialchars($sipname);?>
@@ -152,7 +155,7 @@ include("head.inc"); ?>
?>
<script type="text/javascript">
//<![CDATA[
- window.onload=function(){
+ window.onload=function() {
document.getElementById("pingCaptured").wrap='off';
}
//]]>
@@ -164,15 +167,17 @@ include("head.inc"); ?>
if ($ipproto == "ipv6") {
$command .= "6";
$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
- if (is_linklocal($ifaddr))
+ if (is_linklocal($ifaddr)) {
$ifscope = get_ll_scope($ifaddr);
+ }
} else {
$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip);
}
if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) {
$srcip = "-S" . escapeshellarg($ifaddr);
- if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope))
+ if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope)) {
$host .= "%{$ifscope}";
+ }
}
$cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host);
OpenPOWER on IntegriCloud