mirror of
https://github.com/unraid/webgui.git
synced 2026-01-07 10:10:05 -06:00
Merge pull request #1327 from bergware/master
netconfig: PHP8 fix and regression fix
This commit is contained in:
@@ -350,15 +350,15 @@ function disableForm(form) {
|
||||
$(form).find('input[name^="DESCRIPTION"],input[name^="#"]').prop('disabled',false);
|
||||
}
|
||||
var stopEvent = false;
|
||||
function exitCode(form,key) {
|
||||
function noRun(form) {
|
||||
var arg1 = $(form).find('input[name="#arg[1]"]');
|
||||
if (arg1.val()=='') arg1.val('none');
|
||||
stopEvent = true;
|
||||
}
|
||||
function doRun(form) {
|
||||
if (stopEvent) {stopEvent = false; return;}
|
||||
var arg1 = $(form).find('input[name="#arg[1]"]');
|
||||
if (!key) {
|
||||
arg1.val($(form).find('input[name="#section"]').val());
|
||||
} else {
|
||||
if (arg1.val()=='') arg1.val('none');
|
||||
stopEvent = true;
|
||||
}
|
||||
arg1.val($(form).find('input[name="#section"]').val());
|
||||
}
|
||||
function portcheck_eth0() {
|
||||
$.post('/webGui/include/CheckPort.php',{port:'eth0'},function(text) {
|
||||
@@ -437,7 +437,7 @@ $(function() {
|
||||
watchDHCP.start();
|
||||
});
|
||||
</script>
|
||||
<form markdown="1" name="eth0_settings" method="POST" action="/update.php" target="progressFrame" onchange="exitCode(this,false)" onsubmit="return prepareSettings(this)">
|
||||
<form markdown="1" name="eth0_settings" method="POST" action="/update.php" target="progressFrame" onchange="doRun(this)" onsubmit="return prepareSettings(this)">
|
||||
<input type="hidden" name="#file" value="<?=$ini?>">
|
||||
<input type="hidden" name="#include" value="/webGui/include/update.ethernet.php">
|
||||
<input type="hidden" name="#section" value="eth0">
|
||||
@@ -450,7 +450,7 @@ $(function() {
|
||||
<input type="hidden" name="BRFD" value="0">
|
||||
_(Interface description)_:
|
||||
: <span class="status vshift"><i id="tag-eth0" class="fa fa-fw fa-chevron-down" style="cursor:pointer" onclick="viewToggle('eth0')"></i></span>
|
||||
<input type="text" name="DESCRIPTION:0" maxlength="80" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:0"))?>" oninput="exitCode(this.form,true)">
|
||||
<input type="text" name="DESCRIPTION:0" maxlength="80" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:0"))?>" oninput="noRun(this.form)">
|
||||
|
||||
:eth_interface_description_help:
|
||||
|
||||
@@ -669,7 +669,7 @@ _(Enable VLANs)_:
|
||||
<div markdown="1" id="index-eth0-<?=$i?>" class="access-eth0 shade-<?=$display['theme']?>" style="display:none">
|
||||
_(Interface description)_:
|
||||
: <span class="status vshift"><i id="tag-eth0-<?=$i?>" class="fa fa-fw fa-chevron-down" style="cursor:pointer" onclick="viewToggle('eth0','<?=$i?>')"></i></span>
|
||||
<input type="text" name="DESCRIPTION:<?=$i?>" maxlength="80" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:$i"))?>" onchange="exitCode(this.form,true)">
|
||||
<input type="text" name="DESCRIPTION:<?=$i?>" maxlength="80" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:$i"))?>" oninput="noRun(this.form)">
|
||||
|
||||
:eth_interface_description_help:
|
||||
|
||||
@@ -781,7 +781,7 @@ _(IPv6 privacy extensions)_:
|
||||
<div markdown="1" id="index-eth0-INDEX" class="access-eth0 shade-<?=$display['theme']?>">
|
||||
_(Interface description)_:
|
||||
: <span class="status vshift"><i id="tag-eth0-INDEX" class="fa fa-fw fa-chevron-up" style="cursor:pointer" onclick="viewToggle('eth0','INDEX')"></i></span>
|
||||
<input type="text" name="DESCRIPTION:INDEX" maxlength="80" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:INDEX"))?>" onchange="exitCode(this.form,true)">
|
||||
<input type="text" name="DESCRIPTION:INDEX" maxlength="80" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:INDEX"))?>" oninput="noRun(this.form)">
|
||||
|
||||
<div markdown="1" id="view-eth0-INDEX">
|
||||
_(VLAN number)_:
|
||||
|
||||
@@ -577,6 +577,7 @@ foreach (glob("/var/log/syslog*") as $file) {
|
||||
run("sed -ri 's|\b\S+@\S+\.\S+\b|email@removed.com|;s|\b(username\|password)([=:])\S+\b|\\1\\2xxx|;s|(GUID: \S)\S+(\S) |\\1..\\2 |;s|(moving \"\S\|\"/mnt/user/\S).*(\S)\"|\\1..\\2\"|' ".escapeshellarg("$log.txt"));
|
||||
run("sed -ri 's|(server: ).+(\.(my)?unraid\.net(:[0-9]+)?,)|\\1hash\\2|;s|(host: \").+(\.(my)?unraid\.net(:[0-9]+)?\")|\\1hash\\2|;s|(referrer: \"https?://).+(\.(my)?unraid\.net)|\\1hash\\2|' ".escapeshellarg("$log.txt"));
|
||||
foreach ($titles as $mover) {
|
||||
if (!$mover) continue;
|
||||
$title = "/{$mover[0]}..".substr($mover,-1)."/...";
|
||||
run("sed -i 's/".str_replace("/","\/",$mover)."/".str_replace("/","\/",$title)."/g' ".escapeshellarg("$log.txt")." 2>/dev/null");
|
||||
//run("sed -ri 's|(file: [.>cr].*)[ /]$mover/.*$|\\1 file: $title|' ".escapeshellarg("$log.txt")." 2>/dev/null");
|
||||
|
||||
@@ -21,7 +21,7 @@ function ifname($name) {
|
||||
global $old;
|
||||
if (!$name) return;
|
||||
for ($i=0; $i<$old['SYSNICS']; $i++) {
|
||||
$nics = $old['BONDNICS'][$i] ?: $old['BRNICS'][$i];
|
||||
$nics = $old['BONDNICS'][$i] ?? $old['BRNICS'][$i] ?? '';
|
||||
if (strpos("$nics ","$name ")!==false) return $old['IFNAME'][$i];
|
||||
}
|
||||
return $name;
|
||||
@@ -40,13 +40,13 @@ function bridge_nics(&$bridge,$nic) {
|
||||
if ($run) {
|
||||
$old = [];
|
||||
if (file_exists($cfg)) {
|
||||
$old = parse_ini_string(preg_replace('/^#/m',';',file_get_contents($cfg)));
|
||||
$old = parse_ini_string(preg_replace(['/^#/m',"/\r/m"],[';',''],file_get_contents($cfg)));
|
||||
if (isset($old['SYSNICS'])) {
|
||||
// new syntax
|
||||
$ifname = ifname($set);
|
||||
} else {
|
||||
// legacy syntax
|
||||
if ($set=='eth0') $ifname = $old['BRIDGING']=='yes' ? ($old['BRNAME'] ?: 'br0') : ($old['BONDING']=='yes' ? ($old['BONDNAME'] ?: 'bond0') : $set);
|
||||
if ($set=='eth0') $ifname = $old['BRIDGING']=='yes' ? ($old['BRNAME'] ?? 'br0') : ($old['BONDING']=='yes' ? ($old['BONDNAME'] ?? 'bond0') : $set);
|
||||
}
|
||||
}
|
||||
exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$ifname}_stop")." >/dev/null");
|
||||
@@ -95,8 +95,8 @@ foreach ($ini as $name => $port) {
|
||||
if ($item=='USE_DHCP6') $USE_DHCP6 = $val;
|
||||
if (in_array($item,['IPADDR','NETMASK','GATEWAY']) && $USE_DHCP!='no') continue;
|
||||
if (in_array($item,['IPADDR6','NETMASK6','GATEWAY6']) && $USE_DHCP6!='no') continue;
|
||||
if (preg_match('/^DNS_SERVER/',$key) && (empty($DHCP_KEEPRESOLV) || $DHCP_KEEPRESOLV=='no')) continue;
|
||||
if (preg_match('/^DNS6_SERVER/',$key) && (empty($DHCP6_KEEPRESOLV) || $DHCP6_KEEPRESOLV=='no')) continue;
|
||||
if (preg_match('/^DNS_SERVER/',$key) && isset($DHCP_KEEPRESOLV) && $DHCP_KEEPRESOLV=='no') continue;
|
||||
if (preg_match('/^DNS6_SERVER/',$key) && isset($DHCP6_KEEPRESOLV) && $DHCP6_KEEPRESOLV=='no') continue;
|
||||
if ($item=='PRIVACY6' && $PROTOCOL=='ipv4') continue;
|
||||
if ($item=='METRIC' && $PROTOCOL=='ipv6') continue;
|
||||
if ($item=='METRIC6' && $PROTOCOL=='ipv4') continue;
|
||||
|
||||
Reference in New Issue
Block a user