summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/ajax
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-12-02 11:39:53 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2013-12-02 11:50:55 +0100
commit8ce3ea3e2c0fba2073cc9f279ab14f9d2bdbfdc4 (patch)
tree355788276794ca5ff7555f1c323fe26dc82449aa /apps/files_trashbin/ajax
parent71589e65d24657a6d61fc22b3c67d5a1f5b1404a (diff)
downloadnextcloud-server-8ce3ea3e2c0fba2073cc9f279ab14f9d2bdbfdc4.tar.gz
nextcloud-server-8ce3ea3e2c0fba2073cc9f279ab14f9d2bdbfdc4.zip
fix delete files from trash bin
Diffstat (limited to 'apps/files_trashbin/ajax')
-rw-r--r--apps/files_trashbin/ajax/delete.php30
1 files changed, 16 insertions, 14 deletions
diff --git a/apps/files_trashbin/ajax/delete.php b/apps/files_trashbin/ajax/delete.php
index 5498250dbf5..7b1949e3154 100644
--- a/apps/files_trashbin/ajax/delete.php
+++ b/apps/files_trashbin/ajax/delete.php
@@ -6,10 +6,18 @@ OCP\JSON::callCheck();
// "empty trash" command
$deleteAll = false;
if (isset($_POST['allfiles']) and $_POST['allfiles'] === 'true'){
- $user = \OCP\User::getUser();
- $list = OCA\Files_Trashbin\Helper::getTrashFiles('/');
- $deleteAll = true;
- $dirlisting = '0';
+ $folder = isset($_POST['dir']) ? $_POST['dir'] : '/';
+ if ($folder === '/') {
+ OCA\Files_Trashbin\Trashbin::deleteAll();
+ $list = array();
+ } else {
+ if ( strlen(dirname($folder)) > 1 ) {
+ $dirlisting = '1';
+ } else {
+ $dirlisting = '0';
+ }
+ $list[] = $folder;
+ }
}
else {
$files = $_POST['files'];
@@ -19,19 +27,13 @@ else {
$error = array();
$success = array();
-
$i = 0;
foreach ($list as $file) {
if ( $dirlisting === '0') {
- if ($deleteAll) {
- $filename = $file['name'];
- $timestamp = $file['timestamp'];
- }
- else {
- $delimiter = strrpos($file, '.d');
- $filename = substr($file, 0, $delimiter);
- $timestamp = substr($file, $delimiter+2);
- }
+ $file = ltrim($file, '/');
+ $delimiter = strrpos($file, '.d');
+ $filename = substr($file, 0, $delimiter);
+ $timestamp = substr($file, $delimiter+2);
} else {
$filename = $file;
$timestamp = null;