Skip to content

Commit 9ec3045

Browse files
committed
hide used domains from domain select, except for subdomain forms
1 parent 021ef64 commit 9ec3045

File tree

8 files changed

+18
-8
lines changed

8 files changed

+18
-8
lines changed

interface/lib/classes/tools_sites.inc.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,20 @@ function convertClientName($name){
144144
return $res;
145145
}
146146

147-
function getDomainModuleDomains() {
147+
function getDomainModuleDomains($not_used_in_table = null, $selected_domain = null) {
148148
global $app;
149149

150150
$sql = "SELECT domain_id, domain FROM domain WHERE";
151+
if ($not_used_in_table) {
152+
if (strpos($not_used_in_table, 'dns') !== false) {
153+
$field = "origin";
154+
$select = "SUBSTRING($field, 1, CHAR_LENGTH($field) - 1)";
155+
} else {
156+
$field = "domain";
157+
$select = $field;
158+
}
159+
$sql .= " domain NOT IN (SELECT $select FROM $not_used_in_table WHERE $field != '$selected_domain') AND";
160+
}
151161
if ($_SESSION["s"]["user"]["typ"] == 'admin') {
152162
$sql .= " 1";
153163
} else {

interface/web/dns/dns_import.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
/*
162162
* The domain-module is in use.
163163
*/
164-
$domains = $app->tools_sites->getDomainModuleDomains();
164+
$domains = $app->tools_sites->getDomainModuleDomains("dns_soa");
165165
/*
166166
* We can leave domain empty if domain is filename
167167
*/

interface/web/dns/dns_slave_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function onShowEnd() {
116116
/*
117117
* The domain-module is in use.
118118
*/
119-
$domains = $app->tools_sites->getDomainModuleDomains();
119+
$domains = $app->tools_sites->getDomainModuleDomains("dns_slave", $this->dataRecord["origin"]);
120120
$domain_select = '';
121121
if(is_array($domains) && sizeof($domains) > 0) {
122122
/* We have domains in the list, so create the drop-down-list */

interface/web/dns/dns_soa_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ function onShowEnd() {
157157
/*
158158
* The domain-module is in use.
159159
*/
160-
$domains = $app->tools_sites->getDomainModuleDomains();
160+
$domains = $app->tools_sites->getDomainModuleDomains("dns_soa", $this->dataRecord["origin"]);
161161
$domain_select = '';
162162
if(is_array($domains) && sizeof($domains) > 0) {
163163
/* We have domains in the list, so create the drop-down-list */

interface/web/dns/dns_wizard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
/*
168168
* The domain-module is in use.
169169
*/
170-
$domains = $app->tools_sites->getDomainModuleDomains();
170+
$domains = $app->tools_sites->getDomainModuleDomains("dns_soa");
171171
$domain_select = '';
172172
if(is_array($domains) && sizeof($domains) > 0) {
173173
/* We have domains in the list, so create the drop-down-list */

interface/web/mail/mail_domain_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function onShowEnd() {
150150
/*
151151
* The domain-module is in use.
152152
*/
153-
$domains = $app->tools_sites->getDomainModuleDomains();
153+
$domains = $app->tools_sites->getDomainModuleDomains("mail_domain", $this->dataRecord["domain"]);
154154
$domain_select = '';
155155
if(is_array($domains) && sizeof($domains) > 0) {
156156
/* We have domains in the list, so create the drop-down-list */

interface/web/sites/web_childdomain_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function onShowEnd() {
105105
/*
106106
* The domain-module is in use.
107107
*/
108-
$domains = $app->tools_sites->getDomainModuleDomains();
108+
$domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain", $this->dataRecord["domain"]);
109109
$domain_select = '';
110110
$selected_domain = '';
111111
if(is_array($domains) && sizeof($domains) > 0) {

interface/web/sites/web_vhost_domain_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ function onShowEnd() {
631631
/*
632632
* The domain-module is in use.
633633
*/
634-
$domains = $app->tools_sites->getDomainModuleDomains();
634+
$domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain", $this->dataRecord["domain"]);
635635
$domain_select = '';
636636
$selected_domain = '';
637637
if(is_array($domains) && sizeof($domains) > 0) {

0 commit comments

Comments
 (0)