2011-03-04 01:08:54 +03:00
|
|
|
<?php
|
|
|
|
|
2012-05-03 14:23:29 +04:00
|
|
|
OCP\JSON::checkLoggedIn();
|
2014-03-10 17:39:27 +04:00
|
|
|
\OC::$session->close();
|
2011-03-04 01:08:54 +03:00
|
|
|
|
|
|
|
// Load the files
|
|
|
|
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
|
2013-11-14 16:22:53 +04:00
|
|
|
$dir = \OC\Files\Filesystem::normalizePath($dir);
|
2014-02-18 18:39:35 +04:00
|
|
|
$dirInfo = \OC\Files\Filesystem::getFileInfo($dir);
|
2014-04-03 19:04:13 +04:00
|
|
|
if (!$dirInfo || !$dirInfo->getType() === 'dir') {
|
2013-08-17 15:07:18 +04:00
|
|
|
header("HTTP/1.0 404 Not Found");
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2011-04-17 17:59:06 +04:00
|
|
|
$data = array();
|
2013-08-17 15:07:18 +04:00
|
|
|
$baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir=';
|
2011-03-04 01:08:54 +03:00
|
|
|
|
2014-02-18 18:39:35 +04:00
|
|
|
$permissions = $dirInfo->getPermissions();
|
2013-08-30 01:45:02 +04:00
|
|
|
|
2011-04-17 17:59:06 +04:00
|
|
|
// make filelist
|
2013-09-20 18:46:33 +04:00
|
|
|
$files = \OCA\Files\Helper::getFiles($dir);
|
2011-03-04 01:08:54 +03:00
|
|
|
|
2013-10-28 23:22:06 +04:00
|
|
|
$data['directory'] = $dir;
|
|
|
|
$data['files'] = \OCA\Files\Helper::formatFileInfos($files);
|
2013-08-30 01:45:02 +04:00
|
|
|
$data['permissions'] = $permissions;
|
2011-03-04 01:08:54 +03:00
|
|
|
|
2012-05-03 14:23:29 +04:00
|
|
|
OCP\JSON::success(array('data' => $data));
|