2013-02-06 15:23:22 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::callCheck();
|
|
|
|
|
|
|
|
$file = $_REQUEST['file'];
|
|
|
|
|
|
|
|
$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;
|
|
|
|
}
|
2013-02-06 15:25:10 +00:00
|
|
|
|
2013-02-07 12:14:45 +00:00
|
|
|
if (OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp)) {
|
2013-02-06 15:23:22 +00:00
|
|
|
OCP\JSON::success(array("data" => array("filename" => $file)));
|
|
|
|
} else {
|
2013-02-07 15:31:04 +00:00
|
|
|
$l = OC_L10N::get('files_trashbin');
|
|
|
|
OCP\JSON::error(array("data" => array("message" => $l->t("Couldn't delete %s permanently", array($file)))));
|
2013-02-06 15:23:22 +00:00
|
|
|
}
|
|
|
|
|