Check for SSL enabled vhost-container for ssl-related settings in froxlor-vhost-settings; fixes #642

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-02-24 09:03:03 +01:00
parent 2f38de90e5
commit 51efba0a8d
2 changed files with 7 additions and 7 deletions

View File

@@ -53,7 +53,7 @@ return array(
'visible' => \Froxlor\Settings::Get('system.leenabled') && call_user_func(array( 'visible' => \Froxlor\Settings::Get('system.leenabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ), true)
), ),
'system_le_froxlor_redirect' => array( 'system_le_froxlor_redirect' => array(
'label' => $lng['serversettings']['le_froxlor_redirect'], 'label' => $lng['serversettings']['le_froxlor_redirect'],
@@ -65,7 +65,7 @@ return array(
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array( 'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ), true)
), ),
'system_hsts_maxage' => array( 'system_hsts_maxage' => array(
'label' => $lng['admin']['domain_hsts_maxage'], 'label' => $lng['admin']['domain_hsts_maxage'],
@@ -79,7 +79,7 @@ return array(
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array( 'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ), true)
), ),
'system_hsts_incsub' => array( 'system_hsts_incsub' => array(
'label' => $lng['admin']['domain_hsts_incsub'], 'label' => $lng['admin']['domain_hsts_incsub'],
@@ -91,7 +91,7 @@ return array(
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array( 'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ), true)
), ),
'system_hsts_preload' => array( 'system_hsts_preload' => array(
'label' => $lng['admin']['domain_hsts_preload'], 'label' => $lng['admin']['domain_hsts_preload'],
@@ -103,7 +103,7 @@ return array(
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array( 'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ), true)
), ),
/** /**
* FCGID * FCGID

View File

@@ -6,9 +6,9 @@ use Froxlor\Database\Database;
class FroxlorVhostSettings class FroxlorVhostSettings
{ {
public static function hasVhostContainerEnabled() public static function hasVhostContainerEnabled($need_ssl = false)
{ {
$sel_stmt = Database::prepare("SELECT COUNT(*) as vcentries FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `vhostcontainer`= '1'"); $sel_stmt = Database::prepare("SELECT COUNT(*) as vcentries FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `vhostcontainer`= '1'" . ($need_ssl ? " AND `ssl` = '1'" : ""));
$result = Database::pexecute_first($sel_stmt); $result = Database::pexecute_first($sel_stmt);
return $result['vcentries'] > 0 ? true : false; return $result['vcentries'] > 0 ? true : false;
} }