From ed9235d341339ee5029316ace2de020c5e340827 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Fri, 6 Aug 2010 05:43:28 +0000 Subject: [PATCH] - add possibility to add a subdomain of another domain as "full"-domain in admin-interface, fixes #329 --- admin_domains.php | 58 +++++++++++++++--- install/froxlor.sql | 3 +- .../updates/froxlor/0.9/update_0.9.inc.php | 11 ++++ .../function.domainHasMainSubDomains.php | 60 +++++++++++++++++++ lib/tables.inc.php | 2 +- lng/english.lng.php | 6 ++ lng/german.lng.php | 6 ++ .../jobs/cron_tasks.inc.http.10.apache.php | 11 +++- .../jobs/cron_tasks.inc.http.20.lighttpd.php | 15 ++++- templates/admin/domains/domains_add.tpl | 4 ++ templates/admin/domains/domains_edit.tpl | 4 ++ 11 files changed, 165 insertions(+), 15 deletions(-) create mode 100644 lib/functions/froxlor/function.domainHasMainSubDomains.php diff --git a/admin_domains.php b/admin_domains.php index f7a79841..d4d04030 100644 --- a/admin_domains.php +++ b/admin_domains.php @@ -157,7 +157,15 @@ if($page == 'domains' standard_error('domains_cantdeletedomainwithapsinstances'); } - $query = 'SELECT `id` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE (`id`="' . (int)$id . '" OR `parentdomainid`="' . (int)$id . '") AND `isemaildomain`="1"'; + // check for deletion of main-domains which are logically subdomains, #329 + $rsd_sql = ''; + $remove_subbutmain_domains = isset($_POST['delete_userfiles']) ? 1 : 0; + if($remove_subbutmain_domains == 1) + { + $rsd_sql .= ' OR `ismainbutsubto` = "'.(int)$id.'"'; + } + + $query = 'SELECT `id` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE (`id`="' . (int)$id . '" OR `parentdomainid`="' . (int)$id . '"'.$rsd_sql.') AND `isemaildomain`="1"'; $subResult = $db->query($query); $idString = array(); @@ -177,7 +185,7 @@ if($page == 'domains' $log->logAction(ADM_ACTION, LOG_NOTICE, "deleted domain/s from mail-tables"); } - $db->query("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `id`='" . (int)$id . "' OR `parentdomainid`='" . (int)$result['id'] . "'"); + $db->query("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `id`='" . (int)$id . "' OR `parentdomainid`='" . (int)$result['id'] . "'".$rsd_sql); $deleted_domains = (int)$db->affected_rows(); $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used` = `subdomains_used` - " . (int)($deleted_domains - 1) . " WHERE `customerid` = '" . (int)$result['customerid'] . "'"); $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `domains_used` = `domains_used` - 1 WHERE `adminid` = '" . (int)$userinfo['adminid'] . "'"); @@ -191,7 +199,12 @@ if($page == 'domains' } else { - ask_yesno('admin_domain_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['domain'])); + $showcheck = false; + if(domainHasMainSubDomains($id)) + { + $showcheck = true; + } + ask_yesno_withcheckbox('admin_domain_reallydelete', 'remove_subbutmain_domains', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['domain']), $showcheck); } } } @@ -216,6 +229,7 @@ if($page == 'domains' $wwwserveralias = intval($_POST['wwwserveralias']); $speciallogfile = intval($_POST['speciallogfile']); $aliasdomain = intval($_POST['alias']); + $issubof = intval($_POST['issubof']); $customerid = intval($_POST['customerid']); $customer = $db->query_first("SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `customerid`='" . (int)$customerid . "' " . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = '" . (int)$userinfo['adminid'] . "' ") . " "); @@ -446,6 +460,11 @@ if($page == 'domains' { $caneditdomain = '0'; } + + if($issubof <= '0') + { + $issubof = '0'; + } if($domain == '') { @@ -500,7 +519,8 @@ if($page == 'domains' 'mod_fcgid_starter' => $mod_fcgid_starter, 'mod_fcgid_maxrequests' => $mod_fcgid_maxrequests, 'specialsettings' => $specialsettings, - 'registration_date' => $registration_date + 'registration_date' => $registration_date, + 'issubof' => $issubof ); $security_questions = array( @@ -522,7 +542,7 @@ if($page == 'domains' } } - $db->query("INSERT INTO `" . TABLE_PANEL_DOMAINS . "` (`domain`, `customerid`, `adminid`, `documentroot`, `ipandport`,`aliasdomain`, `zonefile`, `dkim`, `wwwserveralias`, `isbinddomain`, `isemaildomain`, `email_only`, `subcanemaildomain`, `caneditdomain`, `openbasedir`, `safemode`,`speciallogfile`, `specialsettings`, `ssl`, `ssl_redirect`, `ssl_ipandport`, `add_date`, `registration_date`, `phpsettingid`, `mod_fcgid_starter`, `mod_fcgid_maxrequests`) VALUES ('" . $db->escape($domain) . "', '" . (int)$customerid . "', '" . (int)$adminid . "', '" . $db->escape($documentroot) . "', '" . $db->escape($ipandport) . "', " . (($aliasdomain != 0) ? '\'' . $db->escape($aliasdomain) . '\'' : 'NULL') . ", '" . $db->escape($zonefile) . "', '" . $db->escape($dkim) . "', '" . $db->escape($wwwserveralias) . "', '" . $db->escape($isbinddomain) . "', '" . $db->escape($isemaildomain) . "', '" . $db->escape($email_only) . "', '" . $db->escape($subcanemaildomain) . "', '" . $db->escape($caneditdomain) . "', '" . $db->escape($openbasedir) . "', '" . $db->escape($safemode) . "', '" . $db->escape($speciallogfile) . "', '" . $db->escape($specialsettings) . "', '" . $ssl . "', '" . $ssl_redirect . "' , '" . $ssl_ipandport . "', '" . $db->escape(time()) . "', '" . $db->escape($registration_date) . "', '" . (int)$phpsettingid . "', '" . (int)$mod_fcgid_starter . "', '" . (int)$mod_fcgid_maxrequests . "')"); + $db->query("INSERT INTO `" . TABLE_PANEL_DOMAINS . "` (`domain`, `customerid`, `adminid`, `documentroot`, `ipandport`,`aliasdomain`, `zonefile`, `dkim`, `wwwserveralias`, `isbinddomain`, `isemaildomain`, `email_only`, `subcanemaildomain`, `caneditdomain`, `openbasedir`, `safemode`,`speciallogfile`, `specialsettings`, `ssl`, `ssl_redirect`, `ssl_ipandport`, `add_date`, `registration_date`, `phpsettingid`, `mod_fcgid_starter`, `mod_fcgid_maxrequests`, `ismainbutsubto`) VALUES ('" . $db->escape($domain) . "', '" . (int)$customerid . "', '" . (int)$adminid . "', '" . $db->escape($documentroot) . "', '" . $db->escape($ipandport) . "', " . (($aliasdomain != 0) ? '\'' . $db->escape($aliasdomain) . '\'' : 'NULL') . ", '" . $db->escape($zonefile) . "', '" . $db->escape($dkim) . "', '" . $db->escape($wwwserveralias) . "', '" . $db->escape($isbinddomain) . "', '" . $db->escape($isemaildomain) . "', '" . $db->escape($email_only) . "', '" . $db->escape($subcanemaildomain) . "', '" . $db->escape($caneditdomain) . "', '" . $db->escape($openbasedir) . "', '" . $db->escape($safemode) . "', '" . $db->escape($speciallogfile) . "', '" . $db->escape($specialsettings) . "', '" . $ssl . "', '" . $ssl_redirect . "' , '" . $ssl_ipandport . "', '" . $db->escape(time()) . "', '" . $db->escape($registration_date) . "', '" . (int)$phpsettingid . "', '" . (int)$mod_fcgid_starter . "', '" . (int)$mod_fcgid_maxrequests . "', '".(int)$issubof."')"); $domainid = $db->insert_id(); $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `domains_used` = `domains_used` + 1 WHERE `adminid` = '" . (int)$adminid . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "added domain '" . $domain . "'"); @@ -607,12 +627,16 @@ if($page == 'domains' } $domains = makeoption($lng['domains']['noaliasdomain'], 0, NULL, true); + $subtodomains = makeoption($lng['domains']['nosubtomaindomain'], 0, NULL, true); $result_domains = $db->query("SELECT `d`.`id`, `d`.`domain`, `c`.`loginname` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` WHERE `d`.`aliasdomain` IS NULL AND `d`.`parentdomainid`=0 " . $standardsubdomains . ($userinfo['customers_see_all'] ? '' : " AND `d`.`adminid` = '" . (int)$userinfo['adminid'] . "'") . " AND `d`.`customerid`=`c`.`customerid` ORDER BY `loginname`, `domain` ASC"); + $all_domains = ''; while($row_domain = $db->fetch_array($result_domains)) { - $domains.= makeoption($idna_convert->decode($row_domain['domain']) . ' (' . $row_domain['loginname'] . ')', $row_domain['id']); + $all_domains.= makeoption($idna_convert->decode($row_domain['domain']) . ' (' . $row_domain['loginname'] . ')', $row_domain['id']); } + $domains .= $all_domains; + $subtodomains .= $all_domains; $phpconfigs = ''; $configs = $db->query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`"); @@ -724,6 +748,7 @@ if($page == 'domains' } $aliasdomain = intval($_POST['alias']); + $issubof = intval($_POST['issubof']); $isemaildomain = intval($_POST['isemaildomain']); $email_only = intval($_POST['email_only']); $subcanemaildomain = intval($_POST['subcanemaildomain']); @@ -915,6 +940,11 @@ if($page == 'domains' { standard_error('domainisaliasorothercustomer'); } + + if($issubof <= '0') + { + $issubof = '0'; + } $params = array( 'id' => $id, @@ -942,7 +972,8 @@ if($page == 'domains' 'mod_fcgid_starter' => $mod_fcgid_starter, 'mod_fcgid_maxrequests' => $mod_fcgid_maxrequests, 'specialsettings' => $specialsettings, - 'registration_date' => $registration_date + 'registration_date' => $registration_date, + 'issubof' => $issubof ); $security_questions = array( @@ -976,7 +1007,8 @@ if($page == 'domains' || $mod_fcgid_starter != $result['mod_fcgid_starter'] || $mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] || $specialsettings != $result['specialsettings'] - || $aliasdomain != $result['aliasdomain']) + || $aliasdomain != $result['aliasdomain'] + || $issubof != $result['ismainbutsubto']) { inserttask('1'); } @@ -1038,7 +1070,7 @@ if($page == 'domains' $log->logAction(ADM_ACTION, LOG_INFO, "removed specialsettings on all subdomains of domain #" . $id); } - $result = $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `customerid` = '" . (int)$customerid . "', `adminid` = '" . (int)$adminid . "', `documentroot`='" . $db->escape($documentroot) . "', `ipandport`='" . $db->escape($ipandport) . "', `ssl`='" . (int)$ssl . "', `ssl_redirect`='" . (int)$ssl_redirect . "', `ssl_ipandport`='" . (int)$ssl_ipandport . "', `aliasdomain`=" . (($aliasdomain != 0 && $alias_check == 0) ? '\'' . $db->escape($aliasdomain) . '\'' : 'NULL') . ", `isbinddomain`='" . $db->escape($isbinddomain) . "', `isemaildomain`='" . $db->escape($isemaildomain) . "', `email_only`='" . $db->escape($email_only) . "', `subcanemaildomain`='" . $db->escape($subcanemaildomain) . "', `dkim`='" . $db->escape($dkim) . "', `caneditdomain`='" . $db->escape($caneditdomain) . "', `zonefile`='" . $db->escape($zonefile) . "', `wwwserveralias`='" . $db->escape($wwwserveralias) . "', `openbasedir`='" . $db->escape($openbasedir) . "', `safemode`='" . $db->escape($safemode) . "', `phpsettingid`='" . $db->escape($phpsettingid) . "', `mod_fcgid_starter`='" . $db->escape($mod_fcgid_starter) . "', `mod_fcgid_maxrequests`='" . $db->escape($mod_fcgid_maxrequests) . "', `specialsettings`='" . $db->escape($specialsettings) . "', `registration_date`='" . $db->escape($registration_date) . "' WHERE `id`='" . (int)$id . "'"); + $result = $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `customerid` = '" . (int)$customerid . "', `adminid` = '" . (int)$adminid . "', `documentroot`='" . $db->escape($documentroot) . "', `ipandport`='" . $db->escape($ipandport) . "', `ssl`='" . (int)$ssl . "', `ssl_redirect`='" . (int)$ssl_redirect . "', `ssl_ipandport`='" . (int)$ssl_ipandport . "', `aliasdomain`=" . (($aliasdomain != 0 && $alias_check == 0) ? '\'' . $db->escape($aliasdomain) . '\'' : 'NULL') . ", `isbinddomain`='" . $db->escape($isbinddomain) . "', `isemaildomain`='" . $db->escape($isemaildomain) . "', `email_only`='" . $db->escape($email_only) . "', `subcanemaildomain`='" . $db->escape($subcanemaildomain) . "', `dkim`='" . $db->escape($dkim) . "', `caneditdomain`='" . $db->escape($caneditdomain) . "', `zonefile`='" . $db->escape($zonefile) . "', `wwwserveralias`='" . $db->escape($wwwserveralias) . "', `openbasedir`='" . $db->escape($openbasedir) . "', `safemode`='" . $db->escape($safemode) . "', `phpsettingid`='" . $db->escape($phpsettingid) . "', `mod_fcgid_starter`='" . $db->escape($mod_fcgid_starter) . "', `mod_fcgid_maxrequests`='" . $db->escape($mod_fcgid_maxrequests) . "', `specialsettings`='" . $db->escape($specialsettings) . "', `registration_date`='" . $db->escape($registration_date) . "', `ismainbutsubto`='" . (int)$issubof . "' WHERE `id`='" . (int)$id . "'"); $result = $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `customerid` = '" . (int)$customerid . "', `adminid` = '" . (int)$adminid . "', `ipandport`='" . $db->escape($ipandport) . "', `openbasedir`='" . $db->escape($openbasedir) . "', `safemode`='" . $db->escape($safemode) . "', `phpsettingid`='" . $db->escape($phpsettingid) . "', `mod_fcgid_starter`='" . $db->escape($mod_fcgid_starter) . "', `mod_fcgid_maxrequests`='" . $db->escape($mod_fcgid_maxrequests) . "'" . $upd_specialsettings . $updatechildren . " WHERE `parentdomainid`='" . (int)$id . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "edited domain #" . $id); $redirect_props = Array( @@ -1093,6 +1125,14 @@ if($page == 'domains' { $domains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['aliasdomain']); } + + $subtodomains = makeoption($lng['domains']['nosubtomaindomain'], 0, NULL, true); + $result_domains = $db->query("SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` WHERE `d`.`aliasdomain` IS NULL AND `d`.`parentdomainid`=0 AND `d`.`id`<>'" . (int)$result['id'] . "' AND `c`.`standardsubdomain`<>`d`.`id` AND `d`.`customerid`='" . (int)$result['customerid'] . "' AND `c`.`customerid`=`d`.`customerid` ORDER BY `d`.`domain` ASC"); + + while($row_domain = $db->fetch_array($result_domains)) + { + $subtodomains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['ismainbutsubto']); + } if($userinfo['ip'] == "-1") { diff --git a/install/froxlor.sql b/install/froxlor.sql index c543a779..b3c7bc30 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -301,6 +301,7 @@ CREATE TABLE `panel_domains` ( `phpsettingid` INT( 11 ) UNSIGNED NOT NULL DEFAULT '1', `mod_fcgid_starter` int(4) default '-1', `mod_fcgid_maxrequests` int(4) default '-1', + `ismainbutsubto` int(11) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `customerid` (`customerid`), KEY `parentdomain` (`parentdomainid`), @@ -454,7 +455,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload'); -INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.12-svn2'); +INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.12-svn3'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900'); diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index 5ab97fe3..2ede4bc1 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -973,3 +973,14 @@ if(isFroxlorVersion('0.9.12-svn1')) updateToVersion('0.9.12-svn2'); } + +if(isFroxlorVersion('0.9.12-svn2')) +{ + showUpdateStep("Updating from 0.9.12-svn2 to 0.9.12-svn3", false); + + showUpdateStep("Adding new field to domain table"); + $db->query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` ADD `ismainbutsubto` int(11) unsigned NOT NULL default '0' AFTER `mod_fcgid_maxrequests`;"); + lastStepStatus(0); + + updateToVersion('0.9.12-svn3'); +} diff --git a/lib/functions/froxlor/function.domainHasMainSubDomains.php b/lib/functions/froxlor/function.domainHasMainSubDomains.php new file mode 100644 index 00000000..d64abfd3 --- /dev/null +++ b/lib/functions/froxlor/function.domainHasMainSubDomains.php @@ -0,0 +1,60 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Functions + * @version $Id$ + */ + +/** + * check whether a domain has subdomains added as full-domains + * #329 + * + * @param int $id domain-id + * + * @return boolean + */ +function domainHasMainSubDomains($id = 0) +{ + global $db; + + $sql = "SELECT COUNT(`id`) as `mainsubs` FROM `".TABLE_PANEL_DOMAINS."` WHERE `ismainbutsubto` = '".(int)$id."'"; + $result = $db->query_first($sql); + if(isset($result['mainsubs']) + && $result['mainsubs'] > 0 + ) { + return true; + } + return false; +} + +/** + * check whether a subof-domain exists + * #329 + * + * @param int $id subof-domain-id + * + * @return boolean + */ +function domainMainToSubExists($id = 0) +{ + global $db; + + $sql = "SELECT `id` FROM `".TABLE_PANEL_DOMAINS."` WHERE `id` = '".(int)$id."'"; + $result = $db->query_first($sql); + if(isset($result['id']) + && $result['id'] > 0 + ) { + return true; + } + return false; +} diff --git a/lib/tables.inc.php b/lib/tables.inc.php index 420cd697..099f21c4 100644 --- a/lib/tables.inc.php +++ b/lib/tables.inc.php @@ -72,7 +72,7 @@ define('PACKAGE_ENABLED', 2); // VERSION INFO -$version = '0.9.12-svn2'; +$version = '0.9.12-svn3'; $dbversion = '2'; $branding = ''; diff --git a/lng/english.lng.php b/lng/english.lng.php index bb97b203..7fd3ad40 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1468,4 +1468,10 @@ $lng['panel']['descriptionerrordocument'] = 'Can be an URL, path to a file or ju $lng['error']['stringerrordocumentnotvalidforlighty'] = 'A string as ErrorDocument does not work in lighttpd, please specify a path to a file'; $lng['error']['urlerrordocumentnotvalidforlighty'] = 'An URL as ErrorDocument does not work in lighttpd, please specify a path to a file'; +// ADDED IN FROXLOR 0.9.12-svn3 +$lng['question']['remove_subbutmain_domains'] = 'Also remove domains which are added as full domains but which are subdomains of this domain?'; +$lng['domains']['issubof'] = 'This domain is a subdomain of another domain'; +$lng['domains']['issubofinfo'] = 'You have to set this to the correct domain if you want to add a subdomain as full-domain (e.g. you want to add "www.domain.tld", you have to select "domain.tld" here)'; +$lng['domains']['nosubtomaindomain'] = 'No subdomain of a full domain'; + ?> diff --git a/lng/german.lng.php b/lng/german.lng.php index 148f3248..6c694a6b 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1451,4 +1451,10 @@ $lng['panel']['descriptionerrordocument'] = 'Mögliche Werte sind: URL, Pfad $lng['error']['stringerrordocumentnotvalidforlighty'] = 'Ein Text als Fehlerdokument funktioniert leider in LigHTTPd nicht, bitte geben Sie einen Pfad zu einer Datei an'; $lng['error']['urlerrordocumentnotvalidforlighty'] = 'Eine URL als Fehlerdokument funktioniert leider in LigHTTPd nicht, bitte geben Sie einen Pfad zu einer Datei an'; +// ADDED IN FROXLOR 0.9.12-svn3 +$lng['question']['remove_subbutmain_domains'] = 'Auch Domains entfernen, welche als volle Domains hinzugefügt wurden, aber Subdomains von dieser Domain sind?'; +$lng['domains']['issubof'] = 'Diese Domain ist eine Subdomain von der Domain'; +$lng['domains']['issubofinfo'] = 'Diese Einstellung muss gesetzt werden, wenn Sie eine Subdomain einer Hauptdomain als Hauptdomain anlegen (z.B. soll "www.domain.tld" hinzugefügt werden, somit muss hier "domain.tld" ausgewählt werden)'; +$lng['domains']['nosubtomaindomain'] = 'Keine Subdomain einer Hauptdomain'; + ?> diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index bfe23278..9a51dff0 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -600,8 +600,15 @@ class apache protected function getVhostFilename($domain, $ssl_vhost = false) { - if((int)$domain['parentdomainid'] == 0) - { + if((int)$domain['parentdomainid'] == 0 + && ((int)$domain['ismainbutsubto'] == 0 + || domainMainToSubExists($domain['ismainbutsubto']) == false) + ) { + $vhost_no = '22'; + } + elseif((int)$domain['parentdomainid'] == 0 + && (int)$domain['ismainbutsubto'] > 0 + ) { $vhost_no = '21'; } else diff --git a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php index 320cb494..eb34ad7c 100644 --- a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php +++ b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php @@ -278,8 +278,19 @@ class lighttpd $_pos = strrpos($_tmp_path, '/'); $_inc_path = substr($_tmp_path, $_pos+1); - if((int)$domain['parentdomainid'] == 0) - { + if((int)$domain['parentdomainid'] == 0 + && ((int)$domain['ismainbutsubto'] == 0 + || domainMainToSubExists($domain['ismainbutsubto']) == false) + ) { + $vhost_no = '52'; + if($ssl == '1') + { + $vhost_no = '62'; + } + } + elseif((int)$domain['parentdomainid'] == 0 + && (int)$domain['ismainbutsubto'] > 0 + ) { $vhost_no = '51'; if($ssl == '1') { diff --git a/templates/admin/domains/domains_add.tpl b/templates/admin/domains/domains_add.tpl index bf7698f8..6ef06d73 100644 --- a/templates/admin/domains/domains_add.tpl +++ b/templates/admin/domains/domains_add.tpl @@ -34,6 +34,10 @@ $header {$lng['domains']['aliasdomain']}: + + {$lng['domains']['issubof']}:
{$lng['domains']['issubofinfo']} + + {$lng['admin']['domain_edit']}: $caneditdomain diff --git a/templates/admin/domains/domains_edit.tpl b/templates/admin/domains/domains_edit.tpl index 47f1de26..7486830f 100644 --- a/templates/admin/domains/domains_edit.tpl +++ b/templates/admin/domains/domains_edit.tpl @@ -37,6 +37,10 @@ $header + + {$lng['domains']['issubof']}:
{$lng['domains']['issubofinfo']} + + {$lng['domains']['associated_with_domain']}: {$subdomains} {$lng['customer']['subdomains']}, {$alias_check} {$lng['domains']['aliasdomains']}, {$emails} {$lng['customer']['emails']}, {$email_accounts} {$lng['customer']['accounts']}, {$email_forwarders} {$lng['customer']['forwarders']}