Skip to content

Commit 1fef4a5

Browse files
committed
- Fixed FS#3203 - Choice of "Default Secondary DNS Server" broken.
1 parent 2c0812a commit 1fef4a5

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

interface/lib/classes/custom_datasource.inc.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,28 @@ function dns_servers($field, $record) {
6363
return $records_new;
6464
}
6565

66+
function slave_dns_servers($field, $record) {
67+
global $app, $conf;
68+
69+
if($_SESSION["s"]["user"]["typ"] == 'user') {
70+
// Get the limits of the client
71+
$client_group_id = $_SESSION["s"]["user"]["default_group"];
72+
$client = $app->db->queryOneRecord("SELECT default_slave_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
73+
$sql = "SELECT server_id,server_name FROM server WHERE server_id = ".$client['default_slave_dnsserver'];
74+
} else {
75+
$sql = "SELECT server_id,server_name FROM server WHERE dns_server = 1 ORDER BY server_name";
76+
}
77+
$records = $app->db->queryAllRecords($sql);
78+
$records_new = array();
79+
if(is_array($records)) {
80+
foreach($records as $rec) {
81+
$key = $rec['server_id'];
82+
$records_new[$key] = $rec['server_name'];
83+
}
84+
}
85+
return $records_new;
86+
}
87+
6688
function webdav_domains($field, $record) {
6789
global $app, $conf;
6890

interface/web/dns/list/dns_slave.list.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@
6464
'op' => "like",
6565
'prefix' => "%",
6666
'suffix' => "%",
67-
'datasource'=> array ( 'type' => 'CUSTOM',
68-
'class'=> 'custom_datasource',
69-
'function'=> 'dns_servers'
67+
'datasource'=> array ( 'type' => 'CUSTOM',
68+
'class' => 'custom_datasource',
69+
'function' => 'slave_dns_servers'
7070
),
7171
'width' => "",
7272
'value' => "");

0 commit comments

Comments
 (0)