show replacer-variables in php-config add/edit and fpm-versions add/edit; catch potential Exception thrown by Form::processForm() to display the error nicely; minor fixes in field-visibility for phpconfigs depending on php-interface and webserver; validate fcgid/fpm enable-flag correctly if not POST'ed at the same time (older behaviour)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -212,9 +212,10 @@ if ($page == 'overview') {
|
|||||||
} else {
|
} else {
|
||||||
$fpmconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php';
|
$fpmconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php';
|
||||||
|
|
||||||
UI::view('user/form.html.twig', [
|
UI::view('user/form-replacers.html.twig', [
|
||||||
'formaction' => $linker->getLink(['section' => 'phpsettings', 'page' => 'fpmdaemons']),
|
'formaction' => $linker->getLink(['section' => 'phpsettings', 'page' => 'fpmdaemons']),
|
||||||
'formdata' => $fpmconfig_add_data['fpmconfig_add']
|
'formdata' => $fpmconfig_add_data['fpmconfig_add'],
|
||||||
|
'replacers' => $fpmconfig_add_data['fpmconfig_replacers']
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -282,9 +283,10 @@ if ($page == 'overview') {
|
|||||||
} else {
|
} else {
|
||||||
$fpmconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_edit.php';
|
$fpmconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_edit.php';
|
||||||
|
|
||||||
UI::view('user/form.html.twig', [
|
UI::view('user/form-replacers.html.twig', [
|
||||||
'formaction' => $linker->getLink(['section' => 'phpsettings', 'page' => 'fpmdaemons', 'id' => $id]),
|
'formaction' => $linker->getLink(['section' => 'phpsettings', 'page' => 'fpmdaemons', 'id' => $id]),
|
||||||
'formdata' => $fpmconfig_edit_data['fpmconfig_edit'],
|
'formdata' => $fpmconfig_edit_data['fpmconfig_edit'],
|
||||||
|
'replacers' => $fpmconfig_edit_data['fpmconfig_replacers'],
|
||||||
'editid' => $id
|
'editid' => $id
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
|||||||
Response::standardError(lng('error.session_timeout'), lng('error.session_timeout_desc'));
|
Response::standardError(lng('error.session_timeout'), lng('error.session_timeout_desc'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (Form::processForm($settings_data, $_POST, [
|
if (Form::processForm($settings_data, $_POST, [
|
||||||
'filename' => $filename,
|
'filename' => $filename,
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
@@ -97,6 +98,9 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
|||||||
'page' => $page
|
'page' => $page
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Response::dynamicError($e->getMessage(), $e->getCode());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$_part = isset($_GET['part']) ? $_GET['part'] : '';
|
$_part = isset($_GET['part']) ? $_GET['part'] : '';
|
||||||
if ($_part == '') {
|
if ($_part == '') {
|
||||||
|
|||||||
@@ -85,6 +85,12 @@ class Check
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} elseif ((int)Settings::Get($check_array[$fieldname]['other_enabled']) == 1) {
|
||||||
|
// not in the same POST so we still need to check whether the other one's enabled
|
||||||
|
$returnvalue = [
|
||||||
|
self::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
|
||||||
|
$check_array[$fieldname]['other_enabled_lng']
|
||||||
|
];
|
||||||
}
|
}
|
||||||
if (in_array(self::FORMFIELDS_PLAUSIBILITY_CHECK_OK, $returnvalue)) {
|
if (in_array(self::FORMFIELDS_PLAUSIBILITY_CHECK_OK, $returnvalue)) {
|
||||||
// be sure to deactivate the other one for the froxlor-vhost
|
// be sure to deactivate the other one for the froxlor-vhost
|
||||||
|
|||||||
@@ -116,5 +116,57 @@ return [
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
'fpmconfig_replacers' => [
|
||||||
|
'replacers' => [
|
||||||
|
[
|
||||||
|
'var' => 'PEAR_DIR',
|
||||||
|
'description' => lng('admin.phpconfig.pear_dir')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'OPEN_BASEDIR_C',
|
||||||
|
'description' => lng('admin.phpconfig.open_basedir_c')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'OPEN_BASEDIR',
|
||||||
|
'description' => lng('admin.phpconfig.open_basedir')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'OPEN_BASEDIR_GLOBAL',
|
||||||
|
'description' => lng('admin.phpconfig.open_basedir_global')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'TMP_DIR',
|
||||||
|
'description' => lng('admin.phpconfig.tmp_dir')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'CUSTOMER_EMAIL',
|
||||||
|
'description' => lng('admin.phpconfig.customer_email')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'ADMIN_EMAIL',
|
||||||
|
'description' => lng('admin.phpconfig.admin_email')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'DOMAIN',
|
||||||
|
'description' => lng('admin.phpconfig.domain')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'CUSTOMER',
|
||||||
|
'description' => lng('admin.phpconfig.customer')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'ADMIN',
|
||||||
|
'description' => lng('admin.phpconfig.admin')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'DOCUMENT_ROOT',
|
||||||
|
'description' => lng('admin.phpconfig.docroot')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'CUSTOMER_HOMEDIR',
|
||||||
|
'description' => lng('admin.phpconfig.homedir')
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -119,5 +119,57 @@ return [
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
'fpmconfig_replacers' => [
|
||||||
|
'replacers' => [
|
||||||
|
[
|
||||||
|
'var' => 'PEAR_DIR',
|
||||||
|
'description' => lng('admin.phpconfig.pear_dir')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'OPEN_BASEDIR_C',
|
||||||
|
'description' => lng('admin.phpconfig.open_basedir_c')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'OPEN_BASEDIR',
|
||||||
|
'description' => lng('admin.phpconfig.open_basedir')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'OPEN_BASEDIR_GLOBAL',
|
||||||
|
'description' => lng('admin.phpconfig.open_basedir_global')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'TMP_DIR',
|
||||||
|
'description' => lng('admin.phpconfig.tmp_dir')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'CUSTOMER_EMAIL',
|
||||||
|
'description' => lng('admin.phpconfig.customer_email')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'ADMIN_EMAIL',
|
||||||
|
'description' => lng('admin.phpconfig.admin_email')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'DOMAIN',
|
||||||
|
'description' => lng('admin.phpconfig.domain')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'CUSTOMER',
|
||||||
|
'description' => lng('admin.phpconfig.customer')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'ADMIN',
|
||||||
|
'description' => lng('admin.phpconfig.admin')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'DOCUMENT_ROOT',
|
||||||
|
'description' => lng('admin.phpconfig.docroot')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'var' => 'CUSTOMER_HOMEDIR',
|
||||||
|
'description' => lng('admin.phpconfig.homedir')
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ return [
|
|||||||
'value' => '5s'
|
'value' => '5s'
|
||||||
],
|
],
|
||||||
'phpfpm_pass_authorizationheader' => [
|
'phpfpm_pass_authorizationheader' => [
|
||||||
'visible' => Settings::Get('phpfpm.enabled') == 1,
|
'visible' => Settings::Get('phpfpm.enabled') == 1 && Settings::Get('system.webserver') == "apache2",
|
||||||
'label' => lng('admin.phpsettings.pass_authorizationheader'),
|
'label' => lng('admin.phpsettings.pass_authorizationheader'),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'value' => '1',
|
'value' => '1',
|
||||||
|
|||||||
@@ -105,13 +105,14 @@ return [
|
|||||||
'value' => $result['fpm_reqslow']
|
'value' => $result['fpm_reqslow']
|
||||||
],
|
],
|
||||||
'phpfpm_pass_authorizationheader' => [
|
'phpfpm_pass_authorizationheader' => [
|
||||||
'visible' => Settings::Get('phpfpm.enabled') == 1,
|
'visible' => Settings::Get('phpfpm.enabled') == 1 && Settings::Get('system.webserver') == "apache2",
|
||||||
'label' => lng('admin.phpsettings.pass_authorizationheader'),
|
'label' => lng('admin.phpsettings.pass_authorizationheader'),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'value' => '1',
|
'value' => '1',
|
||||||
'checked' => $result['pass_authorizationheader']
|
'checked' => $result['pass_authorizationheader']
|
||||||
],
|
],
|
||||||
'override_fpmconfig' => [
|
'override_fpmconfig' => [
|
||||||
|
'visible' => Settings::Get('phpfpm.enabled') == 1,
|
||||||
'label' => lng('serversettings.phpfpm_settings.override_fpmconfig'),
|
'label' => lng('serversettings.phpfpm_settings.override_fpmconfig'),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'value' => '1',
|
'value' => '1',
|
||||||
|
|||||||
Reference in New Issue
Block a user