add flag to allow access to dns-editor per customer; clean up dns-entries when domain gets deleted
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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'] . ")");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user