json encode list of files
This commit is contained in:
parent
97222b1de5
commit
4a4f705adc
3 changed files with 14 additions and 5 deletions
|
@ -33,4 +33,11 @@ OCP\User::checkLoggedIn();
|
|||
$files = $_GET["files"];
|
||||
$dir = $_GET["dir"];
|
||||
|
||||
OC_Files::get($dir, $files, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
|
||||
$files_list = json_decode($files);
|
||||
if ($files_list === NULL ) {
|
||||
$files_list = array($files);
|
||||
}
|
||||
|
||||
foreach ($files_list as $f) error_log("file: $f");
|
||||
|
||||
OC_Files::get($dir, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
|
||||
|
|
|
@ -220,14 +220,15 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
$('.download').click('click',function(event) {
|
||||
var files=getSelectedFiles('name').join(';');
|
||||
var files=getSelectedFiles('name');
|
||||
var fileslist = JSON.stringify(files);
|
||||
var dir=$('#dir').val()||'/';
|
||||
OC.Notification.show(t('files','Your download is being prepared. This might take some time if the files are big.'));
|
||||
// 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 });
|
||||
window.location=OC.filePath('files', 'ajax', 'download.php') + '?'+ $.param({ dir: dir, files: fileslist });
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
|
|
@ -49,8 +49,9 @@ class OC_Files {
|
|||
isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])) {
|
||||
$xsendfile = true;
|
||||
}
|
||||
if(strpos($files, ';')) {
|
||||
$files=explode(';', $files);
|
||||
|
||||
if (count($files) == 1) {
|
||||
$files = $files[0];
|
||||
}
|
||||
|
||||
if (is_array($files)) {
|
||||
|
|
Loading…
Reference in a new issue