Commit 43941926 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) refactor status_interfaces.php

parent 28e9593e
...@@ -37,44 +37,39 @@ require_once("openvpn.inc"); ...@@ -37,44 +37,39 @@ require_once("openvpn.inc");
require_once("unbound.inc"); require_once("unbound.inc");
require_once("services.inc"); require_once("services.inc");
if ($_POST['if'] && $_POST['submit']) { if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!empty($_POST['if']) && !empty($_POST['submit'])) {
$interface = $_POST['if']; $interface = $_POST['if'];
if ($_POST['status'] == 'up') { if (!empty($_POST['status']) && $_POST['status'] == 'up') {
interface_bring_down($interface); interface_bring_down($interface);
} else { } else {
interface_configure($interface); interface_configure($interface);
} }
header("Location: status_interfaces.php"); header("Location: status_interfaces.php");
exit; exit;
}
} }
include("head.inc"); include("head.inc");
?> ?>
<body> <body>
<?php include("fbegin.inc"); ?> <?php include("fbegin.inc"); ?>
<section class="page-content-main">
<section class="page-content-main">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<section class="col-xs-12"> <section class="col-xs-12">
<div class="content-box"> <?php
foreach (get_configured_interface_with_descr(false, true) as $ifdescr => $ifname):
<div class="table-responsive">
<table class="table table-striped">
<?php
$i = 0;
$ifdescrs = get_configured_interface_with_descr(false, true);
foreach ($ifdescrs as $ifdescr => $ifname):
$ifinfo = get_interface_info($ifdescr); $ifinfo = get_interface_info($ifdescr);
legacy_html_escape_form_data($ifinfo);
$ifdescr = htmlspecialchars($ifdescr);
$ifname = htmlspecialchars($ifname);
// Load MAC-Manufacturer table // Load MAC-Manufacturer table
$mac_man = load_mac_manufacturer_table(); $mac_man = load_mac_manufacturer_table();?>
?> <div class="tab-content content-box col-xs-12 __mb">
<div class="table-responsive">
<table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th colspan="2" class="listtopic"> <th colspan="2" class="listtopic">
...@@ -82,170 +77,169 @@ include("head.inc"); ...@@ -82,170 +77,169 @@ include("head.inc");
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Status"); ?></td> <td width="22%"><?=gettext("Status"); ?></td>
<td width="78%" class="listr"> <td width="78%"><?=$ifinfo['status'];?></td>
<?=htmlspecialchars($ifinfo['status']);?>
</td>
</tr> </tr>
<?php if ($ifinfo['dhcplink']): ?> <?php
<tr> if (!empty($ifinfo['dhcplink'])): ?>
<td width="22%" class="vncellt"> <tr>
DHCP <td> <?=gettext("DHCP");?></td>
</td> <td>
<td width="78%" class="listr"> <form name="dhcplink_form" method="post">
<form name="dhcplink_form" action="status_interfaces.php" method="post"> <input type="hidden" name="if" value="<?=$ifdescr; ?>" />
<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" /> <input type="hidden" name="status" value="<?=$ifinfo['dhcplink']; ?>" />
<input type="hidden" name="status" value="<?php echo $ifinfo['dhcplink']; ?>" /> <?=$ifinfo['dhcplink'];?>&nbsp;&nbsp;
<?=htmlspecialchars($ifinfo['dhcplink']);?>&nbsp;&nbsp; <input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?=$ifinfo['dhcplink'] == "up" ? gettext("Release") : gettext("Renew"); ?>" />
<?php $action = ($ifinfo['dhcplink'] == "up" ? gettext("Release") : gettext("Renew")); ?>
<input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?php echo $action; ?>" />
</form> </form>
</td> </td>
</tr> </tr>
<?php endif; <?php
if ($ifinfo['dhcp6link']): ?> endif;
<tr> if (!empty($ifinfo['dhcp6link'])): ?>
<td width="22%" class="vncellt"> <tr>
DHCP6 <td> <?=gettext("DHCP6");?></td>
</td> <td>
<td width="78%" class="listr"> <form name="dhcp6link_form" method="post">
<form name="dhcp6link_form" action="status_interfaces.php" method="post"> <input type="hidden" name="if" value="<?=$ifdescr; ?>" />
<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" /> <input type="hidden" name="status" value="<?=$ifinfo['dhcp6link']; ?>" />
<input type="hidden" name="status" value="<?php echo $ifinfo['dhcp6link']; ?>" /> <?=$ifinfo['dhcp6link'];?>&nbsp;&nbsp;
<?=htmlspecialchars($ifinfo['dhcp6link']);?>&nbsp;&nbsp; <input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?= $ifinfo['dhcp6link'] == "up" ? gettext("Release") : gettext("Renew"); ?>" />
<?php $action = ($ifinfo['dhcp6link'] == "up" ? gettext("Release") : gettext("Renew")); ?>
<input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?php echo $action; ?>" />
</form> </form>
</td> </td>
</tr> </tr>
<?php endif; if ($ifinfo['pppoelink']): ?> <?php
<tr> endif;
<td width="22%" class="vncellt"><?=gettext("PPPoE"); ?></td> if (!empty($ifinfo['pppoelink'])): ?>
<td width="78%" class="listr"> <tr>
<form name="pppoelink_form" action="status_interfaces.php" method="post"> <td><?=gettext("PPPoE"); ?></td>
<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" /> <td>
<input type="hidden" name="status" value="<?php echo $ifinfo['pppoelink']; ?>" /> <form name="pppoelink_form" method="post">
<?=htmlspecialchars($ifinfo['pppoelink']);?>&nbsp;&nbsp; <input type="hidden" name="if" value="<?=$ifdescr; ?>" />
<?php $action = ($ifinfo['pppoelink'] == "up" ? gettext("Disconnect") : gettext("Connect")); ?> <input type="hidden" name="status" value="<?=$ifinfo['pppoelink']; ?>" />
<input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?php echo $action; ?>" /> <?=$ifinfo['pppoelink'];?>&nbsp;&nbsp;
<input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?=$ifinfo['pppoelink'] == "up" ? gettext("Disconnect") : gettext("Connect"); ?>" />
</form> </form>
</td> </td>
</tr> </tr>
<?php endif; if ($ifinfo['pptplink']): ?> <?php
<tr> endif;
<td width="22%" class="vncellt"><?=gettext("PPTP"); ?></td> if (!empty($ifinfo['pptplink'])): ?>
<td width="78%" class="listr"> <tr>
<form name="pptplink_form" action="status_interfaces.php" method="post"> <td><?=gettext("PPTP"); ?></td>
<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" /> <td>
<input type="hidden" name="status" value="<?php echo $ifinfo['pptplink']; ?>" /> <form name="pptplink_form" method="post">
<?=htmlspecialchars($ifinfo['pptplink']);?>&nbsp;&nbsp; <input type="hidden" name="if" value="<?=$ifdescr; ?>" />
<?php $action = ($ifinfo['pptplink'] == "up" ? gettext("Disconnect") : gettext("Connect")); ?> <input type="hidden" name="status" value="<?=$ifinfo['pptplink']; ?>" />
<input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?php echo $action; ?>" /> <?=$ifinfo['pptplink'];?>&nbsp;&nbsp;
<input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?=$ifinfo['pptplink'] == "up" ? gettext("Disconnect") : gettext("Connect");?>" />
</form> </form>
</td> </td>
</tr> </tr>
<?php endif; if ($ifinfo['l2tplink']): ?> <?php
<tr> endif;
<td width="22%" class="vncellt"><?=gettext("L2TP"); ?></td> if (!empty($ifinfo['l2tplink'])): ?>
<td width="78%" class="listr"> <tr>
<form name="l2tplink_form" action="status_interfaces.php" method="post"> <td><?=gettext("L2TP"); ?></td>
<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" /> <td>
<input type="hidden" name="status" value="<?php echo $ifinfo['l2tplink']; ?>" /> <form name="l2tplink_form" method="post">
<?=htmlspecialchars($ifinfo['l2tplink']);?>&nbsp;&nbsp; <input type="hidden" name="if" value="<?=$ifdescr; ?>" />
<?php $action = ($ifinfo['l2tplink'] == "up" ? gettext("Disconnect") : gettext("Connect")); ?> <input type="hidden" name="status" value="<?=$ifinfo['l2tplink']; ?>" />
<input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?php echo $action; ?>" /> <?=$ifinfo['l2tplink'];?>&nbsp;&nbsp;
<input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?=$ifinfo['l2tplink'] == "up" ? gettext("Disconnect") : gettext("Connect");?>" />
</form> </form>
</td> </td>
</tr> </tr>
<?php endif; if ($ifinfo['ppplink']): ?> <?php
<tr> endif;
<td width="22%" class="vncellt"><?=gettext("PPP"); ?></td> if (!empty($ifinfo['ppplink'])): ?>
<td width="78%" class="listr"> <tr>
<form name="ppplink_form" action="status_interfaces.php" method="post"> <td><?=gettext("PPP"); ?></td>
<input type="hidden" name="if" value="<?php echo $ifdescr; ?>" /> <td>
<input type="hidden" name="status" value="<?php echo $ifinfo['ppplink']; ?>" /> <form name="ppplink_form" method="post">
<?=htmlspecialchars($ifinfo['pppinfo']);?> <input type="hidden" name="if" value="<?=$ifdescr; ?>" />
<input type="hidden" name="status" value="<?=$ifinfo['ppplink']; ?>" />
<?=$ifinfo['pppinfo'];?>
<?php if ($ifinfo['ppplink'] == "up"): ?> <?php if ($ifinfo['ppplink'] == "up"): ?>
<input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?php echo gettext("Disconnect"); ?>" /> <input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?=gettext("Disconnect"); ?>" />
<?php else: ?> <?php else: ?>
<?php if (!$ifinfo['nodevice']): ?> <?php if (!$ifinfo['nodevice']): ?>
<input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?php echo gettext("Connect"); ?>" /> <input type="submit" name="submit" class="btn btn-primary btn-xs" value="<?=gettext("Connect"); ?>" />
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
</form> </form>
</td> </td>
</tr> </tr>
<?php endif; if ($ifinfo['ppp_uptime'] || $ifinfo['ppp_uptime_accumulated']): ?> <?php
endif;
if (!empty($ifinfo['ppp_uptime']) || !empty($ifinfo['ppp_uptime_accumulated'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Uptime ");?><?php if ($ifinfo['ppp_uptime_accumulated']) echo "(historical)"; ?></td> <td><?=gettext("Uptime ");?><?=!empty($ifinfo['ppp_uptime_accumulated']) ? "(historical)" : ""; ?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['ppp_uptime'];?> <?=$ifinfo['ppp_uptime_accumulated'];?></td>
<?=htmlspecialchars($ifinfo['ppp_uptime']);?> <?=htmlspecialchars($ifinfo['ppp_uptime_accumulated']);?>
</td>
</tr> </tr>
<?php endif; if ($ifinfo['cell_rssi']): ?> <?php
endif;
if (!empty($ifinfo['cell_rssi'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Cell Signal (RSSI)");?></td> <td><?=gettext("Cell Signal (RSSI)");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['cell_rssi'];?></td>
<?=htmlspecialchars($ifinfo['cell_rssi']);?>
</td>
</tr> </tr>
<?php endif; if ($ifinfo['cell_mode']): ?> <?php
endif;
if (!empty($ifinfo['cell_mode'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Cell Mode");?></td> <td><?=gettext("Cell Mode");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['cell_mode'];?></td>
<?=htmlspecialchars($ifinfo['cell_mode']);?>
</td>
</tr> </tr>
<?php endif; if ($ifinfo['cell_simstate']): ?> <?php
endif;
if (!empty($ifinfo['cell_simstate'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Cell SIM State");?></td> <td><?=gettext("Cell SIM State");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['cell_simstate'];?></td>
<?=htmlspecialchars($ifinfo['cell_simstate']);?>
</td>
</tr> </tr>
<?php endif; if ($ifinfo['cell_service']): ?> <?php
endif;
if (!empty($ifinfo['cell_service'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Cell Service");?></td> <td><?=gettext("Cell Service");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['cell_service'];?></td>
<?=htmlspecialchars($ifinfo['cell_service']);?>
</td>
</tr> </tr>
<?php endif; if ($ifinfo['cell_bwupstream']): ?> <?php
endif;
if (!empty($ifinfo['cell_bwupstream'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Cell Upstream");?></td> <td><?=gettext("Cell Upstream");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['cell_bwupstream'];?> <?=gettext("kbit/s");?></td>
<?=htmlspecialchars($ifinfo['cell_bwupstream']);?> kbit/s
</td>
</tr> </tr>
<?php endif; if ($ifinfo['cell_bwdownstream']): ?> <?php
endif;
if (!empty($ifinfo['cell_bwdownstream'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Cell Downstream");?></td> <td><?=gettext("Cell Downstream");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['cell_bwdownstream'];?> <?=gettext("kbit/s");?></td>
<?=htmlspecialchars($ifinfo['cell_bwdownstream']);?> kbit/s
</td>
</tr> </tr>
<?php endif; if ($ifinfo['cell_upstream']): ?> <?php
endif;
if (!empty($ifinfo['cell_upstream'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Cell Current Up");?></td> <td><?=gettext("Cell Current Up");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['cell_upstream'];?> <?=gettext("kbit/s");?></td>
<?=htmlspecialchars($ifinfo['cell_upstream']);?> kbit/s
</td>
</tr> </tr>
<?php endif; if ($ifinfo['cell_downstream']): ?> <?php
endif;
if (!empty($ifinfo['cell_downstream'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Cell Current Down");?></td> <td><?=gettext("Cell Current Down");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['cell_downstream'];?> <?=gettext("kbit/s");?></td>
<?=htmlspecialchars($ifinfo['cell_downstream']);?> kbit/s
</td>
</tr> </tr>
<?php endif; if ($ifinfo['macaddr']): ?> <?php
endif;
if ($ifinfo['macaddr']): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("MAC address");?></td> <td><?=gettext("MAC address");?></td>
<td width="78%" class="listr"> <td>
<?php <?php
$mac=$ifinfo['macaddr']; $mac=$ifinfo['macaddr'];
$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
...@@ -254,188 +248,176 @@ include("head.inc"); ...@@ -254,188 +248,176 @@ include("head.inc");
?> ?>
</td> </td>
</tr> </tr>
<?php endif; if ($ifinfo['status'] != "down"): ?> <?php
<?php if ($ifinfo['dhcplink'] != "down" && $ifinfo['pppoelink'] != "down" && $ifinfo['pptplink'] != "down"): ?> endif;
<?php if ($ifinfo['ipaddr']): ?> if ($ifinfo['status'] != "down"):
if ($ifinfo['dhcplink'] != "down" && $ifinfo['pppoelink'] != "down" && $ifinfo['pptplink'] != "down"):
if ($ifinfo['ipaddr']):?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("IPv4 address");?></td> <td><?=gettext("IPv4 address");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['ipaddr'];?></td>
<?=htmlspecialchars($ifinfo['ipaddr']);?>
&nbsp;
</td>
</tr> </tr>
<?php endif; ?><?php if ($ifinfo['subnet']): ?> <?php
endif;
if (!empty($ifinfo['subnet'])):?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Subnet mask IPv4");?></td> <td><?=gettext("Subnet mask IPv4");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['subnet'];?></td>
<?=htmlspecialchars($ifinfo['subnet']);?>
</td>
</tr> </tr>
<?php endif; ?><?php if ($ifinfo['gateway']): ?> <?php
endif;
if (!empty($ifinfo['gateway'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Gateway IPv4");?></td> <td><?=gettext("Gateway IPv4");?></td>
<td width="78%" class="listr"> <td><?=htmlspecialchars($config['interfaces'][$ifdescr]['gateway']);?> <?=$ifinfo['gateway'];?></td>
<?=htmlspecialchars($config['interfaces'][$ifdescr]['gateway']);?>
<?=htmlspecialchars($ifinfo['gateway']);?>
</td>
</tr> </tr>
<?php endif; ?><?php if ($ifinfo['linklocal']): ?> <?php
endif;
if (!empty($ifinfo['linklocal'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("IPv6 Link Local");?></td> <td><?=gettext("IPv6 Link Local");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['linklocal'];?></td>
<?=htmlspecialchars($ifinfo['linklocal']);?>
&nbsp;
</td>
</tr> </tr>
<?php endif; ?><?php if ($ifinfo['ipaddrv6']): ?> <?php
endif;
if (!empty($ifinfo['ipaddrv6'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("IPv6 address");?></td> <td><?=gettext("IPv6 address");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['ipaddrv6'];?></td>
<?=htmlspecialchars($ifinfo['ipaddrv6']);?>
&nbsp;
</td>
</tr> </tr>
<?php endif; ?><?php if ($ifinfo['subnetv6']): ?> <?php
endif;
if (!empty($ifinfo['subnetv6'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Subnet mask IPv6");?></td> <td><?=gettext("Subnet mask IPv6");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['subnetv6'];?></td>
<?=htmlspecialchars($ifinfo['subnetv6']);?>
</td>
</tr> </tr>
<?php endif; ?><?php if ($ifinfo['gatewayv6']): ?> <?php
endif;
if (!empty($ifinfo['gatewayv6'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Gateway IPv6");?></td> <td><?=gettext("Gateway IPv6");?></td>
<td width="78%" class="listr"> <td><?=htmlspecialchars($config['interfaces'][$ifdescr]['gatewayv6']);?> <?=$ifinfo['gatewayv6'];?></td>
<?=htmlspecialchars($config['interfaces'][$ifdescr]['gatewayv6']);?>
<?=htmlspecialchars($ifinfo['gatewayv6']);?>
</td>
</tr> </tr>
<?php endif; if ($ifdescr == 'wan' && file_exists('/etc/resolv.conf')): ?> <?php
endif;
if ($ifdescr == 'wan' && file_exists('/etc/resolv.conf')): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("ISP DNS servers");?></td> <td><?=gettext("ISP DNS servers");?></td>
<td width="78%" class="listr"> <td>
<?php <?php
$dns_servers = get_dns_servers(); foreach(get_dns_servers() as $dns) {
foreach($dns_servers as $dns) {
echo "{$dns}<br />"; echo "{$dns}<br />";
} }?>
?>
</td> </td>
</tr> </tr>
<?php endif; endif; if ($ifinfo['media']): ?> <?php
endif;
endif;
if (!empty($ifinfo['media'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Media");?></td> <td><?=gettext("Media");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['media'];?></td>
<?=htmlspecialchars($ifinfo['media']);?>
</td>
</tr> </tr>
<?php endif; if ($ifinfo['laggproto']): ?> <?php
endif;
if (!empty($ifinfo['laggproto'])):?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("LAGG Protocol");?></td> <td><?=gettext("LAGG Protocol");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['laggproto'];?></td>
<?=htmlspecialchars($ifinfo['laggproto']);?>
</td>
</tr> </tr>
<?php endif; if (is_array($ifinfo['laggport'])): ?> <?php
endif;
if (!empty($ifinfo['laggport']) && is_array($ifinfo['laggport'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("LAGG Ports");?></td> <td><?=gettext("LAGG Ports");?></td>
<td width="78%" class="listr"> <td>
<?php foreach ($ifinfo['laggport'] as $laggport) { ?> <?php foreach ($ifinfo['laggport'] as $laggport) { ?>
<?php echo htmlspecialchars($laggport); ?><br /> <?=$laggport;?><br />
<?php } ?> <?php } ?>
</td> </td>
</tr> </tr>
<?php endif; ?><?php if ($ifinfo['channel']): ?> <?php
endif;
if (!empty($ifinfo['channel'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Channel");?></td> <td><?=gettext("Channel");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['channel'];?></td>
<?=htmlspecialchars($ifinfo['channel']);?>
</td>
</tr> </tr>
<?php endif; ?><?php if ($ifinfo['ssid']): ?> <?php
endif;
if (!empty($ifinfo['ssid'])):?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("SSID");?></td> <td><?=gettext("SSID");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['ssid'];?></td>
<?=htmlspecialchars($ifinfo['ssid']);?>
</td>
</tr> </tr>
<?php endif; ?><?php if ($ifinfo['bssid']): ?> <?php
endif;
if (!empty($ifinfo['bssid'])):?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("BSSID");?></td> <td><?=gettext("BSSID");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['bssid'];?></td>
<?=htmlspecialchars($ifinfo['bssid']);?>
</td>
</tr> </tr>
<?php endif; ?><?php if ($ifinfo['rate']): ?> <?php
endif;
if (!empty($ifinfo['rate'])):?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Rate");?></td> <td><?=gettext("Rate");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['rate'];?></td>
<?=htmlspecialchars($ifinfo['rate']);?>
</td>
</tr> </tr>
<?php endif; ?><?php if ($ifinfo['rssi']): ?> <?php
endif;
if (!empty($ifinfo['rssi'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("RSSI");?></td> <td><?=gettext("RSSI");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['rssi'];?></td>
<?=htmlspecialchars($ifinfo['rssi']);?>
</td>
</tr> </tr>
<?php endif; ?> <?php
endif; ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("In/out packets");?></td> <td><?=gettext("In/out packets");?></td>
<td width="78%" class="listr"> <td> <?=$ifinfo['inpkts'];?> / <?=$ifinfo['outpkts'];?>
<?php (<?=format_bytes($ifinfo['inbytes']);?> / <?=format_bytes($ifinfo['outbytes']);?> )
echo htmlspecialchars($ifinfo['inpkts'] . "/" . $ifinfo['outpkts'] . " (");
echo htmlspecialchars(format_bytes($ifinfo['inbytes']) . "/" . format_bytes($ifinfo['outbytes']) . ")");
?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("In/out packets (pass)");?></td> <td><?=gettext("In/out packets (pass)");?></td>
<td width="78%" class="listr"> <td> <?=$ifinfo['inpktspass'];?> / <?=$ifinfo['outpktspass'];?>
<?php (<?=format_bytes($ifinfo['inbytespass']);?> / <?=format_bytes($ifinfo['outbytespass']);?> )
echo htmlspecialchars($ifinfo['inpktspass'] . "/" . $ifinfo['outpktspass'] . " (");
echo htmlspecialchars(format_bytes($ifinfo['inbytespass']) . "/" . format_bytes($ifinfo['outbytespass']) . ")");
?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("In/out packets (block)");?></td> <td><?=gettext("In/out packets (block)");?></td>
<td width="78%" class="listr"> <td> <?=$ifinfo['inpktsblock'];?> / <?=$ifinfo['outpktsblock'];?>
<?php (<?=format_bytes($ifinfo['inbytesblock']);?> / <?=format_bytes($ifinfo['outbytesblock']);?> )
echo htmlspecialchars($ifinfo['inpktsblock'] . "/" . $ifinfo['outpktsblock'] . " (");
echo htmlspecialchars(format_bytes($ifinfo['inbytesblock']) . "/" . format_bytes($ifinfo['outbytesblock']) . ")");
?>
</td> </td>
</tr> </tr>
<?php if (isset($ifinfo['inerrs'])): ?> <?php
if (isset($ifinfo['inerrs'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("In/out errors");?></td> <td><?=gettext("In/out errors");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['inerrs'] . "/" . $ifinfo['outerrs'];?></td>
<?=htmlspecialchars($ifinfo['inerrs'] . "/" . $ifinfo['outerrs']);?>
</td>
</tr> </tr>
<?php endif; ?> <?php
<?php if (isset($ifinfo['collisions'])): ?> endif;
if (isset($ifinfo['collisions'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Collisions");?></td> <td><?=gettext("Collisions");?></td>
<td width="78%" class="listr"> <td><?=$ifinfo['collisions'];?></td>
<?=htmlspecialchars($ifinfo['collisions']);?>
</td>
</tr> </tr>
<?php endif; ?> <?php
<?php endif; ?> endif;
<?php if ($ifinfo['bridge']): ?> endif;
if (!empty($ifinfo['bridge'])): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?php printf(gettext("Bridge (%s)"),$ifinfo['bridgeint']);?></td> <td><?php printf(gettext("Bridge (%s)"),$ifinfo['bridgeint']);?></td>
<td width="78%" class="listr"> <td>
<?=$ifinfo['bridge'];?> <?=$ifinfo['bridge'];?>
</td> </td>
</tr> </tr>
<?php endif; ?> <?php
endif;
<?php if(file_exists("/usr/bin/vmstat")): ?> if(file_exists("/usr/bin/vmstat")):
<?php
$real_interface = ""; $real_interface = "";
$interrupt_total = ""; $interrupt_total = "";
$interrupt_sec = ""; $interrupt_sec = "";
...@@ -447,12 +429,10 @@ include("head.inc"); ...@@ -447,12 +429,10 @@ include("head.inc");
$interrupt_sec = `vmstat -i | grep $real_interface | awk '{ print $5 }'`; $interrupt_sec = `vmstat -i | grep $real_interface | awk '{ print $5 }'`;
} }
unset($interrupt_total); // XXX: FIX ME! Need a regex and parse correct data 100% of the time. unset($interrupt_total); // XXX: FIX ME! Need a regex and parse correct data 100% of the time.
?> if($interrupt_total): ?>
<?php if($interrupt_total): ?>
<tr> <tr>
<td width="22%" class="vncellt"><?=gettext("Interrupts/Second");?></td> <td><?=gettext("Interrupts/Second");?></td>
<td width="78%" class="listr"> <td>
<?php <?php
echo $interrupt_total . " " . gettext("total"); echo $interrupt_total . " " . gettext("total");
echo "<br />"; echo "<br />";
...@@ -460,26 +440,33 @@ include("head.inc"); ...@@ -460,26 +440,33 @@ include("head.inc");
?> ?>
</td> </td>
</tr> </tr>
<?php endif; ?> <?php
<?php endif; ?> endif;
<?php $i++; endforeach; ?> endif; ?>
</tbody> </tbody>
</table> </table>
</div>
<div class="col-xs-12"> </div>
<p><?php printf(gettext("Using dial-on-demand will bring the connection up again if any packet ". <?php
endforeach; ?>
<div class="tab-content content-box col-xs-12 __mb">
<div class="table-responsive">
<table class="table table-striped">
<tr>
<td>
<?php printf(gettext("Using dial-on-demand will bring the connection up again if any packet ".
"triggers it. To substantiate this point: disconnecting manually ". "triggers it. To substantiate this point: disconnecting manually ".
"will %snot%s prevent dial-on-demand from making connections ". "will %snot%s prevent dial-on-demand from making connections ".
"to the outside! Don't use dial-on-demand if you want to make sure that the line ". "to the outside! Don't use dial-on-demand if you want to make sure that the line ".
"is kept disconnected."),'<strong>','</strong>')?></p><br /> "is kept disconnected."),'<strong>','</strong>')?>
</div> </td>
</tr>
</table>
</div> </div>
</div> </div>
</section> </section>
</div> </div>
</div> </div>
</section> </section>
<?php include("foot.inc"); ?> <?php include("foot.inc"); ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment