removed IP addresses from DB

Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
tracer 2022-02-12 19:36:33 +01:00
parent cf8fb56d2d
commit ac21b53bb9
1 changed files with 40 additions and 4 deletions

View File

@ -215,7 +215,7 @@ class DomainController
*
* @return void
*/
public function createZoneFile(Domain $domain): void
public function createSlaveZoneFile(Domain $domain): void
{
if ($this->config['debug']) {
$domainName = $domain->getName();
@ -223,15 +223,16 @@ class DomainController
}
if ($zonefile = fopen(filename: $this->localZonesDir . $domain->getName(), mode: 'w')) {
fputs(stream: $zonefile, data: 'zone \"' . $domain->getA() . '"' . ' IN {' . PHP_EOL);
// TODO fixme soon
//fputs(stream: $zonefile, data: 'zone \"' . $domain->getA() . '"' . ' IN {' . PHP_EOL);
fputs(stream: $zonefile, data: "\ttype slave;" . PHP_EOL);
fputs(stream: $zonefile, data: "\tfile \"" . $this->zoneCachePath . $domain->getName() . '.db";' . PHP_EOL);
fputs(stream: $zonefile, data: "\tmasters {" . PHP_EOL);
if (!empty($a)) {
fputs(stream: $zonefile, data: "\t\t" . $domain->getA() . ';' . PHP_EOL);
// fputs(stream: $zonefile, data: "\t\t" . $domain->getA() . ';' . PHP_EOL);
}
if (!empty($aaaa)) {
fputs(stream: $zonefile, data: "\t\t" . $domain->getAaaa() . ';' . PHP_EOL);
// fputs(stream: $zonefile, data: "\t\t" . $domain->getAaaa() . ';' . PHP_EOL);
}
fputs(stream: $zonefile, data: "\t};" . PHP_EOL);
fputs(stream: $zonefile, data: "};" . PHP_EOL);
@ -240,4 +241,39 @@ class DomainController
// TODO add on nameservers
}
/**
* @param String $panel
*
* @return String
*/
function createPanelContent(String $panel): String
{
return json_encode(value: [
'panel' => $panel
]
);
}
/**
* @param String $panel
*
* @return false|string
*/
function createIPContent(array $ip): String
{
$result = [];
if (!empty($ip['a'])) {
$result['a'] = $ip['a'];
}
if (!empty($ip['aaaa'])) {
$result['aaaa'] = $ip['aaaa'];
}
return json_encode(value: [
'custom' => $result
]
);
}
}