admin-updates, settings-import and some minor ui tweaks

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-03-16 13:22:59 +01:00
parent d25c5ec4dd
commit 401eb60062
12 changed files with 523 additions and 367 deletions

View File

@@ -18,41 +18,62 @@
/**
* Function getPreConfig
*
* outputs various content before the update process
* outputs various form-field-arrays before the update process
* can be continued (asks for agreement whatever is being asked)
*
* @param string $current_version
* @param int $current_db_version
*
* @return string
* @return array
*/
function getPreConfig($current_version, $current_db_version)
function getPreConfig($current_version, $current_db_version): array
{
$has_preconfig = false;
$return = '<div class="preconfig"><h3 class="red">PLEASE NOTE - Important update notifications</h3>';
include_once \Froxlor\FileDir::makeCorrectFile(dirname(__FILE__) . '/preconfig/0.9/preconfig_0.9.inc.php');
parseAndOutputPreconfig($has_preconfig, $return, $current_version, $current_db_version);
$return['section_09'] = [
'title' => '0.9.x updates',
'fields' => []
];
parseAndOutputPreconfig($has_preconfig, $return['section_09']['fields'], $current_version, $current_db_version);
include_once \Froxlor\FileDir::makeCorrectFile(dirname(__FILE__) . '/preconfig/0.10/preconfig_0.10.inc.php');
parseAndOutputPreconfig2($has_preconfig, $return, $current_version, $current_db_version);
$return['section_010'] = [
'title' => '0.10.x updates',
'fields' => []
];
parseAndOutputPreconfig2($has_preconfig, $return['section_010']['fields'], $current_version, $current_db_version);
$return .= '<br /><br />' . \Froxlor\UI\HTML::makecheckbox('update_changesagreed', '<strong>I have read the update notifications above and I am aware of the changes made to my system.</strong>', '1', true, '0', true);
$return .= '</div>';
$return .= '<input type="hidden" name="update_preconfig" value="1" />';
if (empty($return['section_09']['fields'])) {
unset($return['section_09']);
}
if (empty($return['section_010']['fields'])) {
unset($return['section_010']);
}
if (!empty($return)) {
$has_preconfig = true;
$return['section_agree'] = [
'title' => 'Check',
'fields' => [
'update_changesagreed' => ['type' => 'checkbox', 'value' => 1, 'label' => '<strong>I have read the update notifications above and I am aware of the changes made to my system.</strong>'],
'update_preconfig' => ['type' => 'hidden', 'value' => 1]
]
];
}
if ($has_preconfig) {
return $return;
} else {
return '';
return [];
}
}
function versionInUpdate($current_version, $version_to_check)
{
if (! \Froxlor\Froxlor::isFroxlor()) {
if (!\Froxlor\Froxlor::isFroxlor()) {
return true;
}
return (\Froxlor\Froxlor::versionCompare2($current_version, $version_to_check) == - 1 ? true : false);
return (\Froxlor\Froxlor::versionCompare2($current_version, $version_to_check) == -1 ? true : false);
}

View File

@@ -25,7 +25,7 @@
* @param string $current_version
* current froxlor version
*
* @return null
* @return void
*/
function parseAndOutputPreconfig2(&$has_preconfig, &$return, $current_version, $current_db_version)
{
@@ -33,10 +33,9 @@ function parseAndOutputPreconfig2(&$has_preconfig, &$return, $current_version, $
if (versionInUpdate($current_db_version, '202004140')) {
$has_preconfig = true;
$description = 'Froxlor can now optionally validate the dns entries of domains that request Lets Encrypt certificates to reduce dns-related problems (e.g. freshly registered domain or updated a-record).<br />';
$question = '<strong>Validate DNS of domains when using Lets Encrypt&nbsp;';
$question .= \Froxlor\UI\HTML::makeyesno('system_le_domain_dnscheck', '1', '0', '1');
eval("\$return.=\"" . \Froxlor\UI\Template::getTemplate("update/preconfigitem") . "\";");
$description = 'Froxlor can now optionally validate the dns entries of domains that request Lets Encrypt certificates to reduce dns-related problems (e.g. freshly registered domain or updated a-record).';
$question = '<strong>Validate DNS of domains when using Lets Encrypt';
$return['system_le_domain_dnscheck_note'] = ['type' => 'infotext', 'value' => $description];
$return['system_le_domain_dnscheck'] = ['type' => 'checkbox', 'value' => 1, 'label' => $question];
}
}

File diff suppressed because it is too large Load Diff