From 59453a47facdd0fc81091cc42b0757ac8f7e5302 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 21 Dec 2018 17:51:29 +0100 Subject: [PATCH] fix dns-related function calls Signed-off-by: Michael Kaufmann --- lib/Froxlor/Api/Commands/DomainZones.php | 4 ++-- lib/Froxlor/Cron/Dns/Bind.php | 4 ++-- lib/Froxlor/Cron/Dns/PowerDNS.php | 4 ++-- lib/Froxlor/Dns/Dns.php | 6 +++--- lib/Froxlor/User.php | 2 +- tests/bootstrap.php | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/Froxlor/Api/Commands/DomainZones.php b/lib/Froxlor/Api/Commands/DomainZones.php index c0295a8c..b1f7f313 100644 --- a/lib/Froxlor/Api/Commands/DomainZones.php +++ b/lib/Froxlor/Api/Commands/DomainZones.php @@ -192,7 +192,7 @@ class DomainZones extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour $content .= '.'; } elseif ($type == 'TXT' && ! empty($content)) { // check that TXT content is enclosed in " " - $content = encloseTXTContent($content); + $content = \Froxlor\Dns\Dns::encloseTXTContent($content); } elseif ($type == 'SRV') { if ($prio === null || $prio < 0) { $errors[] = $this->lng['error']['dns_srv_prioempty']; @@ -329,7 +329,7 @@ class DomainZones extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour \Froxlor\UI\Response::standard_error('dns_domain_nodns', '', true); } - $zone = createDomainZone($id); + $zone = \Froxlor\Dns\Dns::createDomainZone($id); $zonefile = (string) $zone; $this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_NOTICE, "[API] get dns-zone for '" . $result['domain'] . "'"); diff --git a/lib/Froxlor/Cron/Dns/Bind.php b/lib/Froxlor/Cron/Dns/Bind.php index 1ca791e4..000ecf19 100644 --- a/lib/Froxlor/Cron/Dns/Bind.php +++ b/lib/Froxlor/Cron/Dns/Bind.php @@ -78,7 +78,7 @@ class Bind extends DnsBase } if ($domain['ismainbutsubto'] == 0) { - $zoneContent = (string) createDomainZone(($domain['id'] == 'none') ? $domain : $domain['id'], $isFroxlorHostname); + $zoneContent = (string) \Froxlor\Dns\Dns::createDomainZone(($domain['id'] == 'none') ? $domain : $domain['id'], $isFroxlorHostname); $domain['zonefile'] = 'domains/' . $domain['domain'] . '.zone'; $zonefile_name = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.bindconf_directory') . '/' . $domain['zonefile']); $zonefile_handler = fopen($zonefile_name, 'w'); @@ -87,7 +87,7 @@ class Bind extends DnsBase $this->_logger->logAction(CRON_ACTION, LOG_INFO, '`' . $zonefile_name . '` written'); $this->_bindconf_file .= $this->_generateDomainConfig($domain); } else { - return (string) createDomainZone(($domain['id'] == 'none') ? $domain : $domain['id'], $isFroxlorHostname, true); + return (string) \Froxlor\Dns\Dns::createDomainZone(($domain['id'] == 'none') ? $domain : $domain['id'], $isFroxlorHostname, true); } } else { $this->_logger->logAction(CRON_ACTION, LOG_INFO, 'Added zonefile ' . $domain['zonefile'] . ' for domain ' . $domain['domain'] . ' - Note that you will also have to handle ALL records for ALL subdomains.'); diff --git a/lib/Froxlor/Cron/Dns/PowerDNS.php b/lib/Froxlor/Cron/Dns/PowerDNS.php index d719ecc5..75fd7d97 100644 --- a/lib/Froxlor/Cron/Dns/PowerDNS.php +++ b/lib/Froxlor/Cron/Dns/PowerDNS.php @@ -63,7 +63,7 @@ class PowerDNS extends DnsBase } if ($domain['ismainbutsubto'] == 0) { - $zoneContent = createDomainZone(($domain['id'] == 'none') ? $domain : $domain['id'], $isFroxlorHostname); + $zoneContent = \Froxlor\Dns\Dns::createDomainZone(($domain['id'] == 'none') ? $domain : $domain['id'], $isFroxlorHostname); if (count($subzones)) { foreach ($subzones as $subzone) { $zoneContent->records[] = $subzone; @@ -74,7 +74,7 @@ class PowerDNS extends DnsBase $this->_insertAllowedTransfers($pdnsDomId); $this->_logger->logAction(CRON_ACTION, LOG_INFO, 'DB entries stored for zone `' . $domain['domain'] . '`'); } else { - return createDomainZone(($domain['id'] == 'none') ? $domain : $domain['id'], $isFroxlorHostname, true); + return \Froxlor\Dns\Dns::createDomainZone(($domain['id'] == 'none') ? $domain : $domain['id'], $isFroxlorHostname, true); } } else { $this->_logger->logAction(CRON_ACTION, LOG_ERROR, 'Custom zonefiles are NOT supported when PowerDNS is selected as DNS daemon (triggered by: ' . $domain['domain'] . ')'); diff --git a/lib/Froxlor/Dns/Dns.php b/lib/Froxlor/Dns/Dns.php index 65ce539b..654224a5 100644 --- a/lib/Froxlor/Dns/Dns.php +++ b/lib/Froxlor/Dns/Dns.php @@ -329,10 +329,10 @@ class Dns $required[$type][md5($record)] = $record; } - private static function encloseTXTContent($txt_content, $isMultiLine = false) + public static function encloseTXTContent($txt_content, $isMultiLine = false) { // check that TXT content is enclosed in " " - if ($isMultiLine == false && Settings::Get('system.dns_server') != 'pdns') { + if ($isMultiLine == false && Settings::Get('system.dns_server') != 'PowerDNS') { if (substr($txt_content, 0, 1) != '"') { $txt_content = '"' . $txt_content; } @@ -340,7 +340,7 @@ class Dns $txt_content .= '"'; } } - if (Settings::Get('system.dns_server') == 'pdns') { + if (Settings::Get('system.dns_server') == 'PowerDNS') { // no quotation for PowerDNS if (substr($txt_content, 0, 1) == '"') { $txt_content = substr($txt_content, 1); diff --git a/lib/Froxlor/User.php b/lib/Froxlor/User.php index 0a17cf8e..94b52ee3 100644 --- a/lib/Froxlor/User.php +++ b/lib/Froxlor/User.php @@ -123,7 +123,7 @@ class User 'email_quota', 'subdomains' ) as $field) { - _addResourceCount($admin_resources[$cur_adm], $customer, $field . '_used', $field); + self::_addResourceCount($admin_resources[$cur_adm], $customer, $field . '_used', $field); } $customer_mysqls_stmt = Database::prepare('SELECT COUNT(*) AS `number_mysqls` FROM `' . TABLE_PANEL_DATABASES . '` diff --git a/tests/bootstrap.php b/tests/bootstrap.php index b16dd30b..08b77d0f 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -155,6 +155,6 @@ Settings::Set('system.use_ssl', '1', true); Settings::Set('system.froxlordirectlyviahostname', '1', true); Settings::Set('system.dns_createhostnameentry', '1', true); Settings::Set('system.dnsenabled', '1', true); -Settings::Set('system.dns_server', 'pdns', true); +Settings::Set('system.dns_server', 'PowerDNS', true); Settings::Set('phpfpm.enabled', '1', true); Settings::Set('phpfpm.enabled_ownvhost', '1', true);