2011-03-03 22:08:54 +00:00
|
|
|
<?php
|
|
|
|
|
2012-03-30 12:39:07 +00:00
|
|
|
// only need filesystem apps
|
|
|
|
$RUNTIME_APPTYPES=array('filesystem');
|
|
|
|
|
2011-03-03 22:08:54 +00:00
|
|
|
// Init owncloud
|
2012-04-17 17:31:29 +00:00
|
|
|
|
2011-03-03 22:08:54 +00:00
|
|
|
|
2012-05-03 10:23:29 +00:00
|
|
|
OCP\JSON::checkLoggedIn();
|
2011-03-03 22:08:54 +00:00
|
|
|
|
|
|
|
// Load the files
|
|
|
|
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
|
2013-11-14 12:22:53 +00:00
|
|
|
$dir = \OC\Files\Filesystem::normalizePath($dir);
|
2014-02-18 14:39:35 +00:00
|
|
|
$dirInfo = \OC\Files\Filesystem::getFileInfo($dir);
|
|
|
|
if (!$dirInfo->getType() === 'dir') {
|
2013-08-17 11:07:18 +00:00
|
|
|
header("HTTP/1.0 404 Not Found");
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2013-08-17 21:38:26 +00:00
|
|
|
$doBreadcrumb = isset($_GET['breadcrumb']);
|
2011-04-17 13:59:06 +00:00
|
|
|
$data = array();
|
2013-08-17 11:07:18 +00:00
|
|
|
$baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir=';
|
2011-03-03 22:08:54 +00:00
|
|
|
|
2014-02-18 14:39:35 +00:00
|
|
|
$permissions = $dirInfo->getPermissions();
|
2013-08-29 21:45:02 +00:00
|
|
|
|
2011-04-17 13:59:06 +00:00
|
|
|
// Make breadcrumb
|
2012-08-28 22:50:12 +00:00
|
|
|
if($doBreadcrumb) {
|
2013-09-20 14:46:33 +00:00
|
|
|
$breadcrumb = \OCA\Files\Helper::makeBreadcrumb($dir);
|
2013-08-17 11:07:18 +00:00
|
|
|
|
|
|
|
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
|
|
|
|
$breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
|
|
|
|
$breadcrumbNav->assign('baseURL', $baseUrl);
|
2012-08-29 06:42:49 +00:00
|
|
|
|
2011-04-17 13:59:06 +00:00
|
|
|
$data['breadcrumb'] = $breadcrumbNav->fetchPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
// make filelist
|
2013-09-20 14:46:33 +00:00
|
|
|
$files = \OCA\Files\Helper::getFiles($dir);
|
2011-03-03 22:08:54 +00:00
|
|
|
|
2013-08-17 11:07:18 +00:00
|
|
|
$list = new OCP\Template("files", "part.list", "");
|
|
|
|
$list->assign('files', $files, false);
|
|
|
|
$list->assign('baseURL', $baseUrl, false);
|
|
|
|
$list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/')));
|
2013-08-29 21:45:02 +00:00
|
|
|
$list->assign('isPublic', false);
|
2013-08-17 11:07:18 +00:00
|
|
|
$data['files'] = $list->fetchPage();
|
2013-08-29 21:45:02 +00:00
|
|
|
$data['permissions'] = $permissions;
|
2011-03-03 22:08:54 +00:00
|
|
|
|
2012-05-03 10:23:29 +00:00
|
|
|
OCP\JSON::success(array('data' => $data));
|