blob: c50e96b2429075f09fb3e42de2516a8fa4d67cf6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?php
// only need filesystem apps
$RUNTIME_APPTYPES=array('filesystem');
// Init owncloud
OCP\JSON::checkLoggedIn();
// Load the files
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
$doBreadcrumb = isset($_GET['breadcrumb']);
$data = array();
// Make breadcrumb
if($doBreadcrumb) {
$breadcrumb = array();
$pathtohere = "/";
foreach( explode( "/", $dir ) as $i ) {
if( $i != "" ) {
$pathtohere .= "$i/";
$breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
}
}
$breadcrumbNav = new OCP\Template( "files", "part.breadcrumb", "" );
$breadcrumbNav->assign( "breadcrumb", $breadcrumb, false );
$data['breadcrumb'] = $breadcrumbNav->fetchPage();
}
// make filelist
$files = array();
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) {
$i["date"] = OCP\Util::formatDate($i["mtime"] );
$files[] = $i;
}
$list = new OCP\Template( "files", "part.list", "" );
$list->assign( "files", $files, false );
$data = array('files' => $list->fetchPage());
OCP\JSON::success(array('data' => $data));
|