Skip to content

Commit 4e825ff

Browse files
committed
Fix issues in DNS wizard
1 parent 1f51858 commit 4e825ff

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

interface/lib/classes/dns_wizard.inc.php

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ function create(array $data)
3737
global $app;
3838
$app->uses('getconf');
3939

40+
// get system settings
41+
$settings = $app->getconf->get_global_config();
42+
43+
$error = '';
44+
4045
// get the correct server_id
4146
if (isset($data['server_id'])) {
4247
$server_id = $app->functions->intval($data['server_id']);
@@ -45,13 +50,18 @@ function create(array $data)
4550
$server_id = $app->functions->intval($data['server_id_value']);
4651
$post_server_id = true;
4752
} else {
48-
$settings = $app->getconf->get_global_config('dns');
49-
$server_id = $app->functions->intval($settings['default_dnsserver']);
53+
$server_id = $app->functions->intval($settings['dns']['default_dnsserver']);
54+
if(empty($server_id)) {
55+
$tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE dns_server = 1 LIMIT 0,1');
56+
if(!empty($tmp['server_id'])) {
57+
$server_id = $tmp['server_id'];
58+
} else {
59+
$error .= $app->lng('error_no_server_id').'<br />';
60+
}
61+
}
5062
$post_server_id = false;
5163
}
5264

53-
$error = '';
54-
5565
if ($post_server_id)
5666
{
5767
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
@@ -74,12 +84,16 @@ function create(array $data)
7484
// apply filters
7585
if(isset($data['domain']) && $data['domain'] != ''){
7686
/* check if the domain module is used - and check if the selected domain can be used! */
77-
if ($domains_settings['use_domain_module'] == 'y') {
87+
if ($settings['domains']['use_domain_module'] == 'y') {
88+
// get domain_id for domain
89+
$tmp = $app->db->queryOneRecord('SELECT domain_id from domain where domain = ?', $data['domain']);
90+
$domain_id = $app->functions->intval( $tmp['domain_id']);
91+
7892
if ($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
79-
$data['client_group_id'] = $app->tools_sites->getClientIdForDomain($data['domain']);
93+
$data['client_group_id'] = $app->tools_sites->getClientIdForDomain($domain_id);
8094
}
81-
$domain_check = $app->tools_sites->checkDomainModuleDomain($data['domain']);
82-
if(!$domain_check) {
95+
$domain_check = $app->tools_sites->checkDomainModuleDomain($domain_id);
96+
if($domain_check === false) {
8397
// invalid domain selected
8498
$data['domain'] = '';
8599
} else {
@@ -110,7 +124,7 @@ function create(array $data)
110124

111125
if(isset($data['ip']) && $data['ip'] == '') $error .= $app->lng('error_ip_empty').'<br />';
112126

113-
if(isset($data['ipv6']) && $data['ipv6'] == '') $error .= $app->lng('error_ipv6_empty').'<br />';
127+
//if(isset($data['ipv6']) && $data['ipv6'] == '') $error .= $app->lng('error_ipv6_empty').'<br />';
114128

115129
# fixme: this regex is pretty poor for hostname validation
116130
if(isset($data['ns1']) && $data['ns1'] == '') $error .= $app->lng('error_ns1_empty').'<br />';

0 commit comments

Comments
 (0)