remove 'main but subdomain' as we now automatically create the correct order of vhost configs and dns zones
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -190,9 +190,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
* optional, whether to create an exclusive web-logfile for this domain, default 0 (false)
|
||||
* @param int $alias
|
||||
* optional, domain-id of a domain that the new domain should be an alias of, default 0 (none)
|
||||
* @param int $issubof
|
||||
* optional, domain-id of a domain this domain is a subdomain of (required for webserver-cronjob to
|
||||
* generate the correct order), default 0 (none)
|
||||
* @param string $registration_date
|
||||
* optional, date of domain registration in form of YYYY-MM-DD, default empty (none)
|
||||
* @param string $termination_date
|
||||
@@ -298,7 +295,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
$serveraliasoption = $this->getParam('selectserveralias', true, Settings::Get('system.domaindefaultalias'));
|
||||
$speciallogfile = $this->getBoolParam('speciallogfile', true, 0);
|
||||
$aliasdomain = intval($this->getParam('alias', true, 0));
|
||||
$issubof = $this->getParam('issubof', true, 0);
|
||||
$registration_date = $this->getParam('registration_date', true, '');
|
||||
$termination_date = $this->getParam('termination_date', true, '');
|
||||
$caneditdomain = $this->getBoolParam('caneditdomain', true, 0);
|
||||
@@ -665,10 +661,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
$serveraliasoption = '0';
|
||||
}
|
||||
|
||||
if ($issubof <= 0) {
|
||||
$issubof = '0';
|
||||
}
|
||||
|
||||
$idna_convert = new IdnaWrapper();
|
||||
if ($domain == '') {
|
||||
Response::standardError([
|
||||
@@ -723,7 +715,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
'phpsettingid' => $phpsettingid,
|
||||
'mod_fcgid_starter' => $mod_fcgid_starter,
|
||||
'mod_fcgid_maxrequests' => $mod_fcgid_maxrequests,
|
||||
'ismainbutsubto' => $issubof,
|
||||
'letsencrypt' => $letsencrypt,
|
||||
'http2' => $http2,
|
||||
'hsts' => $hsts_maxage,
|
||||
@@ -777,7 +768,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
`phpsettingid` = :phpsettingid,
|
||||
`mod_fcgid_starter` = :mod_fcgid_starter,
|
||||
`mod_fcgid_maxrequests` = :mod_fcgid_maxrequests,
|
||||
`ismainbutsubto` = :ismainbutsubto,
|
||||
`letsencrypt` = :letsencrypt,
|
||||
`http2` = :http2,
|
||||
`hsts` = :hsts,
|
||||
@@ -1069,9 +1059,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
* default 0 (false)
|
||||
* @param int $alias
|
||||
* optional, domain-id of a domain that the new domain should be an alias of, default 0 (none)
|
||||
* @param int $issubof
|
||||
* optional, domain-id of a domain this domain is a subdomain of (required for webserver-cronjob to
|
||||
* generate the correct order), default 0 (none)
|
||||
* @param string $registration_date
|
||||
* optional, date of domain registration in form of YYYY-MM-DD, default empty (none)
|
||||
* @param string $termination_date
|
||||
@@ -1191,7 +1178,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
$speciallogfile = $this->getBoolParam('speciallogfile', true, $result['speciallogfile']);
|
||||
$speciallogverified = $this->getBoolParam('speciallogverified', true, 0);
|
||||
$aliasdomain = intval($this->getParam('alias', true, $result['aliasdomain']));
|
||||
$issubof = $this->getParam('issubof', true, $result['ismainbutsubto']);
|
||||
$registration_date = $this->getParam('registration_date', true, $result['registration_date']);
|
||||
$termination_date = $this->getParam('termination_date', true, $result['termination_date']);
|
||||
$caneditdomain = $this->getBoolParam('caneditdomain', true, $result['caneditdomain']);
|
||||
@@ -1640,10 +1626,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
Response::standardError('domainisaliasorothercustomer', '', true);
|
||||
}
|
||||
|
||||
if ($issubof <= 0) {
|
||||
$issubof = '0';
|
||||
}
|
||||
|
||||
if ($serveraliasoption != '1' && $serveraliasoption != '2') {
|
||||
$serveraliasoption = '0';
|
||||
}
|
||||
@@ -1666,7 +1648,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
|| $writeaccesslog != $result['writeaccesslog']
|
||||
|| $writeerrorlog != $result['writeerrorlog']
|
||||
|| $aliasdomain != $result['aliasdomain']
|
||||
|| $issubof != $result['ismainbutsubto']
|
||||
|| $email_only != $result['email_only']
|
||||
|| ($speciallogfile != $result['speciallogfile'] && $speciallogverified == '1')
|
||||
|| $letsencrypt != $result['letsencrypt']
|
||||
@@ -1837,7 +1818,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
$update_data['writeerrorlog'] = $writeerrorlog;
|
||||
$update_data['registration_date'] = $registration_date;
|
||||
$update_data['termination_date'] = $termination_date;
|
||||
$update_data['ismainbutsubto'] = $issubof;
|
||||
$update_data['letsencrypt'] = $letsencrypt;
|
||||
$update_data['http2'] = $http2;
|
||||
$update_data['hsts'] = $hsts_maxage;
|
||||
@@ -1885,7 +1865,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
`writeerrorlog` = :writeerrorlog,
|
||||
`registration_date` = :registration_date,
|
||||
`termination_date` = :termination_date,
|
||||
`ismainbutsubto` = :ismainbutsubto,
|
||||
`letsencrypt` = :letsencrypt,
|
||||
`http2` = :http2,
|
||||
`hsts` = :hsts,
|
||||
@@ -2073,9 +2052,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
* optional, the domain-id
|
||||
* @param string $domainname
|
||||
* optional, the domainname
|
||||
* @param bool $delete_mainsubdomains
|
||||
* optional, remove also domains that are subdomains of this domain but added as main domains; default
|
||||
* false
|
||||
* @param bool $is_stdsubdomain
|
||||
* optional, default false, specify whether it's a std-subdomain you are deleting as it does not count
|
||||
* as subdomain-resource
|
||||
@@ -2091,7 +2067,6 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
$dn_optional = $id > 0;
|
||||
$domainname = $this->getParam('domainname', $dn_optional, '');
|
||||
$is_stdsubdomain = $this->getParam('is_stdsubdomain', true, 0);
|
||||
$remove_subbutmain_domains = $this->getParam('delete_mainsubdomains', true, 0);
|
||||
|
||||
$result = $this->apiCall('Domains.get', [
|
||||
'id' => $id,
|
||||
@@ -2099,15 +2074,10 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
]);
|
||||
$id = $result['id'];
|
||||
|
||||
// check for deletion of main-domains which are logically subdomains, #329
|
||||
$rsd_sql = '';
|
||||
if ($remove_subbutmain_domains) {
|
||||
$rsd_sql .= " OR `ismainbutsubto` = :id";
|
||||
}
|
||||
|
||||
$subresult_stmt = Database::prepare("
|
||||
SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE (`id` = :id OR `parentdomainid` = :id " . $rsd_sql . ")");
|
||||
SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE (`id` = :id OR `parentdomainid` = :id)
|
||||
");
|
||||
Database::pexecute($subresult_stmt, [
|
||||
'id' => $id
|
||||
], true, true);
|
||||
@@ -2129,23 +2099,10 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
$this->logger()->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "[API] deleted domain/s from mail-tables");
|
||||
}
|
||||
|
||||
// if mainbutsubto-domains are not to be deleted, re-assign the (ismainbutsubto value of the main
|
||||
// domain which is being deleted) as their new ismainbutsubto value
|
||||
if ($remove_subbutmain_domains !== 1) {
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
|
||||
`ismainbutsubto` = :newIsMainButSubtoValue
|
||||
WHERE `ismainbutsubto` = :deletedMainDomainId
|
||||
");
|
||||
Database::pexecute($upd_stmt, [
|
||||
'newIsMainButSubtoValue' => $result['ismainbutsubto'],
|
||||
'deletedMainDomainId' => $id
|
||||
], true, true);
|
||||
}
|
||||
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `id` = :id OR `parentdomainid` = :id " . $rsd_sql);
|
||||
DELETE FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `id` = :id OR `parentdomainid` = :id
|
||||
");
|
||||
Database::pexecute($del_stmt, [
|
||||
'id' => $id
|
||||
], true, true);
|
||||
|
||||
@@ -62,8 +62,8 @@ class Bind extends DnsBase
|
||||
$this->bindconf_file = '# ' . Settings::Get('system.bindconf_directory') . 'froxlor_bind.conf' . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n\n";
|
||||
|
||||
foreach ($domains as $domain) {
|
||||
if ($domain['ismainbutsubto'] > 0) {
|
||||
// domains with ismainbutsubto>0 are handled by recursion within walkDomainList()
|
||||
if ($domain['is_child']) {
|
||||
// domains that are subdomains to other main domains are handled by recursion within walkDomainList()
|
||||
continue;
|
||||
}
|
||||
$this->walkDomainList($domain, $domains);
|
||||
@@ -114,7 +114,7 @@ class Bind extends DnsBase
|
||||
$isFroxlorHostname = true;
|
||||
}
|
||||
|
||||
if ($domain['ismainbutsubto'] == 0) {
|
||||
if (!$domain['is_child']) {
|
||||
$zoneContent = (string)Dns::createDomainZone(($domain['id'] == 'none') ? $domain : $domain['id'], $isFroxlorHostname);
|
||||
$domain['zonefile'] = 'domains/' . $domain['domain'] . '.zone';
|
||||
$zonefile_name = FileDir::makeCorrectFile(Settings::Get('system.bindconf_directory') . '/' . $domain['zonefile']);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
namespace Froxlor\Cron\Dns;
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Domain\Domain;
|
||||
use Froxlor\FileDir;
|
||||
use Froxlor\FroxlorLogger;
|
||||
use Froxlor\PhpHelper;
|
||||
@@ -210,7 +211,6 @@ abstract class DnsBase
|
||||
`d`.`dkim`,
|
||||
`d`.`dkim_id`,
|
||||
`d`.`dkim_pubkey`,
|
||||
`d`.`ismainbutsubto`,
|
||||
`c`.`loginname`,
|
||||
`c`.`guid`
|
||||
FROM
|
||||
@@ -219,7 +219,7 @@ abstract class DnsBase
|
||||
WHERE
|
||||
`d`.`isbinddomain` = '1'
|
||||
ORDER BY
|
||||
`d`.`domain` ASC
|
||||
LENGTH(`d`.`domain`), `d`.`domain` ASC
|
||||
");
|
||||
|
||||
$domains = [];
|
||||
@@ -241,7 +241,6 @@ abstract class DnsBase
|
||||
'bindserial' => date('Ymd') . '00',
|
||||
'dkim' => '0',
|
||||
'iswildcarddomain' => '1',
|
||||
'ismainbutsubto' => '0',
|
||||
'zonefile' => '',
|
||||
'froxlorhost' => '1'
|
||||
];
|
||||
@@ -257,18 +256,23 @@ abstract class DnsBase
|
||||
if (!isset($domains[$key]['children'])) {
|
||||
$domains[$key]['children'] = [];
|
||||
}
|
||||
if ($domains[$key]['ismainbutsubto'] > 0) {
|
||||
if (isset($domains[$domains[$key]['ismainbutsubto']])) {
|
||||
$domains[$domains[$key]['ismainbutsubto']]['children'][] = $domains[$key]['id'];
|
||||
} else {
|
||||
$domains[$key]['ismainbutsubto'] = 0;
|
||||
if (!isset($domains[$key]['is_child'])) {
|
||||
$domains[$key]['is_child'] = false;
|
||||
}
|
||||
$children = Domain::getMainSubdomainIds($key);
|
||||
if (count($children) > 0) {
|
||||
foreach ($children as $child) {
|
||||
if (isset($domains[$child])) {
|
||||
$domains[$key]['children'][] = $domains[$child]['id'];
|
||||
$domains[$child]['is_child'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_DEBUG, str_pad('domId', 9, ' ') . str_pad('domain', 40, ' ') . 'ismainbutsubto ' . str_pad('parent domain', 40, ' ') . "list of child domain ids");
|
||||
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_DEBUG, str_pad('domId', 9, ' ') . str_pad('domain', 40, ' ') . "list of child domain ids");
|
||||
foreach ($domains as $domain) {
|
||||
$logLine = str_pad($domain['id'], 9, ' ') . str_pad($domain['domain'], 40, ' ') . str_pad($domain['ismainbutsubto'], 15, ' ') . str_pad(((isset($domains[$domain['ismainbutsubto']])) ? $domains[$domain['ismainbutsubto']]['domain'] : '-'), 40, ' ') . join(', ', $domain['children']);
|
||||
$logLine = str_pad($domain['id'], 9, ' ') . str_pad($domain['domain'], 40, ' ') . join(', ', $domain['children']);
|
||||
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_DEBUG, $logLine);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ class PowerDNS extends DnsBase
|
||||
}
|
||||
|
||||
foreach ($domains as $domain) {
|
||||
if ($domain['ismainbutsubto'] > 0) {
|
||||
// domains with ismainbutsubto>0 are handled by recursion within walkDomainList()
|
||||
if ($domain['is_child']) {
|
||||
// domains that are subdomains to other main domains are handled by recursion within walkDomainList()
|
||||
continue;
|
||||
}
|
||||
$this->walkDomainList($domain, $domains);
|
||||
@@ -108,7 +108,7 @@ class PowerDNS extends DnsBase
|
||||
$isFroxlorHostname = true;
|
||||
}
|
||||
|
||||
if ($domain['ismainbutsubto'] == 0) {
|
||||
if (!$domain['is_child']) {
|
||||
$zoneContent = Dns::createDomainZone(($domain['id'] == 'none') ? $domain : $domain['id'], $isFroxlorHostname);
|
||||
if (count($subzones)) {
|
||||
foreach ($subzones as $subzone) {
|
||||
|
||||
@@ -630,29 +630,6 @@ class Apache extends HttpConfigBase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filename for the virtualhost
|
||||
*/
|
||||
protected function getVhostFilename($domain, $ssl_vhost = false)
|
||||
{
|
||||
if ((int)$domain['parentdomainid'] == 0 && Domain::isCustomerStdSubdomain((int)$domain['id']) == false && ((int)$domain['ismainbutsubto'] == 0 || Domain::domainMainToSubExists($domain['ismainbutsubto']) == false)) {
|
||||
$vhost_no = '35';
|
||||
} elseif ((int)$domain['parentdomainid'] == 0 && Domain::isCustomerStdSubdomain((int)$domain['id']) == false && (int)$domain['ismainbutsubto'] > 0) {
|
||||
$vhost_no = '30';
|
||||
} else {
|
||||
// number of dots in a domain specifies it's position (and depth of subdomain) starting at 29 going downwards on higher depth
|
||||
$vhost_no = (string)(30 - substr_count($domain['domain'], ".") + 1);
|
||||
}
|
||||
|
||||
if ($ssl_vhost === true) {
|
||||
$vhost_filename = FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/' . $vhost_no . '_froxlor_ssl_vhost_' . $domain['domain'] . '.conf');
|
||||
} else {
|
||||
$vhost_filename = FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/' . $vhost_no . '_froxlor_normal_vhost_' . $domain['domain'] . '.conf');
|
||||
}
|
||||
|
||||
return $vhost_filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* We compose the virtualhost entry for one domain
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Froxlor\Cron\Http;
|
||||
use Froxlor\Cron\Http\LetsEncrypt\AcmeSh;
|
||||
use Froxlor\Cron\Http\Php\Fpm;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Domain\Domain;
|
||||
use Froxlor\FileDir;
|
||||
use Froxlor\Froxlor;
|
||||
use Froxlor\FroxlorLogger;
|
||||
@@ -187,4 +188,18 @@ class HttpConfigBase
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filename for the virtualhost
|
||||
*/
|
||||
protected function getVhostFilename(array $domain, bool $ssl_vhost = false, bool $filename_only = false)
|
||||
{
|
||||
// number of dots in a domain specifies its position (and depth of subdomain) starting at 35 going downwards on higher depth
|
||||
$vhost_no = (string)(35 - substr_count($domain['domain'], ".") + 1);
|
||||
$filename = $vhost_no . '_froxlor_' . ($ssl_vhost ? 'ssl' : 'normal') . '_vhost_' . $domain['domain'] . '.conf';
|
||||
if ($filename_only) {
|
||||
return $filename;
|
||||
}
|
||||
return FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/' . $filename);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,24 +336,9 @@ class Lighttpd extends HttpConfigBase
|
||||
$_pos = strrpos($_tmp_path, '/');
|
||||
$_inc_path = substr($_tmp_path, $_pos + 1);
|
||||
|
||||
// maindomain
|
||||
if ((int)$domain['parentdomainid'] == 0 && Domain::isCustomerStdSubdomain((int)$domain['id']) == false && ((int)$domain['ismainbutsubto'] == 0 || Domain::domainMainToSubExists($domain['ismainbutsubto']) == false)) {
|
||||
$vhost_no = '50';
|
||||
} elseif ((int)$domain['parentdomainid'] == 0 && Domain::isCustomerStdSubdomain((int)$domain['id']) == false && (int)$domain['ismainbutsubto'] > 0) {
|
||||
// sub-but-main-domain
|
||||
$vhost_no = '51';
|
||||
} else {
|
||||
// subdomains
|
||||
// number of dots in a domain specifies it's position (and depth of subdomain) starting at 89 going downwards on higher depth
|
||||
$vhost_no = (string)(90 - substr_count($domain['domain'], ".") + 1);
|
||||
}
|
||||
|
||||
if ($ssl == '1') {
|
||||
$vhost_no = (int)$vhost_no += 10;
|
||||
}
|
||||
|
||||
$vhost_filename = FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/vhosts/' . $vhost_no . '_' . $domain['domain'] . '.conf');
|
||||
$included_vhosts[] = $_inc_path . '/vhosts/' . $vhost_no . '_' . $domain['domain'] . '.conf';
|
||||
$filename = self::getVhostFilename($domain, ($ssl == '1'), true);
|
||||
$vhost_filename = FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/vhosts/' . $filename);
|
||||
$included_vhosts[] = $_inc_path . '/vhosts/' . $filename;
|
||||
}
|
||||
|
||||
if (!isset($this->lighttpd_data[$vhost_filename])) {
|
||||
|
||||
@@ -467,26 +467,6 @@ class Nginx extends HttpConfigBase
|
||||
}
|
||||
}
|
||||
|
||||
protected function getVhostFilename($domain, $ssl_vhost = false)
|
||||
{
|
||||
if ((int)$domain['parentdomainid'] == 0 && Domain::isCustomerStdSubdomain((int)$domain['id']) == false && ((int)$domain['ismainbutsubto'] == 0 || Domain::domainMainToSubExists($domain['ismainbutsubto']) == false)) {
|
||||
$vhost_no = '35';
|
||||
} elseif ((int)$domain['parentdomainid'] == 0 && Domain::isCustomerStdSubdomain((int)$domain['id']) == false && (int)$domain['ismainbutsubto'] > 0) {
|
||||
$vhost_no = '30';
|
||||
} else {
|
||||
// number of dots in a domain specifies it's position (and depth of subdomain) starting at 29 going downwards on higher depth
|
||||
$vhost_no = (string)(30 - substr_count($domain['domain'], ".") + 1);
|
||||
}
|
||||
|
||||
if ($ssl_vhost === true) {
|
||||
$vhost_filename = FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/' . $vhost_no . '_froxlor_ssl_vhost_' . $domain['domain'] . '.conf');
|
||||
} else {
|
||||
$vhost_filename = FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/' . $vhost_no . '_froxlor_normal_vhost_' . $domain['domain'] . '.conf');
|
||||
}
|
||||
|
||||
return $vhost_filename;
|
||||
}
|
||||
|
||||
protected function getVhostContent($domain, $ssl_vhost = false)
|
||||
{
|
||||
if ($ssl_vhost === true && $domain['ssl'] != '1' && $domain['ssl_redirect'] != '1') {
|
||||
|
||||
@@ -235,51 +235,30 @@ class Domain
|
||||
}
|
||||
|
||||
/**
|
||||
* check whether a domain has subdomains added as full-domains
|
||||
* #329
|
||||
* get ids of domains that are main domains but a subdomain of another main domain (for DNS)
|
||||
*
|
||||
* @param int $id domain-id
|
||||
* @param int $id main-domain to check
|
||||
*
|
||||
* @return bool
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function domainHasMainSubDomains(int $id): bool
|
||||
public static function getMainSubdomainIds(int $id): array
|
||||
{
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT COUNT(`id`) as `mainsubs` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `ismainbutsubto` = :id");
|
||||
$result = Database::pexecute_first($result_stmt, [
|
||||
'id' => $id
|
||||
]);
|
||||
|
||||
if ($result && isset($result['mainsubs'])) {
|
||||
return $result['mainsubs'] > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* check whether a subof-domain exists
|
||||
* #329
|
||||
*
|
||||
* @param int $id subof-domain-id
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function domainMainToSubExists(int $id): bool
|
||||
{
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `id` = :id");
|
||||
SELECT id
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE
|
||||
isbinddomain = 1 AND
|
||||
domain LIKE CONCAT('%.', ( SELECT d.domain FROM `" . TABLE_PANEL_DOMAINS . "` AS d WHERE d.id = :id ))
|
||||
");
|
||||
Database::pexecute($result_stmt, [
|
||||
'id' => $id
|
||||
]);
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result && isset($result['id'])) {
|
||||
return $result['id'] > 0;
|
||||
$result = [];
|
||||
while ($entry = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$result = $entry['id'];
|
||||
}
|
||||
return false;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,12 +60,6 @@ return [
|
||||
'type' => 'select',
|
||||
'select_var' => $domains
|
||||
],
|
||||
'issubof' => [
|
||||
'label' => lng('domains.issubof'),
|
||||
'desc' => lng('domains.issubofinfo'),
|
||||
'type' => 'select',
|
||||
'select_var' => $subtodomains
|
||||
],
|
||||
'caneditdomain' => [
|
||||
'label' => lng('admin.domain_editable.title'),
|
||||
'desc' => lng('admin.domain_editable.desc'),
|
||||
|
||||
@@ -65,13 +65,6 @@ return [
|
||||
'select_var' => $domains,
|
||||
'selected' => $result['aliasdomain']
|
||||
],
|
||||
'issubof' => [
|
||||
'label' => lng('domains.issubof'),
|
||||
'desc' => lng('domains.issubofinfo'),
|
||||
'type' => 'select',
|
||||
'select_var' => $subtodomains,
|
||||
'selected' => $result['ismainbutsubto']
|
||||
],
|
||||
'associated_info' => [
|
||||
'label' => lng('domains.associated_with_domain'),
|
||||
'type' => 'label',
|
||||
|
||||
Reference in New Issue
Block a user