diff --git a/actions/admin/settings/130.webserver.php b/actions/admin/settings/130.webserver.php
index 782de254..047cba97 100644
--- a/actions/admin/settings/130.webserver.php
+++ b/actions/admin/settings/130.webserver.php
@@ -76,38 +76,6 @@ return array(
'default' => '/etc/apache2/htpasswd/',
'save_method' => 'storeSettingField',
),
- 'system_apachereload_command' => array(
- 'label' => $lng['serversettings']['apachereload_command'],
- 'settinggroup' => 'system',
- 'varname' => 'apachereload_command',
- 'type' => 'string',
- 'default' => '/etc/init.d/apache2 reload',
- 'save_method' => 'storeSettingField',
- ),
- 'system_phpreload_command' => array(
- 'label' => $lng['serversettings']['phpreload_command'],
- 'settinggroup' => 'system',
- 'varname' => 'phpreload_command',
- 'type' => 'string',
- 'default' => '',
- 'save_method' => 'storeSettingField',
- ),
- 'system_nginx_php_backend' => array(
- 'label' => $lng['serversettings']['nginx_php_backend'],
- 'settinggroup' => 'system',
- 'varname' => 'nginx_php_backend',
- 'type' => 'string',
- 'default' => '127.0.0.1:8888',
- 'save_method' => 'storeSettingField',
- ),
- 'system_mod_log_sql' => array(
- 'label' => $lng['serversettings']['mod_log_sql'],
- 'settinggroup' => 'system',
- 'varname' => 'mod_log_sql',
- 'type' => 'bool',
- 'default' => false,
- 'save_method' => 'storeSettingField',
- ),
'system_logfiles_directory' => array(
'label' => $lng['serversettings']['logfiles_directory'],
'settinggroup' => 'system',
@@ -144,6 +112,40 @@ return array(
'default' => '',
'save_method' => 'storeSettingField',
),
+ 'system_apachereload_command' => array(
+ 'label' => $lng['serversettings']['apachereload_command'],
+ 'settinggroup' => 'system',
+ 'varname' => 'apachereload_command',
+ 'type' => 'string',
+ 'default' => '/etc/init.d/apache2 reload',
+ 'save_method' => 'storeSettingField',
+ ),
+ 'system_phpreload_command' => array(
+ 'label' => $lng['serversettings']['phpreload_command'],
+ 'settinggroup' => 'system',
+ 'varname' => 'phpreload_command',
+ 'type' => 'string',
+ 'default' => '',
+ 'save_method' => 'storeSettingField',
+ ),
+ 'system_nginx_php_backend' => array(
+ 'label' => $lng['serversettings']['nginx_php_backend'],
+ 'settinggroup' => 'system',
+ 'varname' => 'nginx_php_backend',
+ 'type' => 'string',
+ 'default' => '127.0.0.1:8888',
+ 'save_method' => 'storeSettingField',
+ 'websrv_avail' => array('nginx')
+ ),
+ 'system_mod_log_sql' => array(
+ 'label' => $lng['serversettings']['mod_log_sql'],
+ 'settinggroup' => 'system',
+ 'varname' => 'mod_log_sql',
+ 'type' => 'bool',
+ 'default' => false,
+ 'save_method' => 'storeSettingField',
+ 'websrv_avail' => array('apache2')
+ ),
'defaultwebsrverrhandler_enabled' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'],
'settinggroup' => 'defaultwebsrverrhandler',
@@ -159,6 +161,7 @@ return array(
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
+ 'websrv_avail' => array('apache2', 'nginx')
),
'defaultwebsrverrhandler_err403' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err403'],
@@ -167,6 +170,7 @@ return array(
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
+ 'websrv_avail' => array('apache2', 'nginx')
),
'defaultwebsrverrhandler_err404' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err404'],
@@ -183,6 +187,7 @@ return array(
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
+ 'websrv_avail' => array('apache2', 'nginx')
),
'customredirect_enabled' => array(
'label' => $lng['serversettings']['customredirect_enabled'],
@@ -191,6 +196,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
+ 'websrv_avail' => array('apache2', 'lighttpd')
),
'customredirect_default' => array(
'label' => $lng['serversettings']['customredirect_default'],
@@ -201,6 +207,7 @@ return array(
'option_mode' => 'one',
'option_options_method' => 'getRedirectCodes',
'save_method' => 'storeSettingField',
+ 'websrv_avail' => array('apache2', 'lighttpd')
),
),
),
diff --git a/actions/admin/settings/135.fcgid.php b/actions/admin/settings/135.fcgid.php
index 982288e8..46d0fd3b 100644
--- a/actions/admin/settings/135.fcgid.php
+++ b/actions/admin/settings/135.fcgid.php
@@ -19,6 +19,7 @@ return array(
'groups' => array(
'fcgid' => array(
'title' => $lng['admin']['fcgid_settings'],
+ 'websrv_avail' => array('apache2'),
'fields' => array(
'system_mod_fcgid_enabled' => array(
'label' => $lng['serversettings']['mod_fcgid'],
diff --git a/actions/admin/settings/137.perl.php b/actions/admin/settings/137.perl.php
index c7a8d462..eefda5da 100644
--- a/actions/admin/settings/137.perl.php
+++ b/actions/admin/settings/137.perl.php
@@ -27,6 +27,7 @@ return array(
'type' => 'string',
'default' => '/usr/bin/perl',
'save_method' => 'storeSettingField',
+ 'websrv_avail' => array('lighttpd')
),
'system_perl_suexecworkaround' => array(
'label' => $lng['serversettings']['perl']['suexecworkaround'],
@@ -35,6 +36,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
+ 'websrv_avail' => array('apache2')
),
'system_perl_suexeccgipath' => array(
'label' => $lng['serversettings']['perl']['suexeccgipath'],
@@ -43,6 +45,7 @@ return array(
'type' => 'string',
'default' => '/var/www/cgi-bin/',
'save_method' => 'storeSettingField',
+ 'websrv_avail' => array('apache2')
),
'perl_server' => array(
'label' => $lng['serversettings']['perl_server'],
@@ -51,6 +54,7 @@ return array(
'type' => 'string',
'default' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock',
'save_method' => 'storeSettingField',
+ 'websrv_avail' => array('nginx')
),
),
),
diff --git a/lib/functions/formfields/function.buildFormEx.php b/lib/functions/formfields/function.buildFormEx.php
index f898a440..2b043b73 100644
--- a/lib/functions/formfields/function.buildFormEx.php
+++ b/lib/functions/formfields/function.buildFormEx.php
@@ -17,6 +17,7 @@
function buildFormEx($form, $part = '')
{
+ global $settings;
$fields = '';
if(validateFormDefinition($form))
@@ -34,24 +35,42 @@ function buildFormEx($form, $part = '')
// only show one section
elseif($part != '' && ($groupname == $part || $part == 'all'))
{
- if(isset($groupdetails['title']) && $groupdetails['title'] != '')
+ /**
+ * this part checks for the 'websrv_avail' entry in the settings-array
+ * if found, we check if the current webserver is in the array. If this
+ * is not the case, we change the setting type to "hidden", #502
+ */
+ $do_show = true;
+ if(isset($groupdetails['websrv_avail']) && is_array($groupdetails['websrv_avail']))
{
- $fields .= getFormGroupOutput($groupname, $groupdetails);
- }
-
- if(validateFieldDefinition($groupdetails))
- {
- // Prefetch form fields
- foreach($groupdetails['fields'] as $fieldname => $fielddetails)
+ $websrv = $settings['system']['webserver'];
+ if(!in_array($websrv, $groupdetails['websrv_avail']))
{
- $groupdetails['fields'][$fieldname] = array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails));
- $form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname];
+ $do_show = false;
}
-
- // Collect form field output
- foreach($groupdetails['fields'] as $fieldname => $fielddetails)
+ }
+
+ if($do_show)
+ {
+ if(isset($groupdetails['title']) && $groupdetails['title'] != '')
{
- $fields .= getFormFieldOutput($fieldname, $fielddetails);
+ $fields .= getFormGroupOutput($groupname, $groupdetails);
+ }
+
+ if(validateFieldDefinition($groupdetails))
+ {
+ // Prefetch form fields
+ foreach($groupdetails['fields'] as $fieldname => $fielddetails)
+ {
+ $groupdetails['fields'][$fieldname] = array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails));
+ $form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname];
+ }
+
+ // Collect form field output
+ foreach($groupdetails['fields'] as $fieldname => $fielddetails)
+ {
+ $fields .= getFormFieldOutput($fieldname, $fielddetails);
+ }
}
}
}
diff --git a/lib/functions/formfields/function.getFormFieldOutput.php b/lib/functions/formfields/function.getFormFieldOutput.php
index 25288e28..2d26fa11 100644
--- a/lib/functions/formfields/function.getFormFieldOutput.php
+++ b/lib/functions/formfields/function.getFormFieldOutput.php
@@ -19,6 +19,8 @@
function getFormFieldOutput($fieldname, $fielddata)
{
+ global $settings;
+
$returnvalue = '';
if(is_array($fielddata) && isset($fielddata['type']) && $fielddata['type'] != '' && function_exists('getFormFieldOutput' . ucfirst($fielddata['type'])))
{
@@ -44,7 +46,26 @@ function getFormFieldOutput($fieldname, $fielddata)
$fielddata['value'] = null;
}
}
- $returnvalue = call_user_func('getFormFieldOutput' . ucfirst($fielddata['type']), $fieldname, $fielddata);
+
+ /**
+ * this part checks for the 'websrv_avail' entry in the settings-array
+ * if found, we check if the current webserver is in the array. If this
+ * is not the case, we change the setting type to "hidden", #502
+ */
+ $do_show = true;
+ if(isset($fielddata['websrv_avail']) && is_array($fielddata['websrv_avail']))
+ {
+ $websrv = $settings['system']['webserver'];
+ if(!in_array($websrv, $fielddata['websrv_avail']))
+ {
+ $do_show = false;
+ }
+ }
+
+ if($do_show)
+ {
+ $returnvalue = call_user_func('getFormFieldOutput' . ucfirst($fielddata['type']), $fieldname, $fielddata);
+ }
}
return $returnvalue;
}
diff --git a/lib/functions/formfields/function.getFormGroupOutput.php b/lib/functions/formfields/function.getFormGroupOutput.php
index 782784ad..20302047 100644
--- a/lib/functions/formfields/function.getFormGroupOutput.php
+++ b/lib/functions/formfields/function.getFormGroupOutput.php
@@ -71,6 +71,24 @@ function getFormOverviewGroupOutput($groupname, $groupdetails)
}
}
- eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";");
+ /**
+ * this part checks for the 'websrv_avail' entry in the settings-array
+ * if found, we check if the current webserver is in the array. If this
+ * is not the case, we change the setting type to "hidden", #502
+ */
+ $do_show = true;
+ if(isset($groupdetails['websrv_avail']) && is_array($groupdetails['websrv_avail']))
+ {
+ $websrv = $settings['system']['webserver'];
+ if(!in_array($websrv, $groupdetails['websrv_avail']))
+ {
+ $do_show = false;
+ }
+ }
+
+ if($do_show)
+ {
+ eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";");
+ }
return $group;
}
diff --git a/lng/english.lng.php b/lng/english.lng.php
index 19e7c520..549ceb9c 100644
--- a/lng/english.lng.php
+++ b/lng/english.lng.php
@@ -547,8 +547,8 @@ $lng['panel']['back'] = 'Back';
$lng['serversettings']['mod_log_sql']['title'] = 'Temporary save logs in the database';
$lng['serversettings']['mod_log_sql']['description'] = 'Use mod_log_sql to save webrequests temporarily
This needs a special apache-configuration!';
-$lng['serversettings']['mod_fcgid']['title'] = 'Include PHP via mod_fcgid/suexec';
-$lng['serversettings']['mod_fcgid']['description'] = 'Use mod_fcgid/suexec/libnss_mysql to run PHP with the corresponding useraccount.
This needs a special webserver configuration, see http://wiki.froxlor.org/contrib/fcgid-handbook