diff --git a/admin_admins.php b/admin_admins.php index 0f51bf02..ae9ce4ee 100644 --- a/admin_admins.php +++ b/admin_admins.php @@ -32,7 +32,7 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') { if ($action == '') { $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_admins"); - $admin_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/admin/tablelisting.admin.php'; + $admin_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.admin.php'; try { // get collection diff --git a/admin_customers.php b/admin_customers.php index ac5245f4..dddbc7be 100644 --- a/admin_customers.php +++ b/admin_customers.php @@ -31,7 +31,7 @@ $id = (int) Request::get('id'); if ($page == 'customers' && $userinfo['customers'] != '0') { if ($action == '') { $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_customers"); - $customer_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/admin/tablelisting.customer.php'; + $customer_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.customer.php'; try { // get collection @@ -39,7 +39,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') { // initialize pagination and filtering $paging = new \Froxlor\UI\Pagination($userinfo, $customer_list_data['customer_list']['columns'], $collection->count()); // get filtered collection - $collection = new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Customers::class, $userinfo, $paging->getApiCommandParams()); + $collection = new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Customers::class, $userinfo, array_merge($paging->getApiCommandParams(), ['show_usages' => true])); $collection->has('admin', \Froxlor\Api\Commands\Admins::class, 'adminid', 'adminid'); } catch (Exception $e) { \Froxlor\UI\Response::dynamic_error($e->getMessage()); diff --git a/admin_domains.php b/admin_domains.php index 525cc1d9..25dc65d7 100644 --- a/admin_domains.php +++ b/admin_domains.php @@ -36,7 +36,7 @@ if ($page == 'domains' || $page == 'overview') { if ($action == '') { $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_domains"); - $domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/admin/tablelisting.domain.php'; + $domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.domain.php'; try { // get collection diff --git a/install/updates/preconfig/0.9/preconfig_0.9.inc.php b/install/updates/preconfig/0.9/preconfig_0.9.inc.php index 848f032d..4d2e7c62 100644 --- a/install/updates/preconfig/0.9/preconfig_0.9.inc.php +++ b/install/updates/preconfig/0.9/preconfig_0.9.inc.php @@ -261,7 +261,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $c $has_preconfig = true; $description = 'Froxlor can now limit the number of autoresponder-entries for each user. Here you can set the value which will be available for each customer (Of course you can change the value for each customer separately after the update).'; $question = 'How many autoresponders should your customers be able to add?: '; - $question .= ' ' . \Froxlor\UI\HTML::makecheckbox('update_autoresponder_default', $lng['customer']['unlimited'], '-1', false, 0, true, true) . '
'; + $question .= ' ' . \Froxlor\UI\HTML::makecheckbox('update_autoresponder_default', $lng['panel']['unlimited'], '-1', false, 0, true, true) . '
'; eval("\$return.=\"" . \Froxlor\UI\Template::getTemplate("update/preconfigitem") . "\";"); } } diff --git a/lib/Froxlor/UI/Callbacks/Number.php b/lib/Froxlor/UI/Callbacks/Number.php deleted file mode 100644 index 0eafdf7b..00000000 --- a/lib/Froxlor/UI/Callbacks/Number.php +++ /dev/null @@ -1,45 +0,0 @@ - (2010-) - * @author Maurice Preuß - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Listing - * - */ -class Number -{ - /** - * Formats the diskspace to human-readable number - * - * @param string $data - * @return string - */ - public static function diskspace(string $data): string - { - return $data >= 0 ? PhpHelper::sizeReadable($data * 1024, null, 'bi') : UI::getLng('panel.unlimited'); - } - - /** - * Formats the traffic to human-readable number - * - * @param string $data - * @return string - */ - public static function traffic(string $data): string - { - return $data >= 0 ? PhpHelper::sizeReadable($data * (1024 * 1024), null, 'bi') : UI::getLng('panel.unlimited'); - } -} diff --git a/lib/Froxlor/UI/Callbacks/ProgressBar.php b/lib/Froxlor/UI/Callbacks/ProgressBar.php index 98e0f429..521d8cf1 100644 --- a/lib/Froxlor/UI/Callbacks/ProgressBar.php +++ b/lib/Froxlor/UI/Callbacks/ProgressBar.php @@ -31,30 +31,12 @@ class ProgressBar */ public static function diskspace(string $data, array $attributes): array { - $infotext = ''; - if (isset($attributes['customerid'])) { - // get disk-space usages for web, mysql and mail - $usages_stmt = \Froxlor\Database\Database::prepare(" - SELECT * FROM `" . TABLE_PANEL_DISKSPACE . "` - WHERE `customerid` = :cid - ORDER BY `stamp` DESC LIMIT 1 - "); - $usages = \Froxlor\Database\Database::pexecute_first($usages_stmt, array( - 'cid' => $attributes['customerid'] - )); - - if ($usages != true) { - $usages = [ - 'webspace' => 0, - 'mailspace' => 0, - 'dbspace' => 0 - ]; - } - + $infotext = null; + if (isset($attributes['webspace_used']) && isset($attributes['mailspace_used']) && isset($attributes['dbspace_used'])) { $infotext = UI::getLng('panel.used') . ':
'; - $infotext .= 'web: ' . PhpHelper::sizeReadable($usages['webspace'] * 1024, null, 'bi') . '
'; - $infotext .= 'mail: ' . PhpHelper::sizeReadable($usages['mailspace'] * 1024, null, 'bi') . '
'; - $infotext .= 'mysql: ' . PhpHelper::sizeReadable($usages['dbspace'] * 1024, null, 'bi'); + $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'); } return self::pbData('diskspace', $attributes, 1024, (int)\Froxlor\Settings::Get('system.report_webmax'), $infotext); @@ -79,7 +61,7 @@ class ProgressBar { $percent = 0; $style = 'bg-info'; - $text = PhpHelper::sizeReadable($attributes[$field . '_used'] * $size_factor, null, 'bi') . ' / ' . UI::getLng('customer.unlimited'); + $text = PhpHelper::sizeReadable($attributes[$field . '_used'] * $size_factor, null, 'bi') . ' / ' . UI::getLng('panel.unlimited'); if ((int) $attributes[$field] >= 0) { if (($attributes[$field] / 100) * $report_max < $attributes[$field . '_used']) { $style = 'bg-danger'; diff --git a/lib/Froxlor/UI/Listing.php b/lib/Froxlor/UI/Listing.php index 8467fb84..45711656 100644 --- a/lib/Froxlor/UI/Listing.php +++ b/lib/Froxlor/UI/Listing.php @@ -23,12 +23,20 @@ class Listing $items = $collection->getData()['list']; $table = []; - foreach ($tabellisting['visible_columns'] as $visible_column) { + foreach ($tabellisting['visible_columns'] as $key => $visible_column) { + if (isset($tabellisting['columns'][$visible_column]['visible']) && !$tabellisting['columns'][$visible_column]['visible']) { + continue; + } + $table['th'][] = $tabellisting['columns'][$visible_column]['label']; } foreach ($items as $key => $item) { foreach ($tabellisting['visible_columns'] as $visible_column) { + if (isset($tabellisting['columns'][$visible_column]['visible']) && !$tabellisting['columns'][$visible_column]['visible']) { + continue; + } + $format_callback = $tabellisting['columns'][$visible_column]['format_callback'] ?? null; $column = $tabellisting['columns'][$visible_column]['column']; $data = self::getMultiArrayFromString($item, $column); diff --git a/lib/tablelisting/admin/admin/tablelisting.admin.php b/lib/tablelisting/admin/tablelisting.admin.php similarity index 100% rename from lib/tablelisting/admin/admin/tablelisting.admin.php rename to lib/tablelisting/admin/tablelisting.admin.php diff --git a/lib/tablelisting/admin/admin/tablelisting.customer.php b/lib/tablelisting/admin/tablelisting.customer.php similarity index 100% rename from lib/tablelisting/admin/admin/tablelisting.customer.php rename to lib/tablelisting/admin/tablelisting.customer.php diff --git a/lib/tablelisting/admin/admin/tablelisting.domain.php b/lib/tablelisting/admin/tablelisting.domain.php similarity index 100% rename from lib/tablelisting/admin/admin/tablelisting.domain.php rename to lib/tablelisting/admin/tablelisting.domain.php diff --git a/lng/czech.lng.php b/lng/czech.lng.php index 729fb022..ff53aa57 100644 --- a/lng/czech.lng.php +++ b/lng/czech.lng.php @@ -69,8 +69,6 @@ $lng['customer']['forwarders'] = 'Email-forwarders'; $lng['customer']['ftps'] = 'FTP-účty'; $lng['customer']['subdomains'] = 'Subdomény'; $lng['customer']['domains'] = 'Domény'; -$lng['customer']['unlimited'] = '∞'; -$lng['customer']['mib'] = 'MiB'; /** * Customermenue diff --git a/lng/english.lng.php b/lng/english.lng.php index 0bed80e1..09d44e87 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -70,7 +70,7 @@ $lng['customer']['forwarders'] = 'Email-forwarders'; $lng['customer']['ftps'] = 'FTP-accounts'; $lng['customer']['subdomains'] = 'Subdomains'; $lng['customer']['domains'] = 'Domains'; -$lng['customer']['unlimited'] = '∞'; +$lng['panel']['unlimited'] = '∞'; $lng['customer']['mib'] = 'MiB'; $lng['customer']['gib'] = 'GiB'; diff --git a/lng/lng_references.php b/lng/lng_references.php index 0683d3aa..2fdbe385 100644 --- a/lng/lng_references.php +++ b/lng/lng_references.php @@ -40,4 +40,3 @@ $lng['menue']['logger']['logger'] = $lng['admin']['loggersystem']; $lng['serversettings']['default_sslvhostconf']['description'] = $lng['serversettings']['default_vhostconf']['description']; $lng['admin']['include_ownvhostsettings'] = $lng['serversettings']['includedefault_sslvhostconf']; -$lng['panel']['unlimited'] = $lng['customer']['unlimited'];