don't show settings which are not needed for used webserver, fixes #502
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user