diff options
author | Renato Botelho <renato@netgate.com> | 2015-11-27 07:28:45 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-11-27 07:28:45 -0200 |
commit | 2b4ea5a413af1309dafb4a6da7e74c8e3183be35 (patch) | |
tree | 30f227e1ac4e075e396f7166f3265f1f979e849f /src/usr/local/www/widgets | |
parent | cbbb068d8c037cc7da1b070eff905561194cf67f (diff) | |
parent | 630d4aebdb3b8449b7da505a70f8446fd0093d45 (diff) | |
download | pfsense-2b4ea5a413af1309dafb4a6da7e74c8e3183be35.zip pfsense-2b4ea5a413af1309dafb4a6da7e74c8e3183be35.tar.gz |
Merge pull request #2126 from ExolonDX/branch_04
Diffstat (limited to 'src/usr/local/www/widgets')
11 files changed, 72 insertions, 53 deletions
diff --git a/src/usr/local/www/widgets/widgets/gateways.widget.php b/src/usr/local/www/widgets/widgets/gateways.widget.php index fdadf6e..ffbc342 100644 --- a/src/usr/local/www/widgets/widgets/gateways.widget.php +++ b/src/usr/local/www/widgets/widgets/gateways.widget.php @@ -81,9 +81,9 @@ if($_REQUEST && $_REQUEST['ajax']) { print("<thead>\n"); print( "<tr>\n"); print( "<th>" . gettext("Name") . "</th>\n"); - print( "<th>RTT</td>\n"); - print( "<th>" . gettext("Loss") . "</td>\n"); - print( "<th>" . gettext("Status") . "</td>\n"); + print( "<th>RTT</th>\n"); + print( "<th>" . gettext("Loss") . "</th>\n"); + print( "<th>" . gettext("Status") . "</th>\n"); print( "</tr>\n"); print("</thead>\n"); print("<tbody>\n"); @@ -194,7 +194,7 @@ if ($_POST) { <!-- close the body we're wrapped in and add a configuration-panel --> </div> -<script> +<script type="text/javascript"> //<![CDATA[ function get_gw_stats() { diff --git a/src/usr/local/www/widgets/widgets/gmirror_status.widget.php b/src/usr/local/www/widgets/widgets/gmirror_status.widget.php index e2d371d..6cb4bbb 100644 --- a/src/usr/local/www/widgets/widgets/gmirror_status.widget.php +++ b/src/usr/local/www/widgets/widgets/gmirror_status.widget.php @@ -66,7 +66,8 @@ require_once("gmirror.inc"); <?=gmirror_html_status()?> </div> -<script> +<script type="text/javascript"> +//<![CDATA[ function gmirrorStatusUpdateFromServer(){ $.ajax({ type: 'get', @@ -85,4 +86,5 @@ function gmirrorStatusUpdateFromServer(){ events.push(function(){ setInterval('gmirrorStatusUpdateFromServer()', 60*1000); }); -</script>
\ No newline at end of file +//]]> +</script> diff --git a/src/usr/local/www/widgets/widgets/interface_statistics.widget.php b/src/usr/local/www/widgets/widgets/interface_statistics.widget.php index 13a326f..339e3fe 100644 --- a/src/usr/local/www/widgets/widgets/interface_statistics.widget.php +++ b/src/usr/local/www/widgets/widgets/interface_statistics.widget.php @@ -67,7 +67,7 @@ require_once("functions.inc"); require_once("/usr/local/www/widgets/include/interface_statistics.inc"); // Compose the table contents and pass it back to the ajax caller -if($_REQUEST && $_REQUEST['ajax']) { +if ($_REQUEST && $_REQUEST['ajax']) { $rows = array( 'inpkts' => 'Packets In', @@ -100,8 +100,9 @@ if($_REQUEST && $_REQUEST['ajax']) { foreach ($ifdescrs as $ifdescr => $ifname) { $ifinfo = get_interface_info($ifdescr); - if ($ifinfo['status'] == "down") + if ($ifinfo['status'] == "down") { continue; + } $ifinfo['inbytes'] = format_bytes($ifinfo['inbytes']); $ifinfo['outbytes'] = format_bytes($ifinfo['outbytes']); @@ -121,7 +122,7 @@ if($_REQUEST && $_REQUEST['ajax']) { <tr><td><?=gettext("Retrieving interface data")?></td></tr> </table> -<script> +<script type="text/javascript"> //<![CDATA[ function get_if_stats() { @@ -146,4 +147,4 @@ if($_REQUEST && $_REQUEST['ajax']) { get_if_stats(); }); //]]> -</script>
\ No newline at end of file +</script> diff --git a/src/usr/local/www/widgets/widgets/ipsec.widget.php b/src/usr/local/www/widgets/widgets/ipsec.widget.php index 135c1c4..bffa87f 100644 --- a/src/usr/local/www/widgets/widgets/ipsec.widget.php +++ b/src/usr/local/www/widgets/widgets/ipsec.widget.php @@ -66,7 +66,7 @@ require_once("functions.inc"); require_once("ipsec.inc"); // Compose the table contents and pass it back to the ajax caller -if($_REQUEST && $_REQUEST['ajax']) { +if ($_REQUEST && $_REQUEST['ajax']) { if (isset($config['ipsec']['phase1'])) { $spd = ipsec_dump_spd(); @@ -213,9 +213,9 @@ if (isset($config['ipsec']['phase2'])): ?> <table class="table table-striped table-hover"> <thead> <tr> - <th>Active Tunnels</td> - <th>Inactive Tunnels</td> - <th>Mobile Users</td> + <th>Active Tunnels</th> + <th>Inactive Tunnels</th> + <th>Mobile Users</th> </tr> </thead> <tbody> @@ -262,7 +262,7 @@ if (isset($config['ipsec']['phase2'])): ?> // so now it lives here. It wouldn't hurt to update this functions and the tab display, but it // looks OK for now. The display_widget_tabs() function in guiconfig.inc would need to be updated to match ?> -<script> +<script type="text/javascript"> //<![CDATA[ curtab = "Overview"; diff --git a/src/usr/local/www/widgets/widgets/load_balancer_status.widget.php b/src/usr/local/www/widgets/widgets/load_balancer_status.widget.php index 7ec965f..91983b9 100644 --- a/src/usr/local/www/widgets/widgets/load_balancer_status.widget.php +++ b/src/usr/local/www/widgets/widgets/load_balancer_status.widget.php @@ -138,8 +138,9 @@ if (!$nentries) { } asort($pool_hosts); foreach ((array) $pool_hosts as $server) { - if(empty($server['ip']['addr'])) + if (empty($server['ip']['addr'])) { continue; + } switch ($server['ip']['state']) { case 'up': @@ -158,7 +159,7 @@ if (!$nentries) { <tr class="bg-<?=$bgcolor?>"> <td><?=$server['ip']['addr']?>:<?=$pool['port']?></td> <td> - <?php if($server['ip']['avail']): ?> + <?php if ($server['ip']['avail']): ?> ({$server['ip']['avail']}) <?php endif; ?> </td> diff --git a/src/usr/local/www/widgets/widgets/log.widget.php b/src/usr/local/www/widgets/widgets/log.widget.php index 5c2f9f1..822e365 100644 --- a/src/usr/local/www/widgets/widgets/log.widget.php +++ b/src/usr/local/www/widgets/widgets/log.widget.php @@ -113,15 +113,18 @@ if (isset($_POST['lastsawtime'])) { $filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 20); foreach ($filterlog as $idx => $row) { - if (strtotime($log_row['time']) <= $_POST['lastsawtime']) + if (strtotime($log_row['time']) <= $_POST['lastsawtime']) { unset($filterlog[$idx]); + } } -} -else +} else { $filterlog = conv_log_filter($filter_logfile, $nentries, 50, $filterfieldsarray); +} ?> -<script> +<script type="text/javascript"> +//<![CDATA[ var logWidgetLastRefresh = <?=time()?>; +//]]> </script> @@ -146,14 +149,15 @@ else $dstIP = htmlspecialchars($filterent['dstip']); } - if ($filterent['act'] == "block") + if ($filterent['act'] == "block") { $iconfn = "times"; - else if ($filterent['act'] == "reject") + } else if ($filterent['act'] == "reject") { $iconfn = "hand-stop-o"; - else if ($filterent['act'] == "match") + } else if ($filterent['act'] == "match") { $iconfn = "filter"; - else + } else { $iconfn = "check"; + } $rule = find_rule_by_number($filterent['rulenum'], $filterent['tracker'], $filterent['act']); @@ -186,11 +190,13 @@ else <?php /* for AJAX response, we only need the panel-body */ -if (isset($_GET['lastsawtime'])) +if (isset($_GET['lastsawtime'])) { exit; +} ?> -<script> +<script type="text/javascript"> +//<![CDATA[ function logWidgetUpdateFromServer(){ $.ajax({ type: 'get', @@ -210,6 +216,7 @@ function logWidgetUpdateFromServer(){ events.push(function(){ setInterval('logWidgetUpdateFromServer()', 60*1000); }); +//]]> </script> <!-- close the body we're wrapped in and add a configuration-panel --> @@ -260,7 +267,8 @@ events.push(function(){ </div> </form> -<script> +<script type="text/javascript"> +//<![CDATA[ if (typeof getURL == 'undefined') { getURL = function(url, callback) { if (!url) @@ -301,5 +309,5 @@ if (typeof getURL == 'undefined') { function outputrule(req) { alert(req.content); } - +//]]> </script> diff --git a/src/usr/local/www/widgets/widgets/ntp_status.widget.php b/src/usr/local/www/widgets/widgets/ntp_status.widget.php index 76cf4fc..037db1a 100644 --- a/src/usr/local/www/widgets/widgets/ntp_status.widget.php +++ b/src/usr/local/www/widgets/widgets/ntp_status.widget.php @@ -121,7 +121,7 @@ if ($_REQUEST['updateme']) { $gps_lon = $gps_lon * (($gps_vars[6] == "E") ? 1 : -1); $gps_la = $gps_vars[4]; $gps_lo = $gps_vars[6]; - }elseif (substr($tmp, 0, 6) == '$GPGGA') { + } elseif (substr($tmp, 0, 6) == '$GPGGA') { $gps_vars = explode(",", $tmp); $gps_ok = $gps_vars[6]; $gps_lat_deg = substr($gps_vars[2], 0, 2); @@ -137,7 +137,7 @@ if ($_REQUEST['updateme']) { $gps_sat = $gps_vars[7]; $gps_la = $gps_vars[3]; $gps_lo = $gps_vars[5]; - }elseif (substr($tmp, 0, 6) == '$GPGLL') { + } elseif (substr($tmp, 0, 6) == '$GPGLL') { $gps_vars = explode(",", $tmp); $gps_ok = ($gps_vars[6] == "A"); $gps_lat_deg = substr($gps_vars[1], 0, 2); @@ -157,9 +157,9 @@ if ($_REQUEST['updateme']) { if (isset($config['ntpd']['gps']['type']) && ($config['ntpd']['gps']['type'] == 'SureGPS') && (isset($gps_ok))) { //GSV message is only enabled by init commands in services_ntpd_gps.php for SureGPS board $gpsport = fopen("/dev/gps0", "r+"); - while($gpsport){ + while ($gpsport) { $buffer = fgets($gpsport); - if(substr($buffer, 0, 6)=='$GPGSV'){ + if (substr($buffer, 0, 6)=='$GPGSV') { //echo $buffer."\n"; $gpgsv = explode(',',$buffer); $gps_satview = $gpgsv[3]; @@ -173,7 +173,11 @@ if ($_REQUEST['updateme']) { <tr> <th>Server Time</th> <td id="ClockTime"> <!-- ntpStatusClock --> - <script>var ntpServerTime = new Date('<?=date_format(date_create(), 'c')?>');</script> + <script type="text/javascript"> + //<![CDATA[ + var ntpServerTime = new Date('<?=date_format(date_create(), 'c')?>'); + //]]> + </script> <!-- display initial value before javascript takes over --> <?=gmdate('D j Y H:i:s \G\M\T O (T)');?> </td> @@ -218,7 +222,8 @@ if ($_REQUEST['updateme']) { exit; } ?> -<script> +<script type="text/javascript"> +//<![CDATA[ function ntpWidgetUpdateFromServer(){ $.ajax({ type: 'get', @@ -241,7 +246,9 @@ function ntpWidgetUpdateDisplay(){ $('#ntpStatusClock').html(ntpServerTime.toString()); } +//]]> </script> + <script type="text/javascript"> //<![CDATA[ /* set up variables used to init clock in BODY's onLoad handler; @@ -256,7 +263,6 @@ function clockInit() { //]]> </script> - <script type="text/javascript"> //<![CDATA[ /*** simpleFindObj, by Andrew Shearer @@ -492,7 +498,7 @@ clockUpdate(); </tbody> </table> --> -<div id='ntpstatus'> +<div id="ntpstatus"> <table width="100%" border="0" cellspacing="0" cellpadding="0" summary="clock"> <tbody> <tr> diff --git a/src/usr/local/www/widgets/widgets/openvpn.widget.php b/src/usr/local/www/widgets/widgets/openvpn.widget.php index b97c2e4..064f207 100644 --- a/src/usr/local/www/widgets/widgets/openvpn.widget.php +++ b/src/usr/local/www/widgets/widgets/openvpn.widget.php @@ -160,7 +160,7 @@ $clients = openvpn_get_active_clients(); $evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd"; $rowIndex++; ?> - <tr name='<?php echo "r:{$server['mgmt']}:{$conn['remote_host']}"; ?>' class="<?=$evenRowClass?>"> + <tr name="<?php echo "r:{$server['mgmt']}:{$conn['remote_host']}"; ?>" class="<?=$evenRowClass?>"> <td> <?=$conn['common_name'];?> </td> @@ -168,13 +168,13 @@ $clients = openvpn_get_active_clients(); <?=$conn['remote_host'];?> </td> <td> - <i class="fa fa-times-circle" onclick="killClient('<?=$server['mgmt']; ?>', '<?=$conn['remote_host']; ?>');" style='cursor:pointer;' - name='<?php echo "i:{$server['mgmt']}:{$conn['remote_host']}"; ?>' + <i class="fa fa-times-circle" onclick="killClient('<?=$server['mgmt']; ?>', '<?=$conn['remote_host']; ?>');" style="cursor:pointer;" + name="<?php echo "i:{$server['mgmt']}:{$conn['remote_host']}"; ?>" title='Kill client connection from <?php echo $conn['remote_host']; ?>'> </i> </td> </tr> - <tr name='<?php echo "r:{$server['mgmt']}:{$conn['remote_host']}"; ?>' class="<?=$evenRowClass?>"> + <tr name="<?php echo "r:{$server['mgmt']}:{$conn['remote_host']}"; ?>" class="<?=$evenRowClass?>"> <td> <?=$conn['connect_time'];?> </td> @@ -212,7 +212,7 @@ $clients = openvpn_get_active_clients(); <?=$sk_server['remote_host'];?> </td> <td> - <?php +<?php if ($sk_server['status'] == "up") { /* tunnel is up */ echo '<i class="fa fa-arrow-up"></i>'; @@ -223,7 +223,7 @@ $clients = openvpn_get_active_clients(); ?> </td> </tr> - <tr name='<?php echo "r:{$sk_server['port']}:{$sk_server['remote_host']}"; ?>'> + <tr name="<?php echo "r:{$sk_server['port']}:{$sk_server['remote_host']}"; ?>"> <td> <?=$sk_server['connect_time'];?> </td> @@ -254,7 +254,7 @@ $clients = openvpn_get_active_clients(); </thead> <tbody> <?php foreach ($clients as $client): ?> - <tr name='<?php echo "r:{$client['port']}:{$client['remote_host']}"; ?>'> + <tr name="<?php echo "r:{$client['port']}:{$client['remote_host']}"; ?>"> <td> <?=$client['name'];?> </td> @@ -262,7 +262,7 @@ $clients = openvpn_get_active_clients(); <?=$client['remote_host'];?> </td> <td> - <?php +<?php if ($client['status'] == "up") { /* tunnel is up */ echo '<i class="fa fa-arrow-up"></i>'; @@ -274,7 +274,7 @@ $clients = openvpn_get_active_clients(); ?> </td> </tr> - <tr name='<?php echo "r:{$client['port']}:{$client['remote_host']}"; ?>'> + <tr name="<?php echo "r:{$client['port']}:{$client['remote_host']}"; ?>"> <td> <?=$client['connect_time'];?> </td> diff --git a/src/usr/local/www/widgets/widgets/rss.widget.php b/src/usr/local/www/widgets/widgets/rss.widget.php index 3d5fe8d..b7d3f9d 100644 --- a/src/usr/local/www/widgets/widgets/rss.widget.php +++ b/src/usr/local/www/widgets/widgets/rss.widget.php @@ -120,8 +120,9 @@ if ($config['widgets']['rssfeed']) { exec("chmod a+rw /tmp/simplepie/cache/."); require_once("simplepie/simplepie.inc"); function textLimit($string, $length, $replacer = '...') { - if(strlen($string) > $length) + if (strlen($string) > $length) { return (preg_match('/^(.*)\W.*$/', substr($string, 0, $length+1), $matches) ? $matches[1] : substr($string, 0, $length)) . $replacer; + } return $string; } $feed = new SimplePie(); @@ -130,7 +131,7 @@ if ($config['widgets']['rssfeed']) { $feed->init(); $feed->handle_content_type(); $counter = 1; - foreach($feed->get_items(0, $max_items) as $item) { + foreach ($feed->get_items(0, $max_items) as $item) { $feed = $item->get_feed(); $feed->strip_htmltags(); $content = $item->get_content(); diff --git a/src/usr/local/www/widgets/widgets/system_information.widget.php b/src/usr/local/www/widgets/widgets/system_information.widget.php index 3961d41..e89e8e1 100644 --- a/src/usr/local/www/widgets/widgets/system_information.widget.php +++ b/src/usr/local/www/widgets/widgets/system_information.widget.php @@ -303,8 +303,8 @@ $filesystems = get_mounted_filesystems(); </tbody> </table> -<script> - +<script type="text/javascript"> +//<![CDATA[ function systemStatusGetUpdateStatus() { $.ajax({ type: 'get', @@ -530,5 +530,5 @@ function widgetActive(x) { events.push(function(){ setTimer(); }); - +//]]> </script> diff --git a/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php b/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php index 2bf8c14..19e670e 100644 --- a/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php +++ b/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php @@ -96,7 +96,7 @@ if ($_POST) { $a_config["shown"]["item"] = array(); foreach ($ifdescrs as $ifname => $ifdescr) { - if(in_array($ifname, $_POST["shown"])) { + if (in_array($ifname, $_POST["shown"])) { $a_config["shown"]["item"][] = $ifname; } } @@ -165,7 +165,7 @@ foreach ($ifdescrs as $ifname => $ifdescr): <div class="col-sm-6 checkbox"> <?php foreach ($ifdescrs as $ifname => $ifdescr): ?> <label> - <input type="checkbox" name="shown[]"<?= $ifname?>]" value="<?=$ifname?>" <?= ($shown[$ifname]) ? "checked":""?> /> + <input type="checkbox" name="shown[]"<?= $ifname?>]" value="<?=$ifname?>" <?= ($shown[$ifname]) ? "checked=\"checked\"":""?> /> <?=$ifname?> </label> <?php endforeach; ?> |