aboutsummaryrefslogtreecommitdiffstats
path: root/storage-backend/index.php
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2017-05-04 16:23:36 +0200
committersteckbrief <steckbrief@chefmail.de>2017-05-04 16:26:11 +0200
commita564fd0a7a60990fc8bd31ffabb9a33cf9a42f32 (patch)
tree80a3b1a2e5a0c8377eb1d58374a3d68e337415e9 /storage-backend/index.php
parentfd7ea5c319a3f7536bc67f81831c89edc82572f4 (diff)
storage-backend: Added json interface to list transferred files
Diffstat (limited to '')
-rw-r--r--storage-backend/index.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/storage-backend/index.php b/storage-backend/index.php
index d153e63..3707963 100644
--- a/storage-backend/index.php
+++ b/storage-backend/index.php
@@ -11,7 +11,7 @@
* size
* content_type
* user_jid
- * receipient_jid
+ * recipient_jid
* 403: In case the XMPP Server Key is not valid
* 406:
* File is empty (error code: 1)
@@ -50,6 +50,7 @@
include_once(__DIR__.'/lib/functions.common.inc.php');
include_once(__DIR__.'/lib/functions.http.inc.php');
include_once(__DIR__.'/lib/functions.filetransfer.inc.php');
+include_once(__DIR__.'/lib/xmpp.util.inc.php');
$method = $_SERVER['REQUEST_METHOD'];
// Load configuration
@@ -74,6 +75,10 @@ switch ($method) {
}
switch ($slotType) {
+ case 'list':
+ $slots = readSlots($userJid);
+ $result = ['list' => $slots];
+ break;
case 'delete':
// Check if all parameters needed for an delete are present - return 400 (bad request) if a parameter is missing / empty
$fileURL = getMandatoryPostParameter('file_url');
@@ -104,7 +109,7 @@ switch ($method) {
$filename = rawurlencode(getMandatoryPostParameter('filename'));
$filesize = getMandatoryPostParameter('size');
$mimeType = getOptionalPostParameter('content_type');
- $receipientJid = getMandatoryPostParameter('receipient_jid');
+ $recipientJid = getMandatoryPostParameter('recipient_jid');
// check file name - return 406 (not acceptable) if file contains invalid characters
foreach ($config['invalid_characters_in_filename'] as $invalidCharacter) {
@@ -122,7 +127,7 @@ switch ($method) {
}
// generate slot uuid, register slot uuid and expected file size and expected mime type
$slotUUID = generate_uuid();
- registerSlot($slotUUID, $filename, $filesize, $mimeType, $userJid, $receipientJid, $config);
+ registerSlot($slotUUID, $filename, $filesize, $mimeType, $userJid, $recipientJid, $config);
if (!mkdir(getUploadFilePath($slotUUID, $config))) {
sendHttpReturnCodeAndJson(500, "Could not create directory for upload.");
}