add new VHOSTLIMIT config option

This commit is contained in:
Matthew Saunders Brown 2024-04-15 10:41:09 -07:00
parent be5fb1238b
commit 59e8e5a6dc
3 changed files with 35 additions and 2 deletions

View File

@ -34,13 +34,29 @@ class VhostsAdd extends \Panel\Vhost {
} else {
$deploy['showwriteinfo'] = 0;
}
$f3->set('deploy', $deploy);
/* check if VHOSTLIMIT is set */
if (is_numeric($f3->get('VHOSTLIMIT'))) {
if ($f3->get('VHOSTLIMIT') > 0) {
$f3->set('vhostlimited', TRUE);
if ($vhosts_array = $f3->call('\Panel::vGet', array("vhost-get.sh -c", FALSE))) {
$f3->set('vhostscount', count($vhosts_array));
}
}
}
}
static function get($f3) {
echo \Template::instance()->render('vhost/vhosts-add.html');
/* check VHOSTLIMIT */
if ($f3->get('vhostlimited') && ($f3->get('vhostscount') >= $f3->get('VHOSTLIMIT'))) {
echo \Template::instance()->render('vhost/vhosts-add-max.html');
} else {
echo \Template::instance()->render('vhost/vhosts-add.html');
}
}

View File

@ -19,11 +19,26 @@ class DomainsAdd extends \Panel\Vmail {
$vm_domains_defaults = $f3->call('\Panel::vGet', array("vmail-defaults-get.sh -c", FALSE));
$f3->set('vm_domains_defaults', $vm_domains_defaults[0]);
/* check if VHOSTLIMIT is set */
if (is_numeric($f3->get('VHOSTLIMIT'))) {
if ($f3->get('VHOSTLIMIT') > 0) {
$f3->set('vhostlimited', TRUE);
if ($domains_array = $f3->call('\Panel::vGet', array("vmail-domains-get.sh -c", FALSE))) {
$f3->set('vhostscount', count($domains_array));
}
}
}
}
static function get($f3) {
echo \Template::instance()->render('vmail/domains-add.html');
/* check VHOSTLIMIT */
if ($f3->get('vhostlimited') && ($f3->get('vhostscount') >= $f3->get('VHOSTLIMIT'))) {
echo \Template::instance()->render('vmail/domains-add-max.html');
} else {
echo \Template::instance()->render('vmail/domains-add.html');
}
}

View File

@ -28,6 +28,8 @@ FPMMAX=4
WRITEUSERINFO=1
; Show "Write User Info" & "Write DB Info" options. If no then just use defaults above without giving users the option to change. 1 = Yes, blank or 0 = No
SHOWWRITEINFO=0
; Maximum number of websites that can be installed. Blank or 0 = unlimited.
VHOSTLIMIT=0
; DNS admin. 1 = Yes, blank or 0 = No
VDNSADMIN=0
; Maximum number of results returned for DNS listings. Defaults to 100 if unspecified.