delete.php 616 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. // Init owncloud
  3. OCP\JSON::checkLoggedIn();
  4. // Get data
  5. $dir = stripslashes($_GET["dir"]);
  6. $files = isset($_GET["file"]) ? stripslashes($_GET["file"]) : stripslashes($_GET["files"]);
  7. $files = explode(';', $files);
  8. $filesWithError = '';
  9. $success = true;
  10. //Now delete
  11. foreach($files as $file) {
  12. if( !OC_Files::delete( $dir, $file )){
  13. $filesWithError .= $file . "\n";
  14. $success = false;
  15. }
  16. }
  17. if($success) {
  18. OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $files )));
  19. } else {
  20. OCP\JSON::error(array("data" => array( "message" => "Could not delete:\n" . $filesWithError )));
  21. }
  22. ?>