summaryrefslogtreecommitdiffstats
path: root/files/ajax/delete.php
blob: d8a01d7acf1c3731b30f88a559bb31745d52aa56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

// Init owncloud


OC_JSON::checkLoggedIn();

// Get data
$dir = stripslashes($_GET["dir"]);
$files = isset($_GET["file"]) ? stripslashes($_GET["file"]) : stripslashes($_GET["files"]);

$files = explode(';', $files);
$filesWithError = '';
$success = true;
//Now delete
foreach($files as $file) {
    if( !OC_Files::delete( $dir, $file )){
		$filesWithError .= $file . "\n";
		$success = false;
	}
}

if($success) {
	OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $files )));
} else {
	OC_JSON::error(array("data" => array( "message" => "Could not delete:\n" . $filesWithError )));
}

?>