From 7182b245b3f6631e3c4cc02cc6c8f591f41e5433 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Thu, 1 Apr 2010 10:18:05 +0000 Subject: [PATCH] - assign correct (parentdomains) php-configuration to new subdomains, fixes #107 --- customer_domains.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/customer_domains.php b/customer_domains.php index c2c45506..5ebab6af 100644 --- a/customer_domains.php +++ b/customer_domains.php @@ -291,7 +291,31 @@ elseif($page == 'domains') } else { - $result = $db->query("INSERT INTO `" . TABLE_PANEL_DOMAINS . "` (`customerid`, `domain`, `documentroot`, `ipandport`, `aliasdomain`, `parentdomainid`, `isemaildomain`, `openbasedir`, `openbasedir_path`, `safemode`, `speciallogfile`, `specialsettings`, `ssl_redirect`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($completedomain) . "', '" . $db->escape($path) . "', '" . $db->escape($domain_check['ipandport']) . "', " . (($aliasdomain != 0) ? "'" . $db->escape($aliasdomain) . "'" : "NULL") . ", '" . (int)$domain_check['id'] . "', '" . ($domain_check['subcanemaildomain'] == '3' ? '1' : '0') . "', '" . $db->escape($domain_check['openbasedir']) . "', '" . $db->escape($openbasedir_path) . "', '" . $db->escape($domain_check['safemode']) . "', '" . $db->escape($domain_check['speciallogfile']) . "', '" . $db->escape($domain_check['specialsettings']) . "', '" . $ssl_redirect . "')"); + // get the phpsettingid from parentdomain, #107 + $phpsid_result = $db->query_first("SELECT `phpsettingid` FROM `".TABLE_PANEL_DOMAINS."` WHERE `id` = '".(int)$domain_check['id']."'"); + if(!isset($phpsid_result['phpsettingid']) + || (int)$phpsid_result['phpsettingid'] <= 0 + ) { + // assign default config + $phpsid_result['phpsettingid'] = 1; + } + + $result = $db->query("INSERT INTO `" . TABLE_PANEL_DOMAINS . "` SET + `customerid` = '" . (int)$userinfo['customerid'] . "', + `domain` = '" . $db->escape($completedomain) . "', + `documentroot` = '" . $db->escape($path) . "', + `ipandport` = '" . $db->escape($domain_check['ipandport']) . "', + `aliasdomain` = ".(($aliasdomain != 0) ? "'" . $db->escape($aliasdomain) . "'" : "NULL") .", + `parentdomainid` = '" . (int)$domain_check['id'] . "', + `isemaildomain` = '" . ($domain_check['subcanemaildomain'] == '3' ? '1' : '0') . "', + `openbasedir` = '" . $db->escape($domain_check['openbasedir']) . "', + `openbasedir_path` = '" . $db->escape($openbasedir_path) . "', + `safemode` = '" . $db->escape($domain_check['safemode']) . "', + `speciallogfile` = '" . $db->escape($domain_check['speciallogfile']) . "', + `specialsettings` = '" . $db->escape($domain_check['specialsettings']) . "', + `ssl_redirect` = '" . $ssl_redirect . "', + `phpsettingid` = '" . $phpsid_result['phpsettingid'] . "'"); + $result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used`=`subdomains_used`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "added subdomain '" . $completedomain . "'"); inserttask('1');