mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
(legacy) prevent some notices in refactored dhcp code
This commit is contained in:
parent
05528a541b
commit
9fe3e40108
@ -139,6 +139,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$savemsg = gettext("The DHCP Server can only be enabled on interfaces configured with static IP addresses") . ".<br/><br/>" . gettext("Only interfaces configured with a static IP will be shown") . ".";
|
||||
}
|
||||
|
||||
/* If no interface is provided, choose first one from interfaces */
|
||||
if (!isset($if)) {
|
||||
foreach ($config['interfaces'] as $if_id => $intf) {
|
||||
if (!empty($intf['enable']) && is_ipaddrv4($intf['ipaddr'])) {
|
||||
$if = $if_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($config['dhcpd'][$if])) {
|
||||
$config['dhcpd'][$if] = array();
|
||||
}
|
||||
@ -153,15 +163,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$act = null;
|
||||
}
|
||||
|
||||
/* If no interface is provided, choose first one from interfaces */
|
||||
if (!isset($if)) {
|
||||
foreach ($config['interfaces'] as $if_id => $intf) {
|
||||
if (!empty($intf['enable']) && is_ipaddrv4($intf['ipaddr'])) {
|
||||
$if = $if_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// point to source of data (pool or main dhcp section)
|
||||
if (isset($pool)) {
|
||||
$dhcpdconf = &$a_pools[$pool];
|
||||
|
||||
@ -45,7 +45,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
header("Location: services_dhcp.php");
|
||||
exit;
|
||||
}
|
||||
if (!empty($config['dhcpd'][$if]['staticmap'][$_GET['id']])) {
|
||||
if (isset($if) && isset($_GET['id']) && !empty($config['dhcpd'][$if]['staticmap'][$_GET['id']])) {
|
||||
$id = $_GET['id'];
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
'ddnsdomainprimary', 'ddnsdomainkeyname', 'ddnsdomainkey', 'ddnsupdate', 'ntp1', 'ntp2', 'tftp', 'ipaddr',
|
||||
'winsserver', 'dnsserver');
|
||||
foreach ($config_copy_fieldnames as $fieldname) {
|
||||
if (isset($config['dhcpd'][$if]['staticmap'][$id][$fieldname])) {
|
||||
if (isset($if) && isset($id) && isset($config['dhcpd'][$if]['staticmap'][$id][$fieldname])) {
|
||||
$pconfig[$fieldname] = $config['dhcpd'][$if]['staticmap'][$id][$fieldname];
|
||||
} elseif (isset($_GET[$fieldname])) {
|
||||
$pconfig[$fieldname] = $_GET[$fieldname];
|
||||
|
||||
@ -74,7 +74,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
"IP addresses. Only interfaces configured with a static IP will be shown."
|
||||
);
|
||||
foreach ($config['interfaces'] as $if_id => $intf) {
|
||||
if (!empty($intf['enable']) && is_ipaddrv6($intf['ipaddrv6']) && !is_linklocal($oc['ipaddrv6'])) {
|
||||
if (!empty($intf['enable']) && isset($intf['ipaddrv6']) && is_ipaddrv6($intf['ipaddrv6']) && !is_linklocal($intf['ipaddrv6'])) {
|
||||
$if = $if_id;
|
||||
break;
|
||||
}
|
||||
@ -445,7 +445,7 @@ include("head.inc");
|
||||
/* active tabs */
|
||||
$tab_array_main = array();
|
||||
foreach ($config['interfaces'] as $if_id => $intf) {
|
||||
if (!empty($intf['enable']) && is_ipaddrv6($intf['ipaddrv6'])) {
|
||||
if (!empty($intf['enable']) && isset($intf['ipaddrv6']) && is_ipaddrv6($intf['ipaddrv6'])) {
|
||||
$ifname = !empty($intf['descr']) ? htmlspecialchars($intf['descr']) : strtoupper($if_id);
|
||||
if ($if_id == $if) {
|
||||
$tab_array_main[] = array($ifname, true, "services_dhcpv6.php?if={$if_id}");
|
||||
@ -815,7 +815,7 @@ include("head.inc");
|
||||
foreach ($config['dhcpdv6'][$if]['staticmap'] as $mapent): ?>
|
||||
<tr>
|
||||
<td><?=htmlspecialchars($mapent['duid']);?></td>
|
||||
<td><?=htmlspecialchars($mapent['ipaddrv6']);?></td>
|
||||
<td><?=isset($mapent['ipaddrv6']) ? htmlspecialchars($mapent['ipaddrv6']) : "";?></td>
|
||||
<td><?=htmlspecialchars($mapent['hostname']);?></td>
|
||||
<td><?=htmlspecialchars($mapent['descr']);?></td>
|
||||
<td>
|
||||
|
||||
@ -37,7 +37,6 @@ function staticmapcmp($a, $b)
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// handle identifiers and action
|
||||
if (!empty($_GET['if']) && !empty($config['interfaces'][$_GET['if']])) {
|
||||
@ -46,7 +45,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
header("Location: services_dhcpv6.php");
|
||||
exit;
|
||||
}
|
||||
if (!empty($config['dhcpdv6'][$if]['staticmap'][$_GET['id']])) {
|
||||
if (isset($if) && isset($_GET['id']) && !empty($config['dhcpdv6'][$if]['staticmap'][$_GET['id']])) {
|
||||
$id = $_GET['id'];
|
||||
}
|
||||
|
||||
@ -54,7 +53,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$pconfig = array();
|
||||
$config_copy_fieldnames = array('duid', 'hostname', 'ipaddrv6', 'filename' ,'rootpath' ,'descr');
|
||||
foreach ($config_copy_fieldnames as $fieldname) {
|
||||
if (isset($config['dhcpdv6'][$if]['staticmap'][$id][$fieldname])) {
|
||||
if (isset($if) && isset($id) && isset($config['dhcpdv6'][$if]['staticmap'][$id][$fieldname])) {
|
||||
$pconfig[$fieldname] = $config['dhcpdv6'][$if]['staticmap'][$id][$fieldname];
|
||||
} elseif (isset($_GET[$fieldname])) {
|
||||
$pconfig[$fieldname] = $_GET[$fieldname];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user