From 7c1479708fc238686d036e48f80c80d767e51bd4 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 31 Oct 2023 18:49:54 +0100 Subject: [PATCH] do not list more than 20 folders/files --- views/bootstrap/class.DropFolderChooser.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.DropFolderChooser.php b/views/bootstrap/class.DropFolderChooser.php index e479368c3..554abb5bf 100644 --- a/views/bootstrap/class.DropFolderChooser.php +++ b/views/bootstrap/class.DropFolderChooser.php @@ -54,9 +54,12 @@ $('.folderselect').click(function(ev) { $rii = new DirectoryIterator($path); $files = array(); - foreach ($rii as $file) + foreach ($rii as $file) { if (!$file->isDir()) $files[] = [substr($file->getPath(), strlen($path)+1), $file->getFilename()]; + if(count($files) > 20) + return $files; + } return $files; } @@ -68,11 +71,14 @@ $('.folderselect').click(function(ev) { $rii = new DirectoryIterator($path); $files = array(); - foreach ($rii as $file) + foreach ($rii as $file) { if ($file->isDir()) { if(($t = substr($file->getPath(), strlen($path)+1)) && ($file->getFilename() == '.')) $files[] = $t; } + if(count($files) > 20) + return $files; + } return $files; }