Merge branch 'zbchristian-wlan-switch' of https://github.com/billz/raspap-webgui into zbchristian-wlan-switch

This commit is contained in:
billz 2020-06-07 17:20:09 +01:00
commit 9c2ae296d3
16 changed files with 232 additions and 105 deletions

View File

@ -1,5 +1,5 @@
![](https://i.imgur.com/xeKD93p.png)
[![Release 2.4](https://img.shields.io/badge/Release-2.4-green.svg)](https://github.com/billz/raspap-webgui/releases) [![Awesome](https://awesome.re/badge.svg)](https://github.com/thibmaek/awesome-raspberry-pi) [![Financial Contributors on Open Collective](https://opencollective.com/raspap/all/badge.svg?label=financial+contributors)](https://opencollective.com/raspap) ![https://travis-ci.com/billz/raspap-webgui/](https://img.shields.io/travis/com/billz/raspap-webgui/master) [![Twitter URL](https://img.shields.io/twitter/url?label=%40RaspAP&logoColor=%23d8224c&url=https%3A%2F%2Ftwitter.com%2Frasp_ap)](https://twitter.com/rasp_ap) [![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/RaspAP?style=social)](https://www.reddit.com/r/RaspAP/)
[![Release 2.4.1](https://img.shields.io/badge/Release-2.4.1-green.svg)](https://github.com/billz/raspap-webgui/releases) [![Awesome](https://awesome.re/badge.svg)](https://github.com/thibmaek/awesome-raspberry-pi) [![Financial Contributors on Open Collective](https://opencollective.com/raspap/all/badge.svg?label=financial+contributors)](https://opencollective.com/raspap) ![https://travis-ci.com/billz/raspap-webgui/](https://img.shields.io/travis/com/billz/raspap-webgui/master) [![Twitter URL](https://img.shields.io/twitter/url?label=%40RaspAP&logoColor=%23d8224c&url=https%3A%2F%2Ftwitter.com%2Frasp_ap)](https://twitter.com/rasp_ap) [![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/RaspAP?style=social)](https://www.reddit.com/r/RaspAP/)
RaspAP lets you quickly get a WiFi access point up and running to share the connectivity of many popular [Debian-based devices](#supported-operating-systems), including the Raspberry Pi. Our popular [Quick installer](#quick-installer) creates a known-good default configuration that "just works" on all current Raspberry Pis with onboard wireless. A responsive interface gives you control over the relevant services and networking options. Advanced DHCP settings, OpenVPN client support, SSL, security audits, themes and multilingual options are included.
@ -31,7 +31,7 @@ We hope you enjoy using RaspAP as much as we do creating it. Tell us how you use
- [License](#license)
## Prerequisites
Start with a clean install of the [latest release of Raspbian](https://www.raspberrypi.org/downloads/raspbian/) (currently Buster). Raspbian Buster Lite is recommended.
Start with a clean install of the [latest release of Raspberry Pi OS (32-bit)](https://www.raspberrypi.org/downloads/raspbian/). Raspberry Pi OS (32-bit) Lite is recommended.
1. Update Raspbian, including the kernel and firmware, followed by a reboot:
```
@ -61,7 +61,9 @@ configured as an access point as follows:
* SSID: `raspi-webgui`
* Password: ChangeMe
**Note:** As the name suggests, the Quick Installer is a great way to quickly setup a new AP. However, it does not automagically detect the unique configuration of your system. Best results are obtained by connecting to ethernet (`eth0`) or as a WiFi client, also known as managed mode, with `wlan0`. For the latter, refer to [this FAQ](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode). Please [read this](https://github.com/billz/raspap-webgui/wiki/Reporting-issues) before reporting an issue.
**Note:** As the name suggests, the Quick Installer is a great way to quickly setup a new AP. However, it does not automagically detect the unique configuration of your system. Best results are obtained by connecting to ethernet (`eth0`) or as a WiFi client, also known as managed mode, with `wlan0`. For the latter, refer to [this FAQ](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode). Special instructions for the Pi Zero W are [available here](https://github.com/billz/raspap-webgui/wiki/RPi-Zero-W-AP-STA-mode).
Please [read this](https://github.com/billz/raspap-webgui/wiki/Reporting-issues) before reporting an issue.
## Ad Blocking
This feature uses DNS blacklisting to block requests for ads, trackers and other undesirable hosts. To enable ad blocking, simply respond to the prompt during the installation. As a beta release, we encourage testing and feedback from users of RaspAP.
@ -78,9 +80,9 @@ By default RaspAP configures a routed AP for your clients to connect to. A bridg
More information on Bridged AP mode is provided [on our wiki](https://github.com/billz/raspap-webgui/wiki/Bridged-AP-mode).
## Simultaneous AP and Wifi client
RaspAP lets you easily create an AP with a Wifi client configuration. With your system configured in managed mode, enable the AP from the **Advanced** tab of **Configure hotspot** by sliding the **Wifi client AP mode** toggle. Save settings and start the hotspot. The managed mode AP is functional without restart.
RaspAP lets you create an AP with a Wifi client configuration, often called AP-STA mode. With your system configured in managed mode, enable the AP from the **Advanced** tab of **Configure hotspot** by sliding the **Wifi client AP mode** toggle. Save settings and start the hotspot. The managed mode AP is functional without restart.
**Note:** This option is disabled until you configure your system as a wireless client. For a device operating in [managed mode](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode) without an `eth0` connection, this configuration must be enabled _before_ a reboot.
**Note:** This option is disabled until you configure your system as a wireless client. For a device operating in [managed mode](https://github.com/billz/raspap-webgui/wiki/FAQs#how-do-i-prepare-the-sd-card-to-connect-to-wifi-in-headless-mode) without an `eth0` connection, this configuration must be enabled [_before_ a reboot](https://github.com/billz/raspap-webgui/wiki/RPi-Zero-W-AP-STA-mode).
## Support us
RaspAP is free software, but powered by your support. If you find RaspAP useful for your personal or commercial projects, please [become a GitHub sponsor](https://github.com/sponsors/billz), join the project on [Open Collective](https://opencollective.com/raspap) or make a one-time donation with [PayPal](https://www.paypal.com/paypalme2/billzgithub). Any of these options makes a big difference!
@ -98,7 +100,7 @@ RaspAP was originally made for Raspbian, but now also installs on the following
| Distribution | Release | Architecture | Support |
|---|:---:|:---:|:---:|
| Raspbian | Buster | ARM | Official |
| Raspberry Pi OS | (32-bit) Lite Buster | ARM | Official |
| Armbian | Buster | [ARM](https://docs.armbian.com/#supported-chips) | Official |
| Debian | Buster | ARM / x86_64 | Beta |
| Ubuntu | 18.04 LTS / 19.10 | ARM / x86_64 | Beta |

View File

@ -13,5 +13,6 @@ $ssid = null;
knownWifiStations($networks);
nearbyWifiStations($networks, !isset($_REQUEST["refresh"]));
connectedWifiStations($networks);
sortNetworksByRSSI($networks);
echo renderTemplate('wifi_stations', compact('networks'));

View File

@ -1,8 +1,20 @@
{
"name": "billz/raspap-webgui",
"homepage": "https://raspap.com/",
"description": "Simple AP setup and wifi mangement for Debian-based devices",
"license": "GPL-3.0",
"keywords": ["raspberrypi"],
"homepage": "https://raspap.com/",
"keywords": ["raspberrypi", "debian", "armbian", "wifi"],
"type": "raspap-core",
"authors": [
{
"name": "RaspAP Team",
"email": "billzimmerman@gmail.com",
"homepage": "https://raspap.com/"
}
],
"require": {
"php": "^7.0"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2.0",
"phpcompatibility/php-compatibility": "^9.3.5",

View File

@ -1,6 +1,6 @@
<?php
define('RASPI_VERSION', '2.4');
define('RASPI_VERSION', '2.4.1');
define('RASPI_CONFIG', '/etc/raspap');
define('RASPI_CONFIG_NETWORKING', RASPI_CONFIG.'/networking');
define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth');

View File

@ -95,6 +95,7 @@ function DisplayWPAConfig()
nearbyWifiStations($networks);
connectedWifiStations($networks);
sortNetworksByRSSI($networks);
echo renderTemplate("configure_client", compact("status"));
}

View File

@ -5,7 +5,7 @@ if (!defined('RASPI_CONFIG')) {
}
$defaults = [
'RASPI_VERSION' => '2.4',
'RASPI_VERSION' => '2.4.1',
'RASPI_CONFIG_NETWORKING' => RASPI_CONFIG.'/networking',
'RASPI_ADMIN_DETAILS' => RASPI_CONFIG.'/raspap.auth',
'RASPI_WIFI_CLIENT_INTERFACE' => 'wlan0',

View File

@ -245,6 +245,9 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
$config.= 'vht_capab=[MAX-AMSDU-3839][SHORT-GI-80]'.PHP_EOL;
$config.= 'vht_oper_chwidth=1'.PHP_EOL;
$config.= 'vht_oper_centr_freq_seg0_idx=42'.PHP_EOL.PHP_EOL;
} elseif ($_POST['hw_mode'] === 'w') {
$config.= 'ieee80211w=2'.PHP_EOL;
$config.= 'wpa_key_mgmt=WPA-EAP-SHA256'.PHP_EOL;
} else {
$config.= 'hw_mode='.$_POST['hw_mode'].PHP_EOL;
$config.= 'ieee80211n=0'.PHP_EOL;

View File

@ -51,7 +51,12 @@ function RPiVersion()
if (array_key_exists($rev, $revisions)) {
return $revisions[$rev];
} else {
return 'Unknown Pi';
exec('cat /proc/device-tree/model', $model);
if (isset($model[0])) {
return $model[0];
} else {
return 'Unknown Device';
}
}
}

View File

@ -64,16 +64,30 @@ function nearbyWifiStations(&$networks, $cached = true)
}
);
// get the name of the AP. Should be excluded from nearby networks
exec('cat '.RASPI_HOSTAPD_CONFIG.' | sed -rn "s/ssid=(.*)\s*$/\1/p" ', $ap_ssid);
$ap_ssid = $ap_ssid[0];
foreach (explode("\n", $scan_results) as $network) {
$arrNetwork = preg_split("/[\t]+/", $network); // split result into array
if (!array_key_exists(4, $arrNetwork) ||
trim($arrNetwork[4]) == $ap_ssid) {
continue;
}
$ssid = trim($arrNetwork[4]);
// filter SSID string: anything invisible in 7bit ASCII or quotes -> ignore network
if (preg_match('[\x00-\x1f\x7f-\xff\'\`\´\"]', $ssid)) {
continue;
}
// If network is saved
if (array_key_exists(4, $arrNetwork) && array_key_exists($arrNetwork[4], $networks)) {
$networks[$arrNetwork[4]]['visible'] = true;
$networks[$arrNetwork[4]]['channel'] = ConvertToChannel($arrNetwork[1]);
if (array_key_exists($ssid, $networks)) {
$networks[$ssid]['visible'] = true;
$networks[$ssid]['channel'] = ConvertToChannel($arrNetwork[1]);
// TODO What if the security has changed?
} else {
$networks[$arrNetwork[4]] = array(
$networks[$ssid] = array(
'configured' => false,
'protocol' => ConvertToSecurity($arrNetwork[3]),
'channel' => ConvertToChannel($arrNetwork[1]),
@ -83,9 +97,11 @@ function nearbyWifiStations(&$networks, $cached = true)
);
}
// Save RSSI
if (array_key_exists(4, $arrNetwork)) {
$networks[$arrNetwork[4]]['RSSI'] = $arrNetwork[2];
// Save RSSI, if the current value is larger than the already stored
if (array_key_exists(4, $arrNetwork) && array_key_exists($arrNetwork[4], $networks)) {
if (! array_key_exists('RSSI', $networks[$arrNetwork[4]]) || $networks[$ssid]['RSSI'] < $arrNetwork[2]) {
$networks[$ssid]['RSSI'] = $arrNetwork[2];
}
}
}
}
@ -100,6 +116,24 @@ function connectedWifiStations(&$networks)
}
}
function sortNetworksByRSSI(&$networks)
{
$valRSSI = array();
foreach ($networks as $SSID => $net) {
if (!array_key_exists('RSSI', $net)) {
$net['RSSI'] = -1000;
}
$valRSSI[$SSID] = $net['RSSI'];
}
$nets = $networks;
arsort($valRSSI);
$networks = array();
foreach ($valRSSI as $SSID => $RSSI) {
$networks[$SSID] = $nets[$SSID];
$networks[$SSID]['RSSI'] = $RSSI;
}
}
function getWifiInterface()
{
if (empty($_SESSION['client_iface'])) {

View File

@ -13,7 +13,7 @@
* @author Lawrence Yau <sirlagz@gmail.com>
* @author Bill Zimmerman <billzimmerman@gmail.com>
* @license GNU General Public License, version 3 (GPL-3.0)
* @version 2.4
* @version 2.4.1
* @link https://github.com/billz/raspap-webgui
* @see http://sirlagz.net/2013/02/08/raspap-webgui/
*/
@ -146,7 +146,7 @@ $bridgedEnabled = $arrHostapdConf['BridgedEnable'];
<a class="nav-link" href="index.php?page=dhcpd_conf"><i class="fas fa-exchange-alt fa-fw mr-2"></i><span class="nav-label"><?php echo _("DHCP Server"); ?></a>
</li>
<?php endif; ?>
<?php if (RASPI_ADBLOCK_ENABLED) : ?>
<?php if (RASPI_ADBLOCK_ENABLED && !$bridgedEnabled) : ?>
<li class="nav-item">
<a class="nav-link" href="index.php?page=adblock_conf"><i class="far fa-hand-paper fa-fw mr-2"></i><span class="nav-label"><?php echo _("Ad Blocking"); ?></a>
</li>

View File

@ -78,16 +78,16 @@ function _get_linux_distro() {
# Sets php package option based on Linux version, abort if unsupported distro
function _set_php_package() {
case $RELEASE in
"18.04"|"19.10") # Ubuntu Server
18.04|19.10) # Ubuntu Server
php_package="php7.4-cgi"
phpcgiconf="/etc/php/7.4/cgi/php.ini" ;;
"10")
10*)
php_package="php7.3-cgi"
phpcgiconf="/etc/php/7.3/cgi/php.ini" ;;
"9")
9*)
php_package="php7.0-cgi"
phpcgiconf="/etc/php/7.0/cgi/php.ini" ;;
"8")
8)
_install_status 1 "${DESC} and php5 are not supported. Please upgrade." ;;
*)
_install_status 1 "${DESC} is unsupported. Please install on a supported distro." ;;

View File

@ -20,6 +20,7 @@ readonly raspap_user="www-data"
readonly raspap_sudoers="/etc/sudoers.d/090_raspap"
readonly raspap_dnsmasq="/etc/dnsmasq.d/090_raspap.conf"
readonly raspap_sysctl="/etc/sysctl.d/90_raspap.conf"
readonly raspap_network="/etc/systemd/network/"
readonly rulesv4="/etc/iptables/rules.v4"
webroot_dir="/var/www/html"
@ -44,13 +45,13 @@ function _get_linux_distro() {
# Sets php package option based on Linux version, abort if unsupported distro
function _set_php_package() {
case $RELEASE in
"18.04"|"19.10") # Ubuntu Server
18.04|19.10) # Ubuntu Server
php_package="php7.4-cgi"
phpcgiconf="/etc/php/7.4/cgi/php.ini" ;;
"10")
10*)
php_package="php7.3-cgi"
phpcgiconf="/etc/php/7.3/cgi/php.ini" ;;
"9")
9*)
php_package="php7.0-cgi"
phpcgiconf="/etc/php/7.0/cgi/php.ini" ;;
esac
@ -148,7 +149,7 @@ function _remove_raspap_service() {
function _restore_networking() {
_install_log "Restoring networking config to pre-install defaults"
echo "Disabling IP forwarding in $raspap_sysctl"
sudo rm $raspap_sysctl || _install_error "Unable to remove $raspap_sysctl"
sudo rm "$raspap_sysctl" || _install_error "Unable to remove $raspap_sysctl"
sudo /etc/init.d/procps restart || _install_error "Unable to execute procps"
echo "Checking iptables rules"
rules=(
@ -169,6 +170,11 @@ function _restore_networking() {
sudo iptables-save | sudo tee $rulesv4 > /dev/null || _install_error "Unable to execute iptables-save"
fi
echo "Done."
# Remove dnsmasq and bridge configs
echo "Removing 090_raspap.conf from dnsmasq"
sudo rm "$raspap_dnsmasq" || _install_error "Unable to remove $raspap_dnsmasq"
echo "Removing raspap bridge configurations"
sudo rm "$raspap_network"/raspap* || _install_error "Unable to remove bridge config"
}
# Removes installed packages

Binary file not shown.

View File

@ -1,22 +1,19 @@
# RaspAP Portable Object file
# Project home: https://github.com/billz/raspap-webgui
# Licensed under the GNU General Public License v3.0
# This file is distributed under the same license as the RaspAP package
# FIRST AUTHOR billzimmerman@gmail.com, 2017
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 1.2.1\n"
"Project-Id-Version: raspap\n"
"Report-Msgid-Bugs-To: Bill Zimmerman <billzimmerman@gmail.com>\n"
"POT-Creation-Date: 2017-10-19 08:56+0000\n"
"PO-Revision-Date: 2019-10-21 23:15+0000\n"
"Last-Translator: Betep <betep@list.ru>\n"
"Language-Team: \n"
"Language: en_US\n"
"PO-Revision-Date: 2020-05-19 15:29\n"
"Last-Translator: Denis Trifiniuc\n"
"Language-Team: Russian\n"
"Language: ru_RU\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=((n%10==1 && n%100!=11) ? 0 : ((n%10 >= 2 && n%10 <=4 && (n%100 < 12 || n%100 > 14)) ? 1 : ((n%10 == 0 || (n%10 >= 5 && n%10 <=9)) || (n%100 >= 11 && n%100 <= 14)) ? 2 : 3));\n"
"X-Crowdin-Project: raspap\n"
"X-Crowdin-Language: ru\n"
"X-Crowdin-File: /master/locale/en_US/LC_MESSAGES/messages.po\n"
#: index.php
msgid "RaspAP Wifi Configuration Portal"
@ -37,6 +34,12 @@ msgstr "WiFi клиента"
msgid "Hotspot"
msgstr "Точка доступа"
msgid "Memory Use"
msgstr "Использование RAM"
msgid "CPU Temp"
msgstr "Температура ЦП"
msgid "Networking"
msgstr "Сетевые"
@ -178,8 +181,8 @@ msgstr "Переданные пакеты"
msgid "Transferred Bytes"
msgstr "Передано Байт"
msgid "Wireless Information"
msgstr "Беспроводная информация"
msgid "Wireless Client"
msgstr "WiFi клиент"
msgid "Connected To"
msgstr "Подключено к"
@ -248,6 +251,9 @@ msgstr "Список клиентов"
msgid "Interface"
msgstr "Интерфейс"
msgid "DNS Server"
msgstr "DNS сервер"
msgid "Starting IP Address"
msgstr "Начальный IP-адрес"
@ -318,31 +324,31 @@ msgid "Dnsmasq is not running"
msgstr "Dnsmasq не запущена"
msgid "Upstream DNS servers"
msgstr "Upstream DNS servers"
msgstr "Пользовательские DNS-серверы"
msgid "Only ever query DNS servers configured below"
msgstr "Only ever query DNS servers configured below"
msgstr "Использовать только DNS-серверы, настроенные ниже"
msgid "Enable this option if you want RaspAP to <b>send DNS queries to the servers configured below exclusively</b>. By default RaspAP also uses its upstream DHCP server's name servers."
msgstr "Enable this option if you want RaspAP to <b>send DNS queries to the servers configured below exclusively</b>. By default RaspAP also uses its upstream DHCP server's name servers."
msgstr "Включите эту опцию, если вы хотите, чтобы RaspAP <b>отправлял DNS-запросы только на серверы, настроенные ниже</b>. По умолчанию RaspAP также использует восходящие DNS-серверы, назначенные через DHCP."
msgid "This option adds <code>no-resolv</code> to the dnsmasq configuration."
msgstr "This option adds <code>no-resolv</code> to the dnsmasq configuration."
msgstr "Этот параметр добавляет <code>no-resolv</code> в конфигурацию dnsmasq."
msgid "Add upstream DNS server"
msgstr "Add upstream DNS server"
msgstr "Добавить сервер DNS"
msgid "Format"
msgstr "Format"
msgstr "Формат"
msgid "Choose a hosted server"
msgstr "Choose a hosted server"
msgstr "Общедоступный DNS-сервер"
msgid "Log DHCP requests"
msgstr "Log DHCP requests"
msgstr "Журнал DHCP-запросов"
msgid "Log DNS queries"
msgstr "Log DNS queries"
msgstr "Журнал DNS-запросов"
#: includes/hostapd.php
msgid "Basic"
@ -426,6 +432,9 @@ msgstr "Записи журнала"
msgid "WiFi client AP mode"
msgstr "Режим AP WiFi-клиента"
msgid "Bridged AP mode"
msgstr "Режим моста ТОЧКИ ДОСТУПА"
msgid "Hide SSID in broadcast"
msgstr "Скрыть SSID при трансляции"
@ -445,9 +454,6 @@ msgstr "Текущие настройки"
msgid "Default Gateway"
msgstr "Основной шлюз"
msgid "DNS Server"
msgstr "DNS сервер"
msgid "Alternate DNS Server"
msgstr "Альтернативный DNS-сервер"
@ -660,6 +666,10 @@ msgstr "Попытка запуска TOR"
msgid "Attempting to stop TOR"
msgstr "Попытка остановить TOR"
#: template/dashboard.php
msgid "Bridged AP mode is enabled. For Hostname and IP, see your router's admin page."
msgstr "Мостовой режим ТОЧКИ ДОСТУПА включен. Для хоста и IP-адреса см. страницу администрирования маршрутизатора."
#: common form controls
msgid "Save settings"
msgstr "Сохранить настройки"
@ -682,3 +692,45 @@ msgstr "вверх"
msgid "down"
msgstr "вниз"
msgid "adblock"
msgstr "Adblock"
msgid "Ad Blocking"
msgstr "Ad Blocking"
msgid "Start Ad Blocking"
msgstr "Запустить Ad Blocking"
msgid "Restart Ad Blocking"
msgstr "Перезапустить Ad Blocking"
msgid "Blocklist settings"
msgstr "Настройки блокировки"
msgid "Enable blocklists"
msgstr "Включить блокировку"
msgid "Enable this option if you want RaspAP to <b>block DNS requests for ads, tracking and other virtual garbage</b>. Blocklists are gathered from multiple, actively maintained sources and automatically updated, cleaned, optimized and moderated on a daily basis."
msgstr "Включите эту опцию, если вы хотите, чтобы RaspAP <b>блокировал DNS запросы для рекламы, отслеживания и другого виртуального мусора</b>. Блокирующие списки собираются из множества активно поддерживаемых источников и автоматически обновляются, очищаются, оптимизируются и модерируются ежедневно."
msgid "This option adds <code>conf-file</code> and <code>addn-hosts</code> to the dnsmasq configuration."
msgstr "Эта опция добавляет в конфигурацию dnsmasq <code>conf-file</code> и <code>addn-hosts</code>."
msgid "Choose a blocklist provider"
msgstr "Выберите поставщика черного списка"
msgid "Hostnames blocklist last updated"
msgstr "Имена черного списка последнее обновление"
msgid "Domains blocklist last updated"
msgstr "Последнее обновление списка блокировки доменов"
msgid "Update now"
msgstr "Обновить сейчас"
msgid "Statistics"
msgstr "Статистика"
msgid "Information provided by adblock"
msgstr "Информация получена от Adblock"

View File

@ -61,6 +61,12 @@
$selectedHwMode = 'ac';
}
}
if (isset($arrConfig['ieee80211w'])) {
if (strval($arrConfig['ieee80211w']) === '2') {
$selectedHwMode = 'w';
}
}
if (!in_array($arrConfig['country_code'], $countries_5Ghz_max48ch)) {
$hwModeDisabled = 'ac';
if ($selectedHwMode === $hwModeDisabled) {

View File

@ -16,41 +16,46 @@
} ?>
<h5 class="card-title"><?php echo htmlspecialchars($ssid, ENT_QUOTES); ?></h5>
<div class="info-item-wifi"><?php echo _("Status"); ?></div>
<div class="info-item-wifi"><?php echo _("Status"); ?></div>
<div>
<?php if ($network['configured']) { ?>
<i class="fas fa-check-circle"></i>
<?php } ?>
<?php if ($network['connected']) { ?>
<i class="fas fa-exchange-alt"></i>
<?php } ?>
<?php if (!$network['configured'] && !$network['connected']) {
echo _("Not configured");
<?php if ($network['configured']) { ?>
<i class="fas fa-check-circle"></i>
<?php } ?>
<?php if ($network['connected']) { ?>
<i class="fas fa-exchange-alt"></i>
<?php } ?>
<?php if (!$network['configured'] && !$network['connected']) {
echo _("Not configured");
} ?>
</div>
<div class="info-item-wifi"><?php echo _("Channel"); ?></div>
<div class="info-item-wifi"><?php echo _("Channel"); ?></div>
<div>
<?php if ($network['visible']) { ?>
<?php echo htmlspecialchars($network['channel'], ENT_QUOTES) ?>
<?php } else { ?>
<span class="label label-warning"> X </span>
<?php } ?>
<?php if ($network['visible']) { ?>
<?php echo htmlspecialchars($network['channel'], ENT_QUOTES) ?>
<?php } else { ?>
<span class="label label-warning"> X </span>
<?php } ?>
</div>
<div class="info-item-wifi"><?php echo _("RSSI"); ?></div>
<div class="info-item-wifi"><?php echo _("RSSI"); ?></div>
<div>
<?php echo htmlspecialchars($network['RSSI'], ENT_QUOTES);
echo "dB (";
if ($network['RSSI'] >= -50) {
echo 100;
} elseif ($network['RSSI'] <= -100) {
echo 0;
} else {
echo 2*($network['RSSI'] + 100);
}
echo "%)";
?>
<?php
if (isset($network['RSSI']) && $network['RSSI'] >= -200) {
echo htmlspecialchars($network['RSSI'], ENT_QUOTES);
echo "dB (";
if ($network['RSSI'] >= -50) {
echo 100;
} elseif ($network['RSSI'] <= -100) {
echo 0;
} else {
echo 2*($network['RSSI'] + 100);
}
echo "%)";
} else {
echo " not found ";
}
?>
</div>
<?php if (array_key_exists('priority', $network)) { ?>
@ -58,35 +63,35 @@
<?php } ?>
<input type="hidden" name="protocol<?php echo $index ?>" value="<?php echo htmlspecialchars($network['protocol'], ENT_QUOTES); ?>" />
<div class="info-item-wifi"><?php echo _("Security"); ?></div>
<div class="info-item-wifi"><?php echo _("Security"); ?></div>
<div><?php echo $network['protocol'] ?></div>
<div class="form-group">
<div class="info-item-wifi"><?php echo _("Passphrase"); ?></div>
<div class="form-group">
<div class="info-item-wifi"><?php echo _("Passphrase"); ?></div>
<div class="input-group">
<?php if ($network['protocol'] === 'Open') { ?>
<input type="password" disabled class="form-control" aria-describedby="passphrase" name="passphrase<?php echo $index ?>" value="" />
<?php } else { ?>
<input type="password" class="form-control js-validate-psk" aria-describedby="passphrase" name="passphrase<?php echo $index ?>" value="<?php echo $network['passphrase'] ?>" data-target="#update<?php echo $index ?>" data-colors="#ffd0d0,#d0ffd0">
<div class="input-group-append">
<button class="btn btn-outline-secondary js-toggle-password" type="button" data-target="[name=passphrase<?php echo $index ?>]" data-toggle-with="<?php echo _("Hide") ?>">Show</button>
</div>
<?php } ?>
</div>
</div>
<?php if ($network['protocol'] === 'Open') { ?>
<input type="password" disabled class="form-control" aria-describedby="passphrase" name="passphrase<?php echo $index ?>" value="" />
<?php } else { ?>
<input type="password" class="form-control js-validate-psk" aria-describedby="passphrase" name="passphrase<?php echo $index ?>" value="<?php echo $network['passphrase'] ?>" data-target="#update<?php echo $index ?>" data-colors="#ffd0d0,#d0ffd0">
<div class="input-group-append">
<button class="btn btn-outline-secondary js-toggle-password" type="button" data-target="[name=passphrase<?php echo $index ?>]" data-toggle-with="<?php echo _("Hide") ?>">Show</button>
</div>
<?php } ?>
</div>
</div>
<div class="btn-group btn-block ">
<?php if ($network['configured']) { ?>
<input type="submit" class="col-xs-4 col-md-4 btn btn-warning" value="<?php echo _("Update"); ?>" id="update<?php echo $index ?>" name="update<?php echo $index ?>"<?php echo ($network['protocol'] === 'Open' ? ' disabled' : '')?> />
<button type="submit" class="col-xs-4 col-md-4 btn btn-info" value="<?php echo $index?>" name="connect"><?php echo _("Connect"); ?></button>
<?php } else { ?>
<input type="submit" class="col-xs-4 col-md-4 btn btn-info" value="<?php echo _("Add"); ?>" id="update<?php echo $index ?>" name="update<?php echo $index ?>" <?php echo ($network['protocol'] === 'Open' ? '' : ' disabled')?> />
<?php } ?>
<input type="submit" class="col-xs-4 col-md-4 btn btn-danger" value="<?php echo _("Delete"); ?>" name="delete<?php echo $index ?>"<?php echo ($network['configured'] ? '' : ' disabled')?> />
</div><!-- /.btn-group -->
<div class="btn-group btn-block ">
<?php if ($network['configured']) { ?>
<input type="submit" class="col-xs-4 col-md-4 btn btn-warning" value="<?php echo _("Update"); ?>" id="update<?php echo $index ?>" name="update<?php echo $index ?>"<?php echo ($network['protocol'] === 'Open' ? ' disabled' : '')?> />
<button type="submit" class="col-xs-4 col-md-4 btn btn-info" value="<?php echo $index?>" name="connect"><?php echo _("Connect"); ?></button>
<?php } else { ?>
<input type="submit" class="col-xs-4 col-md-4 btn btn-info" value="<?php echo _("Add"); ?>" id="update<?php echo $index ?>" name="update<?php echo $index ?>" <?php echo ($network['protocol'] === 'Open' ? '' : ' disabled')?> />
<?php } ?>
<input type="submit" class="col-xs-4 col-md-4 btn btn-danger" value="<?php echo _("Delete"); ?>" name="delete<?php echo $index ?>"<?php echo ($network['configured'] ? '' : ' disabled')?> />
</div><!-- /.btn-group -->
</div><!-- /.card-body -->
</div><!-- /.card -->
</div><!-- /.col-sm -->
<?php $index += 1; ?>
<?php endforeach ?>
<?php $index += 1; ?>
<?php endforeach ?>
</div><!-- /.row -->