From 1a6b899c67fd4bdeeda51b5121d57f26e8bbc698 Mon Sep 17 00:00:00 2001 From: envoyr Date: Sun, 27 Feb 2022 16:36:23 +0100 Subject: [PATCH] refactoring callbacks, add class for table rows --- lib/Froxlor/UI/Callbacks/Domain.php | 22 +++--- lib/Froxlor/UI/Callbacks/Email.php | 11 ++- lib/Froxlor/UI/Callbacks/Ftp.php | 14 ++-- lib/Froxlor/UI/Callbacks/Impersonate.php | 21 +++--- lib/Froxlor/UI/Callbacks/Mysql.php | 7 +- lib/Froxlor/UI/Callbacks/ProgressBar.php | 69 +++++++++---------- lib/Froxlor/UI/Callbacks/SSLCertificates.php | 32 +++++++++ lib/Froxlor/UI/Callbacks/Style.php | 54 +++++++++++++++ lib/Froxlor/UI/Callbacks/Text.php | 28 +++----- lib/Froxlor/UI/Listing.php | 16 +++-- .../admin/tablelisting.admins.php | 24 +++---- .../admin/tablelisting.customers.php | 12 ++-- .../admin/tablelisting.domains.php | 8 +-- .../admin/tablelisting.ipsandports.php | 16 ++--- lib/tablelisting/admin/tablelisting.plans.php | 8 +-- .../admin/tablelisting.sslcertificates.php | 15 ++-- .../customer/tablelisting.mysqls.php | 8 +-- 17 files changed, 222 insertions(+), 143 deletions(-) create mode 100644 lib/Froxlor/UI/Callbacks/SSLCertificates.php create mode 100644 lib/Froxlor/UI/Callbacks/Style.php diff --git a/lib/Froxlor/UI/Callbacks/Domain.php b/lib/Froxlor/UI/Callbacks/Domain.php index 7ba4ad8e..ac3d703e 100644 --- a/lib/Froxlor/UI/Callbacks/Domain.php +++ b/lib/Froxlor/UI/Callbacks/Domain.php @@ -2,6 +2,7 @@ namespace Froxlor\UI\Callbacks; +use Froxlor\FileDir; use Froxlor\UI\Panel\UI; /** @@ -15,33 +16,32 @@ use Froxlor\UI\Panel\UI; * @copyright (c) the authors * @author Froxlor team (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Listing + * @package Froxlor\UI\Callbacks * */ - class Domain { - public static function domainTarget(string $data, array $attributes): mixed + public static function domainTarget(array $attributes) { - if (empty($attributes['aliasdomain'])) { + if (empty($attributes['fields']['aliasdomain'])) { // path or redirect - if (preg_match('/^https?\:\/\//', $attributes['documentroot'])) { + if (preg_match('/^https?\:\/\//', $attributes['fields']['documentroot'])) { return [ 'type' => 'link', 'data' => [ - 'text' => $attributes['documentroot'], - 'href' => $attributes['documentroot'], + 'text' => $attributes['fields']['documentroot'], + 'href' => $attributes['fields']['documentroot'], 'target' => '_blank' ] ]; } else { // show docroot nicely - if (strpos($attributes['documentroot'], UI::getCurrentUser()['documentroot']) === 0) { - $attributes['documentroot'] = \Froxlor\FileDir::makeCorrectDir(str_replace(UI::getCurrentUser()['documentroot'], "/", $attributes['documentroot'])); + if (strpos($attributes['fields']['documentroot'], UI::getCurrentUser()['documentroot']) === 0) { + $attributes['fields']['documentroot'] = FileDir::makeCorrectDir(str_replace(UI::getCurrentUser()['documentroot'], "/", $attributes['fields']['documentroot'])); } - return $attributes['documentroot']; + return $attributes['fields']['documentroot']; } } - return UI::getLng('domains.aliasdomain') . ' ' . $attributes['aliasdomain']; + return UI::getLng('domains.aliasdomain') . ' ' . $attributes['fields']['aliasdomain']; } } diff --git a/lib/Froxlor/UI/Callbacks/Email.php b/lib/Froxlor/UI/Callbacks/Email.php index 03e1a164..b951e9a6 100644 --- a/lib/Froxlor/UI/Callbacks/Email.php +++ b/lib/Froxlor/UI/Callbacks/Email.php @@ -2,8 +2,8 @@ namespace Froxlor\UI\Callbacks; -use Froxlor\Settings; use Froxlor\PhpHelper; +use Froxlor\Settings; /** * This file is part of the Froxlor project. @@ -16,19 +16,18 @@ use Froxlor\PhpHelper; * @copyright (c) the authors * @author Froxlor team (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Listing + * @package Froxlor\UI\Callbacks * */ - class Email { - public static function account(string $data, array $attributes): mixed + public static function account(array $attributes) { return [ 'type' => 'booleanWithInfo', 'data' => [ - 'checked' => $data != 0, - 'info' => $data != 0 ? PhpHelper::sizeReadable($attributes['mboxsize'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s') : '' + 'checked' => $attributes['data'] != 0, + 'info' => $attributes['data'] != 0 ? PhpHelper::sizeReadable($attributes['fields']['mboxsize'], 'GiB', 'bi', '%01.' . (int)Settings::Get('panel.decimal_places') . 'f %s') : '' ] ]; } diff --git a/lib/Froxlor/UI/Callbacks/Ftp.php b/lib/Froxlor/UI/Callbacks/Ftp.php index 31f575ab..0f49da52 100644 --- a/lib/Froxlor/UI/Callbacks/Ftp.php +++ b/lib/Froxlor/UI/Callbacks/Ftp.php @@ -2,6 +2,7 @@ namespace Froxlor\UI\Callbacks; +use Froxlor\FileDir; use Froxlor\UI\Panel\UI; /** @@ -15,19 +16,18 @@ use Froxlor\UI\Panel\UI; * @copyright (c) the authors * @author Froxlor team (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Listing + * @package Froxlor\UI\Callbacks * */ - class Ftp { - public static function pathRelative(string $data, array $attributes): string + public static function pathRelative(array $attributes): string { - if (strpos($data, UI::getCurrentUser()['documentroot']) === 0) { - $data = str_replace(UI::getCurrentUser()['documentroot'], "/", $data); + if (strpos($attributes['data'], UI::getCurrentUser()['documentroot']) === 0) { + $attributes['data'] = str_replace(UI::getCurrentUser()['documentroot'], "/", $attributes['data']); } - $data = \Froxlor\FileDir::makeCorrectDir($data); + $attributes['data'] = FileDir::makeCorrectDir($attributes['data']); - return $data; + return $attributes['data']; } } diff --git a/lib/Froxlor/UI/Callbacks/Impersonate.php b/lib/Froxlor/UI/Callbacks/Impersonate.php index 3d3bea32..d1009b6d 100644 --- a/lib/Froxlor/UI/Callbacks/Impersonate.php +++ b/lib/Froxlor/UI/Callbacks/Impersonate.php @@ -16,45 +16,44 @@ use Froxlor\UI\Panel\UI; * @author Froxlor team (2010-) * @author Maurice Preuß * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Listing + * @package Froxlor\UI\Callbacks * */ - class Impersonate { - public static function admin(string $data, array $attributes): mixed + public static function admin(array $attributes) { - if (UI::getCurrentUser()['adminid'] != $attributes['adminid']) { + if (UI::getCurrentUser()['adminid'] != $attributes['fields']['adminid']) { $linker = UI::getLinker(); return [ 'type' => 'link', 'data' => [ - 'text' => $data, + 'text' => $attributes['data'], 'href' => $linker->getLink([ 'section' => 'admins', 'page' => 'admins', 'action' => 'su', - 'id' => $attributes['adminid'], + 'id' => $attributes['fields']['adminid'], ]), ] ]; } - return $data; + return $attributes['data']; } - public static function customer(string $data, array $attributes): array + public static function customer(array $attributes): array { $linker = UI::getLinker(); return [ 'type' => 'link', 'data' => [ - 'text' => $data, + 'text' => $attributes['data'], 'href' => $linker->getLink([ 'section' => 'customers', 'page' => 'customers', 'action' => 'su', - 'sort' => $attributes['loginname'], - 'id' => $attributes['customerid'], + 'sort' => $attributes['fields']['loginname'], + 'id' => $attributes['fields']['customerid'], ]), ] ]; diff --git a/lib/Froxlor/UI/Callbacks/Mysql.php b/lib/Froxlor/UI/Callbacks/Mysql.php index f3e83411..cd58d436 100644 --- a/lib/Froxlor/UI/Callbacks/Mysql.php +++ b/lib/Froxlor/UI/Callbacks/Mysql.php @@ -15,16 +15,15 @@ use Froxlor\Database\Database; * @copyright (c) the authors * @author Froxlor team (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Listing + * @package Froxlor\UI\Callbacks * */ - class Mysql { - public static function dbserver(string $data, array $attributes): string + public static function dbserver(array $attributes): string { // get sql-root access data - Database::needRoot(true, (int) $data); + Database::needRoot(true, (int)$attributes['data']); Database::needSqlData(); $sql_root = Database::getSqlData(); Database::needRoot(false); diff --git a/lib/Froxlor/UI/Callbacks/ProgressBar.php b/lib/Froxlor/UI/Callbacks/ProgressBar.php index 521d8cf1..9fa78028 100644 --- a/lib/Froxlor/UI/Callbacks/ProgressBar.php +++ b/lib/Froxlor/UI/Callbacks/ProgressBar.php @@ -3,6 +3,7 @@ namespace Froxlor\UI\Callbacks; use Froxlor\PhpHelper; +use Froxlor\Settings; use Froxlor\UI\Panel\UI; /** @@ -17,42 +18,40 @@ use Froxlor\UI\Panel\UI; * @author Froxlor team (2010-) * @author Maurice Preuß * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Listing + * @package Froxlor\UI\Callbacks * */ class ProgressBar { - /** - * get progressbar data for used diskspace - * - * @param string $data - * @param array $attributes - * @return array - */ - public static function diskspace(string $data, array $attributes): array + /** + * get progressbar data for used diskspace + * + * @param array $attributes + * @return array + */ + public static function diskspace(array $attributes): array { - $infotext = null; - if (isset($attributes['webspace_used']) && isset($attributes['mailspace_used']) && isset($attributes['dbspace_used'])) { + $infotext = null; + if (isset($attributes['fields']['webspace_used']) && isset($attributes['fields']['mailspace_used']) && isset($attributes['fields']['dbspace_used'])) { $infotext = UI::getLng('panel.used') . ':
'; - $infotext .= 'web: ' . PhpHelper::sizeReadable($attributes['webspace_used'] * 1024, null, 'bi') . '
'; - $infotext .= 'mail: ' . PhpHelper::sizeReadable($attributes['mailspace_used'] * 1024, null, 'bi') . '
'; - $infotext .= 'mysql: ' . PhpHelper::sizeReadable($attributes['dbspace_used'] * 1024, null, 'bi'); + $infotext .= 'web: ' . PhpHelper::sizeReadable($attributes['fields']['webspace_used'] * 1024, null, 'bi') . '
'; + $infotext .= 'mail: ' . PhpHelper::sizeReadable($attributes['fields']['mailspace_used'] * 1024, null, 'bi') . '
'; + $infotext .= 'mysql: ' . PhpHelper::sizeReadable($attributes['fields']['dbspace_used'] * 1024, null, 'bi'); } - return self::pbData('diskspace', $attributes, 1024, (int)\Froxlor\Settings::Get('system.report_webmax'), $infotext); - } + return self::pbData('diskspace', $attributes['fields'], 1024, (int)Settings::Get('system.report_webmax'), $infotext); + } - /** - * get progressbar data for traffic - * - * @param string $data - * @param array $attributes - * @return array - */ - public static function traffic(string $data, array $attributes): array + /** + * get progressbar data for traffic + * + * @param array $attributes['fields'] + * @return array + */ + public static function traffic(array $attributes): array { - return self::pbData('traffic', $attributes, 1024 * 1024, (int)\Froxlor\Settings::Get('system.report_trafficmax')); - } + return self::pbData('traffic', $attributes['fields'], 1024 * 1024, (int)Settings::Get('system.report_trafficmax')); + } /** * do needed calculations @@ -62,7 +61,7 @@ class ProgressBar $percent = 0; $style = 'bg-info'; $text = PhpHelper::sizeReadable($attributes[$field . '_used'] * $size_factor, null, 'bi') . ' / ' . UI::getLng('panel.unlimited'); - if ((int) $attributes[$field] >= 0) { + if ((int)$attributes[$field] >= 0) { if (($attributes[$field] / 100) * $report_max < $attributes[$field . '_used']) { $style = 'bg-danger'; } elseif (($attributes[$field] / 100) * ($report_max - 15) < $attributes[$field . '_used']) { @@ -76,13 +75,13 @@ class ProgressBar } return [ - 'type' => 'progressbar', - 'data' => [ - 'percent' => $percent, - 'style' => $style, - 'text' => $text, - 'infotext' => $infotext - ] - ]; + 'type' => 'progressbar', + 'data' => [ + 'percent' => $percent, + 'style' => $style, + 'text' => $text, + 'infotext' => $infotext + ] + ]; } } diff --git a/lib/Froxlor/UI/Callbacks/SSLCertificates.php b/lib/Froxlor/UI/Callbacks/SSLCertificates.php new file mode 100644 index 00000000..5f529283 --- /dev/null +++ b/lib/Froxlor/UI/Callbacks/SSLCertificates.php @@ -0,0 +1,32 @@ + (2010-) + * @author Maurice Preuß + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Froxlor\UI\Callbacks + * + */ +class SSLCertificates +{ + public static function domainWithSan(array $attributes): array + { + return [ + 'type' => 'domainWithSan', + 'data' => [ + 'domain' => $attributes['data'], + 'san' => implode(', ', $attributes['fields']['san'] ?? []), + ] + ]; + } +} diff --git a/lib/Froxlor/UI/Callbacks/Style.php b/lib/Froxlor/UI/Callbacks/Style.php new file mode 100644 index 00000000..34d3af15 --- /dev/null +++ b/lib/Froxlor/UI/Callbacks/Style.php @@ -0,0 +1,54 @@ + (2010-) + * @author Maurice Preuß + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Froxlor\UI\Callbacks + * + */ +class Style +{ + public static function deactivated(array $attributes): string + { + return $attributes['fields']['deactivated'] ? 'bg-danger' : ''; + } + + public static function diskspaceWarning(array $attributes): string + { + return self::getWarningStyle('diskspace', $attributes['fields'], (int)Settings::Get('system.report_webmax')); + } + + public static function trafficWarning(array $attributes): string + { + return self::getWarningStyle('traffic', $attributes['fields'], (int)Settings::Get('system.report_trafficmax')); + } + + private static function getWarningStyle(string $field, array $attributes, int $report_max = 90): string + { + $style = ''; + if ((int)$attributes[$field] >= 0) { + if (($attributes[$field] / 100) * $report_max < $attributes[$field . '_used']) { + $style = 'bg-danger'; + } elseif (($attributes[$field] / 100) * ($report_max - 15) < $attributes[$field . '_used']) { + $style = 'bg-warning'; + } + } + return $style; + } +} diff --git a/lib/Froxlor/UI/Callbacks/Text.php b/lib/Froxlor/UI/Callbacks/Text.php index e26c7f62..b96dc3f2 100644 --- a/lib/Froxlor/UI/Callbacks/Text.php +++ b/lib/Froxlor/UI/Callbacks/Text.php @@ -3,6 +3,9 @@ namespace Froxlor\UI\Callbacks; use Froxlor\PhpHelper; +use Froxlor\Settings; +use Froxlor\UI\Panel\UI; +use Froxlor\User; /** * This file is part of the Froxlor project. @@ -16,37 +19,26 @@ use Froxlor\PhpHelper; * @author Froxlor team (2010-) * @author Maurice Preuß * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Listing + * @package Froxlor\UI\Callbacks * */ class Text { - public static function boolean(?string $data): array + public static function boolean(array $attributes): array { return [ 'type' => 'boolean', - 'data' => (bool) $data + 'data' => (bool)$attributes['data'] ]; } - public static function domainWithSan(string $data, array $attributes): array + public static function customerfullname(array $attributes): string { - return [ - 'type' => 'domainWithSan', - 'data' => [ - 'domain' => $data, - 'san' => implode(', ', $attributes['san'] ?? []), - ] - ]; + return User::getCorrectFullUserDetails($attributes['fields']); } - public static function customerfullname(string $data, array $attributes): string + public static function size(array $attributes): string { - return \Froxlor\User::getCorrectFullUserDetails($attributes); - } - - public static function size(string $data, array $attributes): string - { - return PhpHelper::sizeReadable($data, null, 'bi'); + return PhpHelper::sizeReadable($attributes['data'], null, 'bi'); } } diff --git a/lib/Froxlor/UI/Listing.php b/lib/Froxlor/UI/Listing.php index 6b1ee8fa..792fb237 100644 --- a/lib/Froxlor/UI/Listing.php +++ b/lib/Froxlor/UI/Listing.php @@ -75,11 +75,11 @@ class Listing } $format_callback = $tabellisting['columns'][$visible_column]['format_callback'] ?? null; - $column = $tabellisting['columns'][$visible_column]['column']; + $column = $tabellisting['columns'][$visible_column]['field']; $data = self::getMultiArrayFromString($item, $column); if ($format_callback) { - $rows[$row]['td'][$col]['data'] = call_user_func($format_callback, $data, $item); + $rows[$row]['td'][$col]['data'] = call_user_func($format_callback, ['data' => $data, 'fields' => $item]); } else { $rows[$row]['td'][$col]['data'] = $data; } @@ -87,10 +87,14 @@ class Listing $rows[$row]['td'][$col]['class'] = $tabellisting['columns'][$visible_column]['class'] ?? null; } - // TODO: contextual_class ... - //if (...) { - // $rows[$key]['class'] = '...'; - //} + // Set row classes from format_callback + if (isset($tabellisting['format_callback'])) { + $class = []; + foreach ($tabellisting['format_callback'] as $format_callback) { + $class[] = call_user_func($format_callback, ['fields' => $item]); + } + $rows[$row]['class'] = implode(' ', $class); + } // Set all actions for row if (isset($tabellisting['actions'])) { diff --git a/lib/tablelisting/admin/tablelisting.admins.php b/lib/tablelisting/admin/tablelisting.admins.php index 18091a84..cafe73ff 100644 --- a/lib/tablelisting/admin/tablelisting.admins.php +++ b/lib/tablelisting/admin/tablelisting.admins.php @@ -17,6 +17,7 @@ */ use Froxlor\UI\Callbacks\ProgressBar; +use Froxlor\UI\Callbacks\Style; use Froxlor\UI\Callbacks\Text; use Froxlor\UI\Listing; @@ -27,36 +28,36 @@ return [ 'columns' => [ 'adminid' => [ 'label' => '#', - 'column' => 'adminid', + 'field' => 'adminid', 'sortable' => true, ], 'loginname' => [ 'label' => $lng['login']['username'], - 'column' => 'loginname', + 'field' => 'loginname', 'sortable' => true, ], 'name' => [ 'label' => $lng['customer']['name'], - 'column' => 'name', + 'field' => 'name', ], 'customers_used' => [ 'label' => $lng['admin']['customers'], - 'column' => 'customers_used', + 'field' => 'customers_used', 'class' => 'text-center', ], 'diskspace' => [ 'label' => $lng['customer']['diskspace'], - 'column' => 'diskspace', + 'field' => 'diskspace', 'format_callback' => [ProgressBar::class, 'diskspace'], ], 'traffic' => [ 'label' => $lng['customer']['traffic'], - 'column' => 'traffic', + 'field' => 'traffic', 'format_callback' => [ProgressBar::class, 'traffic'], ], 'deactivated' => [ 'label' => $lng['admin']['deactivated'], - 'column' => 'deactivated', + 'field' => 'deactivated', 'class' => 'text-center', 'format_callback' => [Text::class, 'boolean'], ], @@ -90,11 +91,10 @@ return [ ], ], ], - 'contextual_class' => [ - 'deactivated' => [ - 'value' => true, - 'return' => 'bg-secondary' - ] + 'format_callback' => [ + [Style::class, 'deactivated'], + [Style::class, 'diskspaceWarning'], + [Style::class, 'trafficWarning'] ] ] ]; diff --git a/lib/tablelisting/admin/tablelisting.customers.php b/lib/tablelisting/admin/tablelisting.customers.php index b431c698..6ca7ab1d 100644 --- a/lib/tablelisting/admin/tablelisting.customers.php +++ b/lib/tablelisting/admin/tablelisting.customers.php @@ -28,31 +28,31 @@ return [ 'columns' => [ 'c.name' => [ 'label' => $lng['customer']['name'], - 'column' => 'name', + 'field' => 'name', 'format_callback' => [Text::class, 'customerfullname'], ], 'c.loginname' => [ 'label' => $lng['login']['username'], - 'column' => 'loginname', + 'field' => 'loginname', 'format_callback' => [Impersonate::class, 'customer'], ], 'a.loginname' => [ 'label' => $lng['admin']['admin'], - 'column' => 'admin.loginname', + 'field' => 'admin.loginname', 'format_callback' => [Impersonate::class, 'admin'], ], 'c.email' => [ 'label' => $lng['customer']['email'], - 'column' => 'email', + 'field' => 'email', ], 'c.diskspace' => [ 'label' => $lng['customer']['diskspace'], - 'column' => 'diskspace', + 'field' => 'diskspace', 'format_callback' => [ProgressBar::class, 'diskspace'], ], 'c.traffic' => [ 'label' => $lng['customer']['traffic'], - 'column' => 'traffic', + 'field' => 'traffic', 'format_callback' => [ProgressBar::class, 'traffic'], ], ], diff --git a/lib/tablelisting/admin/tablelisting.domains.php b/lib/tablelisting/admin/tablelisting.domains.php index 42001055..55c628f1 100644 --- a/lib/tablelisting/admin/tablelisting.domains.php +++ b/lib/tablelisting/admin/tablelisting.domains.php @@ -27,21 +27,21 @@ return [ 'columns' => [ 'd.domain_ace' => [ 'label' => $lng['domains']['domainname'], - 'column' => 'domain_ace', + 'field' => 'domain_ace', ], 'c.name' => [ 'label' => $lng['customer']['name'], - 'column' => 'customer.name', + 'field' => 'customer.name', 'format_callback' => [Text::class, 'customerfullname'], ], 'c.loginname' => [ 'label' => $lng['login']['username'], - 'column' => 'customer.loginname', + 'field' => 'customer.loginname', 'format_callback' => [Impersonate::class, 'customer'], ], 'd.aliasdomain' => [ 'label' => $lng['domains']['aliasdomain'], - 'column' => 'aliasdomain', + 'field' => 'aliasdomain', ], ], 'visible_columns' => Listing::getVisibleColumnsForListing('domain_list', [ diff --git a/lib/tablelisting/admin/tablelisting.ipsandports.php b/lib/tablelisting/admin/tablelisting.ipsandports.php index 66a1b117..72528e98 100644 --- a/lib/tablelisting/admin/tablelisting.ipsandports.php +++ b/lib/tablelisting/admin/tablelisting.ipsandports.php @@ -27,49 +27,49 @@ return [ 'columns' => [ 'ip' => [ 'label' => $lng['admin']['ipsandports']['ip'], - 'column' => 'ip', + 'field' => 'ip', ], 'port' => [ 'label' => $lng['admin']['ipsandports']['port'], - 'column' => 'port', + 'field' => 'port', 'class' => 'text-center', ], 'listen' => [ 'label' => 'Listen', - 'column' => 'listen_statement', + 'field' => 'listen_statement', 'class' => 'text-center', 'format_callback' => [Text::class, 'boolean'], 'visible' => Settings::Get('system.webserver') != 'nginx' ], 'namevirtualhost' => [ 'label' => 'NameVirtualHost', - 'column' => 'namevirtualhost_statement', + 'field' => 'namevirtualhost_statement', 'class' => 'text-center', 'format_callback' => [Text::class, 'boolean'], 'visible' => Settings::Get('system.webserver') == 'apache2' && (int) Settings::Get('system.apache24') == 0 ], 'vhostcontainer' => [ 'label' => 'vHost-Container', - 'column' => 'vhostcontainer', + 'field' => 'vhostcontainer', 'class' => 'text-center', 'format_callback' => [Text::class, 'boolean'] ], 'specialsettings' => [ 'label' => 'Specialsettings', - 'column' => 'specialsettings', + 'field' => 'specialsettings', 'class' => 'text-center', 'format_callback' => [Text::class, 'boolean'] ], 'servername' => [ 'label' => 'ServerName', - 'column' => 'vhostcontainer_servername_statement', + 'field' => 'vhostcontainer_servername_statement', 'class' => 'text-center', 'format_callback' => [Text::class, 'boolean'], 'visible' => Settings::Get('system.webserver') == 'apache2' ], 'ssl' => [ 'label' => 'SSL', - 'column' => 'ssl', + 'field' => 'ssl', 'class' => 'text-center', 'format_callback' => [Text::class, 'boolean'] ], diff --git a/lib/tablelisting/admin/tablelisting.plans.php b/lib/tablelisting/admin/tablelisting.plans.php index d365bd67..147e79f5 100644 --- a/lib/tablelisting/admin/tablelisting.plans.php +++ b/lib/tablelisting/admin/tablelisting.plans.php @@ -26,19 +26,19 @@ return [ 'columns' => [ 'p.name' => [ 'label' => $lng['admin']['plans']['name'], - 'column' => 'name', + 'field' => 'name', ], 'p.description' => [ 'label' => $lng['admin']['plans']['description'], - 'column' => 'description', + 'field' => 'description', ], 'p.adminname' => [ 'label' => $lng['admin']['admin'], - 'column' => 'adminname', + 'field' => 'adminname', ], 'p.ts' => [ 'label' => $lng['admin']['plans']['last_update'], - 'column' => 'ts', + 'field' => 'ts', ], ], 'visible_columns' => Listing::getVisibleColumnsForListing('sslcertificates_list', [ diff --git a/lib/tablelisting/admin/tablelisting.sslcertificates.php b/lib/tablelisting/admin/tablelisting.sslcertificates.php index a685e64a..458947d6 100644 --- a/lib/tablelisting/admin/tablelisting.sslcertificates.php +++ b/lib/tablelisting/admin/tablelisting.sslcertificates.php @@ -17,6 +17,7 @@ */ use Froxlor\Settings; +use Froxlor\UI\Callbacks\SSLCertificates; use Froxlor\UI\Callbacks\Text; use Froxlor\UI\Listing; @@ -27,28 +28,28 @@ return [ 'columns' => [ 'd.domain' => [ 'label' => $lng['domains']['domainname'], - 'column' => 'domain', + 'field' => 'domain', ], 'c.domain' => [ 'label' => $lng['ssl_certificates']['certificate_for'], - 'column' => 'domain', - 'format_callback' => [Text::class, 'domainWithSan'], + 'field' => 'domain', + 'format_callback' => [SSLCertificates::class, 'domainWithSan'], ], 'c.issuer' => [ 'label' => $lng['ssl_certificates']['issuer'], - 'column' => 'issuer', + 'field' => 'issuer', ], 'c.validfromdate' => [ 'label' => $lng['ssl_certificates']['valid_from'], - 'column' => 'validfromdate', + 'field' => 'validfromdate', ], 'c.validtodate' => [ 'label' => $lng['ssl_certificates']['valid_until'], - 'column' => 'validtodate', + 'field' => 'validtodate', ], 'c.letsencrypt' => [ 'label' => $lng['panel']['letsencrypt'], - 'column' => 'letsencrypt', + 'field' => 'letsencrypt', 'class' => 'text-center', 'format_callback' => [Text::class, 'boolean'], 'visible' => Settings::Get('system.le_froxlor_enabled'), diff --git a/lib/tablelisting/customer/tablelisting.mysqls.php b/lib/tablelisting/customer/tablelisting.mysqls.php index 488037e5..007f1269 100644 --- a/lib/tablelisting/customer/tablelisting.mysqls.php +++ b/lib/tablelisting/customer/tablelisting.mysqls.php @@ -27,20 +27,20 @@ return [ 'columns' => [ 'databasename' => [ 'label' => $lng['mysql']['databasename'], - 'column' => 'databasename', + 'field' => 'databasename', ], 'description' => [ 'label' => $lng['mysql']['databasedescription'], - 'column' => 'description' + 'field' => 'description' ], 'size' => [ 'label' => $lng['mysql']['size'], - 'column' => 'size', + 'field' => 'size', 'format_callback' => [Text::class, 'size'] ], 'dbserver' => [ 'label' => $lng['mysql']['mysql_server'], - 'column' => 'dbserver', + 'field' => 'dbserver', 'format_callback' => [Mysql::class, 'dbserver'], 'visible' => $count_mysqlservers > 1 ]