Sergio Cambra
2014-07-08 9ec3045a846c5e46e5e1be87272449876b21ed1f
hide used domains from domain select, except for subdomain forms
8 files modified
26 ■■■■■ changed files
interface/lib/classes/tools_sites.inc.php 12 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_import.php 2 ●●● patch | view | raw | blame | history
interface/web/dns/dns_slave_edit.php 2 ●●● patch | view | raw | blame | history
interface/web/dns/dns_soa_edit.php 2 ●●● patch | view | raw | blame | history
interface/web/dns/dns_wizard.php 2 ●●● patch | view | raw | blame | history
interface/web/mail/mail_domain_edit.php 2 ●●● patch | view | raw | blame | history
interface/web/sites/web_childdomain_edit.php 2 ●●● patch | view | raw | blame | history
interface/web/sites/web_vhost_domain_edit.php 2 ●●● patch | view | raw | blame | history
interface/lib/classes/tools_sites.inc.php
@@ -144,10 +144,20 @@
        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 {
interface/web/dns/dns_import.php
@@ -161,7 +161,7 @@
    /*
     * 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
    */
interface/web/dns/dns_slave_edit.php
@@ -116,7 +116,7 @@
            /*
             * 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 */
interface/web/dns/dns_soa_edit.php
@@ -157,7 +157,7 @@
        /*
         * 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 */
interface/web/dns/dns_wizard.php
@@ -167,7 +167,7 @@
    /*
     * 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 */
interface/web/mail/mail_domain_edit.php
@@ -150,7 +150,7 @@
            /*
             * 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 */
interface/web/sites/web_childdomain_edit.php
@@ -105,7 +105,7 @@
            /*
             * 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) {
interface/web/sites/web_vhost_domain_edit.php
@@ -631,7 +631,7 @@
            /*
             * 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) {