enable user to download selected files from publically shared directory

This commit is contained in:
Björn Schießle 2012-10-05 16:12:04 +02:00
parent c99f62891a
commit 5e2bce24b4
2 changed files with 9 additions and 2 deletions

View File

@ -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;
});

View File

@ -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);