diff --git a/admin_customers.php b/admin_customers.php index 0c96941c..406439e6 100644 --- a/admin_customers.php +++ b/admin_customers.php @@ -278,12 +278,14 @@ if ($page == 'customers' Database::pexecute($stmt, array('id' => $id)); $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid` = :id"); Database::pexecute($stmt, array('id' => $id)); - // first gather all domain-id's to clean up panel_domaintoip accordingly + // first gather all domain-id's to clean up panel_domaintoip and dns-entries accordingly $did_stmt = Database::prepare("SELECT `id` FROM `".TABLE_PANEL_DOMAINS."` WHERE `customerid` = :id"); Database::pexecute($did_stmt, array('id' => $id)); while ($row = $did_stmt->fetch(PDO::FETCH_ASSOC)) { $stmt = Database::prepare("DELETE FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_domain` = :did"); Database::pexecute($stmt, array('did' => $row['id'])); + $stmt = Database::prepare("DELETE FROM `" . TABLE_DOMAIN_DNS . "` WHERE `domain_id` = :did"); + Database::pexecute($stmt, array('did' => $row['id'])); } $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid` = :id"); Database::pexecute($stmt, array('id' => $id)); @@ -526,6 +528,11 @@ if ($page == 'customers' $perlenabled = intval($_POST['perlenabled']); } + $dnsenabled = 0; + if (isset($_POST['dnsenabled'])) { + $dnsenabled = intval($_POST['dnsenabled']); + } + $store_defaultindex = 0; if (isset($_POST['store_defaultindex'])) { $store_defaultindex = intval($_POST['store_defaultindex']); @@ -638,6 +645,10 @@ if ($page == 'customers' $perlenabled = '1'; } + if ($dnsenabled != '0') { + $dnsenabled = '1'; + } + if ($password == '') { $password = generatePassword(); } @@ -676,6 +687,7 @@ if ($page == 'customers' 'imap' => $email_imap, 'pop3' => $email_pop3, 'perlenabled' => $perlenabled, + 'dnsenabled' => $dnsenabled, 'theme' => $_theme, 'custom_notes' => $custom_notes, 'custom_notes_show' => $custom_notes_show @@ -712,9 +724,11 @@ if ($page == 'customers' `mysqls` = :mysqls, `standardsubdomain` = '0', `phpenabled` = :phpenabled, + `dnsenabled` = :dnsenabled, `imap` = :imap, `pop3` = :pop3, `perlenabled` = :perlenabled, + `dnsenabled` = :dnsenabled, `theme` = :theme, `custom_notes` = :custom_notes, `custom_notes_show` = :custom_notes_show" @@ -1186,6 +1200,11 @@ if ($page == 'customers' $perlenabled = intval($_POST['perlenabled']); } + $dnsenabled = 0; + if (isset($_POST['dnsenabled'])) { + $dnsenabled = intval($_POST['dnsenabled']); + } + $diskspace = $diskspace * 1024; $traffic = $traffic * 1024 * 1024; @@ -1317,6 +1336,10 @@ if ($page == 'customers' $perlenabled = '1'; } + if ($dnsenabled != '0') { + $dnsenabled = '1'; + } + if ($phpenabled != $result['phpenabled'] || $perlenabled != $result['perlenabled'] ) { @@ -1427,6 +1450,7 @@ if ($page == 'customers' 'imap' => $email_imap, 'pop3' => $email_pop3, 'perlenabled' => $perlenabled, + 'dnsenabled' => $dnsenabled, 'custom_notes' => $custom_notes, 'custom_notes_show' => $custom_notes_show ); @@ -1460,6 +1484,7 @@ if ($page == 'customers' `imap` = :imap, `pop3` = :pop3, `perlenabled` = :perlenabled, + `dnsenabled` = :dnsenabled `custom_notes` = :custom_notes, `custom_notes_show` = :custom_notes_show WHERE `customerid` = :customerid" diff --git a/admin_domains.php b/admin_domains.php index af3c18a1..c840b277 100644 --- a/admin_domains.php +++ b/admin_domains.php @@ -245,6 +245,15 @@ if ($page == 'domains' || $page == 'overview') { 'domainid' => $id )); + // remove possible existing DNS entries + $del_stmt = Database::prepare(" + DELETE FROM `" . TABLE_DOMAIN_DNS . "` + WHERE `domain_id` = :domainid + "); + Database::pexecute($del_stmt, array( + 'domainid' => $id + )); + triggerLetsEncryptCSRForAliasDestinationDomain($result['aliasdomain'], $log); $log->logAction(ADM_ACTION, LOG_INFO, "deleted domain/subdomains (#" . $result['id'] . ")"); diff --git a/customer_domains.php b/customer_domains.php index c34f296a..f9432f1b 100644 --- a/customer_domains.php +++ b/customer_domains.php @@ -232,6 +232,13 @@ if ($page == 'overview') { ); Database::pexecute($del_stmt, array('domainid' => $id)); + // remove possible existing DNS entries + $del_stmt = Database::prepare(" + DELETE FROM `" . TABLE_DOMAIN_DNS . "` + WHERE `domain_id` = :domainid + "); + Database::pexecute($del_stmt, array('domainid' => $id)); + inserttask('1'); // Using nameserver, insert a task which rebuilds the server config diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index a7ed3ef1..507add57 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -3365,3 +3365,12 @@ if (isDatabaseVersion('201605120')) { updateToDbVersion('201605170'); } + +if (isDatabaseVersion('201605170')) { + + showUpdateStep("Adding new dns-editor setting for customers"); + Database::query("ALTER TABLE `panel_customers` ADD `dnsenabled` tinyint(1) NOT NULL default '0' AFTER `perlenabled`;"); + lastStepStatus(0); + + updateToDbVersion('201605170'); +} diff --git a/lib/formfields/admin/customer/formfield.customer_add.php b/lib/formfields/admin/customer/formfield.customer_add.php index 54a7e863..eaa408aa 100644 --- a/lib/formfields/admin/customer/formfield.customer_add.php +++ b/lib/formfields/admin/customer/formfield.customer_add.php @@ -257,7 +257,15 @@ return array( 'values' => array( array ('label' => $lng['panel']['yes'], 'value' => '1') ) - ) + ), + 'dnsenabled' => array( + 'label' => $lng['admin']['dnsenabled'].'?', + 'type' => 'checkbox', + 'values' => array( + array ('label' => $lng['panel']['yes'], 'value' => '1') + ), + 'visible' => (Settings::Get('system.dnsenabled') == '1' ? true : false) + ), ) ) ) diff --git a/lib/formfields/admin/customer/formfield.customer_edit.php b/lib/formfields/admin/customer/formfield.customer_edit.php index b7e23476..b099651f 100644 --- a/lib/formfields/admin/customer/formfield.customer_edit.php +++ b/lib/formfields/admin/customer/formfield.customer_edit.php @@ -267,7 +267,16 @@ return array( array ('label' => $lng['panel']['yes'], 'value' => '1') ), 'value' => array($result['perlenabled']) - ) + ), + 'dnsenabled' => array( + 'label' => $lng['admin']['dnsenabled'].'?', + 'type' => 'checkbox', + 'values' => array( + array ('label' => $lng['panel']['yes'], 'value' => '1') + ), + 'value' => array($result['dnsenabled']), + 'visible' => (Settings::Get('system.dnsenabled') == '1' ? true : false) + ), ) ), 'section_d' => array( diff --git a/lng/english.lng.php b/lng/english.lng.php index 72873745..da5a5a66 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -2016,3 +2016,4 @@ $lng['serversettings']['dns_server']['title'] = 'DNS server daemon'; $lng['serversettings']['dns_server']['description'] = 'Remember that daemons have to be configured using froxlors configuration templates'; $lng['error']['domain_nopunycode'] = 'You must not specify punycode (IDNA). The domain will automatically be converted'; +$lng['admin']['dnsenabled'] = 'Enable DNS editor'; diff --git a/lng/german.lng.php b/lng/german.lng.php index ee44bec4..9b26a8ff 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1669,3 +1669,4 @@ $lng['serversettings']['dns_server']['title'] = 'DNS Server Dienst'; $lng['serversettings']['dns_server']['description'] = 'Dienste müssen mit den froxlor Konfigurationstemplates konfiguriert werden'; $lng['error']['domain_nopunycode'] = 'Die Eingabe von Punycode (IDNA) ist nicht notwendig. Die Domain wird automatisch konvertiert.'; +$lng['admin']['dnsenabled'] = 'Zugriff auf DNS Editor';