admin-updates, settings-import and some minor ui tweaks
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -324,7 +324,24 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
\Froxlor\UI\Response::dynamic_error("Upload failed");
|
||||
}
|
||||
} else {
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/importexport/index") . "\";");
|
||||
$settings_data = include_once dirname(__FILE__) . '/lib/formfields/admin/settings/formfield.settings_import.php';
|
||||
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'settings', 'page' => $page, 'action' => 'import')),
|
||||
'formdata' => $settings_data['settings_import'],
|
||||
'actions_links' => [[
|
||||
'class' => 'btn-outline-primary',
|
||||
'href' => $linker->getLink(['section' => 'settings', 'page' => 'overview']),
|
||||
'label' => $lng['admin']['configfiles']['overview'],
|
||||
'icon' => 'fa fa-grip'
|
||||
],[
|
||||
'class' => 'btn-outline-secondary',
|
||||
'href' => $linker->getLink(['section' => 'settings', 'page' => $page, 'action' => 'export']),
|
||||
'label' => 'Download/export ' . $lng['admin']['serversettings'],
|
||||
'icon' => 'fa fa-file-import'
|
||||
]]
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
} elseif ($page == 'testmail') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
@@ -146,8 +146,7 @@ if ($action == '') {
|
||||
UI::twigBuffer('user/table-tpl.html.twig', [
|
||||
'maillisting' => \Froxlor\UI\Listing::formatFromArray($collection_mail, $mailtpl_list_data['mailtpl_list']),
|
||||
'filelisting' => \Froxlor\UI\Listing::formatFromArray($collection_file, $filetpl_list_data['filetpl_list']),
|
||||
'mail_actions_links' => $mail_actions_links,
|
||||
'file_actions_links' => $file_actions_links
|
||||
'actions_links' => array_merge($mail_actions_links, $file_actions_links)
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
} elseif ($action == 'delete' && $subjectid != 0 && $mailbodyid != 0) {
|
||||
|
||||
@@ -20,6 +20,7 @@ require __DIR__ . '/lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\UI\Panel\UI;
|
||||
|
||||
if ($page == 'overview') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
|
||||
@@ -29,7 +30,7 @@ if ($page == 'overview') {
|
||||
* have any version/dbversion in the database (don't know why)
|
||||
* so we have to set them both to run a correct upgrade
|
||||
*/
|
||||
if (! \Froxlor\Froxlor::isFroxlor()) {
|
||||
if (!\Froxlor\Froxlor::isFroxlor()) {
|
||||
if (Settings::Get('panel.version') == null || Settings::Get('panel.version') == '') {
|
||||
Settings::Set('panel.version', '1.4.2.1');
|
||||
}
|
||||
@@ -57,7 +58,7 @@ if ($page == 'overview') {
|
||||
$message = '';
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
if ((isset($_POST['update_preconfig']) && isset($_POST['update_changesagreed']) && intval($_POST['update_changesagreed']) != 0) || ! isset($_POST['update_preconfig'])) {
|
||||
if ((isset($_POST['update_preconfig']) && isset($_POST['update_changesagreed']) && intval($_POST['update_changesagreed']) != 0) || !isset($_POST['update_preconfig'])) {
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_start') . "\";");
|
||||
|
||||
include_once \Froxlor\Froxlor::getInstallDir() . 'install/updatesql.php';
|
||||
@@ -67,15 +68,15 @@ if ($page == 'overview') {
|
||||
|
||||
\Froxlor\User::updateCounters();
|
||||
\Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST);
|
||||
@chmod(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php', 0440);
|
||||
@chmod(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php', 0400);
|
||||
|
||||
$successful_update = true;
|
||||
} else {
|
||||
$message = '<br /><strong class="red">You have to agree that you have read the update notifications.</strong>';
|
||||
$message = '<br><br><strong>You have to agree that you have read the update notifications.</strong>';
|
||||
}
|
||||
}
|
||||
|
||||
if (! $successful_update) {
|
||||
if (!$successful_update) {
|
||||
$current_version = Settings::Get('panel.version');
|
||||
$current_db_version = Settings::Get('panel.db_version');
|
||||
if (empty($current_db_version)) {
|
||||
@@ -93,21 +94,37 @@ if ($page == 'overview') {
|
||||
$ui_text = str_replace('%curversion', $current_db_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_db_version, $ui_text);
|
||||
}
|
||||
$update_information = $ui_text;
|
||||
$ui_text .= $lng['update']['update_information']['part_b'];
|
||||
|
||||
$upd_formfield = [
|
||||
'updates' => [
|
||||
'title' => $lng['update']['update'],
|
||||
'image' => 'fa-solid fa-download',
|
||||
'sections' => [],
|
||||
'buttons' => [
|
||||
[
|
||||
'label' => $lng['update']['proceed']
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
include_once \Froxlor\Froxlor::getInstallDir() . '/install/updates/preconfig.php';
|
||||
$preconfig = getPreConfig($current_version, $current_db_version);
|
||||
if ($preconfig != '') {
|
||||
$update_information .= '<br />' . $preconfig . $message;
|
||||
if (!empty($preconfig)) {
|
||||
$upd_formfield['updates']['sections'] = $preconfig;
|
||||
}
|
||||
|
||||
$update_information .= $lng['update']['update_information']['part_b'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/index') . "\";");
|
||||
UI::twigBuffer('user/form-note.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'updates')),
|
||||
'formdata' => $upd_formfield['updates'],
|
||||
// alert
|
||||
'type' => !empty($message) ? 'danger' : 'info',
|
||||
'alert_msg' => $ui_text . $message
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
} else {
|
||||
$success_message = $lng['update']['noupdatesavail'];
|
||||
$redirect_url = 'admin_index.php';
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/noupdatesavail') . "\";");
|
||||
\Froxlor\UI\Response::standard_success('noupdatesavail');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 ';
|
||||
$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
33
lib/formfields/admin/settings/formfield.settings_import.php
Normal file
33
lib/formfields/admin/settings/formfield.settings_import.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Formfields
|
||||
*
|
||||
*/
|
||||
return array(
|
||||
'settings_import' => array(
|
||||
'title' => $lng['admin']['configfiles']['importexport'],
|
||||
'image' => 'fa-solid fa-file-import',
|
||||
'sections' => array(
|
||||
'section_a' => array(
|
||||
'fields' => array(
|
||||
'import_file' => array(
|
||||
'label' => 'Chose file for import',
|
||||
'type' => 'file',
|
||||
'mandatory' => true
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -31,8 +31,14 @@
|
||||
<input type="hidden" name="send" value="send"/>
|
||||
|
||||
<div class="col-12 text-end">
|
||||
<button type="reset" class="btn btn-outline-secondary">{{ lng('panel.cancel') }}</button>
|
||||
<button type="submit" class="btn btn-primary">{{ lng('panel.save') }}</button>
|
||||
{% if form_data.buttons is defined and form_data.buttons is iterable %}
|
||||
{% for btn in form_data.buttons %}
|
||||
<button type="{{ btn.type|default("submit") }}" class="btn {{ btn.class|default(" btn-primary") }}">{{ btn.label }}</button>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<button type="reset" class="btn btn-outline-secondary">{{ lng('panel.cancel') }}</button>
|
||||
<button type="submit" class="btn btn-primary">{{ lng('panel.save') }}</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{{ parent() }}
|
||||
|
||||
{% if replacers is not empty and replacers is iterable %}
|
||||
<div class="card mb-3">
|
||||
<div class="card my-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{{ lng('admin.templates.template_replace_vars') }}</h5>
|
||||
<dl class="row">
|
||||
|
||||
@@ -18,6 +18,28 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block actions %}
|
||||
|
||||
{% if actions_links is iterable or (entity_info is defined and entity_info is not empty) %}
|
||||
<div>
|
||||
{% if actions_links is iterable %}
|
||||
{% for link in actions_links %}
|
||||
<a class="btn {{ link.class|default('btn-outline-primary') }}" href="{{ link.href|raw }}">
|
||||
<i class="{{ link.icon|default('fa-solid fa-plus-circle') }}"></i><span class="d-none d-lg-inline ms-lg-1">{{ link.label }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{# TODO: eventually not used anymore because of using a documentation link
|
||||
{% if entity_info is defined and entity_info is not empty %}
|
||||
<div class="alert alert-info" role="alert">
|
||||
{{ entity_info|raw }}
|
||||
</div>
|
||||
{% endif %}
|
||||
#}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% import "Froxlor/form/form.html.twig" as form %}
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<div class="row">
|
||||
{% if userinfo.adminsession == 1 %}
|
||||
<div
|
||||
class="col-7">
|
||||
class="col-12 col-lg-6">
|
||||
{# system infos #}
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
@@ -121,7 +121,7 @@
|
||||
</div>
|
||||
{% else %}
|
||||
<div
|
||||
class="col-4">
|
||||
class="col-12 col-md-6 col-lg-4">
|
||||
{# account info #}
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
@@ -184,7 +184,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="col-4">
|
||||
class="col-12 col-md-6 col-lg-4">
|
||||
{# customer details #}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
@@ -245,7 +245,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="{% if userinfo.adminsession == 1 %}col-5{% else %}col-4{% endif %}">
|
||||
<div class="col-12 {% if userinfo.adminsession == 1 %}col-lg-6{% else %}col-lg-4{% endif %}">
|
||||
{% if userinfo.adminsession == 1 %}
|
||||
{# froxlor-details #}
|
||||
<div class="card mb-3">
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
{% extends "Froxlor/user/table.html.twig" %}
|
||||
|
||||
{% block content %}
|
||||
{% block heading %}
|
||||
{% set listing = maillisting %}
|
||||
{{ parent() }}
|
||||
|
||||
{% set listing = filelisting %}
|
||||
{{ parent() }}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% set listing = maillisting %}
|
||||
{% set actions_links = mail_actions_links %}
|
||||
{{ parent() }}
|
||||
|
||||
{% set listing = filelisting %}
|
||||
{% set actions_links = file_actions_links %}
|
||||
{{ parent() }}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user