minor ui/lang adjustments; add security question for backup-abort action

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-05-13 11:22:14 +02:00
parent cc11e2de51
commit 7e14e9edd7
8 changed files with 45 additions and 24 deletions

View File

@@ -289,20 +289,27 @@ if ($page == 'overview' || $page == 'htpasswds') {
} }
if (Settings::Get('system.backupenabled') == 1) { if (Settings::Get('system.backupenabled') == 1) {
if ($action == 'abort' && isset($_POST['send']) && $_POST['send'] == 'send') { if ($action == 'abort') {
$log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "customer_extras::backup - aborted scheduled backupjob"); if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "customer_extras::backup - aborted scheduled backupjob");
CustomerBackups::getLocal($userinfo, $_POST)->delete(); try {
} catch (Exception $e) { CustomerBackups::getLocal($userinfo, $_POST)->delete();
Response::dynamicError($e->getMessage()); } catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Response::redirectTo($filename, [
'page' => $page,
'action' => ''
]);
} else {
HTML::askYesNo('extras_reallydelete_backup', $filename, [
'backup_job_entry' => $id,
'section' => 'extras',
'page' => $page,
'action' => $action
]);
} }
Response::standardSuccess('backupaborted'); } elseif ($action == '') {
Response::redirectTo($filename, [
'page' => $page,
'action' => ''
]);
}
if ($action == '') {
$log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::backup"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::backup");
// check whether there is a backup-job for this customer // check whether there is a backup-job for this customer

View File

@@ -106,16 +106,18 @@ if (!is_null($month) && !is_null($year)) {
'mail_data' => $traf['mail_data'], 'mail_data' => $traf['mail_data'],
]); ]);
} else { } else {
// default to the last 36 months
$from_date = (new DateTime)->modify("last day of last months")->setTime(23, 59, 59)->sub(new \DateInterval('P3Y'))->format('U');
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
FROM `" . TABLE_PANEL_TRAFFIC . "` FROM `" . TABLE_PANEL_TRAFFIC . "`
WHERE `customerid` = :customerid WHERE `customerid` = :customerid AND `stamp` = :fromdate
GROUP BY `year`, `month` GROUP BY `year`, `month`
ORDER BY `year` DESC, `month` DESC ORDER BY `year` ASC, `month` ASC
LIMIT 12
"); ");
Database::pexecute($result_stmt, [ Database::pexecute($result_stmt, [
"customerid" => $userinfo['customerid'] "customerid" => $userinfo['customerid'],
"fromdate" => $from_date
]); ]);
$traffic_complete['http'] = 0; $traffic_complete['http'] = 0;
$traffic_complete['ftp'] = 0; $traffic_complete['ftp'] = 0;

View File

@@ -53,6 +53,9 @@ class HTML
if ((!isset($box['show_element']) || $box['show_element'] === true) && (!isset($box['required_resources']) || $box['required_resources'] == '' || (isset($userinfo[$box['required_resources']]) && ((int)$userinfo[$box['required_resources']] > 0 || $userinfo[$box['required_resources']] == '-1')))) { if ((!isset($box['show_element']) || $box['show_element'] === true) && (!isset($box['required_resources']) || $box['required_resources'] == '' || (isset($userinfo[$box['required_resources']]) && ((int)$userinfo[$box['required_resources']] > 0 || $userinfo[$box['required_resources']] == '-1')))) {
$navigation_links = []; $navigation_links = [];
$box_active = false; $box_active = false;
if (isset($box['url']) && $box['url'] == basename($_SERVER["SCRIPT_FILENAME"])) {
$box_active = true;
}
foreach ($box['elements'] as $element) { foreach ($box['elements'] as $element) {
if ((!isset($element['show_element']) || $element['show_element'] === true) && (!isset($element['required_resources']) || $element['required_resources'] == '' || (isset($userinfo[$element['required_resources']]) && ((int)$userinfo[$element['required_resources']] > 0 || $userinfo[$element['required_resources']] == '-1')))) { if ((!isset($element['show_element']) || $element['show_element'] === true) && (!isset($element['required_resources']) || $element['required_resources'] == '' || (isset($userinfo[$element['required_resources']]) && ((int)$userinfo[$element['required_resources']] > 0 || $userinfo[$element['required_resources']] == '-1')))) {
$target = ''; $target = '';
@@ -63,7 +66,10 @@ class HTML
$target = ' target="_blank"'; $target = ' target="_blank"';
} }
if (isset($_GET['page']) && substr_count($element['url'], "page=" . $_GET['page']) > 0 && substr_count($element['url'], basename($_SERVER["SCRIPT_FILENAME"])) > 0) { if (
((empty($_GET['page']) && substr_count($element['url'], "page=") == 0) || (isset($_GET['page']) && substr_count($element['url'], "page=" . $_GET['page']) > 0))
&& substr_count($element['url'], basename($_SERVER["SCRIPT_FILENAME"])) > 0
) {
$active = true; $active = true;
$box_active = true; $box_active = true;
} }

View File

@@ -143,6 +143,10 @@ return [
[ [
'url' => 'customer_traffic.php?page=current', 'url' => 'customer_traffic.php?page=current',
'label' => lng('menue.traffic.current') 'label' => lng('menue.traffic.current')
],
[
'url' => 'customer_traffic.php',
'label' => lng('menue.traffic.overview')
] ]
] ]
] ]

View File

@@ -111,7 +111,7 @@ return [
'visible' => [Domain::class, 'canEditAlias'] 'visible' => [Domain::class, 'canEditAlias']
], ],
'isassigned' => [ 'isassigned' => [
'icon' => 'fa-check-to-slot', 'icon' => 'fa fa-check-to-slot',
'title' => lng('domains.isassigneddomain'), 'title' => lng('domains.isassigneddomain'),
'visible' => [Domain::class, 'isAssigned'] 'visible' => [Domain::class, 'isAssigned']
], ],

View File

@@ -1035,7 +1035,7 @@ Vielen Dank, Ihr Administrator',
], ],
'domains' => [ 'domains' => [
'domains' => 'Domains', 'domains' => 'Domains',
'settings' => 'Einstellungen', 'settings' => 'Übersicht Domains',
], ],
'ftp' => [ 'ftp' => [
'ftp' => 'FTP', 'ftp' => 'FTP',
@@ -1051,7 +1051,7 @@ Vielen Dank, Ihr Administrator',
'traffic' => [ 'traffic' => [
'traffic' => 'Traffic', 'traffic' => 'Traffic',
'current' => 'Aktueller Monat', 'current' => 'Aktueller Monat',
'table' => 'Übersicht', 'overview' => 'Übersicht',
], ],
'phpsettings' => [ 'phpsettings' => [
'maintitle' => 'PHP-Konfigurationen', 'maintitle' => 'PHP-Konfigurationen',
@@ -1198,6 +1198,7 @@ Vielen Dank, Ihr Administrator',
'email_reallydelete_forwarder' => 'Wollen Sie die Weiterleitung "%s" wirklich löschen?', 'email_reallydelete_forwarder' => 'Wollen Sie die Weiterleitung "%s" wirklich löschen?',
'extras_reallydelete' => 'Wollen Sie den Verzeichnisschutz für "%s" wirklich löschen?', 'extras_reallydelete' => 'Wollen Sie den Verzeichnisschutz für "%s" wirklich löschen?',
'extras_reallydelete_pathoptions' => 'Wollen Sie die Optionen für den Pfad "%s" wirklich löschen?', 'extras_reallydelete_pathoptions' => 'Wollen Sie die Optionen für den Pfad "%s" wirklich löschen?',
'extras_reallydelete_backup' => 'Wollen Sie die geplante Sicherung wirklich löschen?',
'ftp_reallydelete' => 'Wollen Sie das FTP-Benutzerkonto "%s" wirklich löschen?', 'ftp_reallydelete' => 'Wollen Sie das FTP-Benutzerkonto "%s" wirklich löschen?',
'mysql_reallydelete' => 'Wollen Sie die Datenbank "%s" wirklich löschen?<br />ACHTUNG! Alle Daten gehen unwiderruflich verloren!', 'mysql_reallydelete' => 'Wollen Sie die Datenbank "%s" wirklich löschen?<br />ACHTUNG! Alle Daten gehen unwiderruflich verloren!',
'admin_configs_reallyrebuild' => 'Wollen Sie wirklich alle Konfigurationsdateien neu erstellen lassen?', 'admin_configs_reallyrebuild' => 'Wollen Sie wirklich alle Konfigurationsdateien neu erstellen lassen?',

View File

@@ -1332,7 +1332,7 @@ Yours sincerely, your administrator',
], ],
'domains' => [ 'domains' => [
'domains' => 'Domains', 'domains' => 'Domains',
'settings' => 'Settings', 'settings' => 'Domains overview',
], ],
'ftp' => [ 'ftp' => [
'ftp' => 'FTP', 'ftp' => 'FTP',
@@ -1348,7 +1348,7 @@ Yours sincerely, your administrator',
'traffic' => [ 'traffic' => [
'traffic' => 'Traffic', 'traffic' => 'Traffic',
'current' => 'Current Month', 'current' => 'Current Month',
'table' => 'Traffic', 'overview' => 'Total traffic',
], ],
'phpsettings' => [ 'phpsettings' => [
'maintitle' => 'PHP Configurations', 'maintitle' => 'PHP Configurations',
@@ -1543,6 +1543,7 @@ Yours sincerely, your administrator',
'email_reallydelete_forwarder' => 'Do you really want to delete the forwarder %s?', 'email_reallydelete_forwarder' => 'Do you really want to delete the forwarder %s?',
'extras_reallydelete' => 'Do you really want to delete the directory protection for %s?', 'extras_reallydelete' => 'Do you really want to delete the directory protection for %s?',
'extras_reallydelete_pathoptions' => 'Do you really want to delete the path options for %s?', 'extras_reallydelete_pathoptions' => 'Do you really want to delete the path options for %s?',
'extras_reallydelete_backup' => 'Do you really want to abort the planned backup job?',
'ftp_reallydelete' => 'Do you really want to delete the FTP-account %s?', 'ftp_reallydelete' => 'Do you really want to delete the FTP-account %s?',
'mysql_reallydelete' => 'Do you really want to delete the database %s? This cannot be undone!', 'mysql_reallydelete' => 'Do you really want to delete the database %s? This cannot be undone!',
'admin_configs_reallyrebuild' => 'Do you really want to rebuild all config files?', 'admin_configs_reallyrebuild' => 'Do you really want to rebuild all config files?',

View File

@@ -23,7 +23,7 @@
<input type="hidden" name="{{ id }}" value="{{ field }}"/> <input type="hidden" name="{{ id }}" value="{{ field }}"/>
{% endfor %} {% endfor %}
<button class="btn btn-danger" type="submit" name="submitbutton">{{ lng('panel.yes') }}</button>&nbsp; <button class="btn btn-danger" type="submit" name="submitbutton">{{ lng('panel.yes') }}</button>&nbsp;
{% if back_link is defined and back_link is iterable %} {% if back_link is defined and back_link is iterable and back_link|length > 0 %}
<a href="{{ linker(back_link) }}" class="btn btn-secondary">{{ lng('panel.no') }}</a> <a href="{{ linker(back_link) }}" class="btn btn-secondary">{{ lng('panel.no') }}</a>
{% else %} {% else %}
<a href="javascript:history.back(-1)" class="btn btn-secondary">{{ lng('panel.no') }}</a> <a href="javascript:history.back(-1)" class="btn btn-secondary">{{ lng('panel.no') }}</a>