diff options
author | Florian Pritz <bluewind@xinu.at> | 2015-02-19 22:36:29 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-02-19 22:36:29 +0100 |
commit | 0443d0829ab7e2d30825fded2f172b74d26b5b3c (patch) | |
tree | 0d6823082f2803ac732d448e9f1c0ca29dcab44f /application/controllers/file.php | |
parent | 00c600799d074ee9f52cf8e788cf6ff588b89e39 (diff) |
Add claiming of multipastes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers/file.php')
-rw-r--r-- | application/controllers/file.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php index fd7eb9962..6a14fceee 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -813,6 +813,7 @@ class File extends MY_Controller { } if ($multipaste !== false) { + $userid = $this->muser->get_userid(); $ids[] = \service\files::create_multipaste($ids, $userid, $limits)["url_id"]; } @@ -835,17 +836,17 @@ class File extends MY_Controller { assert(is_array($ids)); foreach ($ids as $key => $id) { - $filedata = $this->mfile->get_filedata($id); + $affected = 0; + $affected += $this->mfile->adopt($id); + $affected += $this->mmultipaste->adopt($id); - if ($filedata["user"] != 0) { + if ($affected == 0) { $errors[] = $id; } - - $this->mfile->adopt($id); } if (!empty($errors)) { - throw new \exceptions\PublicApiException("file/claim_id/already-owned", "Someone already owns '".implode(", ", $errors)."', can't reassign."); + throw new \exceptions\PublicApiException("file/claim_id/failed", "Failed to claim ".implode(", ", $errors).""); } $this->session->unset_userdata("last_upload"); |