summaryrefslogtreecommitdiffstats
path: root/application/controllers/file.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/file.php')
-rw-r--r--application/controllers/file.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index 1f07ae4ec..1888b7c06 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -738,8 +738,27 @@ class File extends MY_Controller {
foreach ($history["multipaste_items"] as $key => $item) {
$size = 0;
+ $filenames = array();
+ $files = array();
+ $max_filenames = 10;
+
foreach ($item["items"] as $i) {
$size += $history["items"][$i["id"]]["filesize"];
+ $files[] = array(
+ "filename" => $history["items"][$i["id"]]['filename'],
+ "sort_order" => $i["sort_order"],
+ );
+ }
+
+ uasort($files, function ($a, $b) {
+ return $a['sort_order'] - $b['sort_order'];
+ });
+
+ $filenames = array_map(function ($a) {return $a['filename'];}, $files);
+
+ if (count($filenames) > $max_filenames) {
+ $filenames = array_slice($filenames, 0, $max_filenames);
+ $filenames[] = "...";
}
$history["items"][] = array(
@@ -749,6 +768,7 @@ class File extends MY_Controller {
"date" => $item["date"],
"hash" => "",
"filesize" => $size,
+ "preview_text" => implode("\n", $filenames),
);
}