From 87a2f86365aeac3764e7ff705b2e3a5977582fb3 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 30 May 2019 17:44:08 +0200 Subject: [PATCH] do not set default ssl-ips if the frontend values are left empty; if default ssl-ips are specified, preset them in the form when adding a domain, fixes #697 Signed-off-by: Michael Kaufmann --- lib/Froxlor/Api/Commands/Domains.php | 9 ++++++--- lib/formfields/admin/domains/formfield.domains_add.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Froxlor/Api/Commands/Domains.php b/lib/Froxlor/Api/Commands/Domains.php index 05104b25..79009efd 100644 --- a/lib/Froxlor/Api/Commands/Domains.php +++ b/lib/Froxlor/Api/Commands/Domains.php @@ -170,7 +170,9 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn * @param bool $letsencrypt * optional, whether to generate a Let's Encrypt certificate for this domain, default false; requires SSL to be enabled * @param array $ssl_ipandport - * optional, list of ssl-enabled ip/port id's to assign to this domain + * optional, list of ssl-enabled ip/port id's to assign to this domain, default empty + * @param bool $use_default_ssl_ipandport_if_empty + * optional, set the systems default ssl ip addresses if none are given via $ssl_ipandport parameter * @param bool $http2 * optional, whether to enable http/2 for this domain (requires to be enabled in the settings), default 0 (false) * @param int $hsts_maxage @@ -223,7 +225,8 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn $mod_fcgid_maxrequests = $this->getParam('mod_fcgid_maxrequests', true, - 1); $ssl_redirect = $this->getBoolParam('ssl_redirect', true, 0); $letsencrypt = $this->getBoolParam('letsencrypt', true, 0); - $p_ssl_ipandports = $this->getParam('ssl_ipandport', true, explode(',', Settings::Get('system.defaultsslip'))); + $use_default_ssl_ipandport_if_empty = $this->getBoolParam('use_default_ssl_ipandport_if_empty', true, 0); + $p_ssl_ipandports = $this->getParam('ssl_ipandport', true, $use_default_ssl_ipandport_if_empty ? explode(',', Settings::Get('system.defaultsslip')) : array()); $http2 = $this->getBoolParam('http2', true, 0); $hsts_maxage = $this->getParam('hsts_maxage', true, 0); $hsts_sub = $this->getBoolParam('hsts_sub', true, 0); @@ -1633,7 +1636,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn * @param boolean $ssl * default false * @param int $edit_id - * default 0 + * default 0 * * @throws \Exception * @return array diff --git a/lib/formfields/admin/domains/formfield.domains_add.php b/lib/formfields/admin/domains/formfield.domains_add.php index 48b7b243..ddbb6266 100644 --- a/lib/formfields/admin/domains/formfield.domains_add.php +++ b/lib/formfields/admin/domains/formfield.domains_add.php @@ -185,7 +185,7 @@ return array( 'desc' => $lng['domains']['ipandport_ssl_multi']['description'], 'type' => 'checkbox', 'values' => $ssl_ipsandports, - 'value' => '', + 'value' => explode(',', \Froxlor\Settings::Get('system.defaultsslip')), 'is_array' => 1 ), 'ssl_redirect' => array(