From 1047d14ba0b4d03c2df63898f20d2ab6f8ba9465 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Fri, 21 Apr 2023 22:42:57 +0200 Subject: [PATCH 1/4] Fix function default value, null fails the sub query --- interface/lib/classes/tools_sites.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/lib/classes/tools_sites.inc.php b/interface/lib/classes/tools_sites.inc.php index b2881f57cc..149a9fb67a 100644 --- a/interface/lib/classes/tools_sites.inc.php +++ b/interface/lib/classes/tools_sites.inc.php @@ -145,7 +145,7 @@ class tools_sites { } /* TODO: rewrite SQL */ - function getDomainModuleDomains($not_used_in_table = null, $selected_domain = null) { + function getDomainModuleDomains($not_used_in_table = null, $selected_domain = '') { global $app; $sql = "SELECT domain_id, domain FROM domain WHERE"; -- GitLab From 349ed8a9ddb4915bde2cf31aff8be11dca158ffc Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Fri, 21 Apr 2023 22:43:23 +0200 Subject: [PATCH 2/4] remove invalid argument --- interface/web/dns/dns_wizard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/web/dns/dns_wizard.php b/interface/web/dns/dns_wizard.php index 90e2fef1c4..defaad8618 100644 --- a/interface/web/dns/dns_wizard.php +++ b/interface/web/dns/dns_wizard.php @@ -196,7 +196,7 @@ if ($domains_settings['use_domain_module'] == 'y') { /* * The domain-module is in use. */ - $domains = $app->tools_sites->getDomainModuleDomains("dns_soa", 'domain'); + $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 */ -- GitLab From 03d007bf788f47d93c71c2d0036961e1cb6fa159 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Fri, 21 Apr 2023 22:44:02 +0200 Subject: [PATCH 3/4] Pass the current domain to exclude it from teh filter --- interface/web/sites/web_childdomain_edit.php | 2 +- interface/web/sites/web_vhost_domain_edit.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/interface/web/sites/web_childdomain_edit.php b/interface/web/sites/web_childdomain_edit.php index 019057b3be..3f2726a040 100644 --- a/interface/web/sites/web_childdomain_edit.php +++ b/interface/web/sites/web_childdomain_edit.php @@ -105,7 +105,7 @@ class page_action extends tform_actions { /* * The domain-module is in use. */ - $domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain"); + $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) { diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index 365582e9af..e9e1ef602e 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -694,7 +694,8 @@ class page_action extends tform_actions { /* * The domain-module is in use. */ - $domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain"); + $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) { -- GitLab From f02f15ef2c90191710d6c8c8c36ecc26ab7eb7e9 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Fri, 21 Apr 2023 22:51:47 +0200 Subject: [PATCH 4/4] Fix a null value passed in by the create new forms, which lack an id. --- interface/lib/classes/tools_sites.inc.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interface/lib/classes/tools_sites.inc.php b/interface/lib/classes/tools_sites.inc.php index 149a9fb67a..4ff2b4c75c 100644 --- a/interface/lib/classes/tools_sites.inc.php +++ b/interface/lib/classes/tools_sites.inc.php @@ -148,6 +148,10 @@ class tools_sites { function getDomainModuleDomains($not_used_in_table = null, $selected_domain = '') { global $app; + // Fix a null value passed in by the create new forms, which lack an id. + if ($selected_domain == null) { + $selected_domain = ''; + } $sql = "SELECT domain_id, domain FROM domain WHERE"; if ($not_used_in_table) { if (strpos($not_used_in_table, 'dns') !== false) { -- GitLab