mirror of
https://github.com/unraid/webgui.git
synced 2026-02-28 05:09:57 -06:00
Wireless support
This commit is contained in:
@@ -721,7 +721,7 @@ if (isset($myPage['Load']) && $myPage['Load']>0) echo "\n<script>timers.reload =
|
||||
echo "<div class='tabs'>";
|
||||
$tab = 1;
|
||||
$pages = [];
|
||||
if (!empty($myPage['text']) && page_enabled($myPage)) $pages[$myPage['name']] = $myPage;
|
||||
if (!empty($myPage['text'])) $pages[$myPage['name']] = $myPage;
|
||||
if (_var($myPage,'Type')=='xmenu') $pages = array_merge($pages, find_pages($myPage['name']));
|
||||
if (isset($myPage['Tabs'])) $display['tabs'] = strtolower($myPage['Tabs'])=='true' ? 0 : 1;
|
||||
$tabbed = $display['tabs']==0 && count($pages)>1;
|
||||
@@ -729,7 +729,7 @@ $tabbed = $display['tabs']==0 && count($pages)>1;
|
||||
foreach ($pages as $page) {
|
||||
$close = false;
|
||||
if (isset($page['Title'])) {
|
||||
eval("\$title=\"{$page['Title']}\";");
|
||||
eval("\$title=\"".htmlspecialchars($page['Title'])."\";");
|
||||
if ($tabbed) {
|
||||
echo "<div class='tab'><input type='radio' id='tab{$tab}' name='tabs' onclick='settab(this.id)'><label for='tab{$tab}'>";
|
||||
echo tab_title($title,$page['root'],_var($page,'Tag',false));
|
||||
@@ -746,7 +746,7 @@ foreach ($pages as $page) {
|
||||
if (isset($page['Type']) && $page['Type']=='menu') {
|
||||
$pgs = find_pages($page['name']);
|
||||
foreach ($pgs as $pg) {
|
||||
@eval("\$title=\"{$pg['Title']}\";");
|
||||
@eval("\$title=\"".htmlspecialchars($pg['Title'])."\";");
|
||||
$icon = _var($pg,'Icon',"<i class='icon-app PanelIcon'></i>");
|
||||
if (substr($icon,-4)=='.png') {
|
||||
$root = $pg['root'];
|
||||
|
||||
@@ -18,27 +18,29 @@ require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
function port($eth) {
|
||||
$sys = "/sys/class/net";
|
||||
if (substr($eth,0,4)=='wlan') return $eth;
|
||||
$x = preg_replace('/[^0-9]/','',$eth);
|
||||
return file_exists("$sys/br{$x}") ? "br${x}" : (file_exists("$sys/bond{$x}") ? "bond{$x}" : "eth{$x}");
|
||||
}
|
||||
exec("grep -Po 'nameserver \K.*' /etc/resolv.conf",$ns);
|
||||
|
||||
exec("grep -Po 'nameserver \K\S+' /etc/resolv.conf 2>/dev/null",$ns);
|
||||
$eth = $_POST['port'];
|
||||
$vlan = $_POST['vlan'];
|
||||
$port = port($eth).($vlan ? ".$vlan" : "");
|
||||
$v6on = @file_get_contents("/proc/sys/net/ipv6/conf/$port/disable_ipv6")!=1;
|
||||
$v6on = trim(file_get_contents("/proc/sys/net/ipv6/conf/$port/disable_ipv6"))==='0';
|
||||
$none = _('None');
|
||||
$error = "<span class='red-text'>"._('Missing')."</span>";
|
||||
$note = $eth=='eth0' && !$vlan ? $error : $none;
|
||||
$link = _(ucfirst(exec("ethtool $eth | awk '$1==\"Link\" {print $3;exit}'")))." ("._(exec("ethtool $eth | grep -Pom1 '^\s+Port: \K.*'")).")";
|
||||
$speed = _(preg_replace(['/^(\d+)/','/!/'],['$1 ',''],exec("ethtool $eth | awk '$1==\"Speed:\" {print $2;exit}'")));
|
||||
$ipv4 = array_filter(explode(' ',exec("ip -4 -br addr show $port scope global | awk '{\$1=\$2=\"\";print;exit}' | sed -r 's/ metric [0-9]+//g; s/\/[0-9]+//g'")));
|
||||
$gw4 = exec("ip -4 route show default dev $port | awk '{print \$3;exit}'") ?: $note;
|
||||
$note = in_array($eth,['eth0','wlan0']) && !$vlan ? $error : $none;
|
||||
$link = _(ucfirst(exec("ethtool $eth 2>/dev/null | awk '$1==\"Link\" {print $3;exit}'")) ?: 'Unknown')." ("._(exec("ethtool $eth 2>/dev/null | grep -Pom1 '^\s+Port: \K.*'") ?: ($eth=='wlan0' ? 'wifi' :'not present')).")";
|
||||
$speed = _(preg_replace(['/^(\d+)/','/!/'],['$1 ',''],exec("ethtool $eth 2>/dev/null | awk '$1==\"Speed:\" {print $2;exit}'")) ?: 'Unknown');
|
||||
$ipv4 = array_filter(explode(' ',exec("ip -4 -br addr show $port scope global 2>/dev/null | awk '{\$1=\$2=\"\";print;exit}' | sed -r 's/ metric [0-9]+//g; s/\/[0-9]+//g'")));
|
||||
$gw4 = exec("ip -4 route show default dev $port 2>/dev/null | awk '{print \$3;exit}'") ?: $note;
|
||||
$dns4 = array_filter($ns,function($ns){return strpos($ns,':')===false;});
|
||||
$domain = exec("grep -Pom1 'domain \K.*' /etc/resolv.conf") ?: '---';
|
||||
$domain = exec("grep -Pom1 'domain \K.*' /etc/resolv.conf 2>/dev/null") ?: '---';
|
||||
|
||||
if ($v6on) {
|
||||
$ipv6 = array_filter(explode(' ',exec("ip -6 -br addr show $port scope global -temporary | awk '{\$1=\$2=\"\";print;exit}' | sed -r 's/ metric [0-9]+//g; s/\/[0-9]+//g'")));
|
||||
$gw6 = exec("ip -6 route show default dev $port | awk '{print \$3;exit}'") ?: $note;
|
||||
$ipv6 = array_filter(explode(' ',exec("ip -6 -br addr show $port scope global -temporary 2>/dev/null | awk '{\$1=\$2=\"\";print;exit}' | sed -r 's/ metric [0-9]+//g; s/\/[0-9]+//g'")));
|
||||
$gw6 = exec("ip -6 route show default dev $port 2>/dev/null | awk '{print \$3;exit}'") ?: $note;
|
||||
$dns6 = array_filter($ns,function($ns){return strpos($ns,':')!==false;});
|
||||
}
|
||||
|
||||
@@ -46,6 +48,22 @@ echo "<table style='text-align:left;font-size:1.2rem'>";
|
||||
echo "<tr><td> </td><td> </td></tr>";
|
||||
echo "<tr><td>"._('Interface link').":</td><td>$link</td></tr>";
|
||||
echo "<tr><td>"._('Interface speed').":</td><td>$speed</td></tr>";
|
||||
if ($eth=='wlan0') {
|
||||
$ini = '/boot/config/wireless-networks.cfg';
|
||||
$wifi = (array)@parse_ini_file($ini,true);
|
||||
$att1 = $att2 = $att3 = '';
|
||||
foreach ($wifi as $network => $option) {
|
||||
if (isset($option['GROUP']) && $option['GROUP']=='active') {
|
||||
$att1 = $network;
|
||||
$att2 = $option['ATTR2'];
|
||||
$att3 = $option['ATTR3'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($att1) echo "<tr><td>"._('Network').":</td><td>$att1</td></tr>";
|
||||
if ($att2) echo "<tr><td>"._('Health').":</td><td>$att2</td></tr>";
|
||||
if ($att3) echo "<tr><td>"._('Security').":</td><td>$att3</td></tr>";
|
||||
}
|
||||
if (count($ipv4)) foreach ($ipv4 as $ip) {
|
||||
echo "<tr><td>"._('IPv4 address').":</td><td>$ip</td></tr>";
|
||||
} else {
|
||||
|
||||
17
emhttp/plugins/dynamix/include/OpenSSL.php
Normal file
17
emhttp/plugins/dynamix/include/OpenSSL.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2025, Lime Technology
|
||||
* Copyright 2012-2025, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$cipher = 'aes-256-cbc';
|
||||
$key = 'UnraidEncryptionKey';
|
||||
$iv = '12345678910111213';
|
||||
?>
|
||||
199
emhttp/plugins/dynamix/include/Wireless.php
Normal file
199
emhttp/plugins/dynamix/include/Wireless.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2025, Lime Technology
|
||||
* Copyright 2012-2025, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
|
||||
|
||||
$var = '/var/local/emhttp/var.ini';
|
||||
$cfg = '/boot/config/wireless.cfg';
|
||||
$ini = '/var/local/emhttp/wireless.ini';
|
||||
$tmp = '/var/tmp/attr';
|
||||
$wifi = (array)@parse_ini_file($cfg,true);
|
||||
$attr = (array)@parse_ini_file($tmp,true);
|
||||
$md5 = md5(json_encode($attr),true);
|
||||
$cmd = $_POST['cmd'];
|
||||
$masks = [
|
||||
'255.0.0.0' => '8', '255.255.0.0' => '16', '255.255.128.0' => '17', '255.255.192.0' => '18',
|
||||
'255.255.224.0' => '19', '255.255.240.0' => '20', '255.255.248.0' => '21', '255.255.252.0' => '22',
|
||||
'255.255.254.0' => '23', '255.255.255.0' => '24', '255.255.255.128' => '25', '255.255.255.192' => '26',
|
||||
'255.255.255.224' => '27', '255.255.255.240' => '28', '255.255.255.248' => '29', '255.255.255.252' => '30'
|
||||
];
|
||||
|
||||
// add translations
|
||||
$_SERVER['REQUEST_URI'] = 'settings';
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
|
||||
function scanWifi($port) {
|
||||
$wlan = [];
|
||||
exec("iw $port scan | grep -P '^BSS|signal:|SSID:|Authentication'",$scan);
|
||||
$n = -1;
|
||||
for ($i=0; $i<count($scan); $i++) {
|
||||
if (substr($scan[$i],0,3)=='BSS') {
|
||||
$wlan[++$n]['bss'] = substr($scan[$i],4,17);
|
||||
} elseif (strpos($scan[$i],'signal:')!==false) {
|
||||
$wlan[$n]['signal'] = trim(explode(': ',$scan[$i])[1]);
|
||||
} elseif (strpos($scan[$i],'SSID:')!==false) {
|
||||
$wlan[$n]['ssid'] = trim(explode(': ',$scan[$i])[1]);
|
||||
} elseif (strpos($scan[$i],'suites:')!==false) {
|
||||
$wlan[$n]['security'] = trim(explode(': ',$scan[$i])[1]);
|
||||
}
|
||||
}
|
||||
return array_values(array_intersect_key($wlan,array_unique(array_column($wlan,'ssid'))));
|
||||
}
|
||||
|
||||
function saveWifi() {
|
||||
global $cfg, $wifi;
|
||||
$text = [];
|
||||
foreach ($wifi as $network => $block) {
|
||||
$text[] = "[$network]";
|
||||
foreach ($block as $key => $value) $text[] = "$key=\"$value\"";
|
||||
}
|
||||
file_put_contents_atomic($cfg,implode("\n",$text)."\n");
|
||||
}
|
||||
|
||||
function saveAttr() {
|
||||
global $tmp, $attr, $md5;
|
||||
$text = [];
|
||||
if (md5(json_encode($attr),true) === $md5) return;
|
||||
foreach ($attr as $network => $block) {
|
||||
$text[] = "[$network]";
|
||||
foreach ($block as $key => $value) $text[] = "$key=\"$value\"";
|
||||
}
|
||||
file_put_contents_atomic($tmp,implode("\n",$text)."\n");
|
||||
}
|
||||
|
||||
switch ($cmd) {
|
||||
case 'list':
|
||||
$title = _('Connect to WiFi network');
|
||||
$port = array_key_first($wifi);
|
||||
$wlan = scanWifi($port);
|
||||
$echo = [];
|
||||
$index = 0;
|
||||
if (count(array_column($wlan,'ssid'))) {
|
||||
$up = file_get_contents("/sys/class/net/$port/carrier") == 1;
|
||||
$alive = $up ? exec("iw $port link | grep -Pom1 'SSID: \K.+'") : '';
|
||||
$state = $up ? _('Connected') : _('Disconnected');
|
||||
$color = $up ? 'blue' : 'red';
|
||||
|
||||
foreach (array_column($wlan,'ssid') as $network) {
|
||||
$attr[$network]['ATTR1'] = $wlan[$index]['bss'];
|
||||
$attr[$network]['ATTR2'] = $wlan[$index]['signal'];
|
||||
$attr[$network]['ATTR3'] = $wlan[$index]['security'];
|
||||
$index++;
|
||||
if (isset($wifi[$network]['GROUP'])) {
|
||||
if ($network == $alive) {
|
||||
$echo['active'][] = "<dl><dt>$state:</dt>";
|
||||
$echo['active'][] = "<dd><span class=\"wifi\">$network</span><i class=\"fa fa-fw fa-wifi hand $color-text\" onclick=\"manage_wifi(encodeURIComponent('$network'),1)\" title=\"$title\"></i><input type=\"button\" class=\"form\" value=\""._('Info')."\" onclick=\"networkInfo('$port')\"></dd>";
|
||||
} else {
|
||||
$echo['saved'][] = empty($echo['saved']) ? "<dl><dt>"._('My networks').":</dt>" : "<dt> </dt>";
|
||||
$echo['saved'][] = "<dd><span class=\"wifi\">$network</span><i class=\"fa fa-wifi hand blue-text\" onclick=\"manage_wifi(encodeURIComponent('$network'),1)\" title=\"$title\"></i></dd>";
|
||||
}
|
||||
} else {
|
||||
$echo['other'][] = empty($echo['other']) ? "<dl><dt>"._('Other networks').":</dt>" : "<dt> </dt>";
|
||||
$echo['other'][] = "<dd><span class=\"wifi\">$network</span><i class=\"fa fa-wifi hand grey-text\" onclick=\"manage_wifi(encodeURIComponent('$network'),0)\" title=\"$title\"></i></dd>";
|
||||
}
|
||||
}
|
||||
if (empty($echo['active'])) $echo['active'][] = "<dl><dt>"._('Connected').":</dt><dd>"._('None')."</dd>";
|
||||
if (empty($echo['saved'])) $echo['saved'][] = "<dl><dt>"._('My networks').":</dt><dd>"._('None')."</dd>";
|
||||
if (empty($echo['other'])) $echo['other'][] = "<dl><dt>"._('Other networks').":</dt><dd>"._('None')."</dd>";
|
||||
$echo['active'] = implode($echo['active']);
|
||||
$echo['saved'] = implode($echo['saved']);
|
||||
$echo['other'] = implode($echo['other']);
|
||||
saveAttr();
|
||||
}
|
||||
echo json_encode($echo);
|
||||
break;
|
||||
case 'join':
|
||||
require_once "$docroot/webGui/include/OpenSSL.php";
|
||||
$token = parse_ini_file($var)['csrf_token'];
|
||||
$ssid = rawurldecode($_POST['ssid']);
|
||||
$drop = $_POST['drop']==1;
|
||||
$user = _var($wifi[$ssid],'USERNAME') ? openssl_decrypt($wifi[$ssid]['USERNAME'],$cipher,$key,0,$iv) : '';
|
||||
$passwd = _var($wifi[$ssid],'PASSWORD') ? openssl_decrypt($wifi[$ssid]['PASSWORD'],$cipher,$key,0,$iv) : '';
|
||||
$join = _var($wifi[$ssid],'AUTOJOIN','no');
|
||||
$dhcp4 = _var($wifi[$ssid],'DHCP4','yes');
|
||||
$dns4 = _var($wifi[$ssid],'DNS4','no');
|
||||
$ip4 = _var($wifi[$ssid],'IP4');
|
||||
$mask4 = _var($wifi[$ssid],'MASK4','255.255.255.0');
|
||||
$gw4 = _var($wifi[$ssid],'GATEWAY4');
|
||||
$server4 = _var($wifi[$ssid],'SERVER4');
|
||||
$dhcp6 = _var($wifi[$ssid],'DHCP6');
|
||||
$dns6 = _var($wifi[$ssid],'DNS6','no');
|
||||
$ip6 = _var($wifi[$ssid],'IP6');
|
||||
$mask6 = _var($wifi[$ssid],'MASK6','64');
|
||||
$gwv6 = _var($wifi[$ssid],'GATEWAY6');
|
||||
$server6 = _var($wifi[$ssid],'SERVER6');
|
||||
$hide1 = $dhcp4=='no' ? '': 'hide';
|
||||
$hide2 = $dns4=='no' ? 'hide' : '';
|
||||
$hide3 = $dhcp6=='no' ? '' : 'hide';
|
||||
$hide4 = $dhcp6=='' ? 'hide' : '';
|
||||
$hide5 = $dns6=='no' ? 'hide' : '';
|
||||
$attr1 = $attr[$ssid]['ATTR1'];
|
||||
$attr2 = $attr[$ssid]['ATTR2'];
|
||||
$attr3 = $attr[$ssid]['ATTR3'];
|
||||
echo "<form name=\"wifi\" method=\"POST\" action=\"/update.php\" target=\"progressFrame\">";
|
||||
echo "<input type=\"hidden\" name=\"#file\" value=\"$cfg\">";
|
||||
echo "<input type=\"hidden\" name=\"#include\" value=\"/webGui/include/update.wireless.php\">";
|
||||
echo "<input type=\"hidden\" name=\"#command\" value=\"/webGui/scripts/wireless\">";
|
||||
echo "<input type=\"hidden\" name=\"#section\" value=\"$ssid\">";
|
||||
echo "<input type=\"hidden\" name=\"ATTR1\" value=\"$attr1\">";
|
||||
echo "<input type=\"hidden\" name=\"ATTR2\" value=\"$attr2\">";
|
||||
echo "<input type=\"hidden\" name=\"ATTR3\" value=\"$attr3\">";
|
||||
echo "<input type=\"hidden\" name=\"csrf_token\" value=\"$token\">";
|
||||
echo "<table class=\"swal\">";
|
||||
echo "<tr><td colspan=\"2\"> </td></tr>";
|
||||
if ($drop && isset($wifi[$ssid])) {
|
||||
echo "<tr><td colspan=\"2\"><center><input type=\"button\" class=\"form\" value=\""._('Forget this network')."\" onclick=\"manage_wifi(encodeURIComponent('$ssid'),2)\"></center></td></tr>";
|
||||
echo "<tr><td colspan=\"2\"> </td></tr>";
|
||||
}
|
||||
if (strpos($attr3,'IEEE')!==false) echo "<tr><td>"._('Username').":</td><td><input type=\"text\" name=\"USERNAME\" class=\"narrow\" autocomplete=\"off\" spellcheck=\"false\" value=\"$user\"></td></tr>";
|
||||
if ($attr3) echo "<tr><td>"._('Password').":</td><td><input type=\"password\" name=\"PASSWORD\" class=\"narrow\" autocomplete=\"off\" spellcheck=\"false\" value=\"$passwd\"><i id=\"showPass\" class=\"fa fa-eye\" onclick=\"showPassword()\"></i></td></tr>";
|
||||
echo "<tr><td colspan=\"2\"> </td></tr>";
|
||||
echo "<tr><td>"._('IPv4 address assignment').":</td><td><select name=\"DHCP4\" onclick=\"showDHCP(this.value,4)\">";
|
||||
echo mk_option($dhcp4, 'yes', _('Automatic'));
|
||||
echo mk_option($dhcp4, 'no', _('Static'));
|
||||
echo "</select></td></tr>";
|
||||
echo "<tr class=\"static4 $hide1\"><td>"._('IPv4 address').":</td><td><input type=\"text\" name=\"IP4\" class=\"narrow\" maxlength=\"15\" autocomplete=\"off\" spellcheck=\"false\" value=\"$ip4\">/<select name=\"MASK4\" class=\"slim\">";
|
||||
foreach ($masks as $mask => $prefix) echo mk_option($mask4, $mask, $prefix);
|
||||
echo "</select></td></tr>";
|
||||
echo "<tr class=\"static4 $hide1\"><td>"._('IPv4 default gateway').":</td><td><input type=\"text\" name=\"GATEWAY4\" class=\"narrow\" maxlength=\"15\" autocomplete=\"off\" spellcheck=\"false\" value=\"$gw4\"></td></tr>";
|
||||
echo "<tr class=\"dns4\"><td>"._('IPv4 DNS assignment').":</td><td><select name=\"DNS4\" onclick=\"showDNS(this.value,4)\">";
|
||||
echo mk_option($dns4, "no", _("Automatic"));
|
||||
echo mk_option($dns4, "yes", _("Static"));
|
||||
echo "</select></td></tr>";
|
||||
echo "<tr class=\"server4 $hide2\"><td>"._('DNSv4 server').":</td><td><input type=\"text\" name=\"SERVER4\" class=\"narrow\" autocomplete=\"off\" spellcheck=\"false\" value=\"$server4\"></td></tr>";
|
||||
echo "<tr><td colspan=\"2\"> </td></tr>";
|
||||
echo "<tr><td>"._('IPv6 address assignment').":</td><td><select name=\"DHCP6\" onclick=\"showDHCP(this.value,6)\">";
|
||||
echo mk_option($dhcp6, '', _('None'));
|
||||
echo mk_option($dhcp6, 'yes', _('Automatic'));
|
||||
echo mk_option($dhcp6, 'no', _('Static'));
|
||||
echo "</select></td></tr>";
|
||||
echo "<tr class=\"static6 $hide3\"><td>"._('IPv6 address').":</td><td><input type=\"text\" name=\"IP6\" class=\"narrow\" maxlength=\"39\" autocomplete=\"off\" spellcheck=\"false\" value=\"$ip6\">/<input type=\"number\" min=\"1\" max=\"128\" maxlength=\"3\" name=\"MASK6\" class=\"slim\" value=\"$mask6\"></td></tr>";
|
||||
echo "<tr class=\"static6 $hide3\"><td>"._('IPv6 default gateway').":</td><td><input type=\"text\" name=\"GATEWAY6\" class=\"narrow\" maxlength=\"39\" autocomplete=\"off\" spellcheck=\"false\" value=\"$gw6\"></td></tr>";
|
||||
echo "<tr class=\"dns6 $hide4\"><td>"._('IPv6 DNS assignment').":</td><td><select name=\"DNS6\" onclick=\"showDNS(this.value,6)\">";
|
||||
echo mk_option($dns4, "no", _("Automatic"));
|
||||
echo mk_option($dns4, "yes", _("Static"));
|
||||
echo "</select></td></tr>";
|
||||
echo "<tr class=\"server6 $hide5\"><td>"._('DNSv6 server').":</td><td><input type=\"text\" name=\"SERVER6\" class=\"narrow\" autocomplete=\"off\" spellcheck=\"false\" value=\"$server6\"></td></tr>";
|
||||
echo "<tr><td colspan=\"2\"> </td></tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
break;
|
||||
case 'forget':
|
||||
$ssid = rawurldecode($_POST['ssid']);
|
||||
if ($wifi[$ssid]['GROUP'] == 'active') exec("/etc/rc.d/rc.wireless stop &>/dev/null &");
|
||||
unset($wifi[$ssid]);
|
||||
saveWifi();
|
||||
break;
|
||||
}
|
||||
?>
|
||||
24
emhttp/plugins/dynamix/include/update.wireless.php
Normal file
24
emhttp/plugins/dynamix/include/update.wireless.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2025, Lime Technology
|
||||
* Copyright 2012-2025, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
|
||||
require_once "$docroot/webGui/include/OpenSSL.php";
|
||||
|
||||
// encrypt username and password before saving (if existing)
|
||||
if (!empty($_POST['USERNAME'])) $_POST['USERNAME'] = openssl_encrypt($_POST['USERNAME'],$cipher,$key,0,$iv);
|
||||
if (!empty($_POST['PASSWORD'])) $_POST['PASSWORD'] = openssl_encrypt($_POST['PASSWORD'],$cipher,$key,0,$iv);
|
||||
|
||||
// update active wifi selection
|
||||
foreach ($keys as $key => $val) if (isset($val['GROUP'])) $keys[$key]['GROUP'] = 'saved';
|
||||
$keys[$section]['GROUP'] = 'active';
|
||||
?>
|
||||
Reference in New Issue
Block a user