2013-08-17 11:07:18 +00:00
|
|
|
<?php
|
2015-03-26 10:44:34 +00:00
|
|
|
/**
|
2016-07-21 14:49:16 +00:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2016-05-26 17:56:05 +00:00
|
|
|
* @author Björn Schießle <bjoern@schiessle.org>
|
|
|
|
* @author Lukas Reschke <lukas@statuscode.ch>
|
2015-03-26 10:44:34 +00:00
|
|
|
* @author Vincent Petry <pvince81@owncloud.com>
|
|
|
|
*
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
|
|
|
*/
|
2018-03-22 12:19:29 +00:00
|
|
|
\OC_JSON::checkLoggedIn();
|
2014-10-29 21:53:59 +00:00
|
|
|
\OC::$server->getSession()->close();
|
2013-08-17 11:07:18 +00:00
|
|
|
|
|
|
|
// Load the files
|
2015-02-13 12:33:20 +00:00
|
|
|
$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : '';
|
|
|
|
$sortAttribute = isset($_GET['sort']) ? (string)$_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) {
|
2018-06-26 08:32:50 +00:00
|
|
|
http_response_code(404);
|
2013-08-17 11:07:18 +00:00
|
|
|
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
|
|
|
|
2018-03-22 12:19:29 +00:00
|
|
|
\OC_JSON::success(array('data' => $data));
|
2013-08-17 11:07:18 +00:00
|
|
|
|