summaryrefslogtreecommitdiffstats
path: root/application/controllers/api
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-08-21 15:15:47 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-08-21 15:40:56 +0200
commitce54c1b9c23f4bdb7b2525b8aab66a6ba11bda0d (patch)
tree28216b78b6fa231f442db42b8a390c77fcbb233a /application/controllers/api
parent342e2b1cd341599b734ec581a6c47019b09ac97b (diff)
mfile->add_file: Take userid via argument
This allows for easier testing. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers/api')
-rw-r--r--application/controllers/api/v1/file.php3
-rw-r--r--application/controllers/api/v2/file.php3
2 files changed, 4 insertions, 2 deletions
diff --git a/application/controllers/api/v1/file.php b/application/controllers/api/v1/file.php
index 784f42555..6536335cb 100644
--- a/application/controllers/api/v1/file.php
+++ b/application/controllers/api/v1/file.php
@@ -30,11 +30,12 @@ class file extends \controllers\api\api_controller {
\service\files::verify_uploaded_files($files);
$limits = $this->muser->get_upload_id_limits();
+ $userid = $this->muser->get_userid();
$urls = array();
foreach ($files as $file) {
$id = $this->mfile->new_id($limits[0], $limits[1]);
- \service\files::add_uploaded_file($id, $file["tmp_name"], $file["name"]);
+ \service\files::add_uploaded_file($userid, $id, $file["tmp_name"], $file["name"]);
$ids[] = $id;
$urls[] = site_url($id).'/';
}
diff --git a/application/controllers/api/v2/file.php b/application/controllers/api/v2/file.php
index ebe717f73..79da1c4b8 100644
--- a/application/controllers/api/v2/file.php
+++ b/application/controllers/api/v2/file.php
@@ -30,11 +30,12 @@ class file extends \controllers\api\api_controller {
\service\files::verify_uploaded_files($files);
$limits = $this->muser->get_upload_id_limits();
+ $userid = $this->muser->get_userid();
$urls = array();
foreach ($files as $file) {
$id = $this->mfile->new_id($limits[0], $limits[1]);
- \service\files::add_uploaded_file($id, $file["tmp_name"], $file["name"]);
+ \service\files::add_uploaded_file($userid, $id, $file["tmp_name"], $file["name"]);
$ids[] = $id;
$urls[] = site_url($id).'/';
}