mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Merge pull request #506 from glaszig/feature/dhcp-upstream-server
[WIP] added ui to manage upstream dns servers
This commit is contained in:
@@ -59,6 +59,13 @@ function DisplayDHCPConfig()
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST['no-resolv'] == "1") {
|
||||
$config .= "no-resolv".PHP_EOL;
|
||||
}
|
||||
foreach ($_POST['server'] as $server) {
|
||||
$config .= "server=$server".PHP_EOL;
|
||||
}
|
||||
|
||||
if ($_POST['DNS1']) {
|
||||
$config .= "dhcp-option=6," . $_POST['DNS1'];
|
||||
if ($_POST['DNS2']) {
|
||||
@@ -126,6 +133,8 @@ function DisplayDHCPConfig()
|
||||
$dhcpHost = $conf["dhcp-host"];
|
||||
$dhcpHost = empty($dhcpHost) ? [] : $dhcpHost;
|
||||
$dhcpHost = is_array($dhcpHost) ? $dhcpHost : [ $dhcpHost ];
|
||||
$upstreamServers = is_array($conf['server']) ? $conf['server'] : [ $conf['server'] ];
|
||||
$upstreamServers = array_filter($upstreamServers);
|
||||
|
||||
$DNS1 = '';
|
||||
$DNS2 = '';
|
||||
@@ -173,6 +182,7 @@ function DisplayDHCPConfig()
|
||||
"RangeEnd",
|
||||
"DNS1",
|
||||
"DNS2",
|
||||
"upstreamServers",
|
||||
"arrRangeLeaseTime",
|
||||
"mselected",
|
||||
"hselected",
|
||||
|
@@ -346,3 +346,27 @@ function mb_escapeshellarg($arg)
|
||||
return "\"$escaped_arg\"";
|
||||
}
|
||||
|
||||
function dnsServers()
|
||||
{
|
||||
$data = json_decode(file_get_contents("./config/dns-servers.json"));
|
||||
return (array) $data;
|
||||
}
|
||||
|
||||
function optionsForSelect($options)
|
||||
{
|
||||
$html = "";
|
||||
foreach ($options as $key => $value) {
|
||||
// optgroup
|
||||
if (is_array($value)) {
|
||||
$html .= "<optgroup label=\"$key\">";
|
||||
$html .= optionsForSelect($value);
|
||||
$html .= "</optgroup>";
|
||||
}
|
||||
// option
|
||||
else {
|
||||
$key = is_int($key) ? $value : $key;
|
||||
$html .= "<option value=\"$value\">$key</option>";
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
Reference in New Issue
Block a user