style apikeys and integrity-check
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -267,14 +267,31 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
));
|
||||
}
|
||||
|
||||
$integritycheck = '';
|
||||
$integritycheck = [];
|
||||
foreach ($integrity->available as $id => $check) {
|
||||
$displayid = $id + 1;
|
||||
$result = $integrity->$check();
|
||||
$checkdesc = $lng['integrity_check'][$check];
|
||||
eval("\$integritycheck.=\"" . \Froxlor\UI\Template::getTemplate("settings/integritycheck_row") . "\";");
|
||||
$integritycheck[] = [
|
||||
'displayid' => $id + 1,
|
||||
'result' => $integrity->$check(),
|
||||
'checkdesc' => $lng['integrity_check'][$check]
|
||||
];
|
||||
}
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/integritycheck") . "\";");
|
||||
|
||||
$integrity_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.integrity.php';
|
||||
$collection = [
|
||||
'data' => $integritycheck,
|
||||
'pagination' => []
|
||||
];
|
||||
|
||||
UI::twigBuffer('user/table.html.twig', [
|
||||
'listing' => \Froxlor\UI\Listing::formatFromArray($collection, $integrity_list_data['integrity_list']),
|
||||
'actions_links' => [[
|
||||
'href' => $linker->getLink(['section' => 'settings', 'page' => $page, 'action' => 'fix']),
|
||||
'label' => $lng['admin']['integrityfix'],
|
||||
'icon' => 'fa-solid fa-screwdriver-wrench',
|
||||
'class' => 'btn-warning'
|
||||
]]
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
} elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1') {
|
||||
// check for json-stuff
|
||||
if (!extension_loaded('json')) {
|
||||
|
||||
21
api_keys.php
21
api_keys.php
@@ -165,26 +165,25 @@ $keys_stmt = Database::prepare($keys_stmt_query);
|
||||
Database::pexecute($keys_stmt, $qry_params);
|
||||
$all_keys = $keys_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (count($all_keys) == 0) {
|
||||
$count = 0;
|
||||
$message = $lng['apikeys']['no_api_keys'];
|
||||
$sortcode = "";
|
||||
$searchcode = "";
|
||||
$pagingcode = "";
|
||||
eval("\$apikeys.=\"" . \Froxlor\UI\Template::getTemplate("api_keys/keys_error", true) . "\";");
|
||||
}
|
||||
|
||||
$apikeys_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/tablelisting.apikeys.php';
|
||||
$collection = [
|
||||
'data' => $all_keys,
|
||||
'pagination' => []
|
||||
];
|
||||
|
||||
UI::twigBuffer('user/table.html.twig', [
|
||||
$tpl = 'user/table.html.twig';
|
||||
if (!empty($success_message)) {
|
||||
$tpl = 'user/table-note.html.twig';
|
||||
}
|
||||
|
||||
UI::twigBuffer($tpl, [
|
||||
'listing' => \Froxlor\UI\Listing::formatFromArray($collection, $apikeys_list_data['apikeys_list']),
|
||||
'actions_links' => (int)$userinfo['api_allowed'] == 1 ? [[
|
||||
'href' => $linker->getLink(['section' => 'index', 'page' => $page, 'action' => 'add']),
|
||||
'label' => $lng['apikeys']['key_add']
|
||||
]] : null
|
||||
]] : null,
|
||||
// alert-box
|
||||
'type' => 'success',
|
||||
'alert_msg' => $success_message
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
|
||||
@@ -29,6 +29,11 @@ class Style
|
||||
return $attributes['fields']['deactivated'] ? 'bg-danger' : '';
|
||||
}
|
||||
|
||||
public static function resultIntegrityBad(array $attributes): string
|
||||
{
|
||||
return $attributes['fields']['result'] ? '' : 'bg-warning';
|
||||
}
|
||||
|
||||
public static function invalidApiKey(array $attributes): string
|
||||
{
|
||||
// check whether the api key is not valid anymore
|
||||
|
||||
@@ -93,7 +93,7 @@ return [
|
||||
],
|
||||
],
|
||||
],
|
||||
'callback' => [
|
||||
'format_callback' => [
|
||||
[Style::class, 'deactivated'],
|
||||
[Style::class, 'diskspaceWarning'],
|
||||
[Style::class, 'trafficWarning']
|
||||
|
||||
50
lib/tablelisting/admin/tablelisting.integrity.php
Normal file
50
lib/tablelisting/admin/tablelisting.integrity.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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 Tabellisting
|
||||
*
|
||||
*/
|
||||
|
||||
use Froxlor\UI\Callbacks\Text;
|
||||
use Froxlor\UI\Callbacks\Style;
|
||||
use Froxlor\UI\Listing;
|
||||
|
||||
return [
|
||||
'integrity_list' => [
|
||||
'title' => $lng['admin']['integritycheck'],
|
||||
'icon' => 'fa-solid fa-circle-check',
|
||||
'columns' => [
|
||||
'displayid' => [
|
||||
'label' => $lng['admin']['integrityid'],
|
||||
'field' => 'displayid'
|
||||
],
|
||||
'checkdesc' => [
|
||||
'label' => $lng['admin']['integrityname'],
|
||||
'field' => 'checkdesc'
|
||||
],
|
||||
'result' => [
|
||||
'label' => $lng['admin']['integrityresult'],
|
||||
'field' => 'result',
|
||||
'callback' => [Text::class, 'boolean']
|
||||
]
|
||||
],
|
||||
'visible_columns' => Listing::getVisibleColumnsForListing('integrity_list', [
|
||||
'displayid',
|
||||
'checkdesc',
|
||||
'result'
|
||||
]),
|
||||
'format_callback' => [
|
||||
[Style::class, 'resultIntegrityBad']
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -62,6 +62,7 @@ return [
|
||||
'icon' => 'fa fa-eye',
|
||||
'title' => $lng['apikeys']['clicktoview'],
|
||||
'href' => [
|
||||
'section' => 'index',
|
||||
'page' => 'apikeys',
|
||||
'action' => '#',
|
||||
'id' => ':id'
|
||||
@@ -72,13 +73,14 @@ return [
|
||||
'title' => $lng['panel']['delete'],
|
||||
'class' => 'text-danger',
|
||||
'href' => [
|
||||
'section' => 'index',
|
||||
'page' => 'apikeys',
|
||||
'action' => 'delete',
|
||||
'id' => ':id'
|
||||
],
|
||||
],
|
||||
],
|
||||
'callback' => [
|
||||
'format_callback' => [
|
||||
[Style::class, 'invalidApiKey']
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user