summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2012-10-05 16:12:04 +0200
committerBjörn Schießle <schiessle@owncloud.com>2012-10-05 16:12:04 +0200
commit5e2bce24b4d7576f2503edb762afd6cbe3caccea (patch)
tree69c2dde5c99fcaaabd510b048077da7585d44d56
parentc99f62891a53097115c07f6e860b4dfdf4d70600 (diff)
downloadnextcloud-server-5e2bce24b4d7576f2503edb762afd6cbe3caccea.tar.gz
nextcloud-server-5e2bce24b4d7576f2503edb762afd6cbe3caccea.zip
enable user to download selected files from publically shared directory
-rw-r--r--apps/files/js/files.js7
-rw-r--r--apps/files_sharing/public.php4
2 files changed, 9 insertions, 2 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 414dfb03cdc..e4037454520 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -178,7 +178,12 @@ $(document).ready(function() {
var dir=$('#dir').val()||'/';
$('#notification').text(t('files','generating ZIP-file, it may take some time.'));
$('#notification').fadeIn();
- window.location=OC.filePath('files', 'ajax', 'download.php') + '?'+ $.param({ dir: dir, files: files });
+ // use special download URL if provided, e.g. for public shared files
+ if ( (downloadURL = document.getElementById("downloadURL")) ) {
+ window.location=downloadURL.value+"&download&files="+files;
+ } else {
+ window.location=OC.filePath('files', 'ajax', 'download.php') + '?'+ $.param({ dir: dir, files: files });
+ }
return false;
});
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 67b2dca8c9e..34340102a9e 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -83,7 +83,9 @@ if (isset($_GET['file']) || isset($_GET['dir'])) {
// Download the file
if (isset($_GET['download'])) {
if (isset($_GET['dir'])) {
- if (isset($_GET['path']) && $_GET['path'] != '' ) { // download a file from a shared directory
+ if ( isset($_GET['files']) ) { // download selected files
+ OC_Files::get($path, $_GET['files'], $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
+ } else if (isset($_GET['path']) && $_GET['path'] != '' ) { // download a file from a shared directory
OC_Files::get('', $path, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
} else { // download the whole shared directory
OC_Files::get($path, '', $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);