private function walkDomainList($domain, $domains)
 {
     $zoneContent = '';
     $subzones = '';
     foreach ($domain['children'] as $child_domain_id) {
         $subzones .= $this->walkDomainList($domains[$child_domain_id], $domains);
     }
     if ($domain['zonefile'] == '') {
         // check for system-hostname
         $isFroxlorHostname = false;
         if (isset($domain['froxlorhost']) && $domain['froxlorhost'] == 1) {
             $isFroxlorHostname = true;
         }
         if ($domain['ismainbutsubto'] == 0) {
             $zoneContent = (string) createDomainZone($domain['id'] == 'none' ? $domain : $domain['id'], $isFroxlorHostname);
             $domain['zonefile'] = 'domains/' . $domain['domain'] . '.zone';
             $zonefile_name = makeCorrectFile(Settings::Get('system.bindconf_directory') . '/' . $domain['zonefile']);
             $zonefile_handler = fopen($zonefile_name, 'w');
             fwrite($zonefile_handler, $zoneContent . $subzones);
             fclose($zonefile_handler);
             $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);
         }
     } 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.');
         $this->_bindconf_file .= $this->_generateDomainConfig($domain);
     }
 }
 private function walkDomainList($domain, $domains)
 {
     $zoneContent = '';
     $subzones = array();
     foreach ($domain['children'] as $child_domain_id) {
         $subzones[] = $this->walkDomainList($domains[$child_domain_id], $domains);
     }
     if ($domain['zonefile'] == '') {
         // check for system-hostname
         $isFroxlorHostname = false;
         if (isset($domain['froxlorhost']) && $domain['froxlorhost'] == 1) {
             $isFroxlorHostname = true;
         }
         if ($domain['ismainbutsubto'] == 0) {
             $zoneContent = createDomainZone($domain['id'] == 'none' ? $domain : $domain['id'], $isFroxlorHostname);
             if (count($subzones)) {
                 foreach ($subzones as $subzone) {
                     $zoneContent->records[] = $subzone;
                 }
             }
             $pdnsDomId = $this->_insertZone($zoneContent->origin, $zoneContent->serial);
             $this->_insertRecords($pdnsDomId, $zoneContent->records, $zoneContent->origin);
             $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);
         }
     } else {
         $this->_logger->logAction(CRON_ACTION, LOG_ERROR, 'Custom zonefiles are NOT supported when PowerDNS is selected as DNS daemon (triggered by: ' . $domain['domain'] . ')');
     }
 }
示例#3
0
            }
        }
        unset($_t);
        // success message (inline)
        $success_message = $lng['success']['dns_record_deleted'];
        // re-generate bind configs
        inserttask('4');
    }
}
// show editor
$record_list = "";
$existing_entries = "";
$type_select = "";
$entriescount = 0;
if (!empty($dom_entries)) {
    $entriescount = count($dom_entries);
    foreach ($dom_entries as $entry) {
        $entry['content'] = wordwrap($entry['content'], 100, '<br>', true);
        eval("\$existing_entries.=\"" . getTemplate("dns_editor/entry_bit", true) . "\";");
    }
}
// available types
$type_select_values = array('A', 'AAAA', 'NS', 'MX', 'SRV', 'TXT', 'CNAME');
asort($type_select_values);
foreach ($type_select_values as $_type) {
    $type_select .= makeoption($_type, $_type, $type);
}
eval("\$record_list=\"" . getTemplate("dns_editor/list", true) . "\";");
$zone = createDomainZone($domain_id);
$zonefile = (string) $zone;
eval("echo \"" . getTemplate("dns_editor/index", true) . "\";");