From 81ab0affef47c99239e7bff77e5964788a61aa2a Mon Sep 17 00:00:00 2001 From: Björn Schießle Date: Tue, 22 Jan 2013 12:00:04 +0100 Subject: allow to restore single files/folder from a deleted folder --- apps/files_trashbin/ajax/undelete.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'apps/files_trashbin/ajax') 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; -- cgit v1.2.3