summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/ajax
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-01-22 12:00:04 +0100
committerBjörn Schießle <schiessle@owncloud.com>2013-01-22 15:33:54 +0100
commit81ab0affef47c99239e7bff77e5964788a61aa2a (patch)
treed126b7213459a3c837ad45db43c5c76e36c90ccf /apps/files_trashbin/ajax
parent1817c7895b3db5643d255ba54cf062c3f90885ed (diff)
downloadnextcloud-server-81ab0affef47c99239e7bff77e5964788a61aa2a.tar.gz
nextcloud-server-81ab0affef47c99239e7bff77e5964788a61aa2a.zip
allow to restore single files/folder from a deleted folder
Diffstat (limited to 'apps/files_trashbin/ajax')
-rw-r--r--apps/files_trashbin/ajax/undelete.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/files_trashbin/ajax/undelete.php b/apps/files_trashbin/ajax/undelete.php
index 05b5e7a5ee4..5aa6436ae53 100644
--- a/apps/files_trashbin/ajax/undelete.php
+++ b/apps/files_trashbin/ajax/undelete.php
@@ -5,17 +5,24 @@ if(!OC_User::isLoggedIn()) {
}
$files = $_REQUEST['files'];
+$dirlisting = $_REQUEST['dirlisting'];
$list = explode(';', $files);
$error = array();
$i = 0;
foreach ($list as $file) {
- $delimiter = strrpos($file, '.d');
- $filename = substr($file, 0, $delimiter);
- $timestamp = substr($file, $delimiter+2);
+ if ( $dirlisting=='0') {
+ $delimiter = strrpos($file, '.d');
+ $filename = substr($file, 0, $delimiter);
+ $timestamp = substr($file, $delimiter+2);
+ } else {
+ $path_parts = pathinfo($file);
+ $filename = $path_parts['basename'];
+ $timestamp = null;
+ }
- if ( !OCA_Trash\Trashbin::restore($filename, $timestamp) ) {
+ if ( !OCA_Trash\Trashbin::restore($file, $filename, $timestamp) ) {
$error[] = $filename;
} else {
$success[$i]['filename'] = $filename;