disable settings in 'froxlor vhost settings' that wont have any effect if no IP/port has the 'create vHost container' option enabled; fixes #642

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann 2019-02-11 16:08:34 +01:00
parent 8fd910a92e
commit 8ab86a05b2
No known key found for this signature in database
GPG Key ID: 55284EC83A4823B8
4 changed files with 71 additions and 14 deletions

View File

@ -17,7 +17,7 @@
return array(
'groups' => array(
'froxlorvhost' => array(
'title' => $lng['admin']['froxlorvhost'],
'title' => $lng['admin']['froxlorvhost'] . (call_user_func(array('\Froxlor\Settings\FroxlorVhostSettings', 'hasVhostContainerEnabled')) == false ? $lng['admin']['novhostcontainer'] : ''),
'fields' => array(
/**
* Webserver-Vhost
@ -40,7 +40,10 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingClearCertificates',
'visible' => \Froxlor\Settings::Get('system.leenabled')
'visible' => \Froxlor\Settings::Get('system.leenabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_le_froxlor_redirect' => array(
'label' => $lng['serversettings']['le_froxlor_redirect'],
@ -49,7 +52,10 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl')
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_hsts_maxage' => array(
'label' => $lng['admin']['domain_hsts_maxage'],
@ -60,7 +66,10 @@ return array(
'int_max' => 94608000, // 3-years
'default' => 0,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl')
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_hsts_incsub' => array(
'label' => $lng['admin']['domain_hsts_incsub'],
@ -69,7 +78,10 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl')
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_hsts_preload' => array(
'label' => $lng['admin']['domain_hsts_preload'],
@ -78,7 +90,10 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl')
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
/**
* FCGID
@ -93,7 +108,10 @@ return array(
'websrv_avail' => array(
'apache2'
),
'visible' => \Froxlor\Settings::Get('system.mod_fcgid')
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_mod_fcgid_httpuser' => array(
'label' => $lng['admin']['mod_fcgid_user'],
@ -105,7 +123,10 @@ return array(
'websrv_avail' => array(
'apache2'
),
'visible' => \Froxlor\Settings::Get('system.mod_fcgid')
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_mod_fcgid_httpgroup' => array(
'label' => $lng['admin']['mod_fcgid_group'],
@ -117,7 +138,10 @@ return array(
'websrv_avail' => array(
'apache2'
),
'visible' => \Froxlor\Settings::Get('system.mod_fcgid')
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_mod_fcgid_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
@ -134,7 +158,10 @@ return array(
'websrv_avail' => array(
'apache2'
),
'visible' => \Froxlor\Settings::Get('system.mod_fcgid')
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
/**
* php-fpm
@ -146,7 +173,10 @@ return array(
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('phpfpm.enabled')
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_phpfpm_httpuser' => array(
'label' => $lng['phpfpm']['vhost_httpuser'],
@ -155,7 +185,10 @@ return array(
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingWebserverFcgidFpmUser',
'visible' => \Froxlor\Settings::Get('phpfpm.enabled')
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_phpfpm_httpgroup' => array(
'label' => $lng['phpfpm']['vhost_httpgroup'],
@ -164,7 +197,10 @@ return array(
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('phpfpm.enabled')
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_phpfpm_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
@ -178,7 +214,10 @@ return array(
'getPhpConfigs'
),
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('phpfpm.enabled')
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
/**
* DNS

View File

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

View File

@ -2051,3 +2051,4 @@ $lng['panel']['system_is_configured'] = 'System is already set as configured';
$lng['panel']['settings_before_configuration'] = 'Please be sure you adjusted the settings prior to configuring the services here';
$lng['panel']['alternative_cmdline_config'] = 'Alternatively, just run the following command as root-user in you shell to configure the services automatically';
$lng['tasks']['remove_pdns_domain'] = 'Delete domain %s from PowerDNS database';
$lng['admin']['novhostcontainer'] = '<br><br><small class="red">None of the IPs and ports has the "' . $lng['admin']['ipsandports']['create_vhostcontainer'] . '" option enabled, many settings here will not be available</small>';

View File

@ -1698,3 +1698,4 @@ $lng['panel']['system_is_configured'] = 'Das System ist bereits konfiguriert';
$lng['panel']['settings_before_configuration'] = 'Stelle sicher, dass die Einstellungen angepasst wurden bevor die Dienste konfiguriert werden.';
$lng['panel']['alternative_cmdline_config'] = 'Alternativ, führe den folgenden Befehl als root-Benutzer auf der Shell aus, um die Dienste automatisch zu konfigurieren.';
$lng['tasks']['remove_pdns_domain'] = 'Lösche Domain %s von PowerDNS Datenbank';
$lng['admin']['novhostcontainer'] = '<br><br><small class="red">Keine der IPs und Ports hat die Option "' . $lng['admin']['ipsandports']['create_vhostcontainer'] . '" aktiviert, einige Einstellungen sind daher nicht verfügbar.</small>';