Rename ambiguous variable for clarity

This commit is contained in:
billz
2020-06-09 15:32:49 +01:00
parent e9470aaf7f
commit 2ca9bf5b6f
6 changed files with 26 additions and 26 deletions

View File

@@ -53,10 +53,10 @@ function nearbyWifiStations(&$networks, $cached = true)
$scan_results = cache(
$cacheKey, function () {
exec('sudo wpa_cli -i ' .$_SESSION['client_iface']. ' scan');
exec('sudo wpa_cli -i ' .$_SESSION['ap_interface']. ' scan');
sleep(3);
exec('sudo wpa_cli -i ' .$_SESSION['client_iface']. ' scan_results', $stdout);
exec('sudo wpa_cli -i ' .$_SESSION['ap_interface']. ' scan_results', $stdout);
array_shift($stdout);
return implode("\n", $stdout);
@@ -107,7 +107,7 @@ function nearbyWifiStations(&$networks, $cached = true)
function connectedWifiStations(&$networks)
{
exec('iwconfig ' .$_SESSION['client_iface'], $iwconfig_return);
exec('iwconfig ' .$_SESSION['ap_interface'], $iwconfig_return);
foreach ($iwconfig_return as $line) {
if (preg_match('/ESSID:\"([^"]+)\"/i', $line, $iwconfig_ssid)) {
$networks[$iwconfig_ssid[1]]['connected'] = true;
@@ -135,15 +135,15 @@ function sortNetworksByRSSI(&$networks)
function getWifiInterface()
{
if (empty($_SESSION['client_iface'])) {
if (empty($_SESSION['ap_interface'])) {
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
if (isset($arrHostapdConf['WifiInterface'])) {
$iface = $arrHostapdConf['WifiInterface'];
// check for 2nd wifi interface
exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2);
$_SESSION['client_iface'] = empty($iface2) ? $iface : trim($iface2[0]);
$_SESSION['ap_interface'] = empty($iface2) ? $iface : trim($iface2[0]);
} else { // fallback to default
$_SESSION['client_iface'] = RASPI_WIFI_CLIENT_INTERFACE;
$_SESSION['ap_interface'] = RASPI_WIFI_CLIENT_INTERFACE;
}
}
}