summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/controllers/api/v1/file.php5
-rw-r--r--application/controllers/api/v2/file.php6
-rw-r--r--application/service/files.php9
3 files changed, 18 insertions, 2 deletions
diff --git a/application/controllers/api/v1/file.php b/application/controllers/api/v1/file.php
index dae053db2..784f42555 100644
--- a/application/controllers/api/v1/file.php
+++ b/application/controllers/api/v1/file.php
@@ -62,6 +62,11 @@ class file extends \controllers\api\api_controller {
foreach ($history['items'] as $key => $item) {
unset($history['items'][$key]['thumbnail']);
}
+ foreach ($history['multipaste_items'] as $key => $multipaste_item) {
+ foreach ($multipaste_item['items'] as $inner_key => $item) {
+ unset($history['multipaste_items'][$key]['items'][$inner_key]['sort_order']);
+ }
+ }
return $history;
}
diff --git a/application/controllers/api/v2/file.php b/application/controllers/api/v2/file.php
index ba80ae309..ebe717f73 100644
--- a/application/controllers/api/v2/file.php
+++ b/application/controllers/api/v2/file.php
@@ -59,10 +59,14 @@ class file extends \controllers\api\api_controller {
{
$this->muser->require_access("apikey");
$history = \service\files::history($this->muser->get_userid());
- # APIv1-cleanup: Remove this
foreach ($history['multipaste_items'] as $key => $item) {
+ # APIv1-cleanup: Remove this
unset($history['multipaste_items'][$key]['user_id']);
unset($history['multipaste_items'][$key]['multipaste_id']);
+
+ foreach ($item['items'] as $inner_key => $item) {
+ unset($history['multipaste_items'][$key]['items'][$inner_key]['sort_order']);
+ }
}
return $history;
}
diff --git a/application/service/files.php b/application/service/files.php
index 8f7595c50..d1318c4d4 100644
--- a/application/service/files.php
+++ b/application/service/files.php
@@ -70,10 +70,17 @@ class files {
->join("multipaste_file_map mfm", "m.multipaste_id = mfm.multipaste_id")
->join("files f", "f.id = mfm.file_url_id")
->where("m.user_id", $user)
+ ->order_by("mfm.sort_order")
->get()->result_array();
+ $counter = 0;
+
foreach ($multipaste_items_query as $item) {
- $multipaste_info[$item["url_id"]]["items"][$item["id"]] = array("id" => $item["id"]);
+ $multipaste_info[$item["url_id"]]["items"][$item["id"]] = array(
+ "id" => $item["id"],
+ // normalize sort_order value so we don't leak any information
+ "sort_order" => $counter++,
+ );
}
// No idea why, but this can/could happen so be more forgiving and clean up