diff --git a/lib/Froxlor/Ajax/Ajax.php b/lib/Froxlor/Ajax/Ajax.php index 6e54a9e16..a5483c197 100644 --- a/lib/Froxlor/Ajax/Ajax.php +++ b/lib/Froxlor/Ajax/Ajax.php @@ -237,11 +237,11 @@ private function searchGlobal() private function updateTablelisting() { $columns = []; - foreach ((Request::any('columns') ?? []) as $value) { + foreach ((Request::post('columns') ?? []) as $value) { $columns[] = $value; } if (!empty($columns)) { - Listing::storeColumnListingForUser([Request::any('listing') => $columns]); + $columns = Listing::storeColumnListingForUser([Request::post('listing') => $columns]); return $this->jsonResponse($columns); } return $this->errorResponse('At least one column must be selected', 406); @@ -249,7 +249,7 @@ private function updateTablelisting() private function resetTablelisting() { - Listing::deleteColumnListingForUser([Request::any('listing') => []]); + Listing::deleteColumnListingForUser([Request::post('listing') => []]); return $this->jsonResponse([]); } diff --git a/lib/Froxlor/UI/Listing.php b/lib/Froxlor/UI/Listing.php index 0d95ab693..3d3be00ab 100644 --- a/lib/Froxlor/UI/Listing.php +++ b/lib/Froxlor/UI/Listing.php @@ -27,6 +27,7 @@ use Froxlor\CurrentUser; use Froxlor\Database\Database; +use Froxlor\Froxlor; use Froxlor\UI\Panel\UI; use InvalidArgumentException; @@ -247,9 +248,9 @@ private static function getAvailableColumnsForListing(array $tabellisting): arra * ] * * @param array $tabellisting - * @return bool + * @return array */ - public static function storeColumnListingForUser(array $tabellisting): bool + public static function storeColumnListingForUser(array $tabellisting): array { $section = array_key_first($tabellisting); if (empty($section) || !is_array($tabellisting[$section]) || empty($tabellisting[$section])) { @@ -259,6 +260,22 @@ public static function storeColumnListingForUser(array $tabellisting): bool if (CurrentUser::isAdmin()) { $userid = 'adminid'; } + // include all possible tablelisting-definitions to check for the right section + foreach(glob(Froxlor::getInstallDir().'lib/tablelisting/{,*/}*.php', GLOB_BRACE) as $tbl_file) { + $table_listings = include $tbl_file; + if (!isset($table_listings[$section])) { + continue; + } else { + break; + } + } + $columns_available = array_keys($table_listings[$section]['columns']); + // filter out unknown columns + foreach ($tabellisting[$section] as $index => $column_changed) { + if (!in_array($column_changed, $columns_available)) { + unset($tabellisting[$section][$index]); + } + } // delete possible existing entry self::deleteColumnListingForUser($tabellisting); // add new entry @@ -273,7 +290,7 @@ public static function storeColumnListingForUser(array $tabellisting): bool 'section' => $section, 'cols' => json_encode($tabellisting[$section]) ]); - return true; + return $tabellisting[$section]; } /** diff --git a/lib/tablelisting/admin/tablelisting.domains.php b/lib/tablelisting/admin/tablelisting.domains.php index d0fe24865..11f8ec5ed 100644 --- a/lib/tablelisting/admin/tablelisting.domains.php +++ b/lib/tablelisting/admin/tablelisting.domains.php @@ -29,11 +29,14 @@ use Froxlor\UI\Callbacks\Text; use Froxlor\UI\Listing; +// used outside scope variables +$customerCollectionCount = !is_null($customerCollection ?? null) ? $customerCollection->count() : 0; + return [ 'domain_list' => [ 'title' => lng('admin.domains'), 'icon' => 'fa-solid fa-globe', - 'empty_msg' => $customerCollection->count() == 0 ? lng('admin.domain_nocustomeraddingavailable') : '', + 'empty_msg' => $customerCollectionCount == 0 ? lng('admin.domain_nocustomeraddingavailable') : '', 'self_overview' => ['section' => 'domains', 'page' => 'domains'], 'default_sorting' => ['d.domain_ace' => 'asc'], 'columns' => [ diff --git a/lib/tablelisting/customer/tablelisting.htaccess.php b/lib/tablelisting/customer/tablelisting.htaccess.php index c29adf42a..f2505d284 100644 --- a/lib/tablelisting/customer/tablelisting.htaccess.php +++ b/lib/tablelisting/customer/tablelisting.htaccess.php @@ -27,6 +27,9 @@ use Froxlor\UI\Callbacks\Text; use Froxlor\UI\Listing; +// used outside scope variables +$cperlenabled = $cperlenabled ?? false; + return [ 'htaccess_list' => [ 'title' => lng('menue.extras.pathoptions'), diff --git a/lib/tablelisting/customer/tablelisting.mysqls.php b/lib/tablelisting/customer/tablelisting.mysqls.php index dc599f3bb..cc63d9f36 100644 --- a/lib/tablelisting/customer/tablelisting.mysqls.php +++ b/lib/tablelisting/customer/tablelisting.mysqls.php @@ -27,6 +27,9 @@ use Froxlor\UI\Callbacks\Text; use Froxlor\UI\Listing; +// used outside scope variables +$multiple_mysqlservers = $multiple_mysqlservers ?? false; + return [ 'mysql_list' => [ 'title' => lng('menue.mysql.databases'), diff --git a/lib/tablelisting/tablelisting.dns.php b/lib/tablelisting/tablelisting.dns.php index 1f2ea9376..293e08f42 100644 --- a/lib/tablelisting/tablelisting.dns.php +++ b/lib/tablelisting/tablelisting.dns.php @@ -27,6 +27,10 @@ use Froxlor\UI\Callbacks\Text; use Froxlor\UI\Listing; +// used outside scope variables +$domain = $domain ?? ''; +$domain_id = $domain_id ?? ''; + return [ 'dns_list' => [ 'title' => 'DNS Entries',