Commit 9ec3045a authored by Sergio's avatar Sergio
Browse files

hide used domains from domain select, except for subdomain forms

parent 021ef646
......@@ -144,10 +144,20 @@ class tools_sites {
return $res;
}
function getDomainModuleDomains() {
function getDomainModuleDomains($not_used_in_table = null, $selected_domain = null) {
global $app;
$sql = "SELECT domain_id, domain FROM domain WHERE";
if ($not_used_in_table) {
if (strpos($not_used_in_table, 'dns') !== false) {
$field = "origin";
$select = "SUBSTRING($field, 1, CHAR_LENGTH($field) - 1)";
} else {
$field = "domain";
$select = $field;
}
$sql .= " domain NOT IN (SELECT $select FROM $not_used_in_table WHERE $field != '$selected_domain') AND";
}
if ($_SESSION["s"]["user"]["typ"] == 'admin') {
$sql .= " 1";
} else {
......
......@@ -161,7 +161,7 @@ if ($settings['use_domain_module'] == 'y') {
/*
* The domain-module is in use.
*/
$domains = $app->tools_sites->getDomainModuleDomains();
$domains = $app->tools_sites->getDomainModuleDomains("dns_soa");
/*
* We can leave domain empty if domain is filename
*/
......
......@@ -116,7 +116,7 @@ class page_action extends tform_actions {
/*
* The domain-module is in use.
*/
$domains = $app->tools_sites->getDomainModuleDomains();
$domains = $app->tools_sites->getDomainModuleDomains("dns_slave", $this->dataRecord["origin"]);
$domain_select = '';
if(is_array($domains) && sizeof($domains) > 0) {
/* We have domains in the list, so create the drop-down-list */
......
......@@ -157,7 +157,7 @@ class page_action extends tform_actions {
/*
* The domain-module is in use.
*/
$domains = $app->tools_sites->getDomainModuleDomains();
$domains = $app->tools_sites->getDomainModuleDomains("dns_soa", $this->dataRecord["origin"]);
$domain_select = '';
if(is_array($domains) && sizeof($domains) > 0) {
/* We have domains in the list, so create the drop-down-list */
......
......@@ -167,7 +167,7 @@ if ($settings['use_domain_module'] == 'y') {
/*
* The domain-module is in use.
*/
$domains = $app->tools_sites->getDomainModuleDomains();
$domains = $app->tools_sites->getDomainModuleDomains("dns_soa");
$domain_select = '';
if(is_array($domains) && sizeof($domains) > 0) {
/* We have domains in the list, so create the drop-down-list */
......
......@@ -150,7 +150,7 @@ class page_action extends tform_actions {
/*
* The domain-module is in use.
*/
$domains = $app->tools_sites->getDomainModuleDomains();
$domains = $app->tools_sites->getDomainModuleDomains("mail_domain", $this->dataRecord["domain"]);
$domain_select = '';
if(is_array($domains) && sizeof($domains) > 0) {
/* We have domains in the list, so create the drop-down-list */
......
......@@ -105,7 +105,7 @@ class page_action extends tform_actions {
/*
* The domain-module is in use.
*/
$domains = $app->tools_sites->getDomainModuleDomains();
$domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain", $this->dataRecord["domain"]);
$domain_select = '';
$selected_domain = '';
if(is_array($domains) && sizeof($domains) > 0) {
......
......@@ -631,7 +631,7 @@ class page_action extends tform_actions {
/*
* The domain-module is in use.
*/
$domains = $app->tools_sites->getDomainModuleDomains();
$domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain", $this->dataRecord["domain"]);
$domain_select = '';
$selected_domain = '';
if(is_array($domains) && sizeof($domains) > 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment