raspap-webgui-mirror/templates/dashboard.php

152 lines
7.6 KiB
PHP
Raw Normal View History

2019-08-18 23:04:53 +00:00
<?php
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
2019-08-18 23:04:53 +00:00
if ($arrHostapdConf['WifiAPEnable'] == 1) {
$client_interface = 'uap0';
2019-08-18 23:04:53 +00:00
} else {
$client_interface = $_SESSION['wifi_client_interface'];
}
$ap_iface = $_SESSION['ap_interface'];
2020-03-24 16:21:59 +00:00
$MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"';
if ($arrHostapdConf['BridgedEnable'] == 1) {
2020-06-07 16:15:13 +00:00
$moreLink = "index.php?page=hostapd_conf";
exec('iw dev '.$ap_iface.' station dump | grep -oE '.$MACPattern, $clients);
} else {
2020-06-07 16:15:13 +00:00
$moreLink = "index.php?page=dhcpd_conf";
exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(iw dev '.$ap_iface.' station dump | grep -oE '.$MACPattern.' | paste -sd "|")', $clients);
2019-08-18 23:04:53 +00:00
}
2019-11-01 09:08:49 +00:00
$ifaceStatus = $wlan0up ? "up" : "down";
2019-08-18 23:04:53 +00:00
?>
<div class="row">
<div class="col-lg-12">
2019-10-11 19:37:59 +00:00
<div class="card">
2019-10-14 20:18:16 +00:00
<div class="card-header">
<div class="row">
2020-02-02 13:37:17 +00:00
<div class="col">
<i class="fas fa-tachometer-alt fa-fw mr-2"></i><?php echo _("Dashboard"); ?>
</div>
<div class="col">
<button class="btn btn-light btn-icon-split btn-sm service-status float-right">
<span class="icon"><i class="fas fa-circle service-status-<?php echo $ifaceStatus ?>"></i></span>
<span class="text service-status"><?php echo strtolower($ap_iface) .' '. _($ifaceStatus) ?></span>
2020-02-02 13:37:17 +00:00
</button>
</div>
2019-10-14 20:18:16 +00:00
</div><!-- /.row -->
</div><!-- /.card-header -->
2020-02-02 08:37:15 +00:00
2019-10-11 19:37:59 +00:00
<div class="card-body">
2019-08-18 23:04:53 +00:00
<div class="row">
2020-02-02 08:37:15 +00:00
<div class="col-lg-12">
<div class="card mb-3">
<div class="card-body">
<h4><?php echo _("Hourly traffic amount"); ?></h4>
2020-06-10 08:09:10 +00:00
<div id="divInterface" class="d-none"><?php echo $_SESSION['ap_interface']; ?></div>
2020-02-02 13:37:17 +00:00
<div class="col-md-12">
<canvas id="divDBChartBandwidthhourly"></canvas>
2020-02-02 13:37:17 +00:00
</div>
2020-02-02 08:37:15 +00:00
</div><!-- /.card-body -->
</div><!-- /.card-->
</div>
<div class="col-sm-6 align-items-stretch">
<div class="card h-100">
<div class="card-body wireless">
2020-02-02 08:37:15 +00:00
<h4><?php echo _("Wireless Client"); ?></h4>
<div class="row justify-content-md-center">
<div class="col-md">
2019-10-14 23:01:22 +00:00
<div class="info-item"><?php echo _("Connected To"); ?></div><div><?php echo htmlspecialchars($connectedSSID, ENT_QUOTES); ?></div>
<div class="info-item"><?php echo _("Interface"); ?></div><div><?php echo htmlspecialchars($_SESSION['wifi_client_interface']); ?></div>
2019-10-14 23:01:22 +00:00
<div class="info-item"><?php echo _("AP Mac Address"); ?></div><div><?php echo htmlspecialchars($connectedBSSID, ENT_QUOTES); ?></div>
<div class="info-item"><?php echo _("Bitrate"); ?></div><div><?php echo htmlspecialchars($bitrate, ENT_QUOTES); ?></div>
<div class="info-item"><?php echo _("Signal Level"); ?></div><div><?php echo htmlspecialchars($signalLevel, ENT_QUOTES); ?></div>
<div class="info-item"><?php echo _("Transmit Power"); ?></div><div><?php echo htmlspecialchars($txPower, ENT_QUOTES); ?></div>
<div class="info-item"><?php echo _("Frequency"); ?></div><div><?php echo htmlspecialchars($frequency, ENT_QUOTES); ?></div>
2020-02-02 08:37:15 +00:00
</div>
<div class="col-md mt-2 d-flex justify-content-center">
2019-10-14 23:04:17 +00:00
<script>var linkQ = <?php echo json_encode($strLinkQuality); ?>;</script>
2019-11-03 17:02:45 +00:00
<div class="chart-container">
2020-02-02 08:37:15 +00:00
<canvas id="divChartLinkQ"></canvas>
</div>
2020-02-02 08:37:15 +00:00
</div><!--row-->
</div>
</div><!-- /.card-body -->
</div><!-- /.card -->
</div><!-- /.col-md-6 -->
<div class="col-sm-6">
<div class="card h-100 mb-3">
<div class="card-body">
2019-08-18 23:04:53 +00:00
<h4><?php echo _("Connected Devices"); ?></h4>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
2020-03-25 06:42:53 +00:00
<?php if ($arrHostapdConf['BridgedEnable'] == 1) : ?>
<th><?php echo _("MAC Address"); ?></th>
<?php else : ?>
<th><?php echo _("Host name"); ?></th>
<th><?php echo _("IP Address"); ?></th>
<th><?php echo _("MAC Address"); ?></th>
<?php endif; ?>
2019-08-18 23:04:53 +00:00
</tr>
</thead>
<tbody>
2020-03-25 06:42:53 +00:00
<?php if ($arrHostapdConf['BridgedEnable'] == 1) : ?>
<tr>
2020-03-25 11:55:39 +00:00
<td><small class="text-muted"><?php echo _("Bridged AP mode is enabled. For Hostname and IP, see your router's admin page.");?></small></td>
2020-03-25 06:42:53 +00:00
</tr>
<?php endif; ?>
<?php foreach (array_slice($clients,0, 2) as $client) : ?>
2019-08-18 23:04:53 +00:00
<tr>
2020-03-25 06:42:53 +00:00
<?php if ($arrHostapdConf['BridgedEnable'] == 1): ?>
<td><?php echo htmlspecialchars($client, ENT_QUOTES) ?></td>
<?php else : ?>
<?php $props = explode(' ', $client) ?>
<td><?php echo htmlspecialchars($props[3], ENT_QUOTES) ?></td>
<td><?php echo htmlspecialchars($props[2], ENT_QUOTES) ?></td>
<td><?php echo htmlspecialchars($props[1], ENT_QUOTES) ?></td>
<?php endif; ?>
2019-08-18 23:04:53 +00:00
</tr>
<?php endforeach ?>
2019-08-18 23:04:53 +00:00
</tbody>
</table>
<?php if (sizeof($clients) >2) : ?>
<div class="col-lg-12 float-right">
<a class="btn btn-outline-info" role="button" href="<?php echo $moreLink ?>"><?php echo _("More");?> <i class="fas fa-chevron-right"></i></a>
</div>
<?php elseif (sizeof($clients) ==0) : ?>
<div class="col-lg-12 mt-3"><?php echo _("No connected devices");?></div>
<?php endif; ?>
2019-08-18 23:04:53 +00:00
</div><!-- /.table-responsive -->
2019-10-11 19:37:59 +00:00
</div><!-- /.card-body -->
</div><!-- /.card -->
2019-08-18 23:04:53 +00:00
</div><!-- /.col-md-6 -->
</div><!-- /.row -->
<div class="col-lg-12 mt-3">
2019-08-18 23:04:53 +00:00
<div class="row">
<form action="?page=wlan0_info" method="POST">
<?php echo CSRFTokenFieldTag() ?>
<?php if (!RASPI_MONITOR_ENABLED) : ?>
<?php if (!$wlan0up) : ?>
<input type="submit" class="btn btn-success" value="<?php echo _("Start").' '.$client_interface ?>" name="ifup_wlan0" />
<?php else : ?>
<input type="submit" class="btn btn-warning" value="<?php echo _("Stop").' '.$client_interface ?>" name="ifdown_wlan0" />
<?php endif ?>
<?php endif ?>
2019-10-11 19:37:59 +00:00
<a href="?page=<?php echo $_GET['page'] ?>" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh") ?></a>
2019-08-18 23:04:53 +00:00
</form>
</div>
</div>
2019-10-11 19:37:59 +00:00
</div><!-- /.card-body -->
2019-10-20 17:31:39 +00:00
<div class="card-footer"><?php echo _("Information provided by ip and iw and from system"); ?></div>
2019-10-11 19:37:59 +00:00
</div><!-- /.card -->
2019-08-18 23:04:53 +00:00
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
2020-02-02 08:37:15 +00:00
<script type="text/javascript"<?php //echo ' nonce="'.$csp_page_nonce.'"'; ?>>
// js translations:
var t = new Array();
t['send'] = '<?php echo addslashes(_('Send')); ?>';
t['receive'] = '<?php echo addslashes(_('Receive')); ?>';
</script>