From da50b32d619f3ba9d95cdd0776fa6d0a881ce672 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Wed, 11 Aug 2021 16:18:43 -0400 Subject: [PATCH] Add variable to control if DNS is enabled for free domains --- bureau/class/config.php | 1 + bureau/class/m_admin.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bureau/class/config.php b/bureau/class/config.php index dd2ee7dc..d723108d 100755 --- a/bureau/class/config.php +++ b/bureau/class/config.php @@ -211,6 +211,7 @@ if ($oldid && $oldid != $cuid) { // Init some vars variable_get('hosting_tld', '', 'This is a FQDN that designates the main hostname of the service. For example, hosting_tld determines in what TLD the "free" user domain is created. If this is set to "example.com", a checkbox will appear in the user creation dialog requesting the creator if he wants to create the domain "username.example.com".', array('desc' => 'Wanted FQDN', 'type' => 'string')); +variable_get('free_domain_enable_dns', '0', 'If this is set to a non-zero, non-empty value then the "free" user domain created for accounts (based on hosting_tld) will have DNS entries and e-mails available. Otherwise, only the default sub-domains as defined will be created (this is the default behaviour)', array('desc' => 'Enable DNS for free domains?', 'type' => 'boolean')); variable_get('subadmin_restriction', '0', "This variable sets the way the account list works for accounts other than 'admin' (2000). 0 (default) = admin other than admin/2000 can see their own account, but not the other one 1 = admin other than admin/2000 can see any account by clicking the ''show all accounts'' link.", array('desc' => 'Shared access activated?', 'type' => 'boolean')); diff --git a/bureau/class/m_admin.php b/bureau/class/m_admin.php index 7668b63a..c2e7d27c 100644 --- a/bureau/class/m_admin.php +++ b/bureau/class/m_admin.php @@ -549,9 +549,14 @@ class m_admin { $mem->su($u); $dom->lock(); - // option : 1=hébergement dns, 1=noerase, empeche de modifier, 1=force + // option : 1=hébergement dns + courriels, 1=noerase, empeche de modifier, 1=force // we do not allow DNS modification for hosting_tld - $dns=($domain_name==variable_get("hosting_tld")) ? 0 : 1; + if (variable_get("free_domain_enable_dns")) { + $dns = 1; + } + else { + $dns=($domain_name==variable_get("hosting_tld")) ? 0 : 1; + } $dom->add_domain($mem->user['login'] . "." . $domain_name, $dns, 1, 1); $dom->unlock(); $mem->unsu();