2013-08-17 11:07:18 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
|
|
|
|
// Load the files
|
|
|
|
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
|
2014-04-03 18:57:06 +00:00
|
|
|
$sortAttribute = isset( $_GET['sort'] ) ? $_GET['sort'] : 'name';
|
|
|
|
$sortDirection = isset( $_GET['sortdirection'] ) ? ($_GET['sortdirection'] === 'desc') : false;
|
2013-08-17 11:07:18 +00:00
|
|
|
$data = array();
|
|
|
|
|
|
|
|
// make filelist
|
2014-02-25 19:46:41 +00:00
|
|
|
try {
|
2014-06-17 18:08:40 +00:00
|
|
|
$files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir, \OCP\User::getUser(), $sortAttribute, $sortDirection);
|
2014-02-25 19:46:41 +00:00
|
|
|
} catch (Exception $e) {
|
2013-08-17 11:07:18 +00:00
|
|
|
header("HTTP/1.0 404 Not Found");
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
$encodedDir = \OCP\Util::encodePath($dir);
|
2013-10-28 19:22:06 +00:00
|
|
|
|
|
|
|
$data['permissions'] = 0;
|
|
|
|
$data['directory'] = $dir;
|
|
|
|
$data['files'] = \OCA\Files_Trashbin\Helper::formatFileInfos($files);
|
2013-08-17 11:07:18 +00:00
|
|
|
|
|
|
|
OCP\JSON::success(array('data' => $data));
|
|
|
|
|