diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-02-21 00:05:30 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-02-21 00:05:30 +0100 |
commit | 6aed7abfbe4a58cec822bdd16d8c71d4bac14c28 (patch) | |
tree | 9dd60cd8ac13d2e5a0bd147a8c79a4a49d6416bf /apps/files_trashbin/ajax/delete.php | |
parent | fc1fba23040908fe5629f89b66a280aea5578520 (diff) | |
parent | eb3769e6d6e1b26d2c20c7b26c6a334a5d761f08 (diff) | |
download | nextcloud-server-6aed7abfbe4a58cec822bdd16d8c71d4bac14c28.tar.gz nextcloud-server-6aed7abfbe4a58cec822bdd16d8c71d4bac14c28.zip |
Merge branch 'master' into trashbin_encryption
Diffstat (limited to 'apps/files_trashbin/ajax/delete.php')
-rw-r--r-- | apps/files_trashbin/ajax/delete.php | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/apps/files_trashbin/ajax/delete.php b/apps/files_trashbin/ajax/delete.php index f41482bef55..34f35c39ccb 100644 --- a/apps/files_trashbin/ajax/delete.php +++ b/apps/files_trashbin/ajax/delete.php @@ -3,24 +3,43 @@ OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); -$file = $_REQUEST['file']; +$files = $_POST['files']; +$dirlisting = $_POST['dirlisting']; +$list = json_decode($files); -$path_parts = pathinfo($file); -if ($path_parts['dirname'] == '.') { - $delimiter = strrpos($file, '.d'); - $filename = substr($file, 0, $delimiter); - $timestamp = substr($file, $delimiter+2); -} else { - $filename = $file; - $timestamp = null; -} +$error = array(); +$success = array(); -OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp); +$i = 0; +foreach ($list as $file) { + if ( $dirlisting=='0') { + $delimiter = strrpos($file, '.d'); + $filename = substr($file, 0, $delimiter); + $timestamp = substr($file, $delimiter+2); + } else { + $filename = $file; + $timestamp = null; + } + + OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp); + if (!OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) { + $success[$i]['filename'] = $file; + $success[$i]['timestamp'] = $timestamp; + $i++; + } else { + $error[] = $filename; + } +} -if (!OCA\Files_Trashbin\Trashbin::file_exists($filename)) { - OCP\JSON::success(array("data" => array("filename" => $file))); -} else { +if ( $error ) { + $filelist = ''; + foreach ( $error as $e ) { + $filelist .= $e.', '; + } $l = OC_L10N::get('files_trashbin'); - OCP\JSON::error(array("data" => array("message" => $l->t("Couldn't delete %s permanently", array($file))))); + $message = $l->t("Couldn't delete %s permanently", array(rtrim($filelist, ', '))); + OCP\JSON::error(array("data" => array("message" => $message, + "success" => $success, "error" => $error))); +} else { + OCP\JSON::success(array("data" => array("success" => $success))); } - |